diff options
Diffstat (limited to 'ext/ldap/ldap.c')
-rw-r--r-- | ext/ldap/ldap.c | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 8f52f1f3fb..75ec8f7003 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -147,65 +147,65 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_INI_ENTRIES(); /* Constants to be used with deref-parameter in php_ldap_do_search() */ - REGISTER_LONG_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_NEVER", LDAP_DEREF_NEVER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_SEARCHING", LDAP_DEREF_SEARCHING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_FINDING", LDAP_DEREF_FINDING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_DEREF_ALWAYS", LDAP_DEREF_ALWAYS, CONST_PERSISTENT | CONST_CS); /* Constants to be used with ldap_modify_batch() */ - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_ADD", LDAP_MODIFY_BATCH_ADD, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE", LDAP_MODIFY_BATCH_REMOVE, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REMOVE_ALL", LDAP_MODIFY_BATCH_REMOVE_ALL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_MODIFY_BATCH_REPLACE", LDAP_MODIFY_BATCH_REPLACE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_ATTRIB", LDAP_MODIFY_BATCH_ATTRIB, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP /* LDAP options */ - REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_TIMELIMIT", LDAP_OPT_TIMELIMIT, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_NETWORK_TIMEOUT - REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_OPT_NETWORK_TIMEOUT, CONST_PERSISTENT | CONST_CS); #elif defined (LDAP_X_OPT_CONNECT_TIMEOUT) - REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_PROTOCOL_VERSION", LDAP_OPT_PROTOCOL_VERSION, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_NUMBER", LDAP_OPT_ERROR_NUMBER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_REFERRALS", LDAP_OPT_REFERRALS, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_RESTART - REGISTER_LONG_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_RESTART", LDAP_OPT_RESTART, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_HOST_NAME - REGISTER_LONG_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_HOST_NAME", LDAP_OPT_HOST_NAME, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_ERROR_STRING", LDAP_OPT_ERROR_STRING, CONST_PERSISTENT | CONST_CS); #ifdef LDAP_OPT_MATCHED_DN - REGISTER_LONG_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_MATCHED_DN", LDAP_OPT_MATCHED_DN, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_SERVER_CONTROLS", LDAP_OPT_SERVER_CONTROLS, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_CLIENT_CONTROLS", LDAP_OPT_CLIENT_CONTROLS, CONST_PERSISTENT | CONST_CS); #endif #ifdef LDAP_OPT_DEBUG_LEVEL - REGISTER_LONG_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_DEBUG_LEVEL", LDAP_OPT_DEBUG_LEVEL, CONST_PERSISTENT | CONST_CS); #endif #ifdef HAVE_LDAP_SASL - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_MECH", LDAP_OPT_X_SASL_MECH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_REALM", LDAP_OPT_X_SASL_REALM, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHCID", LDAP_OPT_X_SASL_AUTHCID, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_OPT_X_SASL_AUTHZID", LDAP_OPT_X_SASL_AUTHZID, CONST_PERSISTENT | CONST_CS); #endif #ifdef ORALDAP - REGISTER_LONG_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_NO_AUTH", GSLC_SSL_NO_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_ONEWAY_AUTH", GSLC_SSL_ONEWAY_AUTH, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("GSLC_SSL_TWOWAY_AUTH", GSLC_SSL_TWOWAY_AUTH, CONST_PERSISTENT | CONST_CS); #endif - REGISTER_LONG_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); - REGISTER_LONG_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_ESCAPE_FILTER", PHP_LDAP_ESCAPE_FILTER, CONST_PERSISTENT | CONST_CS); + REGISTER_INT_CONSTANT("LDAP_ESCAPE_DN", PHP_LDAP_ESCAPE_DN, CONST_PERSISTENT | CONST_CS); le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap link", module_number); le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap result", module_number); @@ -870,7 +870,7 @@ PHP_FUNCTION(ldap_count_entries) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); ZEND_FETCH_RESOURCE(ldap_result, LDAPMessage *, result, -1, "ldap result", le_result); - RETURN_LONG(ldap_count_entries(ld->link, ldap_result)); + RETURN_INT(ldap_count_entries(ld->link, ldap_result)); } /* }}} */ @@ -957,7 +957,7 @@ PHP_FUNCTION(ldap_get_entries) num_entries = ldap_count_entries(ldap, ldap_result); array_init(return_value); - add_assoc_long(return_value, "count", num_entries); + add_assoc_int(return_value, "count", num_entries); if (num_entries == 0) { return; @@ -981,7 +981,7 @@ PHP_FUNCTION(ldap_get_entries) num_values = ldap_count_values_len(ldap_value); array_init(&tmp2); - add_assoc_long(&tmp2, "count", num_values); + add_assoc_int(&tmp2, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp2, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1003,7 +1003,7 @@ PHP_FUNCTION(ldap_get_entries) } #endif - add_assoc_long(&tmp1, "count", num_attrib); + add_assoc_int(&tmp1, "count", num_attrib); dn = ldap_get_dn(ldap, ldap_result_entry); add_assoc_string(&tmp1, "dn", dn); #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP || WINDOWS @@ -1018,7 +1018,7 @@ PHP_FUNCTION(ldap_get_entries) ldap_result_entry = ldap_next_entry(ldap, ldap_result_entry); } - add_assoc_long(return_value, "count", num_entries); + add_assoc_int(return_value, "count", num_entries); } /* }}} */ @@ -1119,7 +1119,7 @@ PHP_FUNCTION(ldap_get_attributes) num_values = ldap_count_values_len(ldap_value); array_init(&tmp); - add_assoc_long(&tmp, "count", num_values); + add_assoc_int(&tmp, "count", num_values); for (i = 0; i < num_values; i++) { add_index_stringl(&tmp, i, ldap_value[i]->bv_val, ldap_value[i]->bv_len); } @@ -1140,7 +1140,7 @@ PHP_FUNCTION(ldap_get_attributes) } #endif - add_assoc_long(return_value, "count", num_attrib); + add_assoc_int(return_value, "count", num_attrib); } /* }}} */ @@ -1174,7 +1174,7 @@ PHP_FUNCTION(ldap_get_values_len) add_next_index_stringl(return_value, ldap_value_len[i]->bv_val, ldap_value_len[i]->bv_len); } - add_assoc_long(return_value, "count", num_values); + add_assoc_int(return_value, "count", num_values); ldap_value_free_len(ldap_value_len); } @@ -1233,7 +1233,7 @@ PHP_FUNCTION(ldap_explode_dn) array_init(return_value); - add_assoc_long(return_value, "count", count); + add_assoc_int(return_value, "count", count); for (i = 0; i<count; i++) { add_index_string(return_value, i, ldap_value[i]); } @@ -1338,7 +1338,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) if ((num_values == 1) && (Z_TYPE_P(value) != IS_ARRAY)) { convert_to_string_ex(value); ldap_mods[i]->mod_bvalues[0] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_P(value); + ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRSIZE_P(value); ldap_mods[i]->mod_bvalues[0]->bv_val = Z_STRVAL_P(value); } else { for (j = 0; j < num_values; j++) { @@ -1351,7 +1351,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) } convert_to_string_ex(ivalue); ldap_mods[i]->mod_bvalues[j] = (struct berval *) emalloc (sizeof(struct berval)); - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(ivalue); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(ivalue); ldap_mods[i]->mod_bvalues[j]->bv_val = Z_STRVAL_P(ivalue); } } @@ -1552,7 +1552,7 @@ PHP_FUNCTION(ldap_modify_batch) /* make sure the top level is a normal array */ zend_hash_internal_pointer_reset(Z_ARRVAL_P(mods)); - if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_LONG) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(mods)) != HASH_KEY_IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modifications array must not be string-indexed"); RETURN_FALSE; } @@ -1604,19 +1604,19 @@ PHP_FUNCTION(ldap_modify_batch) RETURN_FALSE; } - if (Z_STRLEN_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRLEN_P(modinfo))) { + if (Z_STRSIZE_P(modinfo) != _ldap_strlen_max(Z_STRVAL_P(modinfo), Z_STRSIZE_P(modinfo))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must not contain NUL bytes"); RETURN_FALSE; } } else if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_MODTYPE)) { - if (Z_TYPE_P(modinfo) != IS_LONG) { + if (Z_TYPE_P(modinfo) != IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_MODTYPE "' value must be a long"); RETURN_FALSE; } /* is the value in range? */ - modtype = Z_LVAL_P(modinfo); + modtype = Z_IVAL_P(modinfo); if ( modtype != LDAP_MODIFY_BATCH_ADD && modtype != LDAP_MODIFY_BATCH_REMOVE && @@ -1656,7 +1656,7 @@ PHP_FUNCTION(ldap_modify_batch) } /* are its keys integers? */ - if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_LONG) { + if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_INT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' array must not be string-indexed"); RETURN_FALSE; } @@ -1700,7 +1700,7 @@ PHP_FUNCTION(ldap_modify_batch) _ldap_hash_fetch(mod, LDAP_MODIFY_BATCH_VALUES, &vals); /* map the modification type */ - switch (Z_LVAL_P(modtype)) { + switch (Z_IVAL_P(modtype)) { case LDAP_MODIFY_BATCH_ADD: oper = LDAP_MOD_ADD; break; @@ -1718,9 +1718,9 @@ PHP_FUNCTION(ldap_modify_batch) /* fill in the basic info */ ldap_mods[i]->mod_op = oper | LDAP_MOD_BVALUES; - ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRLEN_P(attrib)); + ldap_mods[i]->mod_type = estrndup(Z_STRVAL_P(attrib), Z_STRSIZE_P(attrib)); - if (Z_LVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { + if (Z_IVAL_P(modtype) == LDAP_MODIFY_BATCH_REMOVE_ALL) { /* no values */ ldap_mods[i]->mod_bvalues = NULL; } @@ -1739,8 +1739,8 @@ PHP_FUNCTION(ldap_modify_batch) ldap_mods[i]->mod_bvalues[j] = safe_emalloc(1, sizeof(struct berval), 0); /* fill it */ - ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRLEN_P(modval); - ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRLEN_P(modval)); + ldap_mods[i]->mod_bvalues[j]->bv_len = Z_STRSIZE_P(modval); + ldap_mods[i]->mod_bvalues[j]->bv_val = estrndup(Z_STRVAL_P(modval), Z_STRSIZE_P(modval)); } /* NULL-terminate values */ @@ -1800,7 +1800,7 @@ PHP_FUNCTION(ldap_errno) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - RETURN_LONG(_get_lderrno(ld->link)); + RETURN_INT(_get_lderrno(ld->link)); } /* }}} */ @@ -1867,7 +1867,7 @@ PHP_FUNCTION(ldap_compare) } php_error_docref(NULL TSRMLS_CC, E_WARNING, "Compare: %s", ldap_err2string(errno)); - RETURN_LONG(-1); + RETURN_INT(-1); } /* }}} */ @@ -1934,7 +1934,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, val); + ZVAL_INT(retval, val); } break; #ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: @@ -1951,7 +1951,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, timeout->tv_sec); + ZVAL_INT(retval, timeout->tv_sec); ldap_memfree(timeout); } break; #elif defined(LDAP_X_OPT_CONNECT_TIMEOUT) @@ -1963,7 +1963,7 @@ PHP_FUNCTION(ldap_get_option) RETURN_FALSE; } zval_ptr_dtor(retval); - ZVAL_LONG(retval, (timeout / 1000)); + ZVAL_INT(retval, (timeout / 1000)); } break; #endif /* options with string value */ @@ -2039,8 +2039,8 @@ PHP_FUNCTION(ldap_set_option) { int val; - convert_to_long_ex(newval); - val = Z_LVAL_P(newval); + convert_to_int_ex(newval); + val = Z_IVAL_P(newval); if (ldap_set_option(ldap, option, &val)) { RETURN_FALSE; } @@ -2050,8 +2050,8 @@ PHP_FUNCTION(ldap_set_option) { struct timeval timeout; - convert_to_long_ex(newval); - timeout.tv_sec = Z_LVAL_P(newval); + convert_to_int_ex(newval); + timeout.tv_sec = Z_IVAL_P(newval); timeout.tv_usec = 0; if (ldap_set_option(ldap, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { RETURN_FALSE; @@ -2062,8 +2062,8 @@ PHP_FUNCTION(ldap_set_option) { int timeout; - convert_to_long_ex(newval); - timeout = 1000 * Z_LVAL_P(newval); /* Convert to milliseconds */ + convert_to_int_ex(newval); + timeout = 1000 * Z_IVAL_P(newval); /* Convert to milliseconds */ if (ldap_set_option(ldap, LDAP_X_OPT_CONNECT_TIMEOUT, &timeout)) { RETURN_FALSE; } @@ -2138,7 +2138,7 @@ PHP_FUNCTION(ldap_set_option) if ((val = zend_hash_str_find(Z_ARRVAL_P(ctrlval), "value", sizeof("value") - 1)) != NULL) { convert_to_string_ex(val); ctrl->ldctl_value.bv_val = Z_STRVAL_P(val); - ctrl->ldctl_value.bv_len = Z_STRLEN_P(val); + ctrl->ldctl_value.bv_len = Z_STRSIZE_P(val); } else { ctrl->ldctl_value.bv_val = NULL; ctrl->ldctl_value.bv_len = 0; @@ -2204,7 +2204,7 @@ PHP_FUNCTION(ldap_parse_result) } zval_ptr_dtor(errcode); - ZVAL_LONG(errcode, lerrcode); + ZVAL_INT(errcode, lerrcode); /* Reverse -> fall through */ switch (myargcount) { @@ -2424,8 +2424,8 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi ZVAL_COPY_VALUE(&cb_args[0], cb_link); ZVAL_STRING(&cb_args[1], url); if (call_user_function_ex(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL TSRMLS_CC) == SUCCESS && !Z_ISUNDEF(cb_retval)) { - convert_to_long_ex(&cb_retval); - retval = Z_LVAL(cb_retval); + convert_to_int_ex(&cb_retval); + retval = Z_IVAL(cb_retval); zval_ptr_dtor(&cb_retval); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "rebind_proc PHP callback failed"); @@ -2450,7 +2450,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) ZEND_FETCH_RESOURCE(ld, ldap_linkdata *, link, -1, "ldap link", le_link); - if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) { + if (Z_TYPE_P(callback) == IS_STRING && Z_STRSIZE_P(callback) == 0) { /* unregister rebind procedure */ if (!Z_ISUNDEF(ld->rebindproc)) { zval_ptr_dtor(&ld->rebindproc); @@ -2778,7 +2778,7 @@ PHP_FUNCTION(ldap_control_paged_result_response) ldap_controls_free(lserverctrls); if (myargcount == 4) { zval_dtor(estimated); - ZVAL_LONG(estimated, lestimated); + ZVAL_INT(estimated, lestimated); } zval_ptr_dtor(cookie); |