]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth master lookups: If request isn't found, return FAIL instead of NOTFOUND.
authorTimo Sirainen <tss@iki.fi>
Wed, 27 Jan 2010 19:29:19 +0000 (21:29 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 27 Jan 2010 19:29:19 +0000 (21:29 +0200)
--HG--
branch : HEAD

doc/auth-protocol.txt
src/auth/auth-master-connection.c
src/auth/auth-request-handler.c
src/lib-master/master-login-auth.c

index 58e05175bd4b8ab4616d4a3108fdb5ac461bd49b..77abb9202da32022de809e0efd3da281beadb4a1 100644 (file)
@@ -176,13 +176,11 @@ request.
 ID is a connection-specific unique request identifier. It must be a 32bit
 number, so typically you'd just increment it by one.
 
-NOTFOUND reply means that the request or user wasn't found. Master
-shouldn't even try to send REQUEST commands for nonexisting requests, so if
-it happens it means either a timeout caused by very high load, or client
-lying to master about the request.
+NOTFOUND reply means that the user wasn't found.
 
 FAIL reply means an internal error occurred. Usually either a configuration
 mistake or temporary error caused by lost resource (eg. database down).
+Also unknown request IDs are reported as FAILs.
 
 USER reply is sent if request succeeded. It can return parameters:
 
index cc431687050ab9ee0bbecdc2c5ba6fab01130d98..d4aa33a5e65d9b0c9029b24aa68bd0bbdd7ae348 100644 (file)
@@ -94,12 +94,12 @@ master_input_request(struct auth_master_connection *conn, const char *args)
                i_error("Master requested auth for nonexisting client %u",
                        client_pid);
                (void)o_stream_send_str(conn->output,
-                                       t_strdup_printf("NOTFOUND\t%u\n", id));
+                                       t_strdup_printf("FAIL\t%u\n", id));
        } else if (memcmp(client_conn->cookie, cookie, sizeof(cookie)) != 0) {
                i_error("Master requested auth for client %u with invalid cookie",
                        client_pid);
                (void)o_stream_send_str(conn->output,
-                                       t_strdup_printf("NOTFOUND\t%u\n", id));
+                                       t_strdup_printf("FAIL\t%u\n", id));
        } else {
                auth_request_handler_master_request(
                        client_conn->request_handler, conn, id, client_id);
index a17df4f59759aac594d8a7d03af082ef6c9260bd..1c4fa2ef8b485b2a5e58928a3ed30563ef64a7de 100644 (file)
@@ -531,7 +531,7 @@ void auth_request_handler_master_request(struct auth_request_handler *handler,
        if (request == NULL) {
                i_error("Master request %u.%u not found",
                        handler->client_pid, client_id);
-               auth_stream_reply_add(reply, "NOTFOUND", NULL);
+               auth_stream_reply_add(reply, "FAIL", NULL);
                auth_stream_reply_add(reply, NULL, dec2str(id));
                handler->master_callback(reply, master);
                return;
@@ -544,7 +544,7 @@ void auth_request_handler_master_request(struct auth_request_handler *handler,
            !request->successful) {
                i_error("Master requested unfinished authentication request "
                        "%u.%u", handler->client_pid, client_id);
-               auth_stream_reply_add(reply, "NOTFOUND", NULL);
+               auth_stream_reply_add(reply, "FAIL", NULL);
                auth_stream_reply_add(reply, NULL, dec2str(id));
                handler->master_callback(reply, master);
                auth_request_unref(&request);
index 2c94642b95460efc77f9508cab4c177d4a790a59..b22f7b6be1408d46eb2d9b76002eeacdf9eb3946 100644 (file)
@@ -151,7 +151,7 @@ master_login_auth_input_notfound(struct master_login_auth *auth,
        id = (unsigned int)strtoul(args, NULL, 10);
        request = master_login_auth_lookup_request(auth, id);
        if (request != NULL) {
-               i_error("Auth request not found (timed out?): %u", id);
+               i_error("Authenticated user not found from userdb");
                request->callback(NULL, request->context);
                i_free(request);
        }
@@ -172,6 +172,7 @@ master_login_auth_input_fail(struct master_login_auth *auth, const char *args)
        id = (unsigned int)strtoul(args, NULL, 10);
        request = master_login_auth_lookup_request(auth, id);
        if (request != NULL) {
+               i_error("Internal auth failure");
                request->callback(NULL, request->context);
                i_free(request);
        }