]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/url.c
Fix typo in previous commit.
[openldap] / libraries / libldap / url.c
index 08b47efd6be668222fdd938388f11b4294d18fc2..d7af4a9c43f11e0a7391c62c5f8c6767fe135f5f 100644 (file)
@@ -1,4 +1,8 @@
 /*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*  Portions
  *  Copyright (c) 1996 Regents of the University of Michigan.
  *  All rights reserved.
  *
  *  We also tolerate URLs that look like: <ldapurl> and <URL:ldapurl>
  */
 
-#ifndef lint 
-static char copyright[] = "@(#) Copyright (c) 1996 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
 
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifdef MACOS
 #include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
 
-#if defined( DOS ) || defined( _WIN32 )
-#include <stdlib.h>
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS || _WIN32 */
-
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* !MACOS && !DOS && !_WIN32 */
-
-#include "lber.h"
-#include "ldap.h"
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include "ldap-int.h"
 
 
-#ifdef NEEDPROTOS
-static int skip_url_prefix( char **urlp, int *enclosedp );
-static void hex_unescape( char *s );
+/* local functions */
+static int skip_url_prefix LDAP_P(( char **urlp, int *enclosedp ));
+static void hex_unescape LDAP_P(( char *s ));
 static int unhex( char c );
-#else /* NEEDPROTOS */
-static int skip_url_prefix();
-static void hex_unescape();
-static int unhex();
-#endif /* NEEDPROTOS */
 
 
 int
@@ -262,9 +244,9 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
        int             err;
        LDAPURLDesc     *ludp;
        BerElement      *ber;
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
        LDAPServer      *srv = NULL;
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
        if ( ldap_url_parse( url, &ludp ) != 0 ) {
                ld->ld_errno = LDAP_PARAM_ERROR;
@@ -279,7 +261,7 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
        err = 0;
 
        if ( ludp->lud_host != NULL || ludp->lud_port != 0 ) {
-#ifdef LDAP_REFERRALS
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
                if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer )))
                    == NULL || ( srv->lsrv_host = strdup( ludp->lud_host ==
                    NULL ? ld->ld_defhost : ludp->lud_host )) == NULL ) {
@@ -290,27 +272,27 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
                        err = -1;
                } else {
                        if ( ludp->lud_port == 0 ) {
-                               srv->lsrv_port = LDAP_PORT;
+                               srv->lsrv_port = openldap_ldap_global_options.ldo_defport;
                        } else {
                                 srv->lsrv_port = ludp->lud_port;
                        }
                }
-#else /* LDAP_REFERRALS */
+#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
                ld->ld_errno = LDAP_LOCAL_ERROR;
                err = -1;
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
        }
 
        if ( err != 0 ) {
                ber_free( ber, 1 );
        } else {
-#ifdef LDAP_REFERRALS
-               err = send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
+               err = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
                    NULL, 1 );
-#else /* LDAP_REFERRALS */
-               err = send_initial_request( ld, LDAP_REQ_SEARCH,
+#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
+               err = ldap_send_initial_request( ld, LDAP_REQ_SEARCH,
                    ludp->lud_dn, ber );
-#endif /* LDAP_REFERRALS */
+#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
        }
 
        ldap_free_urldesc( ludp );