]> code.citadel.org Git - citadel.git/commitdiff
* CREU command now allows specification of an initial password
authorMichael Hampton <io_error@uncensored.citadel.org>
Sun, 7 Dec 2003 19:56:25 +0000 (19:56 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sun, 7 Dec 2003 19:56:25 +0000 (19:56 +0000)
citadel/ChangeLog
citadel/techdoc/session.txt
citadel/user_ops.c

index e87f553450d74ecead8659b3a90b2ef15c33fba7..6b53bfb9e517c5ba6fd7d0ba9b5444cfb49c3dec 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 612.2  2003/12/07 19:56:24  error
+ * CREU command now allows specification of an initial password
+
  Revision 612.1  2003/12/04 04:20:08  ajc
  * Incoming RFC822 messages get the To: field translated directly to
    a Citadel <R> field.
@@ -5102,4 +5105,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 928caf3a18c486092c927b254350754fe7afab5e..8722b3ec4a8245e86514a977f285cfc5ef1f6345 100644 (file)
@@ -205,16 +205,16 @@ ERROR.
 
  CREU   (CREate new User account)
 
- This command creates a new user account AND DOES NOT LOG IT IN.  The argument to
-this command will be the name of the account.  No case conversion is done
-on the name.  Note that the new account is installed with a default
-configuration, and no password.  This command returns OK if the account was created,
-or ERROR if another user already exists with this name.
+ This command creates a new user account AND DOES NOT LOG IT IN.  The first
+argument to this command will be the name of the account.  No case conversion
+is done on the name.  Note that the new account is installed with a default
+configuration, and no password.  The second argument is optional, and will be
+an initial password for the user.  This command returns OK if the account was
+created, or ERROR if another user already exists with this name.
 
  Please note that CREU is intended to be used for activities in which a system
-administrator is creating user accounts.  For self-service user account creation,
-use the NEWU command.
-
+administrator is creating user accounts.  For self-service user account
+creation, use the NEWU command.
 
 
  LKRN   (List Known Rooms with New messages)
index 9cd7b0be4b141794ed0d702e8e99800a2923a6cc..0ee92bd9036a004eb8f8483ec87f2238a948ea59 100644 (file)
@@ -437,7 +437,7 @@ void session_startup(void)
 {
        int i;
 
-       syslog(LOG_NOTICE, "session %d: user <%s> logged in",
+       syslog(LOG_NOTICE, "Session %d: %s logged in",
               CC->cs_pid, CC->curr_user);
 
        lgetuser(&CC->user, CC->curr_user);
@@ -936,20 +936,25 @@ void cmd_setp(char *new_pw)
 
 
 /*
- * cmd_creu()  -  administratively create a new user account (do not log in to it)
+ * cmd_creu() - administratively create a new user account (do not log in to it)
  */
 void cmd_creu(char *cmdbuf)
 {
        int a;
        char username[SIZ];
+       char password[SIZ];
+       struct ctdluser tmp;
 
        if (CtdlAccessCheck(ac_aide)) {
                return;
        }
 
        extract(username, cmdbuf, 0);
+       extract(password, cmdbuf, 1);
        username[25] = 0;
+       password[31] = 0;
        strproc(username);
+       strproc(password);
 
        if (strlen(username) == 0) {
                cprintf("%d You must supply a user name.\n", ERROR);
@@ -959,7 +964,14 @@ void cmd_creu(char *cmdbuf)
        a = create_user(username, 0);
 
        if (a == 0) {
-               cprintf("%d ok\n", CIT_OK);
+               if (strlen(password) > 0) {
+                       lgetuser(&tmp, username);
+                       safestrncpy(tmp.password, new_pw, sizeof(tmp.password));
+                       lputuser(&tmp);
+               }
+               cprintf("%d User '%s' created %s.\n", CIT_OK, username,
+                               (strlen(password) > 0) ? "and password set" :
+                               "with no password");
                return;
        } else if (a == ERROR + ALREADY_EXISTS) {
                cprintf("%d '%s' already exists.\n",