Remove the pw_name argument of new_pw_passwd. Use the user_newname global

variable instead. This avoid using a parameter with the same name as a function.
This commit is contained in:
nekral-guest 2008-01-06 12:50:22 +00:00
parent 5c6f68cd8f
commit 0c867d23ad
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2008-01-06 Nicolas François <nicolas.francois@centraliens.net>
* src/usermod.c: Remove the pw_name argument of new_pw_passwd. Use
the user_newname global variable instead. This avoid using a
parameter with the same name as a function.
2008-01-06 Nicolas François <nicolas.francois@centraliens.net> 2008-01-06 Nicolas François <nicolas.francois@centraliens.net>
* src/newgrp.c: Removed unused gid parameter of syslog_sg(). * src/newgrp.c: Removed unused gid parameter of syslog_sg().

View File

@ -310,7 +310,7 @@ static void usage (void)
* update encrypted password string (for both shadow and non-shadow * update encrypted password string (for both shadow and non-shadow
* passwords) * passwords)
*/ */
static char *new_pw_passwd (char *pw_pass, const char *pw_name) static char *new_pw_passwd (char *pw_pass)
{ {
if (Lflg && pw_pass[0] != '!') { if (Lflg && pw_pass[0] != '!') {
char *buf = xmalloc (strlen (pw_pass) + 2); char *buf = xmalloc (strlen (pw_pass) + 2);
@ -319,7 +319,7 @@ static char *new_pw_passwd (char *pw_pass, const char *pw_name)
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "updating passwd", audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "updating passwd",
user_newname, user_newid, 0); user_newname, user_newid, 0);
#endif #endif
SYSLOG ((LOG_INFO, "lock user `%s' password", pw_name)); SYSLOG ((LOG_INFO, "lock user `%s' password", user_newname));
strcpy (buf, "!"); strcpy (buf, "!");
strcat (buf, pw_pass); strcat (buf, pw_pass);
pw_pass = buf; pw_pass = buf;
@ -338,7 +338,7 @@ static char *new_pw_passwd (char *pw_pass, const char *pw_name)
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "updating password", audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "updating password",
user_newname, user_newid, 0); user_newname, user_newid, 0);
#endif #endif
SYSLOG ((LOG_INFO, "unlock user `%s' password", pw_name)); SYSLOG ((LOG_INFO, "unlock user `%s' password", user_newname));
s = pw_pass; s = pw_pass;
while (*s) { while (*s) {
*s = *(s + 1); *s = *(s + 1);
@ -349,7 +349,7 @@ static char *new_pw_passwd (char *pw_pass, const char *pw_name)
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "changing password", audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "changing password",
user_newname, user_newid, 1); user_newname, user_newid, 1);
#endif #endif
SYSLOG ((LOG_INFO, "change user `%s' password", pw_name)); SYSLOG ((LOG_INFO, "change user `%s' password", user_newname));
pw_pass = xstrdup (user_pass); pw_pass = xstrdup (user_pass);
} }
return pw_pass; return pw_pass;
@ -374,7 +374,7 @@ static void new_pwent (struct passwd *pwent)
} }
if (!is_shadow_pwd) if (!is_shadow_pwd)
pwent->pw_passwd = pwent->pw_passwd =
new_pw_passwd (pwent->pw_passwd, pwent->pw_name); new_pw_passwd (pwent->pw_passwd);
if (uflg) { if (uflg) {
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
@ -519,7 +519,7 @@ static void new_spent (struct spwd *spent)
spent->sp_expire = user_expire; spent->sp_expire = user_expire;
#endif #endif
} }
spent->sp_pwdp = new_pw_passwd (spent->sp_pwdp, spent->sp_namp); spent->sp_pwdp = new_pw_passwd (spent->sp_pwdp);
if (pflg) if (pflg)
spent->sp_lstchg = time ((time_t *) 0) / SCALE; spent->sp_lstchg = time ((time_t *) 0) / SCALE;
} }