[Pkg-shadow-commits] r2116 - in upstream/trunk: . lib libmisc

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Tue Jun 10 21:52:35 UTC 2008


Author: nekral-guest
Date: 2008-06-10 21:52:34 +0000 (Tue, 10 Jun 2008)
New Revision: 2116

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/prototypes.h
   upstream/trunk/libmisc/valid.c
Log:
	* lib/prototypes.h, libmisc/valid.c: Change the prototype of
	valid() to return a bool.
	* libmisc/valid.c: Add parenthesis.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-06-10 20:34:25 UTC (rev 2115)
+++ upstream/trunk/ChangeLog	2008-06-10 21:52:34 UTC (rev 2116)
@@ -1,5 +1,11 @@
 2008-06-10  Nicolas François  <nicolas.francois at 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 at centraliens.net>
+
 	* lib/commonio.c: Add brackets and parenthesis.
 	* lib/commonio.c: Check the result of fgets().
 	* lib/commonio.c: Avoid implicit conversion of pointers to

Modified: upstream/trunk/lib/prototypes.h
===================================================================
--- upstream/trunk/lib/prototypes.h	2008-06-10 20:34:25 UTC (rev 2115)
+++ upstream/trunk/lib/prototypes.h	2008-06-10 21:52:34 UTC (rev 2116)
@@ -97,7 +97,7 @@
 
 /* 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);

Modified: upstream/trunk/libmisc/valid.c
===================================================================
--- upstream/trunk/libmisc/valid.c	2008-06-10 20:34:25 UTC (rev 2115)
+++ upstream/trunk/libmisc/valid.c	2008-06-10 21:52:34 UTC (rev 2116)
@@ -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 @@
 
 	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 @@
 	 * 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 @@
 	 * 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;
 	}
 }
 




More information about the Pkg-shadow-commits mailing list