dovecot-2.1: ldap: Treat =key the same as =key=, just like v2.0.

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 4 06:10:39 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/9930c75b989a
changeset: 14381:9930c75b989a
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 04 06:10:33 2012 +0300
description:
ldap: Treat =key the same as =key=, just like v2.0.

diffstat:

 src/auth/db-ldap.c |  11 +++++++----
 src/auth/db-ldap.h |   2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r c93601fa444e -r 9930c75b989a src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Wed Apr 04 05:34:51 2012 +0300
+++ b/src/auth/db-ldap.c	Wed Apr 04 06:10:33 2012 +0300
@@ -1032,9 +1032,12 @@
 		}
 
 		templ = strchr(name, '=');
-		if (templ == NULL)
-			templ = "";
-		else {
+		if (templ == NULL) {
+			if (*ldap_attr == '\0') {
+				/* =foo static value */
+				templ = "";
+			}
+		} else {
 			*templ++ = '\0';
 			str_truncate(tmp_str, 0);
 			var_expand_with_funcs(tmp_str, templ, NULL,
@@ -1245,7 +1248,7 @@
 		values = ctx->val_1_arr;
 	}
 
-	if (*field->value == '\0') {
+	if (field->value == NULL) {
 		/* use the LDAP attribute's value */
 	} else {
 		/* template */
diff -r c93601fa444e -r 9930c75b989a src/auth/db-ldap.h
--- a/src/auth/db-ldap.h	Wed Apr 04 05:34:51 2012 +0300
+++ b/src/auth/db-ldap.h	Wed Apr 04 06:10:33 2012 +0300
@@ -122,7 +122,7 @@
 struct ldap_field {
 	/* Dovecot field name. */
 	const char *name;
-	/* Field value template with %vars. "" = same as LDAP value. */
+	/* Field value template with %vars. NULL = same as LDAP value. */
 	const char *value;
 	/* LDAP attribute name, or "" if this is a static field. */
 	const char *ldap_attr_name;


More information about the dovecot-cvs mailing list