Synchronization of LDAP users to Citadel is now complete, including email addresses...
[citadel.git] / citadel / modules / ctdlproto / serv_user.c
index a3238a522c9663e36cc5f074ae1ba8edf8058f3f..5f8e9791bfdbcf5dca73f6db6556a22a1e2c49fb 100644 (file)
@@ -132,7 +132,7 @@ void cmd_newu(char *cmdbuf)
                return;
        }
 
-       a = create_user(username, CREATE_USER_BECOME_USER);
+       a = create_user(username, CREATE_USER_BECOME_USER, NATIVE_AUTH_UID);
 
        if (a == 0) {
                logged_in_response();
@@ -210,7 +210,7 @@ void cmd_creu(char *cmdbuf)
 
        extract_token(password, cmdbuf, 1, '|', sizeof password);
 
-       a = create_user(username, CREATE_USER_DO_NOT_BECOME_USER);
+       a = create_user(username, CREATE_USER_DO_NOT_BECOME_USER, NATIVE_AUTH_UID);
 
        if (a == 0) {
                if (!IsEmptyStr(password)) {
@@ -701,7 +701,6 @@ void cmd_asea(char *cmdbuf)
        char buf[SIZ];
        char whodat[64];
        char new_emailaddrs[512] = { 0 } ;
-       int i;
 
        if (CtdlAccessCheck(ac_aide)) return;
 
@@ -729,25 +728,8 @@ void cmd_asea(char *cmdbuf)
                }
        }
 
-       if (CtdlGetUserLock(&usbuf, requested_user) != 0) {     // We are relying on the fact that the DirectoryIndex functions don't lock.
-               return;                                         // Silently fail here if we can't acquire a lock on the user record.
-       }
-
-       /* Delete all of the existing directory index records for the user (easier this way) */
-       for (i=0; i<num_tokens(usbuf.emailaddrs, '|'); ++i) {
-               extract_token(buf, usbuf.emailaddrs, i, '|', sizeof buf);
-               CtdlDirectoryDelUser(buf, requested_user);
-       }
-
-       strcpy(usbuf.emailaddrs, new_emailaddrs);               // make it official.
 
-       /* Index all of the new email addresses (they've already been sanitized) */
-       for (i=0; i<num_tokens(usbuf.emailaddrs, '|'); ++i) {
-               extract_token(buf, usbuf.emailaddrs, i, '|', sizeof buf);
-               CtdlDirectoryAddUser(buf, requested_user);
-       }
-
-       CtdlPutUserLock(&usbuf);
+       CtdlSetEmailAddressesForUser(requested_user, new_emailaddrs);
 }