[dovecot-cvs] dovecot/src/auth db-passwd-file.c,1.5,1.6

cras at procontrol.fi cras at procontrol.fi
Sun Mar 16 16:33:32 EET 2003


Update of /home/cvs/dovecot/src/auth
In directory danu:/tmp/cvs-serv10842

Modified Files:
	db-passwd-file.c 
Log Message:
Fixes to parsing userdb fields.



Index: db-passwd-file.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/db-passwd-file.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- db-passwd-file.c	10 Mar 2003 00:36:09 -0000	1.5
+++ db-passwd-file.c	16 Mar 2003 14:33:29 -0000	1.6
@@ -90,7 +90,7 @@
 
 	/* home */
 	if (*args != NULL) {
-		pu->home = p_strdup(pw->pool, *args);
+		pu->home = p_strdup_empty(pw->pool, *args);
 		args++;
 	}
 
@@ -99,8 +99,11 @@
 		args++;
 
 	/* flags */
-	if (*args != NULL && strstr(*args, "chroot") != NULL)
-		pu->chroot = TRUE;
+	if (*args != NULL) {
+		if (strstr(*args, "chroot") != NULL)
+			pu->chroot = TRUE;
+		args++;
+	}
 
 	/* rest is MAIL environment */
 	if (*args != NULL) {
@@ -113,7 +116,7 @@
 			str_append(str, *args);
 			args++;
 		}
-		pu->mail = p_strdup(pw->pool, str_c(str));
+		pu->mail = p_strdup_empty(pw->pool, str_c(str));
 	}
 
 	hash_insert(pw->users, pu->user_realm, pu);
@@ -143,8 +146,8 @@
 
 	input = i_stream_create_file(pw->fd, default_pool, 4096, FALSE);
 	while ((line = i_stream_read_next_line(input)) != NULL) {
-		if (*line == '\0' || *line == ':')
-			continue; /* no username */
+		if (*line == '\0' || *line == ':' || *line == '#')
+			continue; /* no username or comment */
 
 		t_push();
 		args = t_strsplit(line, ":");




More information about the dovecot-cvs mailing list