]> granicus.if.org Git - shadow/commitdiff
* lib/prototypes.h, libmisc/valid.c: Change the prototype of
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 10 Jun 2008 21:52:34 +0000 (21:52 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 10 Jun 2008 21:52:34 +0000 (21:52 +0000)
valid() to return a bool.
* libmisc/valid.c: Add parenthesis.

ChangeLog
lib/prototypes.h
libmisc/valid.c

index f32580faf28fd5438fc686b3a7515fc605851571..f73f3a3f0e4f94fb7d650375813ba16fd861383d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-10  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * lib/prototypes.h, libmisc/valid.c: Change the prototype of
+       valid() to return a bool.
+       * libmisc/valid.c: Add parenthesis.
+
 2008-06-10  Nicolas François  <nicolas.francois@centraliens.net>
 
        * lib/commonio.c: Add brackets and parenthesis.
index f94c563fe1ee989b88fcc0c31fe3bcc02cc3483d..c275ba411ceafa79f28d30cc17068c639f5daf9b 100644 (file)
@@ -97,7 +97,7 @@ extern void sanitize_env (void);
 
 /* fields.c */
 extern void change_field (char *, size_t, const char *);
-extern int valid_field (const char *, const char *);
+extern bool valid_field (const char *, const char *);
 
 /* find_new_ids.c */
 extern int find_new_uid (bool sys_user, uid_t *uid, uid_t const *preferred_uid);
index 1c85ed2b60005090037afb03879f794043275d45..42c0dbc3b1c56ab0510af33fac92d83357c454e0 100644 (file)
@@ -49,7 +49,7 @@
  *     is used to indicate that a dummy salt must be used to encrypt the
  *     password anyway.
  */
-int valid (const char *password, const struct passwd *ent)
+bool valid (const char *password, const struct passwd *ent)
 {
        const char *encrypted;
        const char *salt;
@@ -63,9 +63,9 @@ int valid (const char *password, const struct passwd *ent)
 
        if ((NULL != ent->pw_name) && ('\0' == ent->pw_passwd[0])) {
                if ('\0' == password[0]) {
-                       return (1);     /* user entered nothing */
+                       return true;    /* user entered nothing */
                } else {
-                       return (0);     /* user entered something! */
+                       return false;   /* user entered something! */
                }
        }
 
@@ -73,7 +73,7 @@ int valid (const char *password, const struct passwd *ent)
         * If there is no entry then we need a salt to use.
         */
 
-       if (ent->pw_name == (char *) 0 || ent->pw_passwd[0] == '\0') {
+       if ((NULL == ent->pw_name) || ('\0' == ent->pw_passwd[0])) {
                salt = "xx";
        } else {
                salt = ent->pw_passwd;
@@ -94,11 +94,11 @@ int valid (const char *password, const struct passwd *ent)
         * cause non-existent users to not be validated.
         */
 
-       if ((NULL != ent->pw_name) &&
-           (strcmp (encrypted, ent->pw_passwd) == 0)) {
-               return (1);
+       if (   (NULL != ent->pw_name)
+           && (strcmp (encrypted, ent->pw_passwd) == 0)) {
+               return true;
        } else {
-               return (0);
+               return false;
        }
 }