com pecl/caching/memcache: expose ::setSaslData: memcache.c php_memcache.h
| From: | Pierre Joye | Date: | Sun, 13 Oct 2013 17:49:47 +0000 |
| Subject: | com pecl/caching/memcache: expose ::setSaslData: memcache.c php_memcache.h | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-19876@lists.php.net to get a copy of this message | ||
Commit: c2ced03619b4ccbdcb4ceff3f578df8a99d3ef79
Author: unknown <pajoye@php.net> Sun, 13 Oct 2013 19:49:47 +0200
Parents: 9a79cf528712e76f2363a6fc051b466b3c893a93
Branches: nio
Link: http://git.php.net/?p=pecl/caching/memcache.git;a=commitdiff;h=c2ced03619b4ccbdcb4ceff3f578df8a99d3ef79
Log:
expose ::setSaslData
Changed paths:
M memcache.c
M php_memcache.h
Diff:
diff --git a/memcache.c b/memcache.c
index 2e2a67d..adcadf4 100644
--- a/memcache.c
+++ b/memcache.c
@@ -92,6 +92,8 @@ static zend_function_entry php_memcache_pool_class_functions[] = {
PHP_FALIAS(decrement, memcache_decrement, NULL)
PHP_FALIAS(close, memcache_close, NULL)
PHP_FALIAS(flush, memcache_flush, NULL)
+ PHP_FALIAS(setSaslData, memcache_set_sasl_data, NULL)
+
{NULL, NULL, NULL}
};
@@ -789,6 +791,8 @@ static mmc_t *php_mmc_pool_addserver(
pool->failure_callback = &php_mmc_failure_callback;
list_id = MEMCACHE_LIST_INSERT(pool, le_memcache_pool);
add_property_resource(mmc_object, "connection", list_id);
+ add_property_null(mmc_object, "username");
+ add_property_null(mmc_object, "password");
}
else {
pool = (mmc_pool_t *)zend_list_find(Z_LVAL_PP(connection), &resource_type);
@@ -2000,6 +2004,35 @@ PHP_FUNCTION(memcache_flush)
}
/* }}} */
+/* {{{ proto string memcache_set_sasl_data(object memcache, string username, string password)
+ Set credentials for sals authentification */
+PHP_FUNCTION(memcache_set_sasl_data)
+{
+ zval *mmc_object = getThis();
+ char *user;
+ long user_length;
+ char *password;
+ long password_length;
+
+ if (mmc_object == NULL) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oss", &mmc_object,
memcache_pool_ce, &user, &user_length, &password, &password_length) == FAILURE) {
+ return;
+ }
+ } else {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &user, &user_length,
&password, &password_length) == FAILURE) {
+ return;
+ }
+ }
+ if (user_length < 1 || password_length < 1) {
+ RETURN_FALSE;
+ }
+ add_property_stringl(mmc_object, "username", user, user_length, 1);
+ add_property_stringl(mmc_object, "password", password, password_length, 1);
+ RETURN_TRUE;
+}
+/* }}} */
+
+
/* {{{ proto bool memcache_debug( bool onoff ) */
PHP_FUNCTION(memcache_debug)
{
diff --git a/php_memcache.h b/php_memcache.h
index 4c90e9f..1c96958 100644
--- a/php_memcache.h
+++ b/php_memcache.h
@@ -64,6 +64,7 @@ PHP_FUNCTION(memcache_increment);
PHP_FUNCTION(memcache_decrement);
PHP_FUNCTION(memcache_close);
PHP_FUNCTION(memcache_flush);
+PHP_FUNCTION(memcache_set_sasl_data);
#define PHP_MEMCACHE_VERSION "3.0.9-dev"