From: Timo Sirainen Date: Mon, 19 Oct 2009 19:01:16 +0000 (-0400) Subject: passdb-file: When iterating through users, skip empty lines and comments. X-Git-Tag: 2.0.alpha2~66 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55e75a5fce7fa2963dbca62bab32aec5390dca34;p=thirdparty%2Fdovecot%2Fcore.git passdb-file: When iterating through users, skip empty lines and comments. --HG-- branch : HEAD --- 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;