mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Some minor bugs for dntest ""
This commit is contained in:
parent
a2c6a98427
commit
450e0d6803
@ -120,6 +120,7 @@ main( int argc, char *argv[] )
|
||||
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
int i;
|
||||
if( dn ) {
|
||||
for ( i = 0; dn[i]; i++ ) {
|
||||
LDAPRDN *rdn = dn[ i ][ 0 ];
|
||||
char *rstr;
|
||||
@ -132,10 +133,14 @@ main( int argc, char *argv[] )
|
||||
fprintf( stdout, "\tldap_rdn2str() = \"%s\"\n", rstr );
|
||||
ldap_memfree( rstr );
|
||||
}
|
||||
} else {
|
||||
fprintf( stdout, "\tempty DN\n" );
|
||||
}
|
||||
}
|
||||
|
||||
if ( rc == LDAP_SUCCESS &&
|
||||
ldap_dn2str( dn, &str, flags[ f2 ] ) == LDAP_SUCCESS ) {
|
||||
ldap_dn2str( dn, &str, flags[ f2 ] ) == LDAP_SUCCESS )
|
||||
{
|
||||
char **values, *tmp, *tmp2;
|
||||
int n;
|
||||
|
||||
@ -216,7 +221,13 @@ main( int argc, char *argv[] )
|
||||
str, str2,
|
||||
strcmp( str, str2 ) == 0 ? "yes" : "no" );
|
||||
|
||||
for ( iRDN = 0; dn[ iRDN ] && dn2[ iRDN ]; iRDN++ ) {
|
||||
if(( dn != NULL && dn2 == NULL )
|
||||
|| ( dn != NULL && dn2 == NULL ))
|
||||
{
|
||||
fprintf( stdout, "mismatch\n" );
|
||||
} else if (( dn != NULL ) && (dn2 != NULL))
|
||||
for ( iRDN = 0; dn[ iRDN ] && dn2[ iRDN ]; iRDN++ )
|
||||
{
|
||||
LDAPRDN *r = dn[ iRDN ][ 0 ];
|
||||
LDAPRDN *r2 = dn2[ iRDN ][ 0 ];
|
||||
int iAVA;
|
||||
@ -226,12 +237,14 @@ main( int argc, char *argv[] )
|
||||
LDAPAVA *a2 = r2[ iAVA ][ 0 ];
|
||||
|
||||
if ( a->la_attr->bv_len != a2->la_attr->bv_len
|
||||
|| memcmp( a->la_attr->bv_val, a2->la_attr->bv_val, a->la_attr->bv_len )
|
||||
|| memcmp( a->la_attr->bv_val, a2->la_attr->bv_val,
|
||||
a->la_attr->bv_len )
|
||||
|| a->la_flags != a2->la_flags
|
||||
|| a->la_value->bv_len != a2->la_value->bv_len
|
||||
|| memcmp( a->la_value->bv_val, a2->la_value->bv_val, a->la_value->bv_len ) ) {
|
||||
|| memcmp( a->la_value->bv_val, a2->la_value->bv_val,
|
||||
a->la_value->bv_len ) )
|
||||
{
|
||||
fprintf( stdout, "mismatch\n" );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,15 @@ ldap_explode_dn( LDAP_CONST char *dn, int notypes )
|
||||
|
||||
if ( ldap_str2dn( dn, &tmpDN, LDAP_DN_FORMAT_LDAP )
|
||||
!= LDAP_SUCCESS ) {
|
||||
return( NULL );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( tmpDN == NULL ) {
|
||||
values = LDAP_MALLOC( sizeof( char * ) );
|
||||
if( values == NULL ) return NULL;
|
||||
|
||||
values[0] = NULL;
|
||||
return values;
|
||||
}
|
||||
|
||||
for ( iRDN = 0; tmpDN[ iRDN ]; iRDN++ ) {
|
||||
@ -149,18 +157,18 @@ ldap_explode_dn( LDAP_CONST char *dn, int notypes )
|
||||
|
||||
ldap_rdn2str( tmpDN[ iRDN ][ 0 ], &str, flag );
|
||||
|
||||
v = LDAP_REALLOC( values, sizeof( char * ) * ( 2 + iRDN ) );
|
||||
v = LDAP_REALLOC( values, sizeof( char * ) * ( iRDN + 1 ) );
|
||||
if ( v == NULL ) {
|
||||
LBER_VFREE( values );
|
||||
ldap_dnfree( tmpDN );
|
||||
return( NULL );
|
||||
return NULL;
|
||||
}
|
||||
values = v;
|
||||
values[ iRDN ] = str;
|
||||
}
|
||||
values[ iRDN ] = NULL;
|
||||
|
||||
return( values );
|
||||
values[ iRDN ] = NULL;
|
||||
return values;
|
||||
}
|
||||
|
||||
char **
|
||||
|
Loading…
Reference in New Issue
Block a user