~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
  • Date: 2009-09-07 13:41:10 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: james.westby@ubuntu.com-20090907134110-jsdrvn0atu1fex4m
Tags: upstream-2.4.18
ImportĀ upstreamĀ versionĀ 2.4.18

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.14 2009/01/22 00:01:13 kurt Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/unique.c,v 1.20.2.16 2009/08/02 18:44:04 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
5
 * Copyright 2004-2009 The OpenLDAP Foundation.
47
47
        struct berval dn;
48
48
        struct berval ndn;
49
49
        struct berval filter;
 
50
        Filter *f;
50
51
        struct unique_attrs_s *attrs;
51
52
        int scope;
52
53
} unique_domain_uri;
141
142
                ch_free ( uri->dn.bv_val );
142
143
                ch_free ( uri->ndn.bv_val );
143
144
                ch_free ( uri->filter.bv_val );
 
145
                filter_free( uri->f );
144
146
                attr = uri->attrs;
145
147
                while ( attr ) {
146
148
                        next_attr = attr->next;
214
216
                        rc = ARG_BAD_CONF;
215
217
                        goto exit;
216
218
                }
 
219
 
 
220
                if ( BER_BVISNULL( &be->be_rootndn ) || BER_BVISEMPTY( &be->be_rootndn ) ) {
 
221
                        Debug( LDAP_DEBUG_ANY,
 
222
                                "slapo-unique needs a rootdn; "
 
223
                                "backend <%s> has none, YMMV.\n",
 
224
                                be->be_nsuffix[0].bv_val, 0, 0 );
 
225
                }
217
226
        }
218
227
 
219
228
        attr_str = url_desc->lud_attrs;
247
256
        }
248
257
 
249
258
        if (url_desc->lud_filter) {
250
 
                Filter *f = str2filter( url_desc->lud_filter );
251
259
                char *ptr;
252
 
                if ( !f ) {
 
260
                uri->f = str2filter( url_desc->lud_filter );
 
261
                if ( !uri->f ) {
253
262
                        snprintf( c->cr_msg, sizeof( c->cr_msg ),
254
263
                                  "unique: bad filter");
255
264
                        rc = ARG_BAD_CONF;
256
265
                        goto exit;
257
266
                }
258
267
                /* make sure the strfilter is in normal form (ITS#5581) */
259
 
                filter2bv( f, &uri->filter );
260
 
                filter_free( f );
 
268
                filter2bv( uri->f, &uri->filter );
261
269
                ptr = strstr( uri->filter.bv_val, "(?=" /*)*/ );
262
270
                if ( ptr != NULL && ptr <= ( uri->filter.bv_val - STRLENOF( "(?=" /*)*/ ) + uri->filter.bv_len ) )
263
271
                {
459
467
                abort();
460
468
        }
461
469
 
 
470
        if ( rc ) {
 
471
                ch_free( c->value_dn.bv_val );
 
472
                BER_BVZERO( &c->value_dn );
 
473
                ch_free( c->value_ndn.bv_val );
 
474
                BER_BVZERO( &c->value_ndn );
 
475
        }
 
476
 
462
477
        return rc;
463
478
}
464
479
 
1071
1086
                             && !dnIsSuffix( &op->o_req_ndn, &uri->ndn ))
1072
1087
                                continue;
1073
1088
 
 
1089
                        if ( uri->f ) {
 
1090
                                if ( test_filter( NULL, op->ora_e, uri->f )
 
1091
                                        == LDAP_COMPARE_FALSE )
 
1092
                                {
 
1093
                                        Debug( LDAP_DEBUG_TRACE,
 
1094
                                                "==> unique_add_skip<%s>\n",
 
1095
                                                op->o_req_dn.bv_val, 0, 0 );
 
1096
                                        continue;
 
1097
                                }
 
1098
                        }
 
1099
 
1074
1100
                        if(!(a = op->ora_e->e_attrs)) {
1075
1101
                                op->o_bd->bd_info = (BackendInfo *) on->on_info;
1076
1102
                                send_ldap_error(op, rs, LDAP_INVALID_SYNTAX,