Mercurial > dovecot > core-2.2
changeset 10589:cab5f2e7b806 HEAD
auth master lookups: If request isn't found, return FAIL instead of NOTFOUND.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 27 Jan 2010 21:29:19 +0200 |
parents | f4e64cb17aea |
children | 193fa6e7635c |
files | doc/auth-protocol.txt src/auth/auth-master-connection.c src/auth/auth-request-handler.c src/lib-master/master-login-auth.c |
diffstat | 4 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/auth-protocol.txt Wed Jan 27 21:25:44 2010 +0200 +++ b/doc/auth-protocol.txt Wed Jan 27 21:29:19 2010 +0200 @@ -176,13 +176,11 @@ 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:
--- a/src/auth/auth-master-connection.c Wed Jan 27 21:25:44 2010 +0200 +++ b/src/auth/auth-master-connection.c Wed Jan 27 21:29:19 2010 +0200 @@ -94,12 +94,12 @@ 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);
--- a/src/auth/auth-request-handler.c Wed Jan 27 21:25:44 2010 +0200 +++ b/src/auth/auth-request-handler.c Wed Jan 27 21:29:19 2010 +0200 @@ -531,7 +531,7 @@ 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 @@ !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);
--- a/src/lib-master/master-login-auth.c Wed Jan 27 21:25:44 2010 +0200 +++ b/src/lib-master/master-login-auth.c Wed Jan 27 21:29:19 2010 +0200 @@ -151,7 +151,7 @@ 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 @@ 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); }