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

« back to all changes in this revision

Viewing changes to libraries/libldap/search.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
 
/* $OpenLDAP: pkg/ldap/libraries/libldap/search.c,v 1.76.2.5 2008/02/11 23:26:41 kurt Exp $ */
 
1
/* $OpenLDAP: pkg/ldap/libraries/libldap/search.c,v 1.76.2.8 2009/02/02 22:53:14 quanah Exp $ */
2
2
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3
3
 *
4
 
 * Copyright 1998-2008 The OpenLDAP Foundation.
 
4
 * Copyright 1998-2009 The OpenLDAP Foundation.
5
5
 * All rights reserved.
6
6
 *
7
7
 * Redistribution and use in source and binary forms, with or without
66
66
        int sizelimit,
67
67
        int *msgidp )
68
68
{
 
69
        return ldap_pvt_search( ld, base, scope, filter, attrs,
 
70
                attrsonly, sctrls, cctrls, timeout, sizelimit, -1, msgidp );
 
71
}
 
72
 
 
73
int
 
74
ldap_pvt_search(
 
75
        LDAP *ld,
 
76
        LDAP_CONST char *base,
 
77
        int scope,
 
78
        LDAP_CONST char *filter,
 
79
        char **attrs,
 
80
        int attrsonly,
 
81
        LDAPControl **sctrls,
 
82
        LDAPControl **cctrls,
 
83
        struct timeval *timeout,
 
84
        int sizelimit,
 
85
        int deref,
 
86
        int *msgidp )
 
87
{
69
88
        int rc;
70
89
        BerElement      *ber;
71
90
        int timelimit;
98
117
        }
99
118
 
100
119
        ber = ldap_build_search_req( ld, base, scope, filter, attrs,
101
 
            attrsonly, sctrls, cctrls, timelimit, sizelimit, &id ); 
 
120
            attrsonly, sctrls, cctrls, timelimit, sizelimit, deref, &id ); 
102
121
 
103
122
        if ( ber == NULL ) {
104
123
                return ld->ld_errno;
128
147
        int sizelimit,
129
148
        LDAPMessage **res )
130
149
{
 
150
        return ldap_pvt_search_s( ld, base, scope, filter, attrs,
 
151
                attrsonly, sctrls, cctrls, timeout, sizelimit, -1, res );
 
152
}
 
153
 
 
154
int
 
155
ldap_pvt_search_s(
 
156
        LDAP *ld,
 
157
        LDAP_CONST char *base,
 
158
        int scope,
 
159
        LDAP_CONST char *filter,
 
160
        char **attrs,
 
161
        int attrsonly,
 
162
        LDAPControl **sctrls,
 
163
        LDAPControl **cctrls,
 
164
        struct timeval *timeout,
 
165
        int sizelimit,
 
166
        int deref,
 
167
        LDAPMessage **res )
 
168
{
131
169
        int rc;
132
170
        int     msgid;
133
171
 
134
 
        rc = ldap_search_ext( ld, base, scope, filter, attrs, attrsonly,
135
 
                sctrls, cctrls, timeout, sizelimit, &msgid );
 
172
        rc = ldap_pvt_search( ld, base, scope, filter, attrs, attrsonly,
 
173
                sctrls, cctrls, timeout, sizelimit, deref, &msgid );
136
174
 
137
175
        if ( rc != LDAP_SUCCESS ) {
138
176
                return( rc );
188
226
        assert( LDAP_VALID( ld ) );
189
227
 
190
228
        ber = ldap_build_search_req( ld, base, scope, filter, attrs,
191
 
            attrsonly, NULL, NULL, -1, -1, &id ); 
 
229
            attrsonly, NULL, NULL, -1, -1, -1, &id ); 
192
230
 
193
231
        if ( ber == NULL ) {
194
232
                return( -1 );
212
250
        LDAPControl **cctrls,
213
251
        ber_int_t timelimit,
214
252
        ber_int_t sizelimit,
 
253
        ber_int_t deref,
215
254
        ber_int_t *idp)
216
255
{
217
256
        BerElement      *ber;
267
306
            char *dn = ld->ld_options.ldo_cldapdn;
268
307
            if (!dn) dn = "";
269
308
            err = ber_printf( ber, "{ist{seeiib", *idp, dn,
270
 
                LDAP_REQ_SEARCH, base, (ber_int_t) scope, ld->ld_deref,
 
309
                LDAP_REQ_SEARCH, base, (ber_int_t) scope,
 
310
                (deref < 0) ? ld->ld_deref : deref,
271
311
                (sizelimit < 0) ? ld->ld_sizelimit : sizelimit,
272
312
                (timelimit < 0) ? ld->ld_timelimit : timelimit,
273
313
                attrsonly );
301
341
 
302
342
#ifdef LDAP_DEBUG
303
343
        if ( ldap_debug & LDAP_DEBUG_ARGS ) {
304
 
                char    buf[ BUFSIZ ] = { ' ', '*', '\0' };
 
344
                char    buf[ BUFSIZ ], *ptr = " *";
305
345
 
306
346
                if ( attrs != NULL ) {
307
 
                        char    *ptr;
308
 
                        int     i;
 
347
                        int     i, len, rest = sizeof( buf );
309
348
 
310
 
                        for ( ptr = buf, i = 0;
311
 
                                attrs[ i ] != NULL && ptr < &buf[ sizeof( buf ) ];
312
 
                                i++ )
313
 
                        {
314
 
                                ptr += snprintf( ptr, sizeof( buf ) - ( ptr - buf ),
315
 
                                        " %s", attrs[ i ] );
 
349
                        for ( i = 0; attrs[ i ] != NULL && rest > 0; i++ ) {
 
350
                                ptr = &buf[ sizeof( buf ) - rest ];
 
351
                                len = snprintf( ptr, rest, " %s", attrs[ i ] );
 
352
                                rest -= (len >= 0 ? len : (int) sizeof( buf ));
316
353
                        }
317
354
 
318
 
                        if ( ptr >= &buf[ sizeof( buf ) ] ) {
 
355
                        if ( rest <= 0 ) {
319
356
                                AC_MEMCPY( &buf[ sizeof( buf ) - STRLENOF( "...(truncated)" ) - 1 ],
320
357
                                        "...(truncated)", STRLENOF( "...(truncated)" ) + 1 );
321
358
                        } 
 
359
                        ptr = buf;
322
360
                }
323
361
 
324
 
                Debug( LDAP_DEBUG_ARGS, "ldap_build_search_req ATTRS:%s\n", buf, 0, 0 );
 
362
                Debug( LDAP_DEBUG_ARGS, "ldap_build_search_req ATTRS:%s\n", ptr, 0,0 );
325
363
        }
326
364
#endif /* LDAP_DEBUG */
327
365