dovecot: LDAP crashfixes. Based on patch by Katsu Yamamoto.

dovecot at dovecot.org dovecot at dovecot.org
Wed Jul 25 08:45:18 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/d779b7220e23
changeset: 6144:d779b7220e23
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jul 25 08:45:11 2007 +0300
description:
LDAP crashfixes. Based on patch by Katsu Yamamoto.

diffstat:

2 files changed, 6 insertions(+), 2 deletions(-)
src/auth/db-ldap.c     |    6 ++++--
src/auth/userdb-ldap.c |    2 ++

diffs (47 lines):

diff -r 705773edecfb -r d779b7220e23 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Tue Jul 24 07:57:52 2007 +0300
+++ b/src/auth/db-ldap.c	Wed Jul 25 08:45:11 2007 +0300
@@ -55,6 +55,7 @@ struct db_ldap_result_iterate_context {
 	BerElement *ber;
 
 	string_t *var, *debug;
+	unsigned int value_idx;
 };
 
 #define DEF_STR(name) DEF_STRUCT_STR(name, ldap_settings)
@@ -764,12 +765,13 @@ db_ldap_result_change_attr(struct db_lda
 	ctx->vals = ldap_get_values(ctx->conn->ld, ctx->entry,
 				    ctx->attr);
 	ctx->value = ctx->vals[0];
+	ctx->value_idx = 0;
 }
 
 static void
 db_ldap_result_return_value(struct db_ldap_result_iterate_context *ctx)
 {
-	bool first = ctx->value == ctx->vals[0];
+	bool first = ctx->value_idx == 0;
 
 	if (ctx->template != NULL) {
 		ctx->var_table[0].value = ctx->value;
@@ -798,7 +800,7 @@ static bool db_ldap_result_int_next(stru
 		} else {
 			/* continuing existing attribute */
 			if (ctx->value != NULL)
-				ctx->value++;
+				ctx->value = ctx->vals[++ctx->value_idx];
 		}
 
 		if (ctx->value != NULL) {
diff -r 705773edecfb -r d779b7220e23 src/auth/userdb-ldap.c
--- a/src/auth/userdb-ldap.c	Tue Jul 24 07:57:52 2007 +0300
+++ b/src/auth/userdb-ldap.c	Wed Jul 25 08:45:11 2007 +0300
@@ -36,6 +36,8 @@ ldap_query_get_result(struct ldap_connec
 {
 	struct db_ldap_result_iterate_context *ldap_iter;
 	const char *name, *const *values;
+
+	auth_request_init_userdb_reply(auth_request);
 
 	ldap_iter = db_ldap_result_iterate_init(conn, entry, auth_request,
 						conn->user_attr_map);


More information about the dovecot-cvs mailing list