~ubuntu-branches/ubuntu/maverick/openldap/maverick-proposed

« back to all changes in this revision

Viewing changes to servers/slapd/back-ldap/bind.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Steve Langasek, Mathias Gug
  • Date: 2009-02-18 18:44:00 UTC
  • mfrom: (1.1.2 upstream) (0.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20090218184400-zw4mjse9eywt5566
Tags: 2.4.14-0ubuntu1
[ Steve Langasek ]
* New upstream version
  - Fixes a bug with the pcache overlay not returning cached entries
    (closes: #497697)
  - Update evolution-ntlm patch to apply to current Makefiles.
  - (tentatively) drop gnutls-ciphers, since this bug was reported to be
    fixed upstream in 2.4.8.  The fix applied in 2.4.8 didn't match the
    patch from the bug report, so this should be watched for regressions.
* Build against db4.7 instead of db4.2 at last!  Closes: #421946.
* Build with --disable-ndb, to avoid a misbuild when libmysqlclient is
  installed in the build environment.
* New patch, no-crlcheck-for-gnutls, to fix a build failure when using
  --with-tls=gnutls.

[ Mathias Gug ]
* Merge from debian unstable, remaining changes:
  - debian/apparmor-profile: add AppArmor profile
  - debian/slapd.postinst: Reload AA profile on configuration
  - updated debian/slapd.README.Debian for note on AppArmor
  - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6
  - debian/control: Conflicts with apparmor-profiles << 2.1+1075-0ubuntu4
    to make sure that if earlier version of apparmour-profiles gets
    installed it won't overwrite our profile.
  - Modify Maintainer value to match the DebianMaintainerField
    speficication.
  - follow ApparmorProfileMigration and force apparmor compalin mode on 
    some upgrades (LP: #203529)
  - debian/slapd.dirs: add etc/apparmor.d/force-complain
  - debian/slapd.preinst: create symlink for force-complain on pre-feisty
    upgrades, upgrades where apparmor-profiles profile is unchanged (ie
    non-enforcing) and upgrades where apparmor profile does not exist.
  - debian/slapd.postrm: remove symlink in force-complain/ on purge
  - debian/patches/fix-ucred-libc due to changes how newer glibc handle
    the ucred struct now.
  - debian/control:
    - Build-depend on libltdl7-dev rather then libltdl3-dev.
  - debian/patches/autogen.sh:
    - Call libtoolize with the --install option to install config.{guess,sub}
      files.
  - Don't use local statement in config script as it fails if /bin/sh
    points to bash (LP: #286063).
  - Disable the testsuite on hppa. Allows building of packages on this
    architecture again, once this package is in the archive.
    LP: #288908.
  - debian/slapd.postinst, debian/slapd.script-common: set correct ownership
    and permissions on /var/lib/ldap, /etc/ldap/slapd.d (group readable) and
    /var/run/slapd (world readable). (LP: #257667).
  - debian/patches/nssov-build, debian/rules: 
    Build and package the nss overlay.
    debian/schema/misc.ldif: add ldif file for the misc schema, which defines
    rfc822MailMember (required by the nss overlay).
  - debian/{control,rules}: enable PIE hardening
  - Use cn=config as the default configuration backend instead of 
    slapd.conf. Migrate slapd.conf  file to /etc/ldap/slapd.d/ on upgrade
    asking the end user to enter a new password to control the access to the
    cn=config tree.
* debian/patches/corrupt-contextCSN: The contextCSN can get corrupted at
  times. (ITS: #5947)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* bind.c - ldap backend bind function */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/bind.c,v 1.162.2.17 2008/04/14 20:02:21 quanah Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/bind.c,v 1.162.2.21 2009/01/22 00:01:06 kurt Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
 
 * Copyright 1999-2008 The OpenLDAP Foundation.
 
5
 * Copyright 1999-2009 The OpenLDAP Foundation.
6
6
 * Portions Copyright 2000-2003 Pierangelo Masarati.
7
7
 * Portions Copyright 1999-2003 Howard Chu.
8
8
 * All rights reserved.
1637
1637
        char            **refs = NULL;
1638
1638
        LDAPControl     **ctrls = NULL;
1639
1639
 
1640
 
#define ERR_OK(err) ((err) == LDAP_SUCCESS || (err) == LDAP_COMPARE_FALSE || (err) == LDAP_COMPARE_TRUE)
1641
 
 
1642
1640
        rs->sr_text = NULL;
1643
1641
        rs->sr_matched = NULL;
1644
1642
        rs->sr_ref = NULL;
1647
1645
        /* if the error recorded in the reply corresponds
1648
1646
         * to a successful state, get the error from the
1649
1647
         * remote server response */
1650
 
        if ( ERR_OK( rs->sr_err ) ) {
 
1648
        if ( LDAP_ERR_OK( rs->sr_err ) ) {
1651
1649
                int             rc;
1652
1650
                struct timeval  tv;
1653
1651
                LDAPMessage     *res = NULL;
1800
1798
        /* if the error in the reply structure is not
1801
1799
         * LDAP_SUCCESS, try to map it from client 
1802
1800
         * to server error */
1803
 
        if ( !ERR_OK( rs->sr_err ) ) {
 
1801
        if ( !LDAP_ERR_OK( rs->sr_err ) ) {
1804
1802
                rs->sr_err = slap_map_api2result( rs );
1805
1803
 
1806
1804
                /* internal ops ( op->o_conn == NULL ) 
1825
1823
                }
1826
1824
 
1827
1825
        } else if ( op->o_conn &&
1828
 
                ( ( ( sendok & LDAP_BACK_SENDOK ) && ERR_OK( rs->sr_err ) )
1829
 
                        || ( ( sendok & LDAP_BACK_SENDERR ) && rs->sr_err != LDAP_SUCCESS ) ) )
 
1826
                ( ( ( sendok & LDAP_BACK_SENDOK ) && LDAP_ERR_OK( rs->sr_err ) )
 
1827
                        || ( ( sendok & LDAP_BACK_SENDERR ) && !LDAP_ERR_OK( rs->sr_err ) ) ) )
1830
1828
        {
1831
1829
                send_ldap_result( op, rs );
1832
1830
        }
1859
1857
                rs->sr_ctrls = NULL;
1860
1858
        }
1861
1859
 
1862
 
        return( ERR_OK( rs->sr_err ) ? LDAP_SUCCESS : rs->sr_err );
 
1860
        return( LDAP_ERR_OK( rs->sr_err ) ? LDAP_SUCCESS : rs->sr_err );
1863
1861
}
1864
1862
 
1865
1863
/* return true if bound, false if failed */
2208
2206
                 * so that referral chasing is attempted using the right
2209
2207
                 * identity */
2210
2208
                LDAP_BACK_CONN_ISBOUND_SET( lc );
2211
 
                ber_bvreplace( &lc->lc_bound_ndn, binddn );
 
2209
                if ( !BER_BVISNULL( binddn ) ) {
 
2210
                        ber_bvreplace( &lc->lc_bound_ndn, binddn );
 
2211
                }
2212
2212
 
2213
2213
                if ( !BER_BVISNULL( &lc->lc_cred ) ) {
2214
2214
                        memset( lc->lc_cred.bv_val, 0,
2216
2216
                }
2217
2217
 
2218
2218
                if ( LDAP_BACK_SAVECRED( li ) ) {
2219
 
                        ber_bvreplace( &lc->lc_cred, bindcred );
2220
 
                        ldap_set_rebind_proc( lc->lc_ld, li->li_rebind_f, lc );
 
2219
                        if ( !BER_BVISNULL( bindcred ) ) {
 
2220
                                ber_bvreplace( &lc->lc_cred, bindcred );
 
2221
                                ldap_set_rebind_proc( lc->lc_ld, li->li_rebind_f, lc );
 
2222
                        }
2221
2223
 
2222
2224
                } else {
2223
2225
                        lc->lc_cred.bv_len = 0;
2613
2615
                goto done;
2614
2616
        }
2615
2617
 
2616
 
        assert( j1 + j1 <= sizeof( c )/sizeof(LDAPControl) );
 
2618
        assert( j1 + j2 <= (int) (sizeof( c )/sizeof( c[0] )) );
2617
2619
 
2618
2620
        if ( op->o_ctrls ) {
2619
2621
                for ( n = 0; op->o_ctrls[ n ]; n++ )