summaryrefslogtreecommitdiff
path: root/ext/ldap/ldap.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2000-07-28 00:09:33 +0000
committerfoobar <sniper@php.net>2000-07-28 00:09:33 +0000
commitc8b8281e226aa7d9db9bdb7f77556aabe944b3f1 (patch)
treeb30977b3f0097f065d0bfa73f0432a7cdf6e18f5 /ext/ldap/ldap.c
parented2b68a9c37c9f41188b7e9f09e29d2d4d3713e8 (diff)
downloadphp-git-c8b8281e226aa7d9db9bdb7f77556aabe944b3f1.tar.gz
@- Fixed bug in ldap_get_values_len() which makes it NULL-safe. (Jani)
@ Bug-report and fix submitted by Michel Alexeline <alexel@dr15.cnrs.fr> # Plus I added missing ldap_value_free_len().
Diffstat (limited to 'ext/ldap/ldap.c')
-rw-r--r--ext/ldap/ldap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 8451c637f9..4962f0a210 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -957,14 +957,14 @@ PHP_FUNCTION(ldap_get_values)
}
add_assoc_long(return_value, "count", num_values);
-
ldap_value_free(ldap_value);
+
}
/* }}} */
/* {{{ proto array ldap_get_values_len(int link, int result, string attribute)
- Get the lengths for all values from a result entry */
+ Get all values with lengths from a result entry */
PHP_FUNCTION(ldap_get_values_len)
{
pval **link, **result_entry, **attr;
@@ -974,8 +974,7 @@ PHP_FUNCTION(ldap_get_values_len)
struct berval **ldap_value_len;
int i, num_values;
- if (ZEND_NUM_ARGS() != 3 ||
- zend_get_parameters_ex(3, &link, &result_entry, &attr) == FAILURE) {
+ if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &link, &result_entry, &attr) == FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -1007,10 +1006,12 @@ PHP_FUNCTION(ldap_get_values_len)
}
for (i=0; i<num_values; i++) {
- add_next_index_string(return_value, ldap_value_len[i]->bv_val, 1);
+ add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len, 1);
}
add_assoc_long(return_value, "count", num_values);
+ ldap_value_free_len(ldap_value_len);
+
}
/* }}} */