/*
* Server functions which perform operations on user objects.
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License, version 3.
striplt(username);
syslog(LOG_DEBUG, "user_ops: cmd_user(%s)", username);
- a = CtdlLoginExistingUser(NULL, username);
+ a = CtdlLoginExistingUser(username);
switch (a) {
case login_already_logged_in:
cprintf("%d Already logged in.\n", ERROR + ALREADY_LOGGED_IN);
cprintf("%d Not allowed. Use the 'passwd' command.\n", ERROR + NOT_HERE);
return;
}
- if (CC->is_master) {
- cprintf("%d The master prefix password cannot be changed with this command.\n",
- ERROR + NOT_HERE);
- return;
- }
if (!strcasecmp(new_pw, "GENERATE_RANDOM_PASSWORD")) {
char random_password[17];
char buf[SIZ];
char whodat[64];
char new_emailaddrs[512] = { 0 } ;
- int i;
if (CtdlAccessCheck(ac_aide)) return;
}
}
- 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);
}