~ubuntu-branches/ubuntu/quantal/openldap/quantal

« back to all changes in this revision

Viewing changes to servers/slapd/back-meta/map.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-01-23 10:01:13 UTC
  • mfrom: (1.1.9) (0.3.17 sid)
  • Revision ID: package-import@ubuntu.com-20120123100113-gntssa0aqxn4dfui
Tags: 2.4.28-1.1ubuntu1
* Merge from Debian testing.  Remaining changes:
  - Install a default DIT (LP: #442498).
  - Document cn=config in README file (LP: #370784).
  - remaining changes:
    + AppArmor support:
      - debian/apparmor-profile: add AppArmor profile
      - use dh_apparmor:
        - debian/rules: use dh_apparmor
        - debian/control: Build-Depends on debhelper 7.4.20ubuntu5
      - updated debian/slapd.README.Debian for note on AppArmor
      - debian/slapd.dirs: add etc/apparmor.d/force-complain
    + Enable GSSAPI support (LP: #495418):
      - debian/patches/gssapi.diff, thanks to Jerry Carter (Likewise):
        - Add --with-gssapi support
        - Make guess_service_principal() more robust when determining
          principal
      - debian/patches/series: apply gssapi.diff patch.
      - debian/configure.options: Configure with --with-gssapi
      - debian/control: Added libkrb5-dev as a build depend
    + debian/rules: Enable -DLDAP_CONNECTIONLESS to build CLDAP (UDP) support
      in the openldap library, as required by Likewise-Open (LP: #390579)
   + Don't build smbk5pwd overlay since it uses heimdal instead of krb5:
      - debian/control: 
        - remove build-dependency on heimdal-dev.
        - remove slapd-smbk5pwd binary package.
      - debian/rules: don't build smbk5pwd slapd module.
    + debian/{control,rules}: enable PIE hardening
    + ufw support (LP: #423246):
      - debian/control: suggest ufw.
      - debian/rules: install ufw profile.
      - debian/slapd.ufw.profile: add ufw profile.
    + Enable nssoverlay:
      - debian/patches/nssov-build, debian/series, debian/rules: 
        Apply, build and package the nss overlay.
      - debian/schema/extra/misc.ldif: add ldif file for the misc schema
        which defines rfc822MailMember (required by the nss overlay).
    + debian/rules, debian/schema/extra/: 
      Fix configure rule to supports extra schemas shipped as part
      of the debian/schema/ directory.
    + debian/rules, debian/slapd.py: Add apport hook. (LP: #610544)
    + debian/slapd.init.ldif: don't set olcRootDN since it's not defined in
     neither the default DIT nor via an Authn mapping.
    + debian/slapd.scripts-common: adjust minimum version that triggers a
      database upgrade. Upgrade from maverick shouldn't trigger database
      upgrade (which would happen with the version used in Debian).
    + debian/slapd.scripts-common: add slapcat_opts to local variables.
      Remove unused variable new_conf.
    + debian/slapd.script-common: Fix package reconfiguration.
      - Fix backup directory naming for multiple reconfiguration.
    + debian/slapd.default, debian/slapd.README.Debian: 
      use the new configuration style.
    + Install nss overlay (LP: #675391):
      - debian/rules: run install target for nssov module.
      - debian/patches/nssov-build: fix patch to install schema in /etc/ldap/schema
    + debian/patches/gssapi.diff:
      - Update patch so that likewise-open is usuable again. (LP: #661547)
    + debian/patches/service-operational-before-detach: New patch replacing old one
      of the same name as previous could cause database corruption based on upstream commits.
      (LP: #727973)
    + debian/patches/CVE-2011-4079: fix off by one error in postalAddressNormalize()
      (CVE-2011-4079)

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.18 2011/01/31 20:47:58 quanah Exp $ */
 
2
/* $OpenLDAP$ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
5
 * Copyright 1998-2011 The OpenLDAP Foundation.
171
171
 
172
172
int
173
173
ldap_back_map_attrs(
 
174
                Operation *op,
174
175
                struct ldapmap *at_map,
175
176
                AttributeName *an,
176
177
                int remap,
177
 
                char ***mapped_attrs,
178
 
                void *memctx )
 
178
                char ***mapped_attrs )
179
179
{
180
 
        int i, j;
 
180
        int i, x, j;
181
181
        char **na;
182
182
        struct berval mapped;
183
183
 
184
 
        if ( an == NULL ) {
 
184
        if ( an == NULL && op->o_bd->be_extra_anlist == NULL ) {
185
185
                *mapped_attrs = NULL;
186
186
                return LDAP_SUCCESS;
187
187
        }
188
188
 
189
 
        for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ )
190
 
                /*  */ ;
191
 
 
192
 
        na = (char **)ber_memcalloc_x( i + 1, sizeof(char *), memctx );
 
189
        i = 0;
 
190
        if ( an != NULL ) {
 
191
                for ( ; !BER_BVISNULL( &an[i].an_name ); i++ )
 
192
                        /*  */ ;
 
193
        }
 
194
 
 
195
        x = 0;
 
196
        if ( op->o_bd->be_extra_anlist != NULL ) {
 
197
                for ( ; !BER_BVISNULL( &op->o_bd->be_extra_anlist[x].an_name ); x++ )
 
198
                        /*  */ ;
 
199
        }
 
200
 
 
201
        assert( i > 0 || x > 0 );
 
202
        
 
203
        na = (char **)ber_memcalloc_x( i + x + 1, sizeof(char *), op->o_tmpmemctx );
193
204
        if ( na == NULL ) {
194
205
                *mapped_attrs = NULL;
195
206
                return LDAP_NO_MEMORY;
196
207
        }
197
208
 
198
 
        for ( i = j = 0; !BER_BVISNULL( &an[i].an_name ); i++ ) {
199
 
                ldap_back_map( at_map, &an[i].an_name, &mapped, remap );
200
 
                if ( !BER_BVISNULL( &mapped ) && !BER_BVISEMPTY( &mapped ) ) {
201
 
                        na[j++] = mapped.bv_val;
202
 
                }
203
 
        }
204
 
        if ( j == 0 && i != 0 ) {
 
209
        j = 0;
 
210
        if ( i > 0 ) {
 
211
                for ( i = 0; !BER_BVISNULL( &an[i].an_name ); i++ ) {
 
212
                        ldap_back_map( at_map, &an[i].an_name, &mapped, remap );
 
213
                        if ( !BER_BVISNULL( &mapped ) && !BER_BVISEMPTY( &mapped ) ) {
 
214
                                na[j++] = mapped.bv_val;
 
215
                        }
 
216
                }
 
217
        }
 
218
 
 
219
        if ( x > 0 ) {
 
220
                for ( x = 0; !BER_BVISNULL( &op->o_bd->be_extra_anlist[x].an_name ); x++ ) {
 
221
                        if ( op->o_bd->be_extra_anlist[x].an_desc &&
 
222
                                ad_inlist( op->o_bd->be_extra_anlist[x].an_desc, an ) )
 
223
                        {
 
224
                                continue;
 
225
                        }
 
226
 
 
227
                        ldap_back_map( at_map, &op->o_bd->be_extra_anlist[x].an_name, &mapped, remap );
 
228
                        if ( !BER_BVISNULL( &mapped ) && !BER_BVISEMPTY( &mapped ) ) {
 
229
                                na[j++] = mapped.bv_val;
 
230
                        }
 
231
                }
 
232
        }
 
233
 
 
234
        if ( j == 0 && ( i > 0 || x > 0 ) ) {
205
235
                na[j++] = LDAP_NO_ATTRS;
206
236
        }
207
237
        na[j] = NULL;
208
238
 
209
239
        *mapped_attrs = na;
 
240
 
210
241
        return LDAP_SUCCESS;
211
242
}
212
243