From 4831bb0a7557fe41469c9740710287b984d33676 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 7 Jul 1999 17:52:06 +0000 Subject: [PATCH] request value should be optional. --- libraries/libldap/extended.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libraries/libldap/extended.c b/libraries/libldap/extended.c index 4f3f464562..a8ca02b29e 100644 --- a/libraries/libldap/extended.c +++ b/libraries/libldap/extended.c @@ -40,6 +40,7 @@ ldap_extended_operation( int *msgidp ) { BerElement *ber; + int rc; Debug( LDAP_DEBUG_TRACE, "ldap_extended_operation\n", 0, 0, 0 ); @@ -65,10 +66,19 @@ ldap_extended_operation( return( ld->ld_errno ); } - if ( ber_printf( ber, "{it{tstO}", /* '}' */ - ++ld->ld_msgid, LDAP_REQ_EXTENDED, LDAP_TAG_EXOP_REQ_OID, - reqoid, LDAP_TAG_EXOP_REQ_VALUE, reqdata ) == -1 ) - { + if ( reqdata != NULL ) { + rc = ber_printf( ber, "{it{tstO}", /* '}' */ + ++ld->ld_msgid, LDAP_REQ_EXTENDED, + LDAP_TAG_EXOP_REQ_OID, reqoid, + LDAP_TAG_EXOP_REQ_VALUE, reqdata ); + + } else { + rc = ber_printf( ber, "{it{ts}", /* '}' */ + ++ld->ld_msgid, LDAP_REQ_EXTENDED, + LDAP_TAG_EXOP_REQ_OID, reqoid ); + } + + if( rc == -1 ) { ld->ld_errno = LDAP_ENCODING_ERROR; ber_free( ber, 1 ); return( ld->ld_errno ); -- 2.39.5