]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/search.c
Insert missing ')'...
[openldap] / libraries / libldap / search.c
index 191d346710778af55129c3e6229d24635b60f3d3..7657bd656701ccda267986ff80f331a92c22c64c 100644 (file)
@@ -1,4 +1,8 @@
 /*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*  Portions
  *  Copyright (c) 1990 Regents of the University of Michigan.
  *  All rights reserved.
  *
@@ -7,10 +11,6 @@
 
 #include "portable.h"
 
-#ifndef lint 
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -19,8 +19,6 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "lber.h"
-#include "ldap.h"
 #include "ldap-int.h"
 
 static char *find_right_paren LDAP_P(( char *s ));
@@ -114,6 +112,12 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
        }
 
        if ( base == NULL ) {
+               /* no base provided, use session default base */
+               base = ld->ld_options.ldo_defbase;
+       }
+
+       if ( base == NULL ) {
+               /* no session default base, use top */
            base = "";
        }
 
@@ -137,7 +141,7 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
                return( NULLBER );
        }
 
-       filter = strdup( filter );
+       filter = ldap_strdup( filter );
        err = put_filter( ber, filter );
        free( filter );
 
@@ -319,7 +323,7 @@ put_filter( BerElement *ber, char *str )
                                        return( -1 );
 
                                *next = '\0';
-                               tmp = strdup( str );
+                               tmp = ldap_strdup( str );
                                if ( gotescape ) {
                                        escape = 0;
                                        for ( s = d = tmp; *s; s++ ) {
@@ -361,7 +365,7 @@ put_filter( BerElement *ber, char *str )
                        Debug( LDAP_DEBUG_TRACE, "put_filter: default\n", 0, 0,
                            0 );
                        next = strchr( str, '\0' );
-                       tmp = strdup( str );
+                       tmp = ldap_strdup( str );
                        if ( strchr( tmp, '\\' ) != NULL ) {
                                escape = 0;
                                for ( s = d = tmp; *s; s++ ) {