+/* $OpenLDAP$ */
/*
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
#include "portable.h"
#include <stdio.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
#include <ac/ctype.h>
#include <ac/socket.h>
#include "ldap-int.h"
-static char **explode_name( LDAP_CONST char *name, int notypes, int is_dn );
+static char **explode_name( const char *name, int notypes, int is_dn );
char *
ldap_get_dn( LDAP *ld, LDAPMessage *entry )
}
tmp = *entry->lm_ber; /* struct copy */
- if ( ber_scanf( &tmp, "{a", &dn ) == LBER_ERROR ) {
+ if ( ber_scanf( &tmp, "{a" /*}*/, &dn ) == LBER_ERROR ) {
ld->ld_errno = LDAP_DECODING_ERROR;
return( NULL );
}
Debug( LDAP_DEBUG_TRACE, "ldap_dn2ufn\n", 0, 0, 0 );
- if ( ldap_is_dns_dn( dn ) || ( p = strchr( dn, '=' )) == NULL )
- return( strdup( dn ) );
+ if( dn == NULL ) {
+ return NULL;
+ }
+
+ if ( ldap_is_dns_dn( dn ) ||
+ ( p = strchr( dn, '=' ) ) == NULL )
+ {
+ return( LDAP_STRDUP( dn ) );
+ }
+
- ufn = strdup( ++p );
+ ufn = LDAP_STRDUP( ++p );
#define INQUOTE 1
#define OUTQUOTE 2
int ncomps;
int maxcomps = 8;
- if ( (dn = strdup( dn_in )) == NULL ) {
+ if ( (dn = LDAP_STRDUP( dn_in )) == NULL ) {
return( NULL );
}
return NULL;
}
}
- rdns[ncomps++] = strdup( s );
+ rdns[ncomps++] = LDAP_STRDUP( s );
}
LDAP_FREE(dn);
}
static char **
-explode_name( LDAP_CONST char *name, int notypes, int is_dn )
+explode_name( const char *name, int notypes, int is_dn )
{
const char *p, *q;
char **parts = NULL;
int
ldap_is_dns_dn( LDAP_CONST char *dn )
{
- return( dn[ 0 ] != '\0' && strchr( dn, '=' ) == NULL &&
- strchr( dn, ',' ) == NULL );
+ return( dn[ 0 ] != '\0'
+ && strchr( dn, '=' ) == NULL
+ && strchr( dn, ',' ) == NULL
+ && strchr( dn, ';' ) == NULL );
}