* libmisc/valid.c: Avoid implicit conversion of pointers /chars to booleans.
* libmisc/valid.c: Add brackets.
This commit is contained in:
parent
f14452ec3c
commit
1ebf7842f5
@ -1,3 +1,9 @@
|
||||
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/valid.c: Avoid implicit conversion of pointers /chars to
|
||||
booleans.
|
||||
* libmisc/valid.c: Add brackets.
|
||||
|
||||
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/yesno.c: yes_or_no returns a bool instead of int.
|
||||
|
@ -61,11 +61,12 @@ int valid (const char *password, const struct passwd *ent)
|
||||
* routine is meant to waste CPU time.
|
||||
*/
|
||||
|
||||
if (ent->pw_name && !ent->pw_passwd[0]) {
|
||||
if (!password[0])
|
||||
if ((NULL != ent->pw_name) && ('\0' == ent->pw_passwd[0])) {
|
||||
if ('\0' == password[0]) {
|
||||
return (1); /* user entered nothing */
|
||||
else
|
||||
} else {
|
||||
return (0); /* user entered something! */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -93,9 +94,11 @@ int valid (const char *password, const struct passwd *ent)
|
||||
* cause non-existent users to not be validated.
|
||||
*/
|
||||
|
||||
if (ent->pw_name && strcmp (encrypted, ent->pw_passwd) == 0)
|
||||
if ((NULL != ent->pw_name) &&
|
||||
(strcmp (encrypted, ent->pw_passwd) == 0)) {
|
||||
return (1);
|
||||
else
|
||||
} else {
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user