changeset 4103:25204e1faeb6 HEAD

Allow empty uid/gid fields, they're required if we want to set extra fields for passdb. Also removed some unused code.
author Timo Sirainen <tss@iki.fi>
date Sat, 25 Mar 2006 12:19:10 +0200
parents 99b17f13cc1e
children 77e10f1d2cb2
files src/auth/db-passwd-file.c src/auth/db-passwd-file.h
diffstat 2 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/db-passwd-file.c	Sat Mar 25 12:10:41 2006 +0200
+++ b/src/auth/db-passwd-file.c	Sat Mar 25 12:19:10 2006 +0200
@@ -63,7 +63,7 @@
 		}
 	}
 
-	if (*args != NULL) {
+	if (*args != NULL && **args != '\0') {
 		pu->uid = userdb_parse_uid(NULL, *args);
 		if (pu->uid == 0 || pu->uid == (uid_t)-1) {
 			i_error("passwd-file %s: User %s has invalid UID %s",
@@ -71,9 +71,10 @@
 			return;
 		}
 		args++;
-	}
+	} else if (*args != NULL)
+		args++;
 
-	if (*args != NULL) {
+	if (*args != NULL && **args != '\0') {
 		pu->gid = userdb_parse_gid(NULL, *args);
 		if (pu->gid == 0 || pu->gid == (gid_t)-1) {
 			i_error("passwd-file %s: User %s has invalid GID %s",
@@ -86,9 +87,8 @@
 			i_error("passwd-file %s: User %s is missing "
 				"userdb info", pw->path, username);
 		}
-		if (pw->first_missing_userdb_info == NULL)
-			pw->first_missing_userdb_info = user;
-		pw->missing_userdb_info_count++;
+		if (*args != NULL)
+			args++;
 	}
 
 	/* user info */
@@ -206,9 +206,6 @@
 		pw->fd = -1;
 	}
 
-	pw->first_missing_userdb_info = NULL;
-	pw->missing_userdb_info_count = 0;
-
 	if (pw->users != NULL) {
 		hash_destroy(pw->users);
 		pw->users = NULL;
--- a/src/auth/db-passwd-file.h	Sat Mar 25 12:10:41 2006 +0200
+++ b/src/auth/db-passwd-file.h	Sat Mar 25 12:19:10 2006 +0200
@@ -20,9 +20,6 @@
 	int fd;
 
 	struct hash_table *users;
-
-	const char *first_missing_userdb_info;
-	unsigned int missing_userdb_info_count;
 };
 
 struct db_passwd_file {