]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
passdb-file: When iterating through users, skip empty lines and comments.
authorTimo Sirainen <tss@iki.fi>
Mon, 19 Oct 2009 19:01:16 +0000 (15:01 -0400)
committerTimo Sirainen <tss@iki.fi>
Mon, 19 Oct 2009 19:01:16 +0000 (15:01 -0400)
--HG--
branch : HEAD

src/auth/userdb-passwd-file.c

index d5f18ccaae158dbaaafed6f70e2b06ea63e855ef..5bae1f0f59fce0eff0fbd25f074a429033f2ee58 100644 (file)
@@ -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;