summaryrefslogtreecommitdiff
path: root/ext/ldap/ldap.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-09-10 19:56:18 +0800
committerXinchen Hui <laruence@gmail.com>2015-09-10 19:56:18 +0800
commitbb4c0c0703efb7ca06deee67be55957458f24f5e (patch)
treea26704724145e89c2781e8f66398a57072b2c5a7 /ext/ldap/ldap.c
parenta8368ddc38a1940e705914699478dd1f83e745ee (diff)
parent059dd18c37d7814da4d496be0c9ab75121536c4b (diff)
downloadphp-git-bb4c0c0703efb7ca06deee67be55957458f24f5e.tar.gz
Merge branch 'PHP-5.6'
Diffstat (limited to 'ext/ldap/ldap.c')
-rw-r--r--ext/ldap/ldap.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index c717e63982..1514025db5 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -187,6 +187,9 @@ PHP_MINIT_FUNCTION(ldap)
#elif defined (LDAP_X_OPT_CONNECT_TIMEOUT)
REGISTER_LONG_CONSTANT("LDAP_OPT_NETWORK_TIMEOUT", LDAP_X_OPT_CONNECT_TIMEOUT, CONST_PERSISTENT | CONST_CS);
#endif
+#ifdef LDAP_OPT_TIMEOUT
+ REGISTER_LONG_CONSTANT("LDAP_OPT_TIMEOUT", LDAP_OPT_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);
@@ -2119,6 +2122,25 @@ PHP_FUNCTION(ldap_get_option)
ZVAL_LONG(retval, (timeout / 1000));
} break;
#endif
+#ifdef LDAP_OPT_TIMEOUT
+ case LDAP_OPT_TIMEOUT:
+ {
+ struct timeval *timeout = NULL;
+
+ if (ldap_get_option(ld->link, LDAP_OPT_TIMEOUT, (void *) &timeout)) {
+ if (timeout) {
+ ldap_memfree(timeout);
+ }
+ RETURN_FALSE;
+ }
+ if (!timeout) {
+ RETURN_FALSE;
+ }
+ zval_dtor(retval);
+ ZVAL_LONG(retval, timeout->tv_sec);
+ ldap_memfree(timeout);
+ } break;
+#endif
/* options with string value */
case LDAP_OPT_ERROR_STRING:
#ifdef LDAP_OPT_HOST_NAME
@@ -2224,6 +2246,19 @@ PHP_FUNCTION(ldap_set_option)
}
} break;
#endif
+#ifdef LDAP_OPT_TIMEOUT
+ case LDAP_OPT_TIMEOUT:
+ {
+ struct timeval timeout;
+
+ convert_to_long_ex(newval);
+ timeout.tv_sec = Z_LVAL_PP(newval);
+ timeout.tv_usec = 0;
+ if (ldap_set_option(ldap, LDAP_OPT_TIMEOUT, (void *) &timeout)) {
+ RETURN_FALSE;
+ }
+ } break;
+#endif
/* options with string value */
case LDAP_OPT_ERROR_STRING:
#ifdef LDAP_OPT_HOST_NAME