changeset 12547:e6a9bf26ad1e

auth: When logging in as anonymous user, return "anonymous" userdb extra field.
author Timo Sirainen <tss@iki.fi>
date Mon, 06 Dec 2010 04:36:30 +0000
parents ab30580b88d9
children 832d77536f07
files TODO src/auth/auth-request-handler.c
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/TODO	Mon Dec 06 04:00:26 2010 +0000
+++ b/TODO	Mon Dec 06 04:36:30 2010 +0000
@@ -127,7 +127,6 @@
     - read the entire file to memory only once and keep it there, stat() later
       to see if it has changed. if not, perhaps don't even bother stat()ing
       dovecot-acl files? at least not that often..
- - add anonymous environment for anon logins (for managesieve mainly)
  - fs quota: getquotaroot inbox vs. other-box should return different quotas
    if two quotas are defined
  - new primes code: are hash tables now being resized too often?
--- a/src/auth/auth-request-handler.c	Mon Dec 06 04:00:26 2010 +0000
+++ b/src/auth/auth-request-handler.c	Mon Dec 06 04:36:30 2010 +0000
@@ -589,6 +589,15 @@
 					      "master_user",
 					      request->master_user);
 		}
+		if (*request->set->anonymous_username != '\0' &&
+		    strcmp(request->user,
+			   request->set->anonymous_username) == 0) {
+			/* this is an anonymous login, either via ANONYMOUS
+			   SASL mechanism or simply logging in as the anonymous
+			   user via another mechanism */
+			auth_stream_reply_add(request->userdb_reply,
+					      "anonymous", NULL);
+		}
 		auth_stream_reply_import(reply,
 			auth_stream_reply_export(request->userdb_reply));
 		break;