free.c disptmpl.c srchpref.c dsparse.c tmplout.c sort.c \
getdn.c getentry.c getattr.c getvalues.c addentry.c \
request.c getdxbyname.c os-ip.c url.c charset.c \
- init.c options.c
+ init.c options.c strdup.c
OBJS = bind.o open.o result.o error.o compare.o search.o \
modify.o add.o modrdn.o delete.o abandon.o ufn.o cache.o \
getfilter.o sbind.o kbind.o unbind.o friendly.o cldap.o \
free.o disptmpl.o srchpref.o dsparse.o tmplout.o sort.o \
getdn.o getentry.o getattr.o getvalues.o addentry.o \
request.o getdxbyname.o os-ip.o url.o charset.o \
- init.o options.o
+ init.o options.o strdup.o
LIBS = -L$(LDAP_LIBDIR) -lldap -llber $(AC_LIBS)
LIBLBER = ../liblber/liblber.a
}
if ( ld->ld_host == NULL ) {
- ld->ld_host = strdup( host );
+ ld->ld_host = ldap_strdup( host );
}
}
for ( i = 0; !memerr && includeattrs[ i ] != NULL; ++i ) {
if (( attrs = (char **)realloc( attrs, ( attrcnt + 2 ) *
sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] =
- strdup( includeattrs[ i ] )) == NULL ) {
+ ldap_strdup( includeattrs[ i ] )) == NULL ) {
memerr = 1;
} else {
attrs[ attrcnt ] = NULL;
if ( ticolp->ti_attrname != NULL ) {
if (( attrs = (char **)realloc( attrs, ( attrcnt + 2 ) *
sizeof( char * ))) == NULL || ( attrs[ attrcnt++ ] =
- strdup( ticolp->ti_attrname )) == NULL ) {
+ ldap_strdup( ticolp->ti_attrname )) == NULL ) {
memerr = 1;
} else {
attrs[ attrcnt ] = NULL;
return( NULL );
}
- return( strdup( tokstart ));
+ return( ldap_strdup( tokstart ));
}
}
}
- (*map)[i].f_unfriendly = strdup( buf );
- (*map)[i].f_friendly = strdup( s );
+ (*map)[i].f_unfriendly = ldap_strdup( buf );
+ (*map)[i].f_friendly = ldap_strdup( s );
i++;
}
Debug( LDAP_DEBUG_TRACE, "ldap_dn2ufn\n", 0, 0, 0 );
if ( ldap_is_dns_dn( dn ) || ( p = strchr( dn, '=' )) == NULL )
- return( strdup( dn ));
+ return( ldap_strdup( dn ) );
- ufn = strdup( ++p );
+ ufn = ldap_strdup( ++p );
#define INQUOTE 1
#define OUTQUOTE 2
return( NULL );
}
}
- rdns[ncomps++] = strdup( s );
+ rdns[ncomps++] = ldap_strdup( s );
}
rdns[ncomps] = NULL;
* punt: return list conisting of the original domain name only
*/
if (( dxs = (char **)malloc( 2 * sizeof( char * ))) == NULL ||
- ( dxs[ 0 ] = strdup( domain )) == NULL ) {
+ ( dxs[ 0 ] = ldap_strdup( domain )) == NULL ) {
if ( dxs != NULL ) {
free( dxs );
}
ldap_getfilter_free( lfdp );
return( NULL );
}
- nextflp->lfl_tag = strdup( tag );
+ nextflp->lfl_tag = ldap_strdup( tag );
nextflp->lfl_pattern = tok[ 0 ];
if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
#ifdef LDAP_LIBUI
if ( lfdp->lfd_filtprefix != NULL ) {
free( lfdp->lfd_filtprefix );
}
- lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : strdup( prefix );
+ lfdp->lfd_filtprefix = ( prefix == NULL ) ? NULL : ldap_strdup( prefix );
if ( lfdp->lfd_filtsuffix != NULL ) {
free( lfdp->lfd_filtsuffix );
}
- lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : strdup( suffix );
+ lfdp->lfd_filtsuffix = ( suffix == NULL ) ? NULL : ldap_strdup( suffix );
}
return( NULL );
}
- if (( lfdp->lfd_curvalcopy = strdup( value )) == NULL ) {
+ if (( lfdp->lfd_curvalcopy = ldap_strdup( value )) == NULL ) {
return( NULL );
}
case ATTR_STRING:
if (* (char**) p != NULL) free(* (char**) p);
- * (char**) p = strdup(opt);
+ * (char**) p = ldap_strdup(opt);
break;
}
}
if (*value == '\0') {
* (char**) p = NULL;
} else {
- * (char**) p = strdup(value);
+ * (char**) p = ldap_strdup(value);
}
break;
}
gopts.ldo_timelimit = LDAP_NO_LIMIT;
gopts.ldo_sizelimit = LDAP_NO_LIMIT;
- gopts.ldo_defhost = strdup("localhost");
+ gopts.ldo_defhost = ldap_strdup("localhost");
gopts.ldo_defport = LDAP_PORT;
gopts.ldo_refhoplimit = LDAP_DEFAULT_REFHOPLIMIT;
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
};
-
/*
* in init.c
*/
BerElement *ldap_build_search_req( LDAP *ld, char *base, int scope,
char *filter, char **attrs, int attrsonly );
+/*
+ * in strdup.c
+ */
+#ifdef HAVE_STRDUP
+#define ldap_strdup(s) strdup(s)
+extern char *strdup();
+#else
+extern char *ldap_strdup LDAP_P(( const char * ));
+#endif
/*
* in unbind.c
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
if (( srv = (LDAPServer *)calloc( 1, sizeof( LDAPServer ))) ==
NULL || ( ld->ld_defhost != NULL && ( srv->lsrv_host =
- strdup( ld->ld_defhost )) == NULL )) {
+ ldap_strdup( ld->ld_defhost )) == NULL )) {
ldap_ld_free( ld, 0 );
return( NULL );
}
ld->ld_options.ldo_defhost = NULL;
if ( defhost != NULL ) {
- ld->ld_options.ldo_defhost = strdup( defhost );
+ ld->ld_options.ldo_defhost = ldap_strdup( defhost );
} else {
- ld->ld_options.ldo_defhost = strdup(
+ ld->ld_options.ldo_defhost = ldap_strdup(
openldap_ldap_global_options.ldo_defhost);
}
info->ldapai_extensions = malloc(sizeof(features));
for(i=0; features[i] != NULL; i++) {
- info->ldapai_extensions[i] = strdup(features[i]);
+ info->ldapai_extensions[i] =
+ ldap_strdup(features[i]);
}
info->ldapai_extensions[i] = NULL;
}
- info->ldapai_vendor_name = strdup(LDAP_VENDOR_NAME);
+ info->ldapai_vendor_name = ldap_strdup(LDAP_VENDOR_NAME);
info->ldapai_vendor_version = LDAP_VENDOR_VERSION;
return 0;
* we do
*/
- * (char **) outvalue = strdup(lo->ldo_defhost);
+ * (char **) outvalue = ldap_strdup(lo->ldo_defhost);
return 0;
case LDAP_OPT_ERROR_NUMBER:
if( ld->ld_error == NULL ) {
* (char **) outvalue = NULL;
} else {
- * (char **) outvalue = strdup(ld->ld_error);
+ * (char **) outvalue = ldap_strdup(ld->ld_error);
}
break;
}
if(host != NULL) {
- lo->ldo_defhost = strdup(host);
+ lo->ldo_defhost = ldap_strdup(host);
return 0;
}
* must want global default returned
* to initial condition.
*/
- lo->ldo_defhost = strdup("localhost");
+ lo->ldo_defhost = ldap_strdup("localhost");
} else {
/*
* must want the session default
* updated to the current global default
*/
- lo->ldo_defhost = strdup(
+ lo->ldo_defhost = ldap_strdup(
openldap_ldap_global_options.ldo_defhost);
}
} return 0;
if (( hp = gethostbyaddr( (char *) &sin.sin_addr,
sizeof( sin.sin_addr ), AF_INET )) != NULL ) {
if ( hp->h_name != NULL ) {
- return( strdup( hp->h_name ));
+ return( ldap_strdup( hp->h_name ));
}
}
return( -1 );
}
- if (( srv->lsrv_host = strdup( tmpref )) == NULL ) {
+ if (( srv->lsrv_host = ldap_strdup( tmpref )) == NULL ) {
free( (char *)srv );
ber_free( ber, 1 );
ld->ld_errno = LDAP_NO_MEMORY;
prevsrv = srv;
/* copy in info. */
- if (( srv->lsrv_host = strdup( host )) == NULL ||
+ if (( srv->lsrv_host = ldap_strdup( host )) == NULL ||
( server_dn != NULL && ( srv->lsrv_dn =
- strdup( server_dn )) == NULL )) {
+ ldap_strdup( server_dn )) == NULL )) {
free_servers( srvlist );
srvlist = NULL;
break; /* exit loop & return */
return( NULLBER );
}
- filter = strdup( filter );
+ filter = ldap_strdup( filter );
err = put_filter( ber, filter );
free( filter );
return( -1 );
*next = '\0';
- tmp = strdup( str );
+ tmp = ldap_strdup( str );
if ( gotescape ) {
escape = 0;
for ( s = d = tmp; *s; s++ ) {
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++ ) {
result = (char **) realloc( result,
sizeof(char *) * (num + 1) );
- result[num++] = (char *) strdup( buf );
+ result[num++] = (char *) ldap_strdup( buf );
}
if ( result == (char **) 0 )
return( NULL );
getline( buf, sizeof(buf), stdin, prompt2 );
if ( buf[0] == '\0' )
break;
- tmp.mod_type = strdup( buf );
+ tmp.mod_type = ldap_strdup( buf );
tmp.mod_values = get_list( prompt3 );
break;
case 't': /* copy ber's to given file */
- copyfname = strdup( optarg );
+ copyfname = ldap_strdup( optarg );
copyoptions = LBER_TO_FILE;
break;
case 'T': /* only output ber's to given file */
- copyfname = strdup( optarg );
+ copyfname = ldap_strdup( optarg );
copyoptions = (LBER_TO_FILE | LBER_TO_FILE_ONLY);
break;
* 2 )) == NULL ) {
return( ld->ld_errno = LDAP_NO_MEMORY );
}
- dns[0] = strdup( prefix );
+ dns[0] = ldap_strdup( prefix );
dns[1] = NULL;
} else {
dns = NULL;
if ( ld->ld_ufnprefix != NULL )
free( ld->ld_ufnprefix );
- ld->ld_ufnprefix = strdup( prefix );
+ ld->ld_ufnprefix = ldap_strdup( prefix );
}
int
}
/* make working copy of the remainder of the URL */
- if (( url = strdup( url )) == NULL ) {
+ if (( url = ldap_strdup( url )) == NULL ) {
ldap_free_urldesc( ludp );
return( LDAP_URL_ERR_MEM );
}
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 ==
+ == NULL || ( srv->lsrv_host = ldap_strdup( ludp->lud_host ==
NULL ? ld->ld_defhost : ludp->lud_host )) == NULL ) {
if ( srv != NULL ) {
free( srv );