Most importantly now auth client doesn't abort lookup before server does.
--HG--
branch : HEAD
#include "hash.h"
#include "str.h"
#include "str-sanitize.h"
+#include "master-interface.h"
#include "auth-penalty.h"
#include "auth-request.h"
#include "auth-master-connection.h"
}
auth_request_init(request);
- request->to_abort = timeout_add(AUTH_REQUEST_TIMEOUT * 1000,
+ request->to_abort = timeout_add(MASTER_AUTH_SERVER_TIMEOUT_SECS * 1000,
auth_request_timeout, request);
hash_table_insert(handler->requests, POINTER_CAST(id), request);
noinst_LTLIBRARIES = libauth.la
AM_CPPFLAGS = \
- -I$(top_srcdir)/src/lib
+ -I$(top_srcdir)/src/lib \
+ -I$(top_srcdir)/src/lib-master
libauth_la_SOURCES = \
auth-client.c \
/* GSSAPI can use quite large packets */
#define AUTH_CLIENT_MAX_LINE_LENGTH 16384
-/* Use a bit smaller than login process timeout */
-#define AUTH_REQUEST_TIMEOUT (3*60 - 30)
enum mech_security_flags {
/* Don't advertise this as available SASL mechanism (eg. APOP) */
#include "istream.h"
#include "ostream.h"
#include "str.h"
+#include "master-interface.h"
#include "auth-master.h"
#include <stdlib.h>
#define AUTH_PROTOCOL_MAJOR 1
#define AUTH_PROTOCOL_MINOR 0
-#define AUTH_REQUEST_TIMEOUT_SECS 30
#define AUTH_MASTER_IDLE_SECS 60
#define MAX_INBUF_SIZE 8192
conn->input = i_stream_create_fd(conn->fd, MAX_INBUF_SIZE, FALSE);
conn->output = o_stream_create_fd(conn->fd, MAX_OUTBUF_SIZE, FALSE);
conn->io = io_add(conn->fd, IO_READ, auth_input, conn);
- conn->to = timeout_add(1000*AUTH_REQUEST_TIMEOUT_SECS,
+ conn->to = timeout_add(1000*MASTER_AUTH_LOOKUP_TIMEOUT_SECS,
auth_request_timeout, conn);
lib_signals_reset_ioloop();
}
new child processes when needed. */
#define MASTER_LISTEN_FD_FIRST 6
+/* Timeouts: base everything on how long we can wait for login clients. */
+#define MASTER_LOGIN_TIMEOUT_SECS (3*60)
+/* auth server should abort auth requests before that happens */
+#define MASTER_AUTH_SERVER_TIMEOUT_SECS (MASTER_LOGIN_TIMEOUT_SECS - 30)
+/* auth clients should abort auth lookups after server was supposed to have
+ done that */
+#define MASTER_AUTH_LOOKUP_TIMEOUT_SECS (MASTER_AUTH_SERVER_TIMEOUT_SECS + 5)
+
#endif
#include "hex-binary.h"
#include "hash.h"
#include "str.h"
+#include "master-interface.h"
#include "master-auth.h"
#include "master-login-auth.h"
#include <stdlib.h>
#define AUTH_MAX_INBUF_SIZE 8192
-#define AUTH_REQUEST_TIMEOUT_SECS (2*60)
struct master_login_auth_request {
struct master_login_auth_request *prev, *next;
{
time_t expires;
- expires = auth->request_head->create_stamp + AUTH_REQUEST_TIMEOUT_SECS;
+ expires = auth->request_head->create_stamp +
+ MASTER_AUTH_LOOKUP_TIMEOUT_SECS;
return expires <= ioloop_time ? 0 : expires - ioloop_time;
}
/* Disconnect client after this many milliseconds if it hasn't managed
to log in yet. */
-#define CLIENT_LOGIN_TIMEOUT_MSECS (3*60*1000)
+#define CLIENT_LOGIN_TIMEOUT_MSECS (MASTER_LOGIN_TIMEOUT_SECS*1000)
#define AUTH_SERVER_WAITING_MSG \
"Waiting for authentication process to respond.."