php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #67623
Patch gearman-ssl.patch revision 2014-07-17 07:24 UTC by chjgcn at gmail dot com
revision 2014-07-15 12:59 UTC by chjgcn at gmail dot com

Patch gearman-ssl.patch for gearman Bug #67623

Patch version 2014-07-15 12:59 UTC

Return to Bug #67623 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: chjgcn@gmail.com

--- php_gearman.c	2013-08-29 13:03:54.000000000 +0800
+++ php_gearman.c	2014-07-15 19:18:35.275197932 +0800
@@ -378,6 +378,21 @@
 	ZEND_ARG_INFO(0, timeout)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_set_ssl, 0, 0, 5)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_set_ssl, 0, 0, 4)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_add_server, 0, 0, 3)
 	ZEND_ARG_INFO(0, client_object)
 	ZEND_ARG_INFO(0, host)
@@ -835,6 +850,21 @@
 	ZEND_ARG_INFO(0, timeout)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_worker_set_ssl, 0, 0, 5)
+	ZEND_ARG_INFO(0, worker_object)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_worker_set_ssl, 0, 0, 4)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_worker_set_id, 0, 0, 2)
 	ZEND_ARG_INFO(0, worker_object)
 	ZEND_ARG_INFO(0, id)
@@ -1889,6 +1919,41 @@
 }
 /* }}} */
 
+/* {{{ proto void gearman_client_set_ssl(object client, constant timeout, constant ca_file,
+										 constant certificate, constant key_file)
+   Set SSL for a client structure. */
+PHP_FUNCTION(gearman_client_set_ssl) {
+	zval *zobj;
+	gearman_client_obj *obj;
+	bool ssl = false;
+	char *ca_file = NULL;
+	char *certificate = NULL;
+	char *key_file = NULL;
+	int ca_file_len = 0;
+	int certificate_len = 0;
+	int key_file_len = 0;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "b|sss", &zobj, gearman_client_ce,
+				&ssl,
+				&ca_file, &ca_file_len,
+				&certificate, &certificate_len,
+				&key_file, &key_file_len)
+
+	if (ca_file == NULL) {
+		cfg_get_string("gearman.ssl_ca_file", &ca_file);
+	}
+	if (certificate == NULL) {
+		cfg_get_string("gearman.ssl_certificate", &certificate);
+	}
+	if (key_file == NULL) {
+		cfg_get_string("gearman.ssl_key_file", &key_file);
+	}
+
+	gearman_client_set_ssl(&(obj->client), ssl, ca_file, certificate, key_file);
+	RETURN_TRUE;
+}
+/* }}} */
+
 /* {{{ proto bool gearman_client_add_server(object client [, string host [, int port]])
    Add a job server to a client. This goes into a list of servers than can be used to run tasks. No socket I/O happens here, it is just added to a list. */
 PHP_FUNCTION(gearman_client_add_server) {
@@ -3348,6 +3413,41 @@
 }
 /* }}} */
 
+/* {{{ proto void gearman_worker_set_ssl(object worker, constant timeout, constant ca_file,
+										 constant certificate, constant key_file)
+   Set SSL for a worker structure. */
+PHP_FUNCTION(gearman_worker_set_ssl) {
+	zval *zobj;
+	gearman_worker_obj *obj;
+	bool ssl = false;
+	char *ca_file = NULL;
+	char *certificate = NULL;
+	char *key_file = NULL;
+	int ca_file_len = 0;
+	int certificate_len = 0;
+	int key_file_len = 0;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "b|sss", &zobj, gearman_worker_ce,
+				 &ssl,
+				 &ca_file, &ca_file_len,
+				 &certificate, &certificate_len,
+				 &key_file, &key_file_len)
+
+	if (ca_file == NULL) {
+		cfg_get_string("gearman.ssl_ca_file", &ca_file);
+	}
+	if (certificate == NULL) {
+		cfg_get_string("gearman.ssl_certificate", &certificate);
+	}
+	if (key_file == NULL) {
+		cfg_get_string("gearman.ssl_key_file", &key_file);
+	}
+
+	gearman_worker_set_ssl(&(obj->worker), ssl, ca_file, certificate, key_file);
+	RETURN_TRUE;
+}
+/* }}} */
+
 /* {{{ proto void gearman_worker_set_id(object worker, string id)
    Set id for a worker structure. */
 PHP_FUNCTION(gearman_worker_set_id) {
@@ -4107,6 +4207,7 @@
 	PHP_FE(gearman_client_remove_options, arginfo_gearman_client_remove_options)
 	PHP_FE(gearman_client_timeout, arginfo_gearman_client_timeout)
 	PHP_FE(gearman_client_set_timeout, arginfo_gearman_client_set_timeout)
+	PHP_FE(gearman_client_set_ssl, arginfo_gearman_client_set_ssl)
 	PHP_FE(gearman_client_context, arginfo_gearman_client_context)
 	PHP_FE(gearman_client_set_context, arginfo_gearman_client_set_context)
 #if jluedke_0
@@ -4184,6 +4285,7 @@
 	PHP_FE(gearman_worker_remove_options, arginfo_gearman_worker_remove_options)
 	PHP_FE(gearman_worker_timeout, arginfo_gearman_worker_timeout)
 	PHP_FE(gearman_worker_set_timeout, arginfo_gearman_worker_set_timeout)
+	PHP_FE(gearman_worker_set_ssl, arginfo_gearman_worker_set_ssl)
 	PHP_FE(gearman_worker_set_id, arginfo_gearman_worker_set_id)
 #if jluedke_0
 	PHP_FE(gearman_worker_context, arginfo_gearman_worker_context)
@@ -4274,6 +4376,7 @@
 	__PHP_ME_MAPPING(removeOptions, gearman_client_remove_options, arginfo_oo_gearman_client_remove_options, 0)
 	__PHP_ME_MAPPING(timeout, gearman_client_timeout, arginfo_oo_gearman_client_timeout, 0)
 	__PHP_ME_MAPPING(setTimeout, gearman_client_set_timeout, arginfo_oo_gearman_client_set_timeout, 0)
+	__PHP_ME_MAPPING(setSSL, gearman_client_set_ssl, arginfo_oo_gearman_client_set_ssl, 0)
 	__PHP_ME_MAPPING(context, gearman_client_context, arginfo_oo_gearman_client_context, 0)
 	__PHP_ME_MAPPING(setContext, gearman_client_set_context, arginfo_oo_gearman_client_set_context, 0)
 #if jluedke_0
@@ -4357,6 +4460,7 @@
 	__PHP_ME_MAPPING(removeOptions, gearman_worker_remove_options, arginfo_oo_gearman_worker_remove_options, 0)
 	__PHP_ME_MAPPING(timeout, gearman_worker_timeout, arginfo_oo_gearman_worker_timeout, 0)
 	__PHP_ME_MAPPING(setTimeout, gearman_worker_set_timeout, arginfo_oo_gearman_worker_set_timeout, 0)
+	__PHP_ME_MAPPING(setSSL, gearman_worker_set_ssl, arginfo_oo_gearman_worker_set_ssl, 0)
 	__PHP_ME_MAPPING(setId, gearman_worker_set_id, arginfo_oo_gearman_worker_set_id, 0)
 #if jluedke_0
 	__PHP_ME_MAPPING(context, gearman_worker_context, arginfo_oo_gearman_worker_context, 0)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 12:01:30 2024 UTC