usermod: Small optimization using memmove for password unlock
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
e3b7058110
commit
8665fe1957
@ -430,8 +430,6 @@ static char *new_pw_passwd (char *pw_pass)
|
|||||||
strcat (buf, pw_pass);
|
strcat (buf, pw_pass);
|
||||||
pw_pass = buf;
|
pw_pass = buf;
|
||||||
} else if (Uflg && pw_pass[0] == '!') {
|
} else if (Uflg && pw_pass[0] == '!') {
|
||||||
char *s;
|
|
||||||
|
|
||||||
if (pw_pass[1] == '\0') {
|
if (pw_pass[1] == '\0') {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: unlocking the user's password would result in a passwordless account.\n"
|
_("%s: unlocking the user's password would result in a passwordless account.\n"
|
||||||
@ -445,11 +443,7 @@ static char *new_pw_passwd (char *pw_pass)
|
|||||||
"updating password", user_newname, user_newid, 0);
|
"updating password", user_newname, user_newid, 0);
|
||||||
#endif
|
#endif
|
||||||
SYSLOG ((LOG_INFO, "unlock user '%s' password", user_newname));
|
SYSLOG ((LOG_INFO, "unlock user '%s' password", user_newname));
|
||||||
s = pw_pass;
|
memmove(pw_pass, pw_pass + 1, strlen(pw_pass));
|
||||||
while ('\0' != *s) {
|
|
||||||
*s = *(s + 1);
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
} else if (pflg) {
|
} else if (pflg) {
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
audit_logger (AUDIT_USER_CHAUTHTOK, Prog,
|
||||||
|
Loading…
Reference in New Issue
Block a user