~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek, Updated debconf translations
  • Date: 2009-07-28 10:17:15 UTC
  • mfrom: (1.1.4 upstream) (0.2.2 sid)
  • mto: (0.2.4 sid)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20090728101715-epwmqmsk0d3h22k3
* New upstream version.
  - Fixes FTBFS on ia64 with -fPIE. Closes: #524770.
  - Fixes some TLS issues with GnuTLS.  Closes: #505191.
* 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.  Thanks to Peter Marschall for the patch.
  Closes: #496749.
* Bump build-dependency on debhelper to 6 instead of 5, since that's
  what we're using.  Closes: #498116.
* Set the default SLAPD_SERVICES to ldap:/// ldapi:///, instead of using
  the built-in default of ldap:/// only.
* Build-depend on libltdl-dev | libltdl3-dev (>= 1.4.3), for the package
  name change.  Closes: #522965.

[ Updated debconf translations ]
* Spanish, thanks to Francisco Javier Cuadrado <fcocuadrado@gmail.com>.
  Closes: #521804.

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.7 2008/02/11 23:26:47 kurt Exp $ */
 
2
/* $OpenLDAP: pkg/ldap/servers/slapd/back-meta/map.c,v 1.15.2.12 2009/02/17 19:14:41 quanah Exp $ */
3
3
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
4
 *
5
 
 * Copyright 1998-2008 The OpenLDAP Foundation.
 
5
 * Copyright 1998-2009 The OpenLDAP Foundation.
6
6
 * All rights reserved.
7
7
 *
8
8
 * Redistribution and use in source and binary forms, with or without
119
119
 
120
120
        assert( m != NULL );
121
121
 
 
122
        /* let special attrnames slip through (ITS#5760) */
 
123
        if ( bvmatch( s, slap_bv_no_attrs )
 
124
                || bvmatch( s, slap_bv_all_user_attrs )
 
125
                || bvmatch( s, slap_bv_all_operational_attrs ) )
 
126
        {
 
127
                *m = NULL;
 
128
                return 0;
 
129
        }
 
130
 
122
131
        if ( remap == BACKLDAP_REMAP ) {
123
132
                tree = map->remap;
124
133
 
140
149
        int remap )
141
150
{
142
151
        struct ldapmapping *mapping;
 
152
        int drop_missing;
143
153
 
144
154
        /* map->map may be NULL when mapping is configured,
145
155
         * but map->remap can't */
149
159
        }
150
160
 
151
161
        BER_BVZERO( bv );
152
 
        ( void )ldap_back_mapping( map, s, &mapping, remap );
 
162
        drop_missing = ldap_back_mapping( map, s, &mapping, remap );
153
163
        if ( mapping != NULL ) {
154
164
                if ( !BER_BVISNULL( &mapping->dst ) ) {
155
165
                        *bv = mapping->dst;
157
167
                return;
158
168
        }
159
169
 
160
 
        if ( !map->drop_missing ) {
 
170
        if ( !drop_missing ) {
161
171
                *bv = *s;
162
172
        }
163
173
}
323
333
                return LDAP_OTHER;
324
334
        }
325
335
 
326
 
        switch ( f->f_choice ) {
 
336
        switch ( ( f->f_choice & SLAPD_FILTER_MASK ) ) {
327
337
        case LDAP_FILTER_EQUALITY:
328
338
                if ( map_attr_value( dc, f->f_av_desc, &atmp,
329
339
                                        &f->f_av_value, &vtmp, remap ) )
333
343
 
334
344
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
335
345
                        + ( sizeof("(=)") - 1 );
336
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
346
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
337
347
 
338
348
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",
339
349
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
350
360
 
351
361
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
352
362
                        + ( sizeof("(>=)") - 1 );
353
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
363
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
354
364
 
355
365
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",
356
366
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
367
377
 
368
378
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
369
379
                        + ( sizeof("(<=)") - 1 );
370
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
380
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
371
381
 
372
382
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",
373
383
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
384
394
 
385
395
                fstr->bv_len = atmp.bv_len + vtmp.bv_len
386
396
                        + ( sizeof("(~=)") - 1 );
387
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
397
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
388
398
 
389
399
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",
390
400
                        atmp.bv_val, vtmp.bv_len ? vtmp.bv_val : "" );
402
412
                /* cannot be a DN ... */
403
413
 
404
414
                fstr->bv_len = atmp.bv_len + ( STRLENOF( "(=*)" ) );
405
 
                fstr->bv_val = malloc( fstr->bv_len + 128 ); /* FIXME: why 128 ? */
 
415
                fstr->bv_val = ch_malloc( fstr->bv_len + 128 ); /* FIXME: why 128 ? */
406
416
 
407
417
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
408
418
                        atmp.bv_val );
462
472
                }
463
473
 
464
474
                fstr->bv_len = atmp.bv_len + ( STRLENOF( "(=*)" ) );
465
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
475
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
466
476
 
467
477
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
468
478
                        atmp.bv_val );
472
482
        case LDAP_FILTER_OR:
473
483
        case LDAP_FILTER_NOT:
474
484
                fstr->bv_len = STRLENOF( "(%)" );
475
 
                fstr->bv_val = malloc( fstr->bv_len + 128 );    /* FIXME: why 128? */
 
485
                fstr->bv_val = ch_malloc( fstr->bv_len + 128 ); /* FIXME: why 128? */
476
486
 
477
487
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%c)",
478
488
                        f->f_choice == LDAP_FILTER_AND ? '&' :
517
527
                        ( f->f_mr_dnattrs ? STRLENOF( ":dn" ) : 0 ) +
518
528
                        ( !BER_BVISEMPTY( &f->f_mr_rule_text ) ? f->f_mr_rule_text.bv_len + 1 : 0 ) +
519
529
                        vtmp.bv_len + ( STRLENOF( "(:=)" ) );
520
 
                fstr->bv_val = malloc( fstr->bv_len + 1 );
 
530
                fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
521
531
 
522
532
                snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
523
533
                        atmp.bv_val,
530
540
 
531
541
        case SLAPD_FILTER_COMPUTED:
532
542
                switch ( f->f_result ) {
533
 
                case LDAP_COMPARE_FALSE:
534
543
                /* FIXME: treat UNDEFINED as FALSE */
535
544
                case SLAPD_COMPARE_UNDEFINED:
536
545
computed:;
 
546
                        if ( META_BACK_TGT_NOUNDEFFILTER( dc->target ) ) {
 
547
                                return LDAP_COMPARE_FALSE;
 
548
                        }
 
549
                        /* fallthru */
 
550
 
 
551
                case LDAP_COMPARE_FALSE:
537
552
                        if ( META_BACK_TGT_T_F( dc->target ) ) {
538
553
                                tmp = &ber_bvtf_false;
539
554
                                break;