[pkg-kolab] r405 - in trunk/postfix/debian: . patches

Noel Koethe noel at costa.debian.org
Tue Jun 27 11:25:25 UTC 2006


Author: noel
Date: 2006-06-27 11:25:23 +0000 (Tue, 27 Jun 2006)
New Revision: 405

Added:
   trunk/postfix/debian/patches/40-kolab-ldap-leafonly.dpatch
Modified:
   trunk/postfix/debian/changelog
   trunk/postfix/debian/patches/00list
Log:
add missing 40-kolab-ldap-leafonly.dpatch

Modified: trunk/postfix/debian/changelog
===================================================================
--- trunk/postfix/debian/changelog	2006-06-27 11:21:45 UTC (rev 404)
+++ trunk/postfix/debian/changelog	2006-06-27 11:25:23 UTC (rev 405)
@@ -1,3 +1,10 @@
+postfix (2.1.5-10kolab2) unstable; urgency=low
+
+  * Build for Kolab sarge
+  * Add patch (40-kolab-ldap-leafonly.dpatch)
+
+ -- Noèl Köthe <noel.koethe at credativ.de>  Tue, 27 Jun 2006 13:24:31 +0200
+
 postfix (2.1.5-10kolab1) unstable; urgency=low
 
   * Build for Kolab
@@ -3,5 +10,5 @@
   * Add patch (30-kolab.dpatch)
 
- --  <steffen.joeris at skolelinux.de>  Wed, 11 Jan 2006 15:55:55 +0000
+ -- Steffen Jöris <steffen.joeris at skolelinux.de>  Wed, 11 Jan 2006 15:55:55 +0000
 
 postfix (2.1.5-9) unstable; urgency=low

Modified: trunk/postfix/debian/patches/00list
===================================================================
--- trunk/postfix/debian/patches/00list	2006-06-27 11:21:45 UTC (rev 404)
+++ trunk/postfix/debian/patches/00list	2006-06-27 11:25:23 UTC (rev 405)
@@ -10,3 +10,4 @@
 50tls
 60hpux
 30-kolab
+40-kolab-ldap-leafonly.dpatch

Added: trunk/postfix/debian/patches/40-kolab-ldap-leafonly.dpatch
===================================================================
--- trunk/postfix/debian/patches/40-kolab-ldap-leafonly.dpatch	2006-06-27 11:21:45 UTC (rev 404)
+++ trunk/postfix/debian/patches/40-kolab-ldap-leafonly.dpatch	2006-06-27 11:25:23 UTC (rev 405)
@@ -0,0 +1,95 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 40-kolab-ldap-leafonly.patch by Kolab upstream
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: http://wiki.kolab.org/index.php/Kolab-major-app-patches
+## DP: The ldap-leafonly patch adds exclude_internal as an additional postfix ldap option.
+
+ at DPATCH@
+diff -upr ../postfix-2.2.3.orig/src/global/dict_ldap.c ./src/global/dict_ldap.c
+--- ../postfix-2.2.3.orig/src/global/dict_ldap.c        2005-03-08 19:58:44.000000000 +0100
++++ ./src/global/dict_ldap.c    2005-07-19 02:46:30.000000000 +0200
+@@ -60,6 +60,10 @@
+ /* .IP special_result_attribute
+ /*     The attribute(s) of directory entries that can contain DNs or URLs.
+ /*     If found, a recursive subsequent search is done using their values.
++/* .IP exclude_internal
++/*      Used in conjunction with \fIspecial_result_attribute\fR. If set to
++/*      yes, only matching objects without \fIspecial_result_attribute\fR
++/*      attributes are included in the result. The default is no.
+ /* .IP scope
+ /*     LDAP search scope: sub, base, or one.
+ /* .IP bind
+@@ -226,6 +230,7 @@ typedef struct {
+     char   *search_base;
+     ARGV   *result_attributes;
+     int     num_attributes;            /* rest of list is DN's. */
++    int     exclude_internal;
+     int     bind;
+     char   *bind_dn;
+     char   *bind_pw;
+@@ -717,6 +722,7 @@ static void dict_ldap_get_values(DICT_LD
+     char   *myname = "dict_ldap_get_values";
+     struct timeval tv;
+     LDAPURLDesc *url;
++    int     is_leaf;
+
+     tv.tv_sec = dict_ldap->timeout;
+     tv.tv_usec = 0;
+@@ -744,6 +750,27 @@ static void dict_ldap_get_values(DICT_LD
+                     dict_ldap->size_limit);
+            dict_errno = DICT_ERR_RETRY;
+        }
++
++       /*
++        * The number of ordinary attributes is "num_attributes". We run through
++        * the "special" attributes and check if any of them are present in the
++        * object. If yes, then is_leaf = 0, else is_leaf = 1
++        */
++       is_leaf = 1;
++       if (dict_ldap->exclude_internal) {
++           for (i = dict_ldap->num_attributes; dict_ldap->result_attributes->argv[i]; i++) {
++               attr = dict_ldap->result_attributes->argv[i];
++               vals = ldap_get_values(dict_ldap->ld, entry, attr);
++               if (vals) {
++                   if (ldap_count_values(vals) > 0) {
++                       is_leaf = 0;
++                       ldap_value_free(vals);
++                       break;
++                   }
++                   ldap_value_free(vals);
++               }
++           }
++       }
+        for (attr = ldap_first_attribute(dict_ldap->ld, entry, &ber);
+             attr != NULL;
+             ldap_memfree(attr), attr = ldap_next_attribute(dict_ldap->ld,
+@@ -791,6 +818,7 @@ static void dict_ldap_get_values(DICT_LD
+             */
+            if (i < dict_ldap->num_attributes) {
+                /* Ordinary result attribute */
++               if(is_leaf) {
+                for (i = 0; vals[i] != NULL; i++) {
+                    if (db_common_expand(dict_ldap->ctx,
+                                         dict_ldap->result_format, vals[i],
+@@ -809,6 +837,7 @@ static void dict_ldap_get_values(DICT_LD
+                    msg_info("%s[%d]: search returned %ld value(s) for"
+                             " requested result attribute %s",
+                             myname, recursion, i, attr);
++               }
+            } else if (recursion < dict_ldap->recursion_limit
+                       && dict_ldap->result_attributes->argv[i]) {
+                /* Special result attribute */
+@@ -1351,6 +1380,11 @@ DICT   *dict_ldap_open(const char *ldaps
+     myfree(attr);
+
+     /*
++     * get configured value of "exclude_internal", default to no
++     */
++    dict_ldap->exclude_internal = cfg_get_bool(dict_ldap->parser, "exclude_internal", 0);
++
++    /*
+      * get configured value of "bind"; default to true
+      */
+     dict_ldap->bind = cfg_get_bool(dict_ldap->parser, "bind", 1);
+




More information about the pkg-kolab-devel mailing list