Code shuffling fixes warning with inline function... weirdo.
authorWilfried Goesgens <dothebart@citadel.org>
Wed, 7 Sep 2011 15:25:11 +0000 (15:25 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Wed, 7 Sep 2011 15:25:11 +0000 (15:25 +0000)
citadel/user_ops.c
citadel/user_ops.h

index 17aa4e7710254adb8581558623971ec992be3f99..2b66fdbe24029a51e77fd6896008977b5ebc31c1 100644 (file)
@@ -1275,7 +1275,7 @@ void cmd_newu(char *cmdbuf)
 {
        int a;
        long len;
-       char username[26];
+       char username[SIZ];
 
        if (config.c_auth_mode != AUTHMODE_NATIVE) {
                cprintf("%d This system does not use native mode authentication.\n",
@@ -1397,26 +1397,16 @@ void cmd_creu(char *cmdbuf)
        }
 
        extract_token(username, cmdbuf, 0, '|', sizeof username);
-       extract_token(password, cmdbuf, 1, '|', sizeof password);
-       ////username[25] = 0;
-       //password[31] = 0;
        strproc(username);
        strproc(password);
-       len = strlen(username);
-       if (len >= USERNAME_SIZE)
-       {
-               syslog(LOG_EMERG, "Username to long: %s", username);
-               cit_backtrace ();
-               len = USERNAME_SIZE - 1; 
-               username[63]='\0';
-       }
-
-       len = cutuserkey(username);
-
        if (IsEmptyStr(username)) {
                cprintf("%d You must supply a user name.\n", ERROR + USERNAME_REQUIRED);
                return;
        }
+       len = cutuserkey(username);
+
+
+       extract_token(password, cmdbuf, 1, '|', sizeof password);
 
        a = create_user(username, len, 0);
 
index 7bd7c6b7f2cc21d7db7048ff0cc12154c0caafc6..15107af7db79d1955677fefcfb61f18b37378a52 100644 (file)
@@ -70,7 +70,7 @@ static INLINE long cutuserkey(char *username) {
                syslog(LOG_EMERG, "Username to long: %s", username);
                cit_backtrace ();
                len = USERNAME_SIZE - 1; 
-               username[63]='\0';
+               username[len]='\0';
        }
        return len;
 }