From fe86a81e251bda73f04841f765b2a93ac0354396 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 9 Jun 2002 06:12:24 +0000 Subject: [PATCH] VLV clean --- clients/tools/ldapsearch.c | 17 +++++++++-------- doc/devel/todo | 1 - include/ldap.h | 6 +++++- libraries/libldap/filter.c | 14 +++++++------- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 868ac0697f..1ab31acdaa 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -899,20 +899,21 @@ main( int argc, char **argv ) c2.ldctl_oid = LDAP_CONTROL_VALUESRETURNFILTER; c2.ldctl_iscritical = valuesReturnFilter > 1; - if (( ber = ber_alloc_t(LBER_USE_DER)) == NULL ) - exit( EXIT_FAILURE ); + if (( ber = ber_alloc_t(LBER_USE_DER)) == NULL ) { + return EXIT_FAILURE; + } - if ( err = put_vrFilter(ber, vrFilter)==-1 ) { + if ( err = ldap_put_vrFilter(ber, vrFilter)==-1 ) { ber_free( ber, 1 ); fprintf( stderr, "Bad ValuesReturnFilter: %s\n", vrFilter ); - exit( EXIT_FAILURE ); + return EXIT_FAILURE; } - if ( ber_flatten( ber, &bvalp ) == LBER_ERROR ) - return LDAP_NO_MEMORY; + if ( ber_flatten( ber, &bvalp ) == LBER_ERROR ) { + return EXIT_FAILURE; + } c2.ldctl_value=(*bvalp); - } err = ldap_set_option( ld, LDAP_OPT_SERVER_CONTROLS, ctrls ); @@ -925,7 +926,7 @@ main( int argc, char **argv ) (c1.ldctl_iscritical || c2.ldctl_iscritical) ? "critical " : "" ); if( c1.ldctl_iscritical && c2.ldctl_iscritical ) { - exit( EXIT_FAILURE ); + return EXIT_FAILURE; } } } diff --git a/doc/devel/todo b/doc/devel/todo index a051b7b0ae..2c60ebf1c0 100644 --- a/doc/devel/todo +++ b/doc/devel/todo @@ -48,7 +48,6 @@ Update to latest autoconf and friends Small projects -------------- Populate matchingRuleUse attribute in the subschema -Implement -E/-e extensions options Implement -V version options Implement Proxy Authorization Control extension Complete Simple Paged Results Control diff --git a/include/ldap.h b/include/ldap.h index e60b453d5d..7430690d2a 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -1468,6 +1468,10 @@ LDAP_F( LDAPFiltInfo * ) ldap_getnextfilter LDAP_P(( /* deprecated */ LDAPFiltDesc *lfdp )); +LDAP_F( int ) +ldap_put_vrFilter LDAP_P(( + BerElement *ber, + const char *vrf )); /* * in free.c @@ -1608,7 +1612,7 @@ ldap_parse_sort_control LDAP_P(( */ /* - * structure for virtul list. + * structure for virtual list. */ typedef struct ldapvlvinfo { int ldvlv_version; diff --git a/libraries/libldap/filter.c b/libraries/libldap/filter.c index 7d40d1ceb4..93a45cd75a 100644 --- a/libraries/libldap/filter.c +++ b/libraries/libldap/filter.c @@ -808,8 +808,8 @@ put_substring_filter( BerElement *ber, char *type, char *val ) return 0; } -int -ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in ) +static int +put_vrFilter( BerElement *ber, const char *str_in ) { int rc; char *freeme; @@ -847,7 +847,7 @@ ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in ) */ #ifdef NEW_LOGGING - LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, "ldap_pvt_put_vrFilter: \"%s\"\n", + LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, "put_vrFilter: \"%s\"\n", str_in )); #else Debug( LDAP_DEBUG_TRACE, "put_vrFilter: \"%s\"\n", str_in, 0, 0 ); @@ -893,7 +893,7 @@ ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in ) default: #ifdef NEW_LOGGING LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, - "ldap_pvt_put_vrFilter: simple\n" )); + "put_vrFilter: simple\n" )); #else Debug( LDAP_DEBUG_TRACE, "put_vrFilter: simple\n", 0, 0, 0 ); @@ -987,7 +987,7 @@ done: } int -put_vrFilter( BerElement *ber, const char *str_in ) +ldap_put_vrFilter( BerElement *ber, const char *str_in ) { int rc =0; @@ -995,7 +995,7 @@ put_vrFilter( BerElement *ber, const char *str_in ) rc = -1; } - rc = ldap_pvt_put_vrFilter( ber, str_in ); + rc = put_vrFilter( ber, str_in ); if ( ber_printf( ber, /*"{"*/ "N}" ) == -1 ) { rc = -1; @@ -1031,7 +1031,7 @@ put_vrFilter_list( BerElement *ber, char *str ) /* now we have "(filter)" with str pointing to it */ *next = '\0'; - if ( ldap_pvt_put_vrFilter( ber, str ) == -1 ) return -1; + if ( put_vrFilter( ber, str ) == -1 ) return -1; *next = save; str = next; } -- 2.39.5