From 11e722f9406b58f2884d6d63f4acba49b668f53f Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Wed, 7 Sep 2011 15:25:11 +0000 Subject: [PATCH] Code shuffling fixes warning with inline function... weirdo. --- citadel/user_ops.c | 20 +++++--------------- citadel/user_ops.h | 2 +- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 17aa4e771..2b66fdbe2 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -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); diff --git a/citadel/user_ops.h b/citadel/user_ops.h index 7bd7c6b7f..15107af7d 100644 --- a/citadel/user_ops.h +++ b/citadel/user_ops.h @@ -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; } -- 2.30.2