]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/ufn.c
Commit preliminary fix for ldap.conf base usage.
[openldap] / libraries / libldap / ufn.c
index 5827ca12b716e2e2fc94f7b22944176a66e6b38c..d56dc5799dbead14e344b36c1ef50ecd45fc06e6 100644 (file)
@@ -5,53 +5,34 @@
  *  ufn.c
  */
 
+#include "portable.h"
+
 #ifndef lint 
 static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
 #endif
 
 #include <stdio.h>
-#include <string.h>
+#include <ac/string.h>
 #include <ctype.h>
-
-#ifdef MACOS
 #include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
-
-#include "lber.h"
-#include "ldap.h"
 
+#include <ac/socket.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
 #include "ldapconfig.h"
 
-#ifdef NEEDPROTOS
-typedef int (*cancelptype)( void *cancelparm );
-#else /* NEEDPROTOS */
-typedef int (*cancelptype)();
-#endif /* NEEDPROTOS */
+typedef int (*cancelptype) LDAP_P(( void *cancelparm ));
 
-#ifdef NEEDPROTOS
-static int ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, 
+/* local functions */
+static int ldap_ufn_search_ctx LDAP_P(( LDAP *ld, char **ufncomp, int ncomp, 
        char *prefix, char **attrs, int attrsonly, LDAPMessage **res, 
        cancelptype cancelproc, void *cancelparm, char *tag1, char *tag2,
-       char *tag3 );
-static LDAPMessage *ldap_msg_merge( LDAP *ld, LDAPMessage *a, LDAPMessage *b );
-static LDAPMessage *ldap_ufn_expand( LDAP *ld, cancelptype cancelproc,
+       char *tag3 ));
+static LDAPMessage *ldap_msg_merge LDAP_P(( LDAP *ld, LDAPMessage *a, LDAPMessage *b ));
+static LDAPMessage *ldap_ufn_expand LDAP_P(( LDAP *ld, cancelptype cancelproc,
        void *cancelparm, char **dns, char *filter, int scope,
-       char **attrs, int aonly, int *err );
-LDAPFiltDesc *ldap_ufn_setfilter( LDAP *ld, char *fname );
-#else /* NEEDPROTOS */
-static LDAPMessage *ldap_msg_merge();
-static LDAPMessage *ldap_ufn_expand();
-LDAPFiltDesc *ldap_ufn_setfilter();
-#endif /* NEEDPROTOS */
+       char **attrs, int aonly, int *err ));
 
 /*
  * ldap_ufn_search_ctx - do user friendly searching; provide cancel feature;
@@ -85,13 +66,12 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
        char **attrs, int attrsonly, LDAPMessage **res, cancelptype cancelproc,
        void *cancelparm, char *tag1, char *tag2, char *tag3 )
 {
-       char            *dn, *ftag;
-       char            **dns;
-       int             max, i, err, scope, phase, tries;
+       char            *dn, *ftag = NULL;
+       char            **dns = NULL;
+       int             max, i, err, scope = 0, phase, tries;
        LDAPFiltInfo    *fi;
        LDAPMessage     *tmpcand;
        LDAPMessage     *candidates;
-       LDAPMessage     *ldap_msg_merge(), *ldap_ufn_expand();
        static char     *objattrs[] = { "objectClass", NULL };
 
        /* 
@@ -148,7 +128,7 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
                                    * 2 )) == NULL ) {
                                        return( ld->ld_errno = LDAP_NO_MEMORY );
                                }
-                               dns[0] = strdup( prefix );
+                               dns[0] = ldap_strdup( prefix );
                                dns[1] = NULL;
                        } else {
                                dns = NULL;
@@ -242,7 +222,7 @@ ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly,
 {
        char    **ufncomp, **prefixcomp;
        char    *pbuf;
-       int     ncomp, pcomp, i, err;
+       int     ncomp, pcomp, i, err = 0;
 
        /* initialize the getfilter stuff if it's not already */
        if ( ld->ld_filtd == NULL && ldap_ufn_setfilter( ld, FILTERFILE )
@@ -492,7 +472,7 @@ ldap_ufn_setprefix( LDAP *ld, char *prefix )
        if ( ld->ld_ufnprefix != NULL )
                free( ld->ld_ufnprefix );
 
-       ld->ld_ufnprefix = strdup( prefix );
+       ld->ld_ufnprefix = ldap_strdup( prefix );
 }
 
 int