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

« back to all changes in this revision

Viewing changes to servers/slapd/back-bdb/id2entry.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
/* id2entry.c - routines to deal with the id2entry database */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/id2entry.c,v 1.72.2.6 2008/05/01 21:39:35 quanah Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/id2entry.c,v 1.72.2.13 2009/01/22 00:01:05 kurt Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
 
 * Copyright 2000-2008 The OpenLDAP Foundation.
 
5
 * Copyright 2000-2009 The OpenLDAP Foundation.
6
6
 * All rights reserved.
7
7
 *
8
8
 * Redistribution and use in source and binary forms, with or without
93
93
int bdb_id2entry(
94
94
        BackendDB *be,
95
95
        DB_TXN *tid,
96
 
        BDB_LOCKER locker,
97
96
        ID id,
98
97
        Entry **e )
99
98
{
120
119
        rc = db->cursor( db, tid, &cursor, bdb->bi_db_opflags );
121
120
        if ( rc ) return rc;
122
121
 
123
 
        /* Use our own locker if needed */
124
 
        if ( !tid && locker ) {
125
 
                CURSOR_SETLOCKER( cursor, locker );
126
 
        }
127
 
 
128
122
        /* Get the nattrs / nvals counts first */
129
123
        data.ulen = data.dlen = sizeof(buf);
130
124
        data.data = buf;
273
267
                                if ( bli->bli_id == e->e_id ) {
274
268
                                        bdb_cache_return_entry_rw( bdb, e, rw, &bli->bli_lock );
275
269
                                        prev->bli_next = bli->bli_next;
276
 
                                        op->o_tmpfree( bli, op->o_tmpmemctx );
 
270
                                        /* Cleanup, or let caller know we unlocked */
 
271
                                        if ( bli->bli_flag & BLI_DONTFREE )
 
272
                                                bli->bli_flag = 0;
 
273
                                        else
 
274
                                                op->o_tmpfree( bli, op->o_tmpmemctx );
277
275
                                        break;
278
276
                                }
279
277
                        }
280
278
                        if ( !boi->boi_locks ) {
281
279
                                LDAP_SLIST_REMOVE( &op->o_extra, &boi->boi_oe, OpExtra, oe_next );
282
 
                                op->o_tmpfree( boi, op->o_tmpmemctx );
 
280
                                if ( !(boi->boi_flag & BOI_DONTFREE))
 
281
                                        op->o_tmpfree( boi, op->o_tmpmemctx );
283
282
                        }
284
283
                }
285
284
        } else {
322
321
        int     rc;
323
322
        const char *at_name = at ? at->ad_cname.bv_val : "(null)";
324
323
 
325
 
        BDB_LOCKER      locker = 0;
326
324
        DB_LOCK         lock;
327
 
        int             free_lock_id = 0;
328
325
 
329
326
        Debug( LDAP_DEBUG_ARGS,
330
327
                "=> bdb_entry_get: ndn: \"%s\"\n", ndn->bv_val, 0, 0 ); 
342
339
                        txn = boi->boi_txn;
343
340
        }
344
341
 
345
 
        if ( txn != NULL ) {
346
 
                locker = TXN_ID ( txn );
347
 
        } else {
348
 
                rc = LOCK_ID ( bdb->bi_dbenv, &locker );
349
 
                free_lock_id = 1;
 
342
        if ( !txn ) {
 
343
                rc = bdb_reader_get( op, bdb->bi_dbenv, &txn );
350
344
                switch(rc) {
351
345
                case 0:
352
346
                        break;
357
351
 
358
352
dn2entry_retry:
359
353
        /* can we find entry */
360
 
        rc = bdb_dn2entry( op, txn, ndn, &ei, 0, locker, &lock );
 
354
        rc = bdb_dn2entry( op, txn, ndn, &ei, 0, &lock );
361
355
        switch( rc ) {
362
356
        case DB_NOTFOUND:
363
357
        case 0:
366
360
        case DB_LOCK_NOTGRANTED:
367
361
                /* the txn must abort and retry */
368
362
                if ( txn ) {
369
 
                        boi->boi_err = rc;
 
363
                        if ( boi ) boi->boi_err = rc;
370
364
                        return LDAP_BUSY;
371
365
                }
372
366
                ldap_pvt_thread_yield();
373
367
                goto dn2entry_retry;
374
368
        default:
375
369
                if ( boi ) boi->boi_err = rc;
376
 
                if ( free_lock_id ) {
377
 
                        LOCK_ID_FREE( bdb->bi_dbenv, locker );
378
 
                }
379
370
                return (rc != LDAP_BUSY) ? LDAP_OTHER : LDAP_BUSY;
380
371
        }
381
372
        if (ei) e = ei->bei_e;
383
374
                Debug( LDAP_DEBUG_ACL,
384
375
                        "=> bdb_entry_get: cannot find entry: \"%s\"\n",
385
376
                                ndn->bv_val, 0, 0 ); 
386
 
                if ( free_lock_id ) {
387
 
                        LOCK_ID_FREE( bdb->bi_dbenv, locker );
388
 
                }
389
377
                return LDAP_NO_SUCH_OBJECT; 
390
378
        }
391
379
        
401
389
                goto return_results;
402
390
        }
403
391
 
 
392
        /* NOTE: attr_find() or attrs_find()? */
 
393
        if ( at && attr_find( e->e_attrs, at ) == NULL ) {
 
394
                Debug( LDAP_DEBUG_ACL,
 
395
                        "<= bdb_entry_get: failed to find attribute %s\n",
 
396
                        at->ad_cname.bv_val, 0, 0 ); 
 
397
                rc = LDAP_NO_SUCH_ATTRIBUTE;
 
398
                goto return_results;
 
399
        }
 
400
 
404
401
return_results:
405
402
        if( rc != LDAP_SUCCESS ) {
406
403
                /* free entry */
425
422
                                                op->o_tmpmemctx );
426
423
                                        bli->bli_next = boi->boi_locks;
427
424
                                        bli->bli_id = e->e_id;
 
425
                                        bli->bli_flag = 0;
428
426
                                        bli->bli_lock = lock;
429
427
                                        boi->boi_locks = bli;
430
428
                                }
435
433
                }
436
434
        }
437
435
 
438
 
        if ( free_lock_id ) {
439
 
                LOCK_ID_FREE( bdb->bi_dbenv, locker );
440
 
        }
441
 
 
442
436
        Debug( LDAP_DEBUG_TRACE,
443
437
                "bdb_entry_get: rc=%d\n",
444
438
                rc, 0, 0 );