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

« back to all changes in this revision

Viewing changes to servers/slapd/overlays/unique.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
/* unique.c - attribute uniqueness module */
2
 
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/unique.c,v 1.20.2.9 2008/07/09 23:45:53 quanah Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/unique.c,v 1.20.2.14 2009/01/22 00:01:13 kurt Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
 
 * Copyright 2004-2008 The OpenLDAP Foundation.
 
5
 * Copyright 2004-2009 The OpenLDAP Foundation.
6
6
 * Portions Copyright 2004,2006-2007 Symas Corporation.
7
7
 * All rights reserved.
8
8
 *
197
197
                        goto exit;
198
198
                }
199
199
 
 
200
                if ( be->be_nsuffix == NULL ) {
 
201
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
 
202
                                  "suffix must be set" );
 
203
                        Debug ( LDAP_DEBUG_CONFIG, "unique config: %s\n",
 
204
                                c->cr_msg, NULL, NULL );
 
205
                        rc = ARG_BAD_CONF;
 
206
                        goto exit;
 
207
                }
 
208
 
200
209
                if ( !dnIsSuffix ( &uri->ndn, &be->be_nsuffix[0] ) ) {
201
210
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
202
211
                                  "dn <%s> is not a suffix of backend base dn <%s>",
239
248
 
240
249
        if (url_desc->lud_filter) {
241
250
                Filter *f = str2filter( url_desc->lud_filter );
 
251
                char *ptr;
242
252
                if ( !f ) {
243
253
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
244
254
                                  "unique: bad filter");
248
258
                /* make sure the strfilter is in normal form (ITS#5581) */
249
259
                filter2bv( f, &uri->filter );
250
260
                filter_free( f );
 
261
                ptr = strstr( uri->filter.bv_val, "(?=" /*)*/ );
 
262
                if ( ptr != NULL && ptr <= ( uri->filter.bv_val - STRLENOF( "(?=" /*)*/ ) + uri->filter.bv_len ) )
 
263
                {
 
264
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
 
265
                                  "unique: bad filter");
 
266
                        rc = ARG_BAD_CONF;
 
267
                        goto exit;
 
268
                }
251
269
        }
252
270
exit:
253
271
        uri->next = *urip;
406
424
                        rc = ARG_BAD_CONF;
407
425
                        break;
408
426
                }
 
427
                if ( be->be_nsuffix == NULL ) {
 
428
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
 
429
                                  "suffix must be set" );
 
430
                        Debug ( LDAP_DEBUG_CONFIG, "unique config: %s\n",
 
431
                                c->cr_msg, NULL, NULL );
 
432
                        rc = ARG_BAD_CONF;
 
433
                        break;
 
434
                }
409
435
                if ( !dnIsSuffix ( &c->value_ndn,
410
436
                                   &be->be_nsuffix[0] ) ) {
411
437
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
956
982
        unique_counter uq = { NULL, 0 };
957
983
        int rc;
958
984
 
959
 
        Debug(LDAP_DEBUG_TRACE, "==> unique_search %s\n", key, 0, 0);
 
985
        Debug(LDAP_DEBUG_TRACE, "==> unique_search %s\n", key->bv_val, 0, 0);
960
986
 
961
987
        nop->ors_filter = str2filter_x(nop, key->bv_val);
 
988
        if(nop->ors_filter == NULL) {
 
989
                op->o_bd->bd_info = (BackendInfo *) on->on_info;
 
990
                send_ldap_error(op, rs, LDAP_OTHER,
 
991
                        "unique_search invalid filter");
 
992
                return(rs->sr_err);
 
993
        }
 
994
 
962
995
        nop->ors_filterstr = *key;
963
996
 
964
997
        cb.sc_response  = (slap_response*)count_attr_cb;
980
1013
 
981
1014
        nop->o_bd = on->on_info->oi_origdb;
982
1015
        rc = nop->o_bd->be_search(nop, &nrs);
983
 
        filter_free_x(nop, nop->ors_filter);
 
1016
        filter_free_x(nop, nop->ors_filter, 1);
984
1017
        op->o_tmpfree( key->bv_val, op->o_tmpmemctx );
985
1018
 
986
1019
        if(rc != LDAP_SUCCESS && rc != LDAP_NO_SUCH_OBJECT) {