Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions ext/ldap/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashTable *control_ht)
{
zval* val;
zend_string *control_oid;
zend_string *control_oid, *control_oid_tmp;
char** ldap_attrs = NULL;
LDAPSortKey** sort_keys = NULL;
zend_string *tmpstring = NULL, **tmpstrings1 = NULL, **tmpstrings2 = NULL;
Expand All @@ -436,8 +436,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
return -1;
}

control_oid = zval_get_string(val);
if (EG(exception)) {
control_oid = zval_try_get_tmp_string(val, &control_oid_tmp);
if (!control_oid) {
return -1;
}

Expand All @@ -453,8 +453,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT

if ((val = zend_hash_find(control_ht, ZSTR_KNOWN(ZEND_STR_VALUE))) != NULL) {
if (Z_TYPE_P(val) != IS_ARRAY) {
tmpstring = zval_get_string(val);
if (EG(exception)) {
tmpstring = zval_try_get_string(val);
if (!tmpstring) {
rc = -1;
goto failure;
}
Expand All @@ -468,8 +468,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
pagesize = zval_get_long(tmp);
}
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "cookie", sizeof("cookie") - 1)) != NULL) {
tmpstring = zval_get_string(tmp);
if (EG(exception)) {
tmpstring = zval_try_get_string(tmp);
if (!tmpstring) {
rc = -1;
goto failure;
}
Expand All @@ -488,8 +488,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
rc = -1;
zend_value_error("%s(): Control must have a \"filter\" key", get_active_function_name());
} else {
zend_string* assert = zval_get_string(tmp);
if (EG(exception)) {
zend_string* assert = zval_try_get_string(tmp);
if (!assert) {
rc = -1;
goto failure;
}
Expand All @@ -516,8 +516,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
rc = -1;
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
} else {
tmpstring = zval_get_string(tmp);
if (EG(exception)) {
tmpstring = zval_try_get_string(tmp);
if (!tmpstring) {
rc = -1;
goto failure;
}
Expand Down Expand Up @@ -555,8 +555,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
goto failure;
}

tmpstrings1[num_tmpstrings1] = zval_get_string(attr);
if (EG(exception)) {
tmpstrings1[num_tmpstrings1] = zval_try_get_string(attr);
if (!tmpstrings1[num_tmpstrings1]) {
rc = -1;
goto failure;
}
Expand Down Expand Up @@ -603,17 +603,17 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
goto failure;
}
sort_keys[i] = emalloc(sizeof(LDAPSortKey));
tmpstrings1[num_tmpstrings1] = zval_get_string(tmp);
if (EG(exception)) {
tmpstrings1[num_tmpstrings1] = zval_try_get_string(tmp);
if (!tmpstrings1[num_tmpstrings1]) {
rc = -1;
goto failure;
}
sort_keys[i]->attributeType = ZSTR_VAL(tmpstrings1[num_tmpstrings1]);
++num_tmpstrings1;

if ((tmp = zend_hash_str_find(Z_ARRVAL_P(sortkey), "oid", sizeof("oid") - 1)) != NULL) {
tmpstrings2[num_tmpstrings2] = zval_get_string(tmp);
if (EG(exception)) {
tmpstrings2[num_tmpstrings2] = zval_try_get_string(tmp);
if (!tmpstrings2[num_tmpstrings2]) {
rc = -1;
goto failure;
}
Expand Down Expand Up @@ -659,8 +659,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
}

if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "attrvalue", sizeof("attrvalue") - 1)) != NULL) {
tmpstring = zval_get_string(tmp);
if (EG(exception)) {
tmpstring = zval_try_get_string(tmp);
if (!tmpstring) {
rc = -1;
goto failure;
}
Expand All @@ -685,8 +685,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
}

if ((tmp = zend_hash_str_find(Z_ARRVAL_P(val), "context", sizeof("context") - 1)) != NULL) {
tmpstring = zval_get_string(tmp);
if (EG(exception)) {
tmpstring = zval_try_get_string(tmp);
if (!tmpstring) {
rc = -1;
goto failure;
}
Expand Down Expand Up @@ -714,7 +714,7 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
}

failure:
zend_string_release(control_oid);
zend_tmp_string_release(control_oid_tmp);
if (tmpstring != NULL) {
zend_string_release(tmpstring);
}
Expand Down Expand Up @@ -2791,8 +2791,8 @@ PHP_FUNCTION(ldap_modify_batch)
zend_ulong value_index = 0;
zval *modification_value_zv = NULL;
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(modification_values), modification_value_zv) {
zend_string *modval = zval_get_string(modification_value_zv);
if (EG(exception)) {
zend_string *modval = zval_try_get_string(modification_value_zv);
if (!modval) {
RETVAL_FALSE;
ldap_mods[modification_index]->mod_bvalues[value_index] = NULL;
num_mods = modification_index + 1;
Expand Down