From 6baeab011ea62bf53d0e06ffa7a17f16226d9a71 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sat, 7 Jan 2006 16:52:33 +0000 Subject: [PATCH] paged results may not be the only control response --- clients/tools/ldapsearch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index c75b22dfcd..b959d31668 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -1568,7 +1568,7 @@ parse_page_control( rc = ldap_parse_result( ld, result, &err, NULL, NULL, NULL, &ctrl, 0 ); - if( rc != LDAP_SUCCESS ) { + if ( rc != LDAP_SUCCESS ) { tool_perror( "ldap_parse_result", rc, NULL, NULL, NULL, NULL ); exit( EXIT_FAILURE ); } @@ -1577,7 +1577,12 @@ parse_page_control( fprintf( stderr, "%s (%d)\n", ldap_err2string(err), err ); } - if( ctrl ) { + if ( ctrl ) { + /* There might be others, e.g. ppolicy... */ + ctrlp = ldap_find_control( LDAP_CONTROL_PAGEDRESULTS, ctrl ); + } + + if ( ctrlp ) { /* Parse the control value * searchResult ::= SEQUENCE { * size INTEGER (0..maxInt), -- 2.39.5