diff options
author | Stig Venaas <venaas@php.net> | 2001-10-09 21:14:14 +0000 |
---|---|---|
committer | Stig Venaas <venaas@php.net> | 2001-10-09 21:14:14 +0000 |
commit | de894ef0988fdc1f3d21af63ee52b016ee3b7fb4 (patch) | |
tree | 3173f2a3e9a48b3ac7e9fb9bc37a3ae3a6e02146 | |
parent | 27fb33e8b7540befb0aad0ec1e439de8753888b2 (diff) | |
download | php-git-de894ef0988fdc1f3d21af63ee52b016ee3b7fb4.tar.gz |
Added ldap_start_tls() function
@- Added ldap_start_tls() function (Stig Venaas, patch by kuenne@rentec.com)
-rw-r--r-- | ext/ldap/ldap.c | 33 | ||||
-rw-r--r-- | ext/ldap/php_ldap.h | 4 |
2 files changed, 35 insertions, 2 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 28e1670b81..ba697cf44c 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -109,7 +109,11 @@ function_entry ldap_functions[] = { PHP_FE(ldap_parse_reference, third_argument_force_ref) PHP_FE(ldap_rename, NULL) #endif - + +#if LDAP_API_VERSION > 2000 + PHP_FE(ldap_start_tls, NULL) +#endif + #ifdef STR_TRANSLATION PHP_FE(ldap_t61_to_8859, NULL) PHP_FE(ldap_8859_to_t61, NULL) @@ -1941,7 +1945,32 @@ PHP_FUNCTION(ldap_rename) /* }}} */ #endif - +#if LDAP_API_VERSION > 2000 +/* {{{ proto int ldap_start_tls(int link) + Start TLS */ +PHP_FUNCTION(ldap_start_tls) +{ + pval **link; + LDAP *ldap; + + if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &link) == FAILURE) { + WRONG_PARAM_COUNT; + } + + ZEND_FETCH_RESOURCE(ldap, LDAP *, link, -1, "ldap link", le_link); + + if (ldap_start_tls_s(ldap, NULL, NULL) != LDAP_SUCCESS) { + php_error(E_WARNING,"LDAP: Unable to start TLS: %s", + ldap_err2string(_get_lderrno(ldap))); + RETURN_FALSE; + } else { + RETURN_TRUE; + } +} +/* }}} */ +#endif + + #ifdef STR_TRANSLATION /* {{{ php_ldap_do_translate */ diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h index 9404c82585..140111d71f 100644 --- a/ext/ldap/php_ldap.h +++ b/ext/ldap/php_ldap.h @@ -88,6 +88,10 @@ PHP_FUNCTION(ldap_parse_reference); PHP_FUNCTION(ldap_rename); #endif +#if LDAP_API_VERSION > 2000 +PHP_FUNCTION(ldap_start_tls); +#endif + #ifdef STR_TRANSLATION PHP_FUNCTION(ldap_t61_to_8859); PHP_FUNCTION(ldap_8859_to_t61); |