From 67b9c423fe9a5a38525f24b3bdfe27b930b32603 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sat, 29 Dec 2007 14:52:35 +0000 Subject: [PATCH] Avoid variables with the name of a type. --- ChangeLog | 1 + src/newusers.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4acb86e8..a6dfe87f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ pam API was already checked. No need to validate it again. * src/newusers.c: Avoid implicit brackets. * src/newusers.c: Avoid assignments in comparisons. + * src/newusers.c: Avoid variables with the name of a type. 2007-12-29 Nicolas François diff --git a/src/newusers.c b/src/newusers.c index dad58361..80ddac9e 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -256,7 +256,7 @@ static int add_user (const char *name, const char *uid, uid_t * nuid, gid_t gid) return !pw_update (&pwent); } -static void update_passwd (struct passwd *pwd, const char *passwd) +static void update_passwd (struct passwd *pwd, const char *password) { void *crypt_arg = NULL; if (crypt_method != NULL) { @@ -266,9 +266,9 @@ static void update_passwd (struct passwd *pwd, const char *passwd) } if ((crypt_method != NULL) && (0 == strcmp(crypt_method, "NONE"))) { - pwd->pw_passwd = (char *)passwd; + pwd->pw_passwd = (char *)password; } else { - pwd->pw_passwd = pw_encrypt (passwd, + pwd->pw_passwd = pw_encrypt (password, crypt_make_salt (crypt_method, crypt_arg)); } @@ -277,7 +277,7 @@ static void update_passwd (struct passwd *pwd, const char *passwd) /* * add_passwd - add or update the encrypted password */ -static int add_passwd (struct passwd *pwd, const char *passwd) +static int add_passwd (struct passwd *pwd, const char *password) { const struct spwd *sp; struct spwd spent; @@ -294,7 +294,7 @@ static int add_passwd (struct passwd *pwd, const char *passwd) * harder since there are zillions of things to do ... */ if (!is_shadow) { - update_passwd (pwd, passwd); + update_passwd (pwd, password); return 0; } @@ -305,7 +305,7 @@ static int add_passwd (struct passwd *pwd, const char *passwd) sp = spw_locate (pwd->pw_name); if (NULL != sp) { spent = *sp; - spent.sp_pwdp = pw_encrypt (passwd, + spent.sp_pwdp = pw_encrypt (password, crypt_make_salt (crypt_method, crypt_arg)); return !spw_update (&spent); @@ -318,7 +318,7 @@ static int add_passwd (struct passwd *pwd, const char *passwd) * the password set someplace else. */ if (strcmp (pwd->pw_passwd, "x") != 0) { - update_passwd (pwd, passwd); + update_passwd (pwd, password); return 0; } @@ -327,7 +327,7 @@ static int add_passwd (struct passwd *pwd, const char *passwd) * shadow password file entry. */ spent.sp_namp = pwd->pw_name; - spent.sp_pwdp = pw_encrypt (passwd, + spent.sp_pwdp = pw_encrypt (password, crypt_make_salt (crypt_method, crypt_arg)); spent.sp_lstchg = time ((time_t *) 0) / SCALE; spent.sp_min = getdef_num ("PASS_MIN_DAYS", 0); -- 2.40.0