dovecot-2.2: auth: userdb passwd-file iteration now skips passdb...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 19 11:23:04 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/0fc8856e24aa
changeset: 15845:0fc8856e24aa
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 19 11:22:57 2013 +0200
description:
auth: userdb passwd-file iteration now skips passdb-only entries if there are other userdbs.

diffstat:

 src/auth/userdb-passwd-file.c |  10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r 2ee278eaa1e3 -r 0fc8856e24aa src/auth/userdb-passwd-file.c
--- a/src/auth/userdb-passwd-file.c	Tue Feb 19 11:08:49 2013 +0200
+++ b/src/auth/userdb-passwd-file.c	Tue Feb 19 11:22:57 2013 +0200
@@ -20,6 +20,7 @@
 	struct userdb_iterate_context ctx;
 	struct istream *input;
 	char *path;
+	bool skip_passdb_entries;
 };
 
 struct passwd_file_userdb_module {
@@ -98,6 +99,7 @@
 	ctx->ctx.auth_request = auth_request;
 	ctx->ctx.callback = callback;
 	ctx->ctx.context = context;
+	ctx->skip_passdb_entries = module->pwf->userdb_warn_missing;
 	if (module->pwf->default_file == NULL) {
 		i_error("passwd-file: User iteration isn't currently supported "
 			"with %%variable paths");
@@ -121,7 +123,7 @@
 {
 	struct passwd_file_userdb_iterate_context *ctx =
 		(struct passwd_file_userdb_iterate_context *)_ctx;
-	const char *line;
+	const char *line, *p;
 
 	if (ctx->input == NULL)
 		line = NULL;
@@ -129,6 +131,12 @@
 		while ((line = i_stream_read_next_line(ctx->input)) != NULL) {
 			if (*line == '\0' || *line == ':' || *line == '#')
 				continue; /* no username or comment */
+			if (ctx->skip_passdb_entries &&
+			    ((p = strchr(line, ':')) == NULL ||
+			     strchr(p+1, ':') == NULL)) {
+				/* only passdb info */
+				continue;
+			}
 			break;
 		}
 		if (line == NULL && ctx->input->stream_errno != 0) {


More information about the dovecot-cvs mailing list