+/* $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 )
+ if( dn == NULL ) {
+ return NULL;
+ }
+
+ if ( ldap_is_dns_dn( dn ) ||
+ ( p = strchr( dn, '=' ) ) == NULL )
+ {
return( LDAP_STRDUP( dn ) );
+ }
+
ufn = LDAP_STRDUP( ++p );
}
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 );
}