summaryrefslogtreecommitdiff
path: root/ext/ldap/ldap.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ldap/ldap.c')
-rw-r--r--ext/ldap/ldap.c73
1 files changed, 39 insertions, 34 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 8f52f1f3fb..151b059026 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -241,9 +241,9 @@ PHP_MINFO_FUNCTION(ldap)
php_info_print_table_row(2, "RCS Version", "$Id$");
if (LDAPG(max_links) == -1) {
- snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links));
+ snprintf(tmp, 31, ZEND_LONG_FMT "/unlimited", LDAPG(num_links));
} else {
- snprintf(tmp, 31, "%ld/%ld", LDAPG(num_links), LDAPG(max_links));
+ snprintf(tmp, 31, ZEND_LONG_FMT "/" ZEND_LONG_FMT, LDAPG(num_links), LDAPG(max_links));
}
php_info_print_table_row(2, "Total Links", tmp);
@@ -294,12 +294,12 @@ PHP_MINFO_FUNCTION(ldap)
PHP_FUNCTION(ldap_connect)
{
char *host = NULL;
- int hostlen;
- long port = 389; /* Default port */
+ size_t hostlen;
+ zend_long port = 389; /* Default port */
#ifdef HAVE_ORALDAP
char *wallet = NULL, *walletpasswd = NULL;
- int walletlen = 0, walletpasswdlen = 0;
- long authmode = GSLC_SSL_NO_AUTH;
+ size_t walletlen = 0, walletpasswdlen = 0;
+ zend_long authmode = GSLC_SSL_NO_AUTH;
int ssl=0;
#endif
ldap_linkdata *ld;
@@ -324,7 +324,7 @@ PHP_FUNCTION(ldap_connect)
#endif
if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", LDAPG(num_links));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%pd)", LDAPG(num_links));
RETURN_FALSE;
}
@@ -394,7 +394,7 @@ PHP_FUNCTION(ldap_bind)
{
zval *link;
char *ldap_bind_dn = NULL, *ldap_bind_pw = NULL;
- int ldap_bind_dnlen, ldap_bind_pwlen;
+ size_t ldap_bind_dnlen, ldap_bind_pwlen;
ldap_linkdata *ld;
int rc;
@@ -521,7 +521,7 @@ PHP_FUNCTION(ldap_sasl_bind)
char *sasl_authz_id = NULL;
char *sasl_authc_id = NULL;
char *props = NULL;
- int rc, dn_len, passwd_len, mech_len, realm_len, authc_id_len, authz_id_len, props_len;
+ size_t rc, dn_len, passwd_len, mech_len, realm_len, authc_id_len, authz_id_len, props_len;
php_ldap_bictx *ctx;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|sssssss", &link, &binddn, &dn_len, &passwd, &passwd_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authc_id, &authc_id_len, &sasl_authz_id, &authz_id_len, &props, &props_len) != SUCCESS) {
@@ -610,7 +610,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in
static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
{
zval *link, *base_dn, *filter, *attrs = NULL, *attr;
- long attrsonly, sizelimit, timelimit, deref;
+ zend_long attrsonly, sizelimit, timelimit, deref;
char *ldap_base_dn = NULL, *ldap_filter = NULL, **ldap_attrs = NULL;
ldap_linkdata *ld = NULL;
LDAPMessage *ldap_res;
@@ -1031,7 +1031,7 @@ PHP_FUNCTION(ldap_first_attribute)
ldap_linkdata *ld;
ldap_resultentry *resultentry;
char *attribute;
- long dummy_ber;
+ zend_long dummy_ber;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) {
return;
@@ -1059,7 +1059,7 @@ PHP_FUNCTION(ldap_next_attribute)
ldap_linkdata *ld;
ldap_resultentry *resultentry;
char *attribute;
- long dummy_ber;
+ zend_long dummy_ber;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) {
return;
@@ -1153,7 +1153,8 @@ PHP_FUNCTION(ldap_get_values_len)
ldap_resultentry *resultentry;
char *attr;
struct berval **ldap_value_len;
- int i, num_values, attr_len;
+ int i, num_values;
+ size_t attr_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrs", &link, &result_entry, &attr, &attr_len) != SUCCESS) {
return;
@@ -1214,9 +1215,10 @@ PHP_FUNCTION(ldap_get_dn)
Splits DN into its component parts */
PHP_FUNCTION(ldap_explode_dn)
{
- long with_attrib;
+ zend_long with_attrib;
char *dn, **ldap_value;
- int i, count, dn_len;
+ int i, count;
+ size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &dn, &dn_len, &with_attrib) != SUCCESS) {
return;
@@ -1247,7 +1249,7 @@ PHP_FUNCTION(ldap_explode_dn)
PHP_FUNCTION(ldap_dn2ufn)
{
char *dn, *ufn;
- int dn_len;
+ size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dn, &dn_len) != SUCCESS) {
return;
@@ -1277,10 +1279,11 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
ldap_linkdata *ld;
char *dn;
LDAPMod **ldap_mods;
- int i, j, num_attribs, num_values, dn_len;
+ int i, j, num_attribs, num_values;
+ size_t dn_len;
int *num_berval;
zend_string *attribute;
- ulong index;
+ zend_ulong index;
int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) {
@@ -1431,7 +1434,8 @@ PHP_FUNCTION(ldap_delete)
zval *link;
ldap_linkdata *ld;
char *dn;
- int rc, dn_len;
+ int rc;
+ size_t dn_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &link, &dn, &dn_len) != SUCCESS) {
return;
@@ -1500,7 +1504,7 @@ PHP_FUNCTION(ldap_modify_batch)
zval *attrib, *modtype, *vals;
zval *fetched;
char *dn;
- int dn_len;
+ size_t dn_len;
int i, j, k;
int num_mods, num_modprops, num_modvals;
LDAPMod **ldap_mods;
@@ -1539,10 +1543,10 @@ PHP_FUNCTION(ldap_modify_batch)
/* perform validation */
{
zend_string *modkey;
- long modtype;
+ zend_long modtype;
/* to store the wrongly-typed keys */
- ulong tmpUlong;
+ zend_ulong tmpUlong;
/* make sure the DN contains no NUL bytes */
if (_ldap_strlen_max(dn, dn_len) != dn_len) {
@@ -1808,7 +1812,7 @@ PHP_FUNCTION(ldap_errno)
Convert error number to error string */
PHP_FUNCTION(ldap_err2str)
{
- long perrno;
+ zend_long perrno;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &perrno) != SUCCESS) {
return;
@@ -1844,7 +1848,7 @@ PHP_FUNCTION(ldap_compare)
{
zval *link;
char *dn, *attr, *value;
- int dn_len, attr_len, value_len;
+ size_t dn_len, attr_len, value_len;
ldap_linkdata *ld;
int errno;
@@ -1878,7 +1882,7 @@ PHP_FUNCTION(ldap_sort)
zval *link, *result;
ldap_linkdata *ld;
char *sortfilter;
- int sflen;
+ size_t sflen;
zend_resource *le;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrs", &link, &result, &sortfilter, &sflen) != SUCCESS) {
@@ -1908,7 +1912,7 @@ PHP_FUNCTION(ldap_get_option)
{
zval *link, *retval;
ldap_linkdata *ld;
- long option;
+ zend_long option;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz/", &link, &option, &retval) != SUCCESS) {
return;
@@ -2013,7 +2017,7 @@ PHP_FUNCTION(ldap_set_option)
zval *link, *newval;
ldap_linkdata *ld;
LDAP *ldap;
- long option;
+ zend_long option;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zlz", &link, &option, &newval) != SUCCESS) {
return;
@@ -2341,7 +2345,7 @@ PHP_FUNCTION(ldap_rename)
ldap_linkdata *ld;
int rc;
char *dn, *newrdn, *newparent;
- int dn_len, newrdn_len, newparent_len;
+ size_t dn_len, newrdn_len, newparent_len;
zend_bool deleteoldrdn;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsssb", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn) != SUCCESS) {
@@ -2463,10 +2467,10 @@ PHP_FUNCTION(ldap_set_rebind_proc)
/* callable? */
if (!zend_is_callable(callback, 0, &callback_name TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Two arguments expected for '%s' to be a valid callback", callback_name->val);
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
RETURN_FALSE;
}
- STR_RELEASE(callback_name);
+ zend_string_release(callback_name);
/* register rebind procedure */
if (Z_ISUNDEF(ld->rebindproc)) {
@@ -2520,9 +2524,10 @@ static void php_ldap_escape_map_set_chars(zend_bool *map, const char *chars, con
PHP_FUNCTION(ldap_escape)
{
char *value, *ignores, *result;
- int valuelen = 0, ignoreslen = 0, i;
+ size_t valuelen = 0, ignoreslen = 0;
+ int i;
size_t resultlen;
- long flags = 0;
+ zend_long flags = 0;
zend_bool map[256] = {0}, havecharlist = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) {
@@ -2613,11 +2618,11 @@ PHP_FUNCTION(ldap_8859_to_t61)
Inject paged results control*/
PHP_FUNCTION(ldap_control_paged_result)
{
- long pagesize;
+ zend_long pagesize;
zend_bool iscritical;
zval *link;
char *cookie = NULL;
- int cookie_len = 0;
+ size_t cookie_len = 0;
struct berval lcookie = { 0, NULL };
ldap_linkdata *ld;
LDAP *ldap;