[dovecot-cvs] dovecot/src/lib var-expand.c,1.11.2.1,1.11.2.2

tss at dovecot.org tss at dovecot.org
Sun Oct 15 22:03:40 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv30400/src/lib

Modified Files:
      Tag: branch_1_0
	var-expand.c 
Log Message:
Added %D modified to return "sub.domain.org" as "sub,dc=domain,dc=org" (for
LDAP queries). Patch by Andrey Panin.



Index: var-expand.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/var-expand.c,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -d -r1.11.2.1 -r1.11.2.2
--- var-expand.c	10 Aug 2006 20:22:40 -0000	1.11.2.1
+++ var-expand.c	15 Oct 2006 21:03:38 -0000	1.11.2.2
@@ -88,6 +88,21 @@
 	return binary_to_hex(digest, sizeof(digest));
 }
 
+static const char *m_str_ldap_dn(const char *str, struct var_expand_context *ctx __attr_unused__)
+{
+	string_t *ret = t_str_new(256);
+
+	while (*str) {
+		if (*str == '.')
+			str_append(ret, ",dc=");
+		else
+			str_append_c(ret, *str);
+		str++;
+	}
+
+	return str_free_without_data(&ret);
+}
+
 #define MAX_MODIFIER_COUNT 10
 static const struct var_expand_modifier modifiers[] = {
 	{ 'L', m_str_lcase },
@@ -97,6 +112,7 @@
 	{ 'R', m_str_reverse },
 	{ 'H', m_str_hash },
 	{ 'M', m_str_md5 },
+	{ 'D', m_str_ldap_dn },
 	{ '\0', NULL }
 };
 



More information about the dovecot-cvs mailing list