dovecot: Ignore spaces after commas in user_attrs and pass_attrs.

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 6 18:24:15 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/6c3788e03f7e
changeset: 6175:6c3788e03f7e
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 06 18:24:11 2007 +0300
description:
Ignore spaces after commas in user_attrs and pass_attrs.

diffstat:

1 file changed, 10 insertions(+), 6 deletions(-)
src/auth/db-ldap.c |   16 ++++++++++------

diffs (35 lines):

diff -r 6c48466c23fa -r 6c3788e03f7e src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Mon Aug 06 18:02:48 2007 +0300
+++ b/src/auth/db-ldap.c	Mon Aug 06 18:24:11 2007 +0300
@@ -623,9 +623,9 @@ void db_ldap_set_attrs(struct ldap_conne
 		       char ***attr_names_r, struct hash_table *attr_map,
 		       const char *skip_attr)
 {
-	const char *const *attr;
+	const char *const *attr, *attr_data, *p;
 	string_t *static_data;
-	char *name, *value, *p;
+	char *name, *value;
 	unsigned int i, j, size;
 
 	if (*attrlist == '\0')
@@ -640,11 +640,15 @@ void db_ldap_set_attrs(struct ldap_conne
 	*attr_names_r = p_new(conn->pool, char *, size + 1);
 
 	for (i = j = 0; i < size; i++) {
-		p = strchr(attr[i], '=');
+		/* allow spaces here so "foo=1, bar=2" works */
+		attr_data = attr[i];
+		while (*attr_data == ' ') attr_data++;
+
+		p = strchr(attr_data, '=');
 		if (p == NULL)
-			name = value = p_strdup(conn->pool, attr[i]);
-		else if (p != attr[i]) {
-			name = p_strdup_until(conn->pool, attr[i], p);
+			name = value = p_strdup(conn->pool, attr_data);
+		else if (p != attr_data) {
+			name = p_strdup_until(conn->pool, attr_data, p);
 			value = p_strdup(conn->pool, p + 1);
 		} else {
 			/* =<static key>=<static value> */


More information about the dovecot-cvs mailing list