changeset 1299:e7ece7cfb14c HEAD

Fixes to parsing userdb fields.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Mar 2003 16:33:29 +0200
parents c2935bbfd399
children 952bf533c2ea
files src/auth/db-passwd-file.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/db-passwd-file.c	Sat Mar 15 02:33:47 2003 +0200
+++ b/src/auth/db-passwd-file.c	Sun Mar 16 16:33:29 2003 +0200
@@ -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, ":");