patrickallaert Sun Jun 28 22:38:23 2009 UTC
Modified files:
/php-src/ext/ldap ldap.c
/php-src/ext/ldap/tests bug48441.phpt
Log:
unicode support in ext/ldap
http://cvs.php.net/viewvc.cgi/php-src/ext/ldap/ldap.c?r1=1.204r2=1.205diff_format=u
Index: php-src/ext/ldap/ldap.c
diff -u php-src/ext/ldap/ldap.c:1.204 php-src/ext/ldap/ldap.c:1.205
--- php-src/ext/ldap/ldap.c:1.204 Thu Jun 25 14:48:53 2009
+++ php-src/ext/ldap/ldap.c Sun Jun 28 22:38:22 2009
@@ -23,7 +23,7 @@
+--+
*/
-/* $Id: ldap.c,v 1.204 2009/06/25 14:48:53 felipe Exp $ */
+/* $Id: ldap.c,v 1.205 2009/06/28 22:38:22 patrickallaert Exp $ */
#define IS_EXT_MODULE
#ifdef HAVE_CONFIG_H
@@ -235,7 +235,7 @@
php_info_print_table_start();
php_info_print_table_row(2, LDAP Support, enabled);
- php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 1.204
2009/06/25 14:48:53 felipe Exp $);
+ php_info_print_table_row(2, RCS Version, $Id: ldap.c,v 1.205
2009/06/28 22:38:22 patrickallaert Exp $);
if (LDAPG(max_links) == -1) {
snprintf(tmp, 31, %ld/unlimited, LDAPG(num_links));
@@ -286,7 +286,7 @@
}
/* }}} */
-/* {{{ proto resource ldap_connect([string host [, int port [, string wallet
[, string wallet_passwd [, int authmode])
+/* {{{ proto resource ldap_connect([string host [, int port [, string wallet
[, string wallet_passwd [, int authmode]) U
Connect to an LDAP server */
PHP_FUNCTION(ldap_connect)
{
@@ -307,7 +307,7 @@
WRONG_PARAM_COUNT;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |slssl, host,
hostlen, port, wallet, walletlen, walletpasswd, walletpasswdlen,
authmode) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |slssl,
host, hostlen, UG(utf8_conv), port, wallet, walletlen, UG(utf8_conv),
walletpasswd, walletpasswdlen, UG(utf8_conv), authmode) != SUCCESS) {
RETURN_FALSE;
}
@@ -385,7 +385,7 @@
}
/* }}} */
-/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]])
+/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]]) U
Bind to LDAP directory */
PHP_FUNCTION(ldap_bind)
{
@@ -395,7 +395,7 @@
ldap_linkdata *ld;
int rc;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|ss, link,
ldap_bind_dn, ldap_bind_dnlen, ldap_bind_pw, ldap_bind_pwlen) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|ss, link,
ldap_bind_dn, ldap_bind_dnlen, UG(utf8_conv), ldap_bind_pw,
ldap_bind_pwlen, UG(utf8_conv)) != SUCCESS) {
RETURN_FALSE;
}
@@ -495,7 +495,7 @@
}
/* }}} */
-/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string
password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [,
string sasl_authz_id [, string props]]])
+/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string
password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [,
string sasl_authz_id [, string props]]]) U
Bind to LDAP directory using SASL */
PHP_FUNCTION(ldap_sasl_bind)
{
@@ -511,7 +511,7 @@
int 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|sss,
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) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
r|sss, link, binddn, dn_len, UG(utf8_conv), passwd,
passwd_len, UG(utf8_conv), sasl_mech, mech_len, UG(utf8_conv), sasl_realm,
realm_len, UG(utf8_conv), sasl_authc_id, authc_id_len, UG(utf8_conv),
sasl_authz_id, authz_id_len, UG(utf8_conv), props, props_len,
UG(utf8_conv)) != SUCCESS) {
RETURN_FALSE;
}
@@ -535,7 +535,7 @@
/* }}} */
#endif /* HAVE_LDAP_SASL */
-/* {{{ proto bool ldap_unbind(resource link)
+/* {{{ proto bool ldap_unbind(resource link) U
Unbind from LDAP directory */
PHP_FUNCTION(ldap_unbind)
{
@@ -612,6 +612,7 @@
int num_attribs = 0;
int i, errno;
int myargcount = ZEND_NUM_ARGS();
+ int free_base_dn = 0;
int ret = 1;
if (zend_parse_parameters(myargcount TSRMLS_CC, ZZZ|Z, link,
base_dn, filter, attrs, attrsonly,
@@ -695,6 +696,11 @@
/* If anything else than string is passed, ldap_base_dn
= NULL */
if (Z_TYPE_PP(base_dn) == IS_STRING) {
ldap_base_dn = Z_STRVAL_PP(base_dn);
+ } else if(Z_TYPE_PP(base_dn) == IS_UNICODE){
+ char *tmp =
zend_unicode_to_ascii(Z_USTRVAL_PP(base_dn), Z_USTRLEN_PP(base_dn)