Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 182576

Summary: net-dns/bind with DLZ LDAP no more working with openldap 2.3.x
Product: Gentoo Linux Reporter: sevicecomputer <cyril>
Component: New packagesAssignee: Konstantin Arkhipov (RETIRED) <voxus>
Status: RESOLVED DUPLICATE    
Severity: major    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description sevicecomputer 2007-06-19 12:54:10 UTC
the handling of the ldap URL has change since openldap 2.3.x.
the "%" included in the tokens are out.

The DLZ schema is not included in the ebuild

Reproducible: Always

Steps to Reproduce:
1. emerge openldap 2.3.x
2. emerge bind 9.4.1 with USE="DLZ LDAP"
3. configure named.conf to use ldap

Actual Results:  
the LDAP url are not recognized as LDAP url due to "%" tokens used by DLZ

Expected Results:  
tokens recognized normaly

as discussed with the bind, openldap and DLZ team, here is the patch for ebuild:

*** /usr/portage/net-dns/bind/bind-9.4.1-r1.ebuild      Sun Jun 17 21:35:59 2007
--- /opt/gentoo-overlay/net-dns/bind/bind-9.4.1-r2.ebuild       Tue Jun 19 11:19:30 2007
***************
*** 1,6 ****
  # Copyright 1999-2007 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
! # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.4.1-r1.ebuild,v 1.8 2007/06/17 19:35:36 killerfox Exp $
  
  inherit eutils libtool autotools toolchain-funcs flag-o-matic
  
--- 1,6 ----
  # Copyright 1999-2007 Gentoo Foundation
  # Distributed under the terms of the GNU General Public License v2
! # $Header: /var/cvsroot/gentoo-x86/net-dns/bind/bind-9.4.1-r1.ebuild,v 1.1 2007/06/02 22:34:48 voxus Exp $
  
  inherit eutils libtool autotools toolchain-funcs flag-o-matic
  
***************
*** 13,19 ****
  
  LICENSE="as-is"
  SLOT="0"
! KEYWORDS="alpha amd64 hppa ~ia64 ~mips ppc ppc64 sparc x86"
  IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads resolvconf urandom"
  
  DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
--- 13,19 ----
  
  LICENSE="as-is"
  SLOT="0"
! KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc x86"
  IUSE="ssl ipv6 doc dlz postgres berkdb mysql odbc ldap selinux idn threads resolvconf urandom"
  
  DEPEND="ssl? ( >=dev-libs/openssl-0.9.6g )
***************
*** 66,71 ****
--- 66,72 ----
        sed -e \
                's:struct isc_socket {:#undef SO_BSDCOMPAT\n\nstruct isc_socket {:' \
                -i lib/isc/unix/socket.c
+       use dlz && use ldap && (cp ${S}/contrib/dlz/drivers/dlz_ldap_driver.c ${S}/contrib/dlz/drivers/dlz_ldap_driver.c.orig ;epatch ${FILESDIR}/dlz_ldap.patch)
  }
  
  src_compile() {
***************
*** 200,205 ****
--- 201,209 ----
        install -d -o named -g named ${ROOT}/var/run/named \
                ${ROOT}/var/bind/pri ${ROOT}/var/bind/sec
        chown -R named:named ${ROOT}/var/bind
+       use ldap && {
+               install -o named -g named ${FILESDIR}/dlz.schema ${ROOT}/etc/openldap/schema
+               }
  
        elog "The default zone files are now installed as *.zone,"
        elog "be careful merging config files if you have modified"

here is the patch to insert in files dir:
*** /var/tmp/portage/net-dns/bind-9.4.1-r2/work/bind-9.4.1/contrib/dlz/drivers/dlz_ldap_driver.c.orig   Mon Sep  5 02:18:19 2005
--- /var/tmp/portage/net-dns/bind-9.4.1-r2/work/bind-9.4.1/contrib/dlz/drivers/dlz_ldap_driver.c        Tue Jun 12 14:41:08 2007
***************
*** 136,141 ****
--- 136,154 ----
        isc_result_t result = ISC_R_SUCCESS;
        int ldap_result;
        LDAPURLDesc *ldap_url = NULL;
+       /* Patch DLZ BEGIN*/
+       char * pch;
+       int i;
+ 
+         while (1) {
+             pch = (char*) memchr (URL, '%', strlen(URL));
+             if (pch!=NULL) {
+               //            printf ("Character l was at position %d.\n",pch-URL3+1);
+                 i = pch-URL;
+               URL[i] = '_';
+           } else break;
+       }
+       /* Patch DLZ END*/
  
        if (!ldap_is_ldap_url(URL)) {
                isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
***************
*** 203,208 ****
--- 216,232 ----
        if (ldap_url != NULL)
                ldap_free_urldesc(ldap_url);
  
+    /* Patch DLZ BEGIN*/
+    while (1) {
+             pch = (char*) memchr (URL,'_', strlen(URL));
+             if (pch!=NULL) {
+        //            printf ("Character l was at position %d.\n", pch-URL3+1);
+          i = pch-URL;
+          URL[i] = '%';
+        } else break;
+    }
+    /* Patch DLZ END*/
+ 
        return result;
  }
  /*% Connects / reconnects to LDAP server */
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-06-19 13:33:46 UTC
Please, don't paste patches inline, it kills formatting. Use attachments instead.
Comment 2 Konstantin Arkhipov (RETIRED) gentoo-dev 2007-06-19 14:54:22 UTC

*** This bug has been marked as a duplicate of bug 167056 ***