[Dovecot] patch for serdb-ldap which allows set user_global_mail variable
--- dovecot-1.0.rc17/src/auth/db-ldap.~h 2007-01-15 03:23:09.000000000 +0200 +++ dovecot-1.0.rc17/src/auth/db-ldap.h 2006-11-07 18:47:00.000000000 +0200 @@ -38,6 +38,7 @@ const char *default_pass_scheme; const char *user_global_uid; const char *user_global_gid; + const char *user_global_mail; /* ... */ int ldap_deref, ldap_scope; --- dovecot-1.0.rc17/src/auth/db-ldap.~c 2007-01-15 03:23:09.000000000 +0200 +++ dovecot-1.0.rc17/src/auth/db-ldap.c 2006-11-19 15:42:41.000000000 +0200 @@ -67,6 +67,7 @@ DEF(SET_STR, default_pass_scheme), DEF(SET_STR, user_global_uid), DEF(SET_STR, user_global_gid), + DEF(SET_STR, user_global_mail), { 0, NULL, 0 } }; @@ -93,7 +94,8 @@ MEMBER(pass_filter) "(&(objectClass=posixAccount)(uid=%u))", MEMBER(default_pass_scheme) "crypt", MEMBER(user_global_uid) "", - MEMBER(user_global_gid) "" + MEMBER(user_global_gid) "", + MEMBER(user_global_mail) NULL }; static struct ldap_connection *ldap_connections = NULL; --- dovecot-1.0.rc17/src/auth/userdb-ldap.~c 2007-01-15 03:23:09.000000000 +0200 +++ dovecot-1.0.rc17/src/auth/userdb-ldap.c 2006-12-21 18:06:28.000000000 +0200 @@ -72,7 +72,7 @@ const char *name; char *attr, **vals; unsigned int i; - bool seen_uid = FALSE, seen_gid = FALSE; + bool seen_uid = FALSE, seen_gid = FALSE, seen_mail = FALSE ; reply = auth_stream_reply_init(auth_request); auth_stream_reply_add(reply, NULL, auth_request->user); @@ -94,6 +94,7 @@ return NULL; seen_gid = TRUE; } else if (*name != '\0') { + if (strcmp(name, "mail") == 0) {seen_mail = TRUE;} for (i = 0; vals[i] != NULL; i++) { auth_stream_reply_add(reply, name, vals[i]); @@ -126,6 +127,16 @@ auth_stream_reply_add(reply, "gid", dec2str(conn->set.gid)); } + if (!seen_mail) { + if (*conn->set.user_global_mail != '\0') { + const struct var_expand_table *vars; + vars = auth_request_get_var_expand_table(auth_request, auth_request_str_escape); + string_t *str; + str = t_str_new(512); + var_expand(str, conn->set.user_global_mail, vars); + auth_stream_reply_add(reply, "mail", str_c(str)); + } + } return reply; } --- dovecot-1.0.rc17/doc/dovecot-ldap.~conf 2007-01-15 03:23:09.000000000 +0200 +++ dovecot-1.0.rc17/doc/dovecot-ldap.conf 2006-11-07 18:47:00.000000000 +0200 @@ -114,3 +114,9 @@ # If the UID/GID is still found from LDAP reply, it overrides these values. #user_global_uid = #user_global_gid = + +# You can use same mail path all user accounts if you really want to. +# Same variables can be used as for filter, see user_filter +# If the 'mail' variable is still found from LDAP reply, it overrides these value. +#user_global_mail = +
Do you use multiple userdbs, or why setting mail_location isn't enough?
participants (2)
-
Taras
-
Timo Sirainen