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

« back to all changes in this revision

Viewing changes to servers/slapd/overlays/rwmmap.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
/* rwmmap.c - rewrite/mapping routines */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/rwmmap.c,v 1.31.2.6 2008/02/11 23:26:49 kurt Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/rwmmap.c,v 1.31.2.11 2009/02/05 19:42:04 quanah 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 1999-2003 Howard Chu.
7
7
 * Portions Copyright 2000-2003 Pierangelo Masarati.
8
8
 * All rights reserved.
81
81
                return LDAP_NO_MEMORY;
82
82
        }
83
83
 
84
 
        /* FIXME: I don't think this is needed any more... */
 
84
        /* NOTE: this is needed to make sure that
 
85
         *      rwm-map attribute *
 
86
         * does not  filter out all attributes including objectClass */
85
87
        rc = slap_str2ad( "objectClass", &mapping[0].m_src_ad, &text );
86
88
        if ( rc != LDAP_SUCCESS ) {
87
89
                ch_free( mapping );
493
495
                return LDAP_OTHER;
494
496
        }
495
497
 
 
498
        if ( f->f_choice & SLAPD_FILTER_UNDEFINED ) {
 
499
                goto computed;
 
500
        }
 
501
 
496
502
        switch ( f->f_choice & SLAPD_FILTER_MASK ) {
497
503
        case LDAP_FILTER_EQUALITY:
498
504
                ad = f->f_av_desc;
704
710
 
705
711
        case -1:
706
712
computed:;
707
 
                filter_free_x( op, f );
 
713
                filter_free_x( op, f, 0 );
708
714
                f->f_choice = SLAPD_FILTER_COMPUTED;
709
715
                f->f_result = SLAPD_COMPARE_UNDEFINED;
710
716
                /* fallthru */
1172
1178
int
1173
1179
rwm_dnattr_result_rewrite(
1174
1180
        dncookie                *dc,
1175
 
        BerVarray               a_vals )
 
1181
        BerVarray               a_vals,
 
1182
        BerVarray               a_nvals )
1176
1183
{
1177
1184
        int             i, last;
1178
1185
 
1180
1187
        last--;
1181
1188
 
1182
1189
        for ( i = 0; !BER_BVISNULL( &a_vals[i] ); i++ ) {
1183
 
                struct berval   dn;
 
1190
                struct berval   pdn, ndn = BER_BVNULL;
1184
1191
                int             rc;
1185
1192
                
1186
 
                dn = a_vals[i];
1187
 
                rc = rwm_dn_massage_pretty( dc, &a_vals[i], &dn );
 
1193
                pdn = a_vals[i];
 
1194
                rc = rwm_dn_massage_pretty_normalize( dc, &a_vals[i], &pdn, &ndn );
1188
1195
                switch ( rc ) {
1189
1196
                case LDAP_UNWILLING_TO_PERFORM:
1190
1197
                        /*
1192
1199
                         * legal to trim values when adding/modifying;
1193
1200
                         * it should be when searching (e.g. ACLs).
1194
1201
                         */
 
1202
                        assert( a_vals[i].bv_val != a_nvals[i].bv_val );
1195
1203
                        ch_free( a_vals[i].bv_val );
 
1204
                        ch_free( a_nvals[i].bv_val );
1196
1205
                        if ( last > i ) {
1197
1206
                                a_vals[i] = a_vals[last];
 
1207
                                a_nvals[i] = a_nvals[last];
1198
1208
                        }
1199
1209
                        BER_BVZERO( &a_vals[last] );
 
1210
                        BER_BVZERO( &a_nvals[last] );
1200
1211
                        last--;
1201
1212
                        break;
1202
1213
 
1203
1214
                default:
1204
1215
                        /* leave attr untouched if massage failed */
1205
 
                        if ( !BER_BVISNULL( &dn ) && a_vals[i].bv_val != dn.bv_val ) {
 
1216
                        if ( !BER_BVISNULL( &pdn ) && a_vals[i].bv_val != pdn.bv_val ) {
1206
1217
                                ch_free( a_vals[i].bv_val );
1207
 
                                a_vals[i] = dn;
 
1218
                                a_vals[i] = pdn;
 
1219
                        }
 
1220
                        if ( !BER_BVISNULL( &ndn ) && a_nvals[i].bv_val != ndn.bv_val ) {
 
1221
                                ch_free( a_nvals[i].bv_val );
 
1222
                                a_nvals[i] = ndn;
1208
1223
                        }
1209
1224
                        break;
1210
1225
                }