From 55e75a5fce7fa2963dbca62bab32aec5390dca34 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 19 Oct 2009 15:01:16 -0400 Subject: [PATCH] passdb-file: When iterating through users, skip empty lines and comments. --HG-- branch : HEAD --- src/auth/userdb-passwd-file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/auth/userdb-passwd-file.c b/src/auth/userdb-passwd-file.c index d5f18ccaae..5bae1f0f59 100644 --- a/src/auth/userdb-passwd-file.c +++ b/src/auth/userdb-passwd-file.c @@ -124,7 +124,11 @@ static void passwd_file_iterate_next(struct userdb_iterate_context *_ctx) if (ctx->input == NULL) line = NULL; else { - line = i_stream_read_next_line(ctx->input); + while ((line = i_stream_read_next_line(ctx->input)) != NULL) { + if (*line == '\0' || *line == ':' || *line == '#') + continue; /* no username or comment */ + break; + } if (line == NULL && ctx->input->stream_errno != 0) { i_error("read(%s) failed: %m", ctx->path); _ctx->failed = TRUE; -- 2.47.3