X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fuser_ops.c;h=0a61cb0e28a01dc6c6b7788e7be1eab8b5f40332;hb=56e1a9496ac3e2445f44c5cdfee4b3b28134c65e;hp=b78cc592fbdc84410569b7e242517707acbcc716;hpb=4e6233ae0eefb338a0049e29e13d6b7997b9792e;p=citadel.git diff --git a/citadel/user_ops.c b/citadel/user_ops.c index b78cc592f..0a61cb0e2 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -623,8 +623,7 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname) if (((CC->nologin)) && (CC->user.axlevel < AxAideU)) { return login_too_many_users; } else { - safestrncpy(CC->curr_user, CC->user.fullname, - sizeof CC->curr_user); + safestrncpy(CC->curr_user, CC->user.fullname, sizeof CC->curr_user); return login_ok; } } @@ -663,7 +662,18 @@ void do_login(void) } } - CtdlPutUserLock(&CCC->user); + /* + * If we are using LDAP authentication, extract the user's email addresses from the directory. + * FIXME make this a site configurable setting + */ + #ifdef HAVE_LDAP + if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) { + char new_emailaddrs[512]; + if (extract_email_addresses_from_ldap(CCC->ldap_dn, new_emailaddrs) == 0) { + strcpy(CCC->user.emailaddrs, new_emailaddrs); + } + } + #endif /* * No email address for user? Make one up. @@ -672,6 +682,8 @@ void do_login(void) sprintf(CCC->user.emailaddrs, "cit%ld@%s", CCC->user.usernum, CtdlGetConfigStr("c_fqdn")); } + CtdlPutUserLock(&CCC->user); + /* * Populate cs_inet_email and cs_inet_other_emails with valid email addresses from the user record */