Fix bug # 242143 - ldap_extended_operation(3) sends requestValue

when not requested.
  Now if a NULL struct berval * is passed for the extended op data,
  no value is sent.
This commit is contained in:
mcs%pearlcrescent.com 2004-09-09 18:23:39 +00:00
Родитель 02fdc9d90f
Коммит ce27adf824
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -61,7 +61,7 @@ ldap_extended_operation(
) )
{ {
BerElement *ber; BerElement *ber;
int rc, msgid; int rc, berrc, msgid;
/* /*
* the ldapv3 extended operation request looks like this: * the ldapv3 extended operation request looks like this:
@ -117,9 +117,15 @@ ldap_extended_operation(
} }
/* fill it in */ /* fill it in */
if ( ber_printf( ber, "{it{tsto}", msgid, LDAP_REQ_EXTENDED, if (NULL == exdata) {
LDAP_TAG_EXOP_REQ_OID, exoid, LDAP_TAG_EXOP_REQ_VALUE, berrc = ber_printf( ber, "{it{ts}", msgid, LDAP_REQ_EXTENDED,
exdata->bv_val, (int)exdata->bv_len /* XXX lossy cast */ ) == -1 ) { LDAP_TAG_EXOP_REQ_OID, exoid, LDAP_TAG_EXOP_REQ_VALUE);
} else
berrc = ber_printf( ber, "{it{tsto}", msgid, LDAP_REQ_EXTENDED,
LDAP_TAG_EXOP_REQ_OID, exoid, LDAP_TAG_EXOP_REQ_VALUE,
exdata->bv_val, (int)exdata->bv_len /* XXX lossy cast */ );
if (-1 == berrc) {
rc = LDAP_ENCODING_ERROR; rc = LDAP_ENCODING_ERROR;
LDAP_SET_LDERRNO( ld, rc, NULL, NULL ); LDAP_SET_LDERRNO( ld, rc, NULL, NULL );
ber_free( ber, 1 ); ber_free( ber, 1 );