mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
check reponse tags in ldapmodify; other functions rely on client library, which might need further work. Also, remove or silence all deprecated API calls
This commit is contained in:
parent
c5cf54dddf
commit
81b28fe329
@ -49,6 +49,18 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if !LDAP_DEPRECATED
|
||||
/*
|
||||
* NOTE: we declare it here only because we want to keep supporting
|
||||
* (how long?) ancient, deprecated LDAP_AUTH_KRB* auth methods
|
||||
*/
|
||||
LDAP_F( int )
|
||||
ldap_bind LDAP_P(( /* deprecated */
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *who,
|
||||
LDAP_CONST char *passwd,
|
||||
int authmethod ));
|
||||
#endif
|
||||
|
||||
int authmethod = -1;
|
||||
char *binddn = NULL;
|
||||
@ -189,11 +201,11 @@ NULL
|
||||
}
|
||||
|
||||
void tool_perror(
|
||||
char *func,
|
||||
const char *func,
|
||||
int err,
|
||||
char *extra,
|
||||
char *matched,
|
||||
char *info,
|
||||
const char *extra,
|
||||
const char *matched,
|
||||
const char *info,
|
||||
char **refs )
|
||||
{
|
||||
fprintf( stderr, "%s: %s (%d)%s\n",
|
||||
@ -886,12 +898,13 @@ tool_conn_setup( int not, void (*private_setup)( LDAP * ) )
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
if ( use_tls &&
|
||||
( ldap_start_tls_s( ld, NULL, NULL ) != LDAP_SUCCESS ))
|
||||
{
|
||||
ldap_perror( ld, "ldap_start_tls" );
|
||||
if ( use_tls > 1 ) {
|
||||
exit( EXIT_FAILURE );
|
||||
if ( use_tls ) {
|
||||
rc = ldap_start_tls_s( ld, NULL, NULL );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
tool_perror( "ldap_start_tls", rc, NULL, NULL, NULL, NULL );
|
||||
if ( use_tls > 1 ) {
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -946,7 +959,8 @@ tool_bind( LDAP *ld )
|
||||
|
||||
lutil_sasl_freedefs( defaults );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_sasl_interactive_bind_s" );
|
||||
tool_perror( "ldap_sasl_interactive_bind_s",
|
||||
rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
#else
|
||||
@ -955,7 +969,7 @@ tool_bind( LDAP *ld )
|
||||
exit( EXIT_FAILURE );
|
||||
#endif
|
||||
} else {
|
||||
int msgid, err;
|
||||
int msgid, err, rc;
|
||||
LDAPMessage *result;
|
||||
LDAPControl **ctrls;
|
||||
char msgbuf[256];
|
||||
@ -967,19 +981,19 @@ tool_bind( LDAP *ld )
|
||||
|
||||
msgid = ldap_bind( ld, binddn, passwd.bv_val, authmethod );
|
||||
if ( msgid == -1 ) {
|
||||
ldap_perror( ld, "ldap_bind" );
|
||||
tool_perror( "ldap_bind", -1, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
if ( ldap_result( ld, msgid, 1, NULL, &result ) == -1 ) {
|
||||
ldap_perror( ld, "ldap_result" );
|
||||
tool_perror( "ldap_result", -1, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
if ( ldap_parse_result( ld, result, &err, &matched, &info, &refs,
|
||||
&ctrls, 1 ) != LDAP_SUCCESS )
|
||||
{
|
||||
ldap_perror( ld, "ldap_bind parse result" );
|
||||
rc = ldap_parse_result( ld, result, &err, &matched, &info, &refs,
|
||||
&ctrls, 1 );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
tool_perror( "ldap_bind parse result", rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -1263,7 +1277,7 @@ tool_check_abandon( LDAP *ld, int msgid )
|
||||
return -1;
|
||||
|
||||
case LDAP_REQ_ABANDON:
|
||||
rc = ldap_abandon( ld, msgid );
|
||||
rc = ldap_abandon_ext( ld, msgid, NULL, NULL );
|
||||
fprintf( stderr, "got interrupt, abandon got %d: %s\n",
|
||||
rc, ldap_err2string( rc ) );
|
||||
return -1;
|
||||
|
@ -83,11 +83,11 @@ void tool_destroy LDAP_P(( void ));
|
||||
void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
|
||||
int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
|
||||
void tool_perror LDAP_P((
|
||||
char *func,
|
||||
const char *func,
|
||||
int err,
|
||||
char *extra,
|
||||
char *matched,
|
||||
char *info,
|
||||
const char *extra,
|
||||
const char *matched,
|
||||
const char *info,
|
||||
char **refs ));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
@ -261,7 +261,7 @@ static int docompare(
|
||||
|
||||
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
|
||||
if ( rc < 0 ) {
|
||||
ldap_perror( ld, "ldapcompare: ldap_result" );
|
||||
tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ static int dodelete(
|
||||
|
||||
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
|
||||
if ( rc < 0 ) {
|
||||
ldap_perror( ld, "ldapdelete: ldap_result" );
|
||||
tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ static int deletechildren(
|
||||
rc = ldap_search_ext_s( ld, dn, LDAP_SCOPE_ONELEVEL, NULL, attrs, 1,
|
||||
NULL, NULL, NULL, -1, &res );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_search" );
|
||||
tool_perror( "ldap_search", rc, NULL, NULL, NULL, NULL );
|
||||
return( rc );
|
||||
}
|
||||
|
||||
@ -331,15 +331,15 @@ static int deletechildren(
|
||||
char *dn = ldap_get_dn( ld, e );
|
||||
|
||||
if( dn == NULL ) {
|
||||
ldap_perror( ld, "ldap_prune" );
|
||||
ldap_get_option( ld, LDAP_OPT_ERROR_NUMBER, &rc );
|
||||
tool_perror( "ldap_prune", rc, NULL, NULL, NULL, NULL );
|
||||
ber_memfree( dn );
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = deletechildren( ld, dn );
|
||||
if ( rc == -1 ) {
|
||||
ldap_perror( ld, "ldap_prune" );
|
||||
tool_perror( "ldap_prune", rc, NULL, NULL, NULL, NULL );
|
||||
ber_memfree( dn );
|
||||
return rc;
|
||||
}
|
||||
@ -348,9 +348,9 @@ static int deletechildren(
|
||||
printf( _("\tremoving %s\n"), dn );
|
||||
}
|
||||
|
||||
rc = ldap_delete_s( ld, dn );
|
||||
rc = ldap_delete_ext_s( ld, dn, NULL, NULL );
|
||||
if ( rc == -1 ) {
|
||||
ldap_perror( ld, "ldap_delete" );
|
||||
tool_perror( "ldap_delete", rc, NULL, NULL, NULL, NULL );
|
||||
ber_memfree( dn );
|
||||
return rc;
|
||||
|
||||
@ -390,7 +390,7 @@ static int deletechildren(
|
||||
rc = ldap_search_ext_s( ld, dn, LDAP_SCOPE_ONELEVEL, NULL, attrs, 1,
|
||||
ctrls, NULL, NULL, -1, &res_se );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_search" );
|
||||
tool_perror( "ldap_search", rc, NULL, NULL, NULL, NULL );
|
||||
return( rc );
|
||||
}
|
||||
ber_free( ber, 1 );
|
||||
@ -406,8 +406,8 @@ static int deletechildren(
|
||||
char *dn = ldap_get_dn( ld, e );
|
||||
|
||||
if( dn == NULL ) {
|
||||
ldap_perror( ld, "ldap_prune" );
|
||||
ldap_get_option( ld, LDAP_OPT_ERROR_NUMBER, &rc );
|
||||
tool_perror( "ldap_prune", rc, NULL, NULL, NULL, NULL );
|
||||
ber_memfree( dn );
|
||||
return rc;
|
||||
}
|
||||
@ -416,9 +416,9 @@ static int deletechildren(
|
||||
printf( _("\tremoving %s\n"), dn );
|
||||
}
|
||||
|
||||
rc = ldap_delete_s( ld, dn );
|
||||
rc = ldap_delete_ext_s( ld, dn, NULL, NULL );
|
||||
if ( rc == -1 ) {
|
||||
ldap_perror( ld, "ldap_delete" );
|
||||
tool_perror( "ldap_delete", rc, NULL, NULL, NULL, NULL );
|
||||
ber_memfree( dn );
|
||||
return rc;
|
||||
|
||||
|
@ -118,7 +118,7 @@ static int dorename LDAP_P((
|
||||
static int process_response(
|
||||
LDAP *ld,
|
||||
int msgid,
|
||||
const char *opstr,
|
||||
int res,
|
||||
const char *dn );
|
||||
static char *read_one_record LDAP_P(( FILE *fp ));
|
||||
|
||||
@ -303,7 +303,7 @@ main( int argc, char **argv )
|
||||
/* create transaction */
|
||||
rc = ldap_txn_create_s( ld, &txnCookiep, NULL, NULL );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_txn_create_s" );
|
||||
tool_perror( "ldap_txn_create_s", rc, NULL, NULL, NULL, NULL );
|
||||
if( txn > 2 ) return EXIT_FAILURE;
|
||||
txn = 0;
|
||||
}
|
||||
@ -398,7 +398,7 @@ main( int argc, char **argv )
|
||||
/* create transaction */
|
||||
rc = ldap_txn_end_s( ld, &txnCookie, !txnabort, NULL, NULL );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_txn_create_s" );
|
||||
tool_perror( "ldap_txn_create_s", rc, NULL, NULL, NULL, NULL );
|
||||
if( txn > 2 ) return EXIT_FAILURE;
|
||||
txn = 0;
|
||||
}
|
||||
@ -1024,14 +1024,14 @@ domodify(
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
/* print error message about failed update including DN */
|
||||
fprintf( stderr, _("%s: update failed: %s\n"), prog, dn );
|
||||
ldap_perror( ld, newentry ? "ldap_add" : "ldap_modify" );
|
||||
tool_perror( newentry ? "ldap_add" : "ldap_modify", rc, NULL, NULL, NULL, NULL );
|
||||
goto done;
|
||||
} else if ( verbose ) {
|
||||
printf( _("modify complete\n") );
|
||||
}
|
||||
|
||||
rc = process_response( ld, msgid,
|
||||
newentry ? "ldap_add" : "ldap_modify", dn );
|
||||
newentry ? LDAP_RES_ADD : LDAP_RES_MODIFY, dn );
|
||||
|
||||
} else {
|
||||
rc = LDAP_SUCCESS;
|
||||
@ -1056,13 +1056,13 @@ dodelete(
|
||||
rc = ldap_delete_ext( ld, dn, pctrls, NULL, &msgid );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
fprintf( stderr, _("%s: delete failed: %s\n"), prog, dn );
|
||||
ldap_perror( ld, "ldap_delete" );
|
||||
tool_perror( "ldap_delete", rc, NULL, NULL, NULL, NULL );
|
||||
goto done;
|
||||
} else if ( verbose ) {
|
||||
printf( _("delete complete") );
|
||||
}
|
||||
|
||||
rc = process_response( ld, msgid, "ldap_delete", dn );
|
||||
rc = process_response( ld, msgid, LDAP_RES_DELETE, dn );
|
||||
|
||||
} else {
|
||||
rc = LDAP_SUCCESS;
|
||||
@ -1095,13 +1095,13 @@ dorename(
|
||||
pctrls, NULL, &msgid );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
fprintf( stderr, _("%s: rename failed: %s\n"), prog, dn );
|
||||
ldap_perror( ld, "ldap_modrdn" );
|
||||
tool_perror( "ldap_modrdn", rc, NULL, NULL, NULL, NULL );
|
||||
goto done;
|
||||
} else {
|
||||
printf( _("modrdn completed\n") );
|
||||
}
|
||||
|
||||
rc = process_response( ld, msgid, "ldap_rename", dn );
|
||||
rc = process_response( ld, msgid, LDAP_RES_RENAME, dn );
|
||||
|
||||
} else {
|
||||
rc = LDAP_SUCCESS;
|
||||
@ -1112,14 +1112,33 @@ done:
|
||||
return( rc );
|
||||
}
|
||||
|
||||
static const char *
|
||||
res2str( int res ) {
|
||||
switch ( res ) {
|
||||
case LDAP_RES_ADD:
|
||||
return "ldap_add";
|
||||
case LDAP_RES_DELETE:
|
||||
return "ldap_delete";
|
||||
case LDAP_RES_MODIFY:
|
||||
return "ldap_modify";
|
||||
case LDAP_RES_MODRDN:
|
||||
return "ldap_modrdn";
|
||||
default:
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
return "ldap_unknown";
|
||||
}
|
||||
|
||||
static int process_response(
|
||||
LDAP *ld,
|
||||
int msgid,
|
||||
const char *opstr,
|
||||
int op,
|
||||
const char *dn )
|
||||
{
|
||||
LDAPMessage *res;
|
||||
int rc = LDAP_OTHER;
|
||||
int rc = LDAP_OTHER,
|
||||
msgtype;
|
||||
struct timeval tv = { 0, 0 };
|
||||
|
||||
for ( ; ; ) {
|
||||
@ -1147,9 +1166,31 @@ static int process_response(
|
||||
}
|
||||
}
|
||||
|
||||
if ( ldap_msgtype( res ) != LDAP_RES_INTERMEDIATE ) {
|
||||
rc = ldap_result2error( ld, res, 1 );
|
||||
if( rc != LDAP_SUCCESS ) ldap_perror( ld, opstr );
|
||||
msgtype = ldap_msgtype( res );
|
||||
if ( msgtype != LDAP_RES_INTERMEDIATE ) {
|
||||
int err;
|
||||
char *text = NULL, *matched = NULL, **refs = NULL;
|
||||
|
||||
rc = ldap_parse_result( ld, res, &err, &matched, &text, &refs, NULL, 1 );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = err;
|
||||
}
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
tool_perror( res2str( op ), rc, NULL, matched, text, refs );
|
||||
} else if ( msgtype != op ) {
|
||||
fprintf( stderr, "%s: msgtype: expected %d got %d\n",
|
||||
res2str( op ), op, msgtype );
|
||||
rc = LDAP_OTHER;
|
||||
}
|
||||
if ( text ) {
|
||||
ldap_memfree( text );
|
||||
}
|
||||
if ( matched ) {
|
||||
ldap_memfree( matched );
|
||||
}
|
||||
if ( text ) {
|
||||
ber_memvfree( (void **)refs );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ static int domodrdn(
|
||||
|
||||
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
|
||||
if ( rc < 0 ) {
|
||||
ldap_perror( ld, "ldapmodrdn: ldap_result" );
|
||||
tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ main( int argc, char *argv[] )
|
||||
ber_free( ber, 1 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_extended_operation" );
|
||||
tool_perror( "ldap_extended_operation", rc, NULL, NULL, NULL, NULL );
|
||||
rc = EXIT_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
@ -334,7 +334,7 @@ main( int argc, char *argv[] )
|
||||
|
||||
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
|
||||
if ( rc < 0 ) {
|
||||
ldap_perror( ld, "ldappasswd: ldap_result" );
|
||||
tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -346,14 +346,14 @@ main( int argc, char *argv[] )
|
||||
rc = ldap_parse_result( ld, res,
|
||||
&code, &matcheddn, &text, &refs, NULL, 0 );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_parse_result" );
|
||||
tool_perror( "ldap_parse_result", rc, NULL, NULL, NULL, NULL );
|
||||
rc = EXIT_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 1 );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_parse_extended_result" );
|
||||
tool_perror( "ldap_parse_extended_result", rc, NULL, NULL, NULL, NULL );
|
||||
rc = EXIT_FAILURE;
|
||||
goto done;
|
||||
}
|
||||
|
@ -71,6 +71,23 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if !LDAP_DEPRECATED
|
||||
/*
|
||||
* NOTE: we use this deprecated function only because
|
||||
* we want ldapsearch to provide some client-side sorting
|
||||
* capability.
|
||||
*/
|
||||
/* from ldap.h */
|
||||
typedef int (LDAP_SORT_AD_CMP_PROC) LDAP_P(( /* deprecated */
|
||||
LDAP_CONST char *left,
|
||||
LDAP_CONST char *right ));
|
||||
|
||||
LDAP_F( int ) /* deprecated */
|
||||
ldap_sort_entries LDAP_P(( LDAP *ld,
|
||||
LDAPMessage **chain,
|
||||
LDAP_CONST char *attr,
|
||||
LDAP_SORT_AD_CMP_PROC *cmp ));
|
||||
#endif
|
||||
|
||||
static int scope = LDAP_SCOPE_SUBTREE;
|
||||
static int deref = -1;
|
||||
@ -1234,7 +1251,7 @@ static int dosearch(
|
||||
|
||||
done:
|
||||
if ( rc == -1 ) {
|
||||
ldap_perror( ld, "ldap_result" );
|
||||
tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
|
||||
return( rc );
|
||||
}
|
||||
|
||||
@ -1295,7 +1312,7 @@ print_entry(
|
||||
rc = ldap_get_entry_controls( ld, entry, &ctrls );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
fprintf(stderr, _("print_entry: %d\n"), rc );
|
||||
ldap_perror( ld, "ldap_get_entry_controls" );
|
||||
tool_perror( "ldap_get_entry_controls", rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -1393,7 +1410,7 @@ static void print_reference(
|
||||
rc = ldap_parse_reference( ld, reference, &refs, &ctrls, 0 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror(ld, "ldap_parse_reference");
|
||||
tool_perror( "ldap_parse_reference", rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -1428,7 +1445,7 @@ static void print_extended(
|
||||
&retoid, &retdata, 0 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror(ld, "ldap_parse_extended_result");
|
||||
tool_perror( "ldap_parse_extended_result", rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -1466,7 +1483,7 @@ static void print_partial(
|
||||
&retoid, &retdata, &ctrls, 0 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror(ld, "ldap_parse_intermediate");
|
||||
tool_perror( "ldap_parse_intermediate", rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -1516,7 +1533,7 @@ static int print_result(
|
||||
&err, &matcheddn, &text, &refs, &ctrls, 0 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror(ld, "ldap_parse_result");
|
||||
tool_perror( "ldap_parse_result", rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
@ -1669,7 +1686,7 @@ parse_page_control(
|
||||
&err, NULL, NULL, NULL, &ctrl, 0 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror(ld, "ldap_parse_result");
|
||||
tool_perror( "ldap_parse_result", rc, NULL, NULL, NULL, NULL );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ main( int argc, char *argv[] )
|
||||
rc = ldap_whoami( ld, NULL, NULL, &id );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_extended_operation" );
|
||||
tool_perror( "ldap_extended_operation", rc, NULL, NULL, NULL, NULL );
|
||||
rc = EXIT_FAILURE;
|
||||
goto skip;
|
||||
}
|
||||
@ -178,7 +178,7 @@ main( int argc, char *argv[] )
|
||||
|
||||
rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
|
||||
if ( rc < 0 ) {
|
||||
ldap_perror( ld, "ldapwhoami: ldap_result" );
|
||||
tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -190,8 +190,12 @@ main( int argc, char *argv[] )
|
||||
rc = ldap_parse_result( ld, res,
|
||||
&code, &matcheddn, &text, &refs, NULL, 0 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_parse_result" );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = code;
|
||||
}
|
||||
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
tool_perror( "ldap_parse_result", rc, NULL, matcheddn, text, refs );
|
||||
rc = EXIT_FAILURE;
|
||||
goto skip;
|
||||
}
|
||||
@ -199,7 +203,7 @@ main( int argc, char *argv[] )
|
||||
rc = ldap_parse_extended_result( ld, res, &retoid, &retdata, 1 );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ldap_perror( ld, "ldap_parse_result" );
|
||||
tool_perror( "ldap_parse_extended_result", rc, NULL, NULL, NULL, NULL );
|
||||
rc = EXIT_FAILURE;
|
||||
goto skip;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user