#include "portable.h"
#include <stdio.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
#include <ac/ctype.h>
#include <ac/socket.h>
const char *url_tmp;
char *url;
- Debug( LDAP_DEBUG_TRACE, "ldap_url_parse(%s)\n", url, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "ldap_url_parse(%s)\n", url_in, 0, 0 );
*ludpp = NULL; /* pessimistic */
}
/* make working copy of the remainder of the URL */
- if (( url = strdup( url_tmp )) == NULL ) {
+ if (( url = LDAP_STRDUP( url_tmp )) == NULL ) {
return( LDAP_URL_ERR_MEM );
}
/* allocate return struct */
- if (( ludp = (LDAPURLDesc *)calloc( 1, sizeof( LDAPURLDesc )))
+ if (( ludp = (LDAPURLDesc *)LDAP_CALLOC( 1, sizeof( LDAPURLDesc )))
== NULLLDAPURLDESC )
{
- free( url );
+ LDAP_FREE( url );
return( LDAP_URL_ERR_MEM );
}
}
}
- if (( ludp->lud_attrs = (char **)calloc( nattrs + 1,
+ if (( ludp->lud_attrs = (char **)LDAP_CALLOC( nattrs + 1,
sizeof( char * ))) == NULL ) {
ldap_free_urldesc( ludp );
return( LDAP_URL_ERR_MEM );
{
if ( ludp != NULLLDAPURLDESC ) {
if ( ludp->lud_string != NULL ) {
- free( ludp->lud_string );
+ LDAP_FREE( ludp->lud_string );
}
if ( ludp->lud_attrs != NULL ) {
- free( ludp->lud_attrs );
+ LDAP_FREE( ludp->lud_attrs );
}
- free( ludp );
+ LDAP_FREE( ludp );
}
}
int err;
LDAPURLDesc *ludp;
BerElement *ber;
-#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
LDAPServer *srv = NULL;
-#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
if ( ldap_url_parse( url, &ludp ) != 0 ) {
ld->ld_errno = LDAP_PARAM_ERROR;
ludp->lud_filter, ludp->lud_attrs, attrsonly, NULL, NULL,
-1, -1 );
- if ( ber == NULLBER ) {
+ if ( ber == NULL ) {
return( -1 );
}
err = 0;
if ( ludp->lud_host != NULL || ludp->lud_port != 0 ) {
-#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
- if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer )))
- == NULL || ( srv->lsrv_host = strdup( ludp->lud_host ==
+ if (( srv = (LDAPServer *)LDAP_CALLOC( 1, sizeof( LDAPServer )))
+ == NULL || ( srv->lsrv_host = LDAP_STRDUP( ludp->lud_host ==
NULL ? ld->ld_defhost : ludp->lud_host )) == NULL ) {
if ( srv != NULL ) {
- free( srv );
+ LDAP_FREE( srv );
}
ld->ld_errno = LDAP_NO_MEMORY;
err = -1;
} else {
if ( ludp->lud_port == 0 ) {
- srv->lsrv_port = openldap_ldap_global_options.ldo_defport;
+ srv->lsrv_port = ldap_int_global_options.ldo_defport;
} else {
srv->lsrv_port = ludp->lud_port;
}
}
-#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
- ld->ld_errno = LDAP_LOCAL_ERROR;
- err = -1;
-#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
}
if ( err != 0 ) {
ber_free( ber, 1 );
} else {
-#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
err = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
NULL, 1 );
-#else /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
- err = ldap_send_initial_request( ld, LDAP_REQ_SEARCH,
- ludp->lud_dn, ber );
-#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
}
ldap_free_urldesc( ludp );