~ubuntu-branches/ubuntu/karmic/openldap/karmic

« back to all changes in this revision

Viewing changes to servers/slapd/overlays/rwm.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Steve Langasek, Mathias Gug
  • Date: 2009-07-30 16:42:58 UTC
  • mfrom: (0.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090730164258-r282hhchgzytxm00
Tags: 2.4.17-1ubuntu1

[ Steve Langasek ]
* Fix up the lintian warnings:
  - add missing misc-depends on all packages
  - slapd, libldap-2.4-2-dbg sections changed to 'debug' to match archive
    overrides
  - bump Standards-Version to 3.8.2, no changes required.

[ Mathias Gug ]
* Resynchronise with Debian. Remaining changes:
  - AppArmor support:
    - debian/apparmor-profile: add AppArmor profile
    - updated debian/slapd.README.Debian for note on AppArmor
    - debian/slapd.dirs: add etc/apparmor.d/force-complain
    - debian/slapd.postrm: remove symlink in force-complain/ on purge
    - debian/rules: install apparmor profile.
  - Don't use local statement in config script as it fails if /bin/sh
    points to bash.
  - 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).
  - Enable nssoverlay:
    - 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/slapd.postinst: create /var/run/slapd before updating its
    permissions.
  - debian/slapd.init: Correctly set slapd config backend option even if
    the pidfile is configured in slapd default file.
* Dropped:
  - Merged in Debian:
    - Update priority of libldap-2.4-2 to match the archive override.
    - Add the missing ldapexop and ldapurl tools to ldap-utils, as well as
      the ldapurl(1) manpage.
    - Bump build-dependency on debhelper to 6 instead of 5, since that's
      what we're using.
    - Set the default SLAPD_SERVICES to ldap:/// ldapi:///, instead of using
      the built-in default of ldap:/// only.
  - Fixed in upstream release:
    - debian/patches/fix-ldap_back_entry_get_rwa.patch: fix test-0034
      failure when built with PIE.
    - debian/patches/gnutls-enable-v1-ca-certs: Enable V1 CA certs to be
      trusted.
  - Update Apparmor profile support: don't support upgrade from pre-hardy
    systems:
    - debian/slapd.postinst: Reload AA profile on configuration
    - 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
      apparmor-profiles gets installed it won't overwrite our profile.
    - follow ApparmorProfileMigration and force apparmor complain mode on
      some upgrades
    - 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/patches/autogen.sh: no longer needed with karmic libtool.
    - Call libtoolize with the --install option to install
      config.{guess,sub} files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* rwm.c - rewrite/remap operations */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/rwm.c,v 1.70.2.24 2009/02/20 00:14:30 quanah Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/rwm.c,v 1.70.2.28 2009/05/01 19:51:07 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
5
 * Copyright 2003-2009 The OpenLDAP Foundation.
823
823
        }
824
824
 
825
825
        /* just free entry if (probably) ours */
826
 
        if ( e->e_private == NULL ) {
 
826
        if ( e->e_private == NULL && BER_BVISNULL( &e->e_bv ) ) {
827
827
                entry_free( e );
828
828
                return LDAP_SUCCESS;
829
829
        }
847
847
        SlapReply               rs = { REP_SEARCH };
848
848
 
849
849
        rwm_op_state            ros = { 0 };
 
850
        struct berval           mndn = BER_BVNULL;
850
851
 
851
852
        if ( ((BackendInfo *)on->on_info->oi_orig)->bi_entry_get_rw == NULL ) {
852
853
                return SLAP_CB_CONTINUE;
862
863
                return LDAP_OTHER;
863
864
        }
864
865
 
 
866
        mndn = BER_BVISNULL( &ros.r_ndn ) ? *ndn : ros.r_ndn;
 
867
 
865
868
        /* map attribute & objectClass */
866
869
        if ( at != NULL ) {
867
870
        }
874
877
        op2.o_bd = &db;
875
878
        op2.o_bd->bd_info = (BackendInfo *)on->on_info->oi_orig;
876
879
        op2.ors_attrs = slap_anlist_all_attributes;
877
 
        rc = op2.o_bd->bd_info->bi_entry_get_rw( &op2, &ros.r_ndn, oc, at, rw, ep );
 
880
        rc = op2.o_bd->bd_info->bi_entry_get_rw( &op2, &mndn, oc, at, rw, ep );
878
881
        if ( rc == LDAP_SUCCESS && *ep != NULL ) {
 
882
                /* we assume be_entry_release() needs to be called */
 
883
                rs.sr_flags = REP_ENTRY_MUSTRELEASE;
879
884
                rs.sr_entry = *ep;
880
885
 
881
886
                /* duplicate & release */
887
892
                }
888
893
        }
889
894
 
890
 
        if ( ros.r_ndn.bv_val != ndn->bv_val ) {
 
895
        if ( !BER_BVISNULL( &ros.r_ndn) && ros.r_ndn.bv_val != ndn->bv_val ) {
891
896
                op->o_tmpfree( ros.r_ndn.bv_val, op->o_tmpmemctx );
892
897
        }
893
898
 
1197
1202
                int                     last = -1;
1198
1203
                Attribute               *a;
1199
1204
 
1200
 
                if ( op->ors_attrs != NULL && 
 
1205
                if ( ( rwmap->rwm_flags & RWM_F_DROP_UNREQUESTED_ATTRS ) &&
 
1206
                                op->ors_attrs != NULL && 
1201
1207
                                !SLAP_USERATTRS( rs->sr_attr_flags ) &&
1202
1208
                                !ad_inlist( (*ap)->a_desc, op->ors_attrs ) )
1203
1209
                {
1829
1835
        RWM_CF_MAP,
1830
1836
        RWM_CF_T_F_SUPPORT,
1831
1837
        RWM_CF_NORMALIZE_MAPPED,
 
1838
        RWM_CF_DROP_UNREQUESTED,
1832
1839
 
1833
1840
        RWM_CF_LAST
1834
1841
};
1883
1890
                        "SINGLE-VALUE )",
1884
1891
                NULL, NULL },
1885
1892
 
 
1893
        { "rwm-drop-unrequested-attrs", "true|false",
 
1894
                2, 2, 0, ARG_MAGIC|ARG_ON_OFF|RWM_CF_DROP_UNREQUESTED, rwm_cf_gen,
 
1895
                "( OLcfgOvAt:16.5 NAME 'olcRwmDropUnrequested' "
 
1896
                        "DESC 'Drop unrequested attributes' "
 
1897
                        "SYNTAX OMsBoolean "
 
1898
                        "SINGLE-VALUE )",
 
1899
                NULL, NULL },
 
1900
 
1886
1901
        { NULL, NULL, 0, 0, 0, ARG_IGNORED }
1887
1902
};
1888
1903
 
2051
2066
                        c->value_int = ( rwmap->rwm_flags & RWM_F_NORMALIZE_MAPPED_ATTRS );
2052
2067
                        break;
2053
2068
 
 
2069
                case RWM_CF_DROP_UNREQUESTED:
 
2070
                        c->value_int = ( rwmap->rwm_flags & RWM_F_DROP_UNREQUESTED_ATTRS );
 
2071
                        break;
 
2072
 
2054
2073
                default:
2055
2074
                        assert( 0 );
2056
2075
                        rc = 1;
2145
2164
                        rwmap->rwm_flags &= ~RWM_F_NORMALIZE_MAPPED_ATTRS;
2146
2165
                        break;
2147
2166
 
 
2167
                case RWM_CF_DROP_UNREQUESTED:
 
2168
                        rwmap->rwm_flags &= ~RWM_F_DROP_UNREQUESTED_ATTRS;
 
2169
                        break;
 
2170
 
2148
2171
                default:
2149
2172
                        return 1;
2150
2173
                }
2325
2348
                }
2326
2349
                break;
2327
2350
 
 
2351
        case RWM_CF_DROP_UNREQUESTED:
 
2352
                if ( c->value_int ) {
 
2353
                        rwmap->rwm_flags |= RWM_F_DROP_UNREQUESTED_ATTRS;
 
2354
                } else {
 
2355
                        rwmap->rwm_flags &= ~RWM_F_DROP_UNREQUESTED_ATTRS;
 
2356
                }
 
2357
                break;
 
2358
 
2328
2359
        default:
2329
2360
                assert( 0 );
2330
2361
                return 1;
2344
2375
 
2345
2376
        rwmap = (struct ldaprwmap *)ch_calloc( 1, sizeof( struct ldaprwmap ) );
2346
2377
 
 
2378
        /* default */
 
2379
        rwmap->rwm_flags = RWM_F_DROP_UNREQUESTED_ATTRS;
 
2380
 
2347
2381
        rc = rwm_info_init( &rwmap->rwm_rw );
2348
2382
 
2349
 
error_return:;
2350
2383
        on->on_bi.bi_private = (void *)rwmap;
2351
2384
 
2352
2385
        if ( rc ) {