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

« back to all changes in this revision

Viewing changes to servers/slapd/back-meta/map.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
/* map.c - ldap backend mapping routines */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/back-meta/map.c,v 1.15.2.7 2008/02/11 23:26:47 kurt Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/back-meta/map.c,v 1.15.2.11 2009/01/22 00:01:07 kurt 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
323
323
                return LDAP_OTHER;
324
324
        }
325
325
 
326
 
        switch ( f->f_choice ) {
 
326
        switch ( ( f->f_choice & SLAPD_FILTER_MASK ) ) {
327
327
        case LDAP_FILTER_EQUALITY:
328
328
                if ( map_attr_value( dc, f->f_av_desc, &atmp,
329
329
                                        &f->f_av_value, &vtmp, remap ) )
333
333
 
334
334
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
335
335
                        + ( sizeof("(=)") - 1 );
336
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
336
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
337
337
 
338
338
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",
339
339
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
350
350
 
351
351
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
352
352
                        + ( sizeof("(>=)") - 1 );
353
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
353
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
354
354
 
355
355
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",
356
356
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
367
367
 
368
368
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
369
369
                        + ( sizeof("(<=)") - 1 );
370
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
370
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
371
371
 
372
372
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",
373
373
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
384
384
 
385
385
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
386
386
                        + ( sizeof("(~=)") - 1 );
387
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
387
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
388
388
 
389
389
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",
390
390
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
402
402
                /* cannot be a DN ... */
403
403
 
404
404
                fstr->bv_len = atmp.bv_len + ( STRLENOF( "(=*)" ) );
405
 
                fstr->bv_val = malloc( fstr->bv_len + 128 ); /* FIXME: why 128 ? */
 
405
                fstr->bv_val = ch_malloc( fstr->bv_len + 128 ); /* FIXME: why 128 ? */
406
406
 
407
407
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
408
408
                        atmp.bv_val );
462
462
                }
463
463
 
464
464
                fstr->bv_len = atmp.bv_len + ( STRLENOF( "(=*)" ) );
465
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
465
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
466
466
 
467
467
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
468
468
                        atmp.bv_val );
472
472
        case LDAP_FILTER_OR:
473
473
        case LDAP_FILTER_NOT:
474
474
                fstr->bv_len = STRLENOF( "(%)" );
475
 
                fstr->bv_val = malloc( fstr->bv_len + 128 );    /* FIXME: why 128? */
 
475
                fstr->bv_val = ch_malloc( fstr->bv_len + 128 ); /* FIXME: why 128? */
476
476
 
477
477
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%c)",
478
478
                        f->f_choice == LDAP_FILTER_AND ? '&' :
517
517
                        ( f->f_mr_dnattrs ? STRLENOF( ":dn" ) : 0 ) +
518
518
                        ( !BER_BVISEMPTY( &f->f_mr_rule_text ) ? f->f_mr_rule_text.bv_len + 1 : 0 ) +
519
519
                        vtmp.bv_len + ( STRLENOF( "(:=)" ) );
520
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
520
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
521
521
 
522
522
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
523
523
                        atmp.bv_val,
530
530
 
531
531
        case SLAPD_FILTER_COMPUTED:
532
532
                switch ( f->f_result ) {
533
 
                case LDAP_COMPARE_FALSE:
534
533
                /* FIXME: treat UNDEFINED as FALSE */
535
534
                case SLAPD_COMPARE_UNDEFINED:
536
535
computed:;
 
536
                        if ( META_BACK_TGT_NOUNDEFFILTER( dc->target ) ) {
 
537
                                return LDAP_COMPARE_FALSE;
 
538
                        }
 
539
                        /* fallthru */
 
540
 
 
541
                case LDAP_COMPARE_FALSE:
537
542
                        if ( META_BACK_TGT_T_F( dc->target ) ) {
538
543
                                tmp = &ber_bvtf_false;
539
544
                                break;