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

« back to all changes in this revision

Viewing changes to servers/slapd/backend.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
/* backend.c - routines for dealing with back-end databases */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/backend.c,v 1.362.2.17 2008/04/24 08:13:39 hyc Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/backend.c,v 1.362.2.26 2009/01/30 19:00:12 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
 
 * Copyright 1998-2008 The OpenLDAP Foundation.
 
5
 * Copyright 1998-2009 The OpenLDAP Foundation.
6
6
 * All rights reserved.
7
7
 *
8
8
 * Redistribution and use in source and binary forms, with or without
261
261
                                return rc;
262
262
                        }
263
263
                }
264
 
                /* append global access controls */
265
 
                acl_append( &be->be_acl, frontendDB->be_acl, -1 );
266
264
 
267
265
                return backend_startup_one( be, &cr );
268
266
        }
310
308
                                "has no suffix\n",
311
309
                                i, be->bd_info->bi_type, 0 );
312
310
                }
313
 
                /* append global access controls */
314
 
                acl_append( &be->be_acl, frontendDB->be_acl, -1 );
315
311
 
316
312
                rc = backend_startup_one( be, &cr );
317
313
 
349
345
                }
350
346
 
351
347
                if ( be->bd_info->bi_db_close ) {
352
 
                        be->bd_info->bi_db_close( be, NULL );
 
348
                        rc = be->bd_info->bi_db_close( be, NULL );
 
349
                        if ( rc ) return rc;
353
350
                }
354
351
 
355
352
                if( be->bd_info->bi_close ) {
356
 
                        be->bd_info->bi_close( be->bd_info );
 
353
                        rc = be->bd_info->bi_close( be->bd_info );
 
354
                        if ( rc ) return rc;
357
355
                }
358
356
 
359
357
                return 0;
451
449
        if ( !BER_BVISNULL( &bd->be_rootpw ) ) {
452
450
                free( bd->be_rootpw.bv_val );
453
451
        }
454
 
        acl_destroy( bd->be_acl, frontendDB->be_acl );
 
452
        acl_destroy( bd->be_acl );
455
453
        limits_destroy( bd->be_limits );
456
454
        if ( !BER_BVISNULL( &bd->be_update_ndn ) ) {
457
455
                ch_free( bd->be_update_ndn.bv_val );
502
500
                if ( !BER_BVISNULL( &bd->be_rootpw ) ) {
503
501
                        free( bd->be_rootpw.bv_val );
504
502
                }
505
 
                acl_destroy( bd->be_acl, frontendDB->be_acl );
 
503
                acl_destroy( bd->be_acl );
 
504
                frontendDB = NULL;
506
505
        }
507
506
 
508
507
        return 0;
594
593
        be->be_requires = frontendDB->be_requires;
595
594
        be->be_ssf_set = frontendDB->be_ssf_set;
596
595
 
597
 
        be->be_pcl_mutexp = &be->be_pcl_mutex;
598
 
        ldap_pvt_thread_mutex_init( be->be_pcl_mutexp );
 
596
        ldap_pvt_thread_mutex_init( &be->be_pcl_mutex );
599
597
 
600
598
        /* assign a default depth limit for alias deref */
601
599
        be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH; 
614
612
                        nbackends--;
615
613
                }
616
614
        } else {
 
615
                if ( !bi->bi_nDB ) {
 
616
                        backend_init_controls( bi );
 
617
                }
617
618
                bi->bi_nDB++;
618
619
        }
619
620
        return( be );
946
947
 
947
948
                        case LDAP_COMPARE_FALSE:
948
949
                                if ( !op->o_bd->be_ctrls[cid] && (*ctrls)->ldctl_iscritical ) {
 
950
#ifdef SLAP_CONTROL_X_WHATFAILED
 
951
                                        if ( get_whatFailed( op ) ) {
 
952
                                                char *oids[ 2 ];
 
953
                                                oids[ 0 ] = (*ctrls)->ldctl_oid;
 
954
                                                oids[ 1 ] = NULL;
 
955
                                                slap_ctrl_whatFailed_add( op, rs, oids );
 
956
                                        }
 
957
#endif
949
958
                                        /* RFC 4511 allows unavailableCriticalExtension to be
950
959
                                         * returned when the server is unwilling to perform
951
960
                                         * an operation extended by a recognized critical
996
1005
        slap_mask_t requires;
997
1006
        slap_mask_t opflag;
998
1007
        slap_mask_t exopflag = 0;
999
 
        slap_ssf_set_t *ssf;
 
1008
        slap_ssf_set_t ssfs, *ssf;
1000
1009
        int updateop = 0;
1001
1010
        int starttls = 0;
1002
1011
        int session = 0;
1003
1012
 
 
1013
        restrictops = frontendDB->be_restrictops;
 
1014
        requires = frontendDB->be_requires;
 
1015
        ssfs = frontendDB->be_ssf_set;
 
1016
        ssf = &ssfs;
 
1017
 
1004
1018
        if ( op->o_bd ) {
1005
 
                int     rc = SLAP_CB_CONTINUE;
 
1019
                slap_ssf_t *fssf, *bssf;
 
1020
                int     rc = SLAP_CB_CONTINUE, i;
1006
1021
 
1007
1022
                if ( op->o_bd->be_chk_controls ) {
1008
1023
                        rc = ( *op->o_bd->be_chk_controls )( op, rs );
1016
1031
                        return rs->sr_err;
1017
1032
                }
1018
1033
 
1019
 
                restrictops = op->o_bd->be_restrictops;
1020
 
                requires = op->o_bd->be_requires;
1021
 
                ssf = &op->o_bd->be_ssf_set;
1022
 
 
1023
 
        } else {
1024
 
                restrictops = frontendDB->be_restrictops;
1025
 
                requires = frontendDB->be_requires;
1026
 
                ssf = &frontendDB->be_ssf_set;
 
1034
                restrictops |= op->o_bd->be_restrictops;
 
1035
                requires |= op->o_bd->be_requires;
 
1036
                bssf = &op->o_bd->be_ssf_set.sss_ssf;
 
1037
                fssf = &ssfs.sss_ssf;
 
1038
                for ( i=0; i<sizeof(ssfs)/sizeof(slap_ssf_t); i++ ) {
 
1039
                        if ( bssf[i] ) fssf[i] = bssf[i];
 
1040
                }
1027
1041
        }
1028
1042
 
1029
1043
        switch( op->o_tag ) {
1496
1510
                                                {
1497
1511
                                                        rc = 0;
1498
1512
                                                }
1499
 
                                                filter_free_x( op, filter );
 
1513
                                                filter_free_x( op, filter, 1 );
1500
1514
                                        }
1501
1515
loopit:
1502
1516
                                        ldap_free_urldesc( ludp );