mirror of
https://github.com/php/php-src.git
synced 2024-12-14 12:26:19 +08:00
Fixed ldap_exop and ldap_parse_exop. Only tested them for whoami exop. (see test file)
This commit is contained in:
parent
28530b2f1c
commit
e832ce4b22
@ -2577,7 +2577,7 @@ PHP_FUNCTION(ldap_parse_exop)
|
||||
struct berval *lretdata;
|
||||
int rc, myargcount = ZEND_NUM_ARGS();
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|zz", &link, &result, &retoid, &retdata) == SUCCESS) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|z/z/", &link, &result, &retoid, &retdata) != SUCCESS) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
@ -3314,7 +3314,7 @@ PHP_FUNCTION(ldap_exop)
|
||||
int rc, msgid, myargcount = ZEND_NUM_ARGS();
|
||||
/* int reqoid_len, reqdata_len, retdata_len, retoid_len, retdat_len; */
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|zzz", &link, &reqoid, &reqdata, &retoid, &retdata) != SUCCESS) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz|zz/z/", &link, &reqoid, &reqdata, &retoid, &retdata) != SUCCESS) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
@ -3879,7 +3879,7 @@ ZEND_END_ARG_INFO()
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 5)
|
||||
ZEND_ARG_INFO(0, link)
|
||||
ZEND_ARG_INFO(0, reqoid)
|
||||
ZEND_ARG_INFO(1, reqdata)
|
||||
ZEND_ARG_INFO(0, reqdata)
|
||||
ZEND_ARG_INFO(1, repoid)
|
||||
ZEND_ARG_INFO(1, repdata)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
52
ext/ldap/tests/ldap_exop.phpt
Normal file
52
ext/ldap/tests/ldap_exop.phpt
Normal file
@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
ldap_exop() and ldap_parse_exop() - EXOP operations
|
||||
--CREDITS--
|
||||
Côme Chilliet <mcmic@php.net>
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
<?php require_once('skipifbindfailure.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
insert_dummy_data($link, $base);
|
||||
|
||||
function ber_encode($string) {
|
||||
$null_padded_string = '';
|
||||
for($i = 0; $i<strlen($string); $i++) {
|
||||
$null_padded_string .= substr($string,$i,1)."\0";
|
||||
}
|
||||
return base64_encode($null_padded_string);
|
||||
}
|
||||
|
||||
// ldap_exop(resource link, string reqoid [, string reqdata [, string retoid [, string retdata]]])
|
||||
// bool ldap_parse_exop(resource link, resource result [, string retoid [, string retdata]])
|
||||
var_dump(
|
||||
ldap_exop($link, "1.3.6.1.4.1.4203.1.11.3", NULL, $retoid, $retdata),
|
||||
$retdata,
|
||||
$retoid,
|
||||
$r = ldap_exop($link, "1.3.6.1.4.1.4203.1.11.3"),
|
||||
ldap_parse_exop($link, $r, $retoid2, $retdata2),
|
||||
$retdata2,
|
||||
$retoid2
|
||||
);
|
||||
?>
|
||||
===DONE===
|
||||
--CLEAN--
|
||||
<?php
|
||||
require "connect.inc";
|
||||
|
||||
$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
|
||||
|
||||
remove_dummy_data($link, $base);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
string(%d) "dn:%s"
|
||||
string(0) ""
|
||||
resource(%d) of type (ldap result)
|
||||
bool(true)
|
||||
string(%d) "dn:%s"
|
||||
string(0) ""
|
||||
===DONE===
|
Loading…
Reference in New Issue
Block a user