dovecot-2.2: ldap auth: "!ldapField" now requests the given fiel...

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 18 21:31:45 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/16a410a546de
changeset: 16037:16a410a546de
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 18 21:31:34 2013 +0200
description:
ldap auth: "!ldapField" now requests the given field, but doesn't return it directly.
It's only useful for listing fields that %{ldap_ptr} can potentially access.

diffstat:

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

diffs (38 lines):

diff -r b6986edec17f -r 16a410a546de src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Mon Mar 18 21:23:54 2013 +0200
+++ b/src/auth/db-ldap.c	Mon Mar 18 21:31:34 2013 +0200
@@ -1314,6 +1314,11 @@
 				/* @name=ldapField */
 				name++;
 				field->value_is_dn = TRUE;
+			} else if (name[0] == '!' && name == ldap_attr) {
+				/* !ldapAttr */
+				name = "";
+				ldap_attr++;
+				field->skip = TRUE;
 			}
 			field->name = name;
 			field->value = templ;
@@ -1596,7 +1601,8 @@
 		if (ctx->attr_idx == array_count(ctx->attr_map))
 			return FALSE;
 		field = array_idx(ctx->attr_map, ctx->attr_idx++);
-	} while (field->value_is_dn != ctx->iter_dn_values);
+	} while (field->value_is_dn != ctx->iter_dn_values ||
+		 field->skip);
 
 	ldap_value = *field->ldap_attr_name == '\0' ? NULL :
 		hash_table_lookup(ctx->ldap_attrs, field->ldap_attr_name);
diff -r b6986edec17f -r 16a410a546de src/auth/db-ldap.h
--- a/src/auth/db-ldap.h	Mon Mar 18 21:23:54 2013 +0200
+++ b/src/auth/db-ldap.h	Mon Mar 18 21:31:34 2013 +0200
@@ -87,6 +87,9 @@
 	/* LDAP value contains a DN, which is looked up and used for @name
 	   attributes. */
 	bool value_is_dn;
+	/* This attribute is used internally only via %{ldap_ptr},
+	   it shouldn't be returned in iteration. */
+	bool skip;
 };
 ARRAY_DEFINE_TYPE(ldap_field, struct ldap_field);
 


More information about the dovecot-cvs mailing list