dovecot-2.0: userdb passwd-file: Fixes to user listing.

dovecot at dovecot.org dovecot at dovecot.org
Fri May 15 22:10:36 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/6557ed6fc4e1
changeset: 9287:6557ed6fc4e1
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 15 15:08:37 2009 -0400
description:
userdb passwd-file: Fixes to user listing.

diffstat:

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

diffs (35 lines):

diff -r 22369ac2c99c -r 6557ed6fc4e1 src/auth/userdb-passwd-file.c
--- a/src/auth/userdb-passwd-file.c	Fri May 15 13:06:15 2009 -0400
+++ b/src/auth/userdb-passwd-file.c	Fri May 15 15:08:37 2009 -0400
@@ -88,7 +88,7 @@ passwd_file_iterate_init(struct auth_use
 			 userdb_iter_callback_t *callback, void *context)
 {
 	struct passwd_file_userdb_module *module =
-		(struct passwd_file_userdb_module *)userdb;
+		(struct passwd_file_userdb_module *)userdb->userdb;
 	struct passwd_file_userdb_iterate_context *ctx;
 	int fd;
 
@@ -96,6 +96,12 @@ passwd_file_iterate_init(struct auth_use
 	ctx->ctx.userdb = userdb->userdb;
 	ctx->ctx.callback = callback;
 	ctx->ctx.context = context;
+	if (module->pwf->default_file == NULL) {
+		i_error("passwd-file: User iteration isn't currently supported "
+			"with %%variable paths");
+		ctx->ctx.failed = TRUE;
+		return &ctx->ctx;
+	}
 	ctx->path = i_strdup(module->pwf->default_file->path);
 
 	/* for now we support only a single passwd-file */
@@ -137,7 +143,8 @@ static int passwd_file_iterate_deinit(st
 		(struct passwd_file_userdb_iterate_context *)_ctx;
 	int ret = _ctx->failed ? -1 : 0;
 
-	i_stream_destroy(&ctx->input);
+	if (ctx->input != NULL)
+		i_stream_destroy(&ctx->input);
 	i_free(ctx->path);
 	i_free(ctx);
 	return ret;


More information about the dovecot-cvs mailing list