Skip to content
Snippets Groups Projects
Commit 206b1aed authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Parse server controls on each response, and print them.

parent 0bb7d518
No related branches found
No related tags found
No related merge requests found
......@@ -288,6 +288,7 @@ static int docompare(
char *matcheddn;
char *text;
char **refs;
LDAPControl **ctrls = NULL;
if ( dont ) {
return LDAP_SUCCESS;
......@@ -320,7 +321,7 @@ static int docompare(
}
}
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 );
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, &ctrls, 1 );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: ldap_parse_result: %s (%d)\n",
......@@ -350,10 +351,6 @@ static int docompare(
}
}
ber_memfree( text );
ber_memfree( matcheddn );
ber_memvfree( (void **) refs );
/* if we were told to be quiet, use the return value. */
if ( !quiet ) {
if ( code == LDAP_COMPARE_TRUE ) {
......@@ -365,6 +362,15 @@ static int docompare(
}
}
if ( ctrls ) {
tool_print_ctrls( ld, ctrls );
ldap_controls_free( ctrls );
}
ber_memfree( text );
ber_memfree( matcheddn );
ber_memvfree( (void **) refs );
return( code );
}
......@@ -210,6 +210,7 @@ static int dodelete(
int id;
int rc, code;
char *matcheddn = NULL, *text = NULL, **refs = NULL;
LDAPControl **ctrls = NULL;
LDAPMessage *res;
if ( verbose ) {
......@@ -254,7 +255,7 @@ static int dodelete(
}
}
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 );
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, &ctrls, 1 );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: ldap_parse_result: %s (%d)\n",
......@@ -286,6 +287,11 @@ static int dodelete(
}
}
if (ctrls) {
tool_print_ctrls( ld, ctrls );
ldap_controls_free( ctrls );
}
ber_memfree( text );
ber_memfree( matcheddn );
ber_memvfree( (void **) refs );
......
......@@ -70,6 +70,7 @@ main( int argc, char *argv[] )
LDAP *ld = NULL;
char *matcheddn = NULL, *text = NULL, **refs = NULL;
LDAPControl **ctrls = NULL;
int id, code;
LDAPMessage *res;
......@@ -240,7 +241,7 @@ main( int argc, char *argv[] )
}
rc = ldap_parse_result( ld, res,
&code, &matcheddn, &text, &refs, NULL, 0 );
&code, &matcheddn, &text, &refs, &ctrls, 0 );
if ( rc == LDAP_SUCCESS ) {
rc = code;
}
......@@ -345,6 +346,11 @@ main( int argc, char *argv[] )
}
}
if (ctrls) {
tool_print_ctrls( ld, ctrls );
ldap_controls_free( ctrls );
}
ber_memfree( text );
ber_memfree( matcheddn );
ber_memvfree( (void **) refs );
......
......@@ -1296,7 +1296,7 @@ static int process_response(
if ( matched ) ldap_memfree( matched );
if ( text ) ber_memvfree( (void **)refs );
if ( ctrls != NULL ) {
if ( ctrls ) {
tool_print_ctrls( ld, ctrls );
ldap_controls_free( ctrls );
}
......
......@@ -241,6 +241,7 @@ static int domodrdn(
{
int rc, code, id;
char *matcheddn=NULL, *text=NULL, **refs=NULL;
LDAPControl **ctrls = NULL;
LDAPMessage *res;
if ( verbose ) {
......@@ -284,7 +285,7 @@ static int domodrdn(
}
}
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, NULL, 1 );
rc = ldap_parse_result( ld, res, &code, &matcheddn, &text, &refs, &ctrls, 1 );
if( rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: ldap_parse_result: %s (%d)\n",
......@@ -314,6 +315,11 @@ static int domodrdn(
}
}
if (ctrls) {
tool_print_ctrls( ld, ctrls );
ldap_controls_free( ctrls );
}
ber_memfree( text );
ber_memfree( matcheddn );
ber_memvfree( (void **) refs );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment