php: split grpc_credentials to channel_credentials and call_credentials

reviewable/pr3765/r1
Stanley Cheung 9 years ago
parent af93a8fddb
commit aeea10287f
  1. 138
      src/php/ext/grpc/call_credentials.c
  2. 63
      src/php/ext/grpc/call_credentials.h
  3. 8
      src/php/ext/grpc/channel.c
  4. 4
      src/php/ext/grpc/config.m4
  5. 120
      src/php/ext/grpc/credentials.c
  6. 24
      src/php/ext/grpc/credentials.h
  7. 18
      src/php/ext/grpc/package.xml
  8. 4
      src/php/ext/grpc/php_grpc.c
  9. 4
      src/php/tests/unit_tests/SecureEndToEndTest.php

@ -0,0 +1,138 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "credentials.h"
#include "call_credentials.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/spl/spl_exceptions.h>
#include "php_grpc.h"
#include <zend_exceptions.h>
#include <zend_hash.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
zend_class_entry *grpc_ce_call_credentials;
/* Frees and destroys an instance of wrapped_grpc_call_credentials */
void free_wrapped_grpc_call_credentials(void *object TSRMLS_DC) {
wrapped_grpc_call_credentials *creds =
(wrapped_grpc_call_credentials *)object;
if (creds->wrapped != NULL) {
grpc_call_credentials_release(creds->wrapped);
}
efree(creds);
}
/* Initializes an instance of wrapped_grpc_call_credentials to be
* associated with an object of a class specified by class_type */
zend_object_value create_wrapped_grpc_call_credentials(
zend_class_entry *class_type TSRMLS_DC) {
zend_object_value retval;
wrapped_grpc_call_credentials *intern;
intern = (wrapped_grpc_call_credentials *)emalloc(
sizeof(wrapped_grpc_call_credentials));
memset(intern, 0, sizeof(wrapped_grpc_call_credentials));
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put(
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
free_wrapped_grpc_call_credentials, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers();
return retval;
}
zval *grpc_php_wrap_call_credentials(grpc_call_credentials *wrapped) {
zval *credentials_object;
MAKE_STD_ZVAL(credentials_object);
object_init_ex(credentials_object, grpc_ce_call_credentials);
wrapped_grpc_call_credentials *credentials =
(wrapped_grpc_call_credentials *)zend_object_store_get_object(
credentials_object TSRMLS_CC);
credentials->wrapped = wrapped;
return credentials_object;
}
/**
* Create composite credentials from two existing credentials.
* @param Credentials cred1 The first credential
* @param Credentials cred2 The second credential
* @return Credentials The new composite credentials object
*/
PHP_METHOD(CallCredentials, createComposite) {
zval *cred1_obj;
zval *cred2_obj;
/* "OO" == 3 Objects */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &cred1_obj,
grpc_ce_call_credentials, &cred2_obj,
grpc_ce_call_credentials) == FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException,
"createComposite expects 2 CallCredentials",
1 TSRMLS_CC);
return;
}
wrapped_grpc_call_credentials *cred1 =
(wrapped_grpc_call_credentials *)zend_object_store_get_object(
cred1_obj TSRMLS_CC);
wrapped_grpc_call_credentials *cred2 =
(wrapped_grpc_call_credentials *)zend_object_store_get_object(
cred2_obj TSRMLS_CC);
grpc_call_credentials *creds =
grpc_composite_call_credentials_create(cred1->wrapped, cred2->wrapped,
NULL);
zval *creds_object = grpc_php_wrap_call_credentials(creds);
RETURN_DESTROY_ZVAL(creds_object);
}
static zend_function_entry call_credentials_methods[] = {
PHP_ME(CallCredentials, createComposite, NULL,
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_FE_END};
void grpc_init_call_credentials(TSRMLS_D) {
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "Grpc\\CallCredentials", call_credentials_methods);
ce.create_object = create_wrapped_grpc_call_credentials;
grpc_ce_call_credentials = zend_register_internal_class(&ce TSRMLS_CC);
}

@ -0,0 +1,63 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_
#define NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_grpc.h"
#include "grpc/grpc.h"
#include "grpc/grpc_security.h"
/* Class entry for the CallCredentials PHP class */
extern zend_class_entry *grpc_ce_call_credentials;
/* Wrapper struct for grpc_call_credentials that can be associated
* with a PHP object */
typedef struct wrapped_grpc_call_credentials {
zend_object std;
grpc_call_credentials *wrapped;
} wrapped_grpc_call_credentials;
/* Initializes the CallCredentials PHP class */
void grpc_init_call_credentials(TSRMLS_D);
#endif /* NET_GRPC_PHP_GRPC_CALL_CREDENTIALS_H_ */

@ -139,7 +139,7 @@ PHP_METHOD(Channel, __construct) {
grpc_channel_args args; grpc_channel_args args;
HashTable *array_hash; HashTable *array_hash;
zval **creds_obj = NULL; zval **creds_obj = NULL;
wrapped_grpc_credentials *creds = NULL; wrapped_grpc_channel_credentials *creds = NULL;
/* "s|a" == 1 string, 1 optional array */ /* "s|a" == 1 string, 1 optional array */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &target, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &target,
&target_length, &args_array) == FAILURE) { &target_length, &args_array) == FAILURE) {
@ -153,13 +153,13 @@ PHP_METHOD(Channel, __construct) {
array_hash = Z_ARRVAL_P(args_array); array_hash = Z_ARRVAL_P(args_array);
if (zend_hash_find(array_hash, "credentials", sizeof("credentials"), if (zend_hash_find(array_hash, "credentials", sizeof("credentials"),
(void **)&creds_obj) == SUCCESS) { (void **)&creds_obj) == SUCCESS) {
if (zend_get_class_entry(*creds_obj TSRMLS_CC) != grpc_ce_credentials) { if (zend_get_class_entry(*creds_obj TSRMLS_CC) != grpc_ce_channel_credentials) {
zend_throw_exception(spl_ce_InvalidArgumentException, zend_throw_exception(spl_ce_InvalidArgumentException,
"credentials must be a Credentials object", "credentials must be a ChannelCredentials object",
1 TSRMLS_CC); 1 TSRMLS_CC);
return; return;
} }
creds = (wrapped_grpc_credentials *)zend_object_store_get_object( creds = (wrapped_grpc_channel_credentials *)zend_object_store_get_object(
*creds_obj TSRMLS_CC); *creds_obj TSRMLS_CC);
zend_hash_del(array_hash, "credentials", 12); zend_hash_del(array_hash, "credentials", 12);
} }

@ -71,5 +71,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_SUBST(GRPC_SHARED_LIBADD) PHP_SUBST(GRPC_SHARED_LIBADD)
PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c channel.c completion_queue.c credentials.c timeval.c server.c server_credentials.c php_grpc.c, $ext_shared, , -Wall -Werror -std=c11) PHP_NEW_EXTENSION(grpc, byte_buffer.c call.c call_credentials.c channel.c \
completion_queue.c credentials.c timeval.c server.c server_credentials.c \
php_grpc.c, $ext_shared, , -Wall -Werror -std=c11)
fi fi

@ -32,6 +32,7 @@
*/ */
#include "credentials.h" #include "credentials.h"
#include "call_credentials.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
@ -49,55 +50,56 @@
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/grpc_security.h> #include <grpc/grpc_security.h>
zend_class_entry *grpc_ce_credentials; zend_class_entry *grpc_ce_channel_credentials;
/* Frees and destroys an instance of wrapped_grpc_credentials */ /* Frees and destroys an instance of wrapped_grpc_channel_credentials */
void free_wrapped_grpc_credentials(void *object TSRMLS_DC) { void free_wrapped_grpc_channel_credentials(void *object TSRMLS_DC) {
wrapped_grpc_credentials *creds = (wrapped_grpc_credentials *)object; wrapped_grpc_channel_credentials *creds =
(wrapped_grpc_channel_credentials *)object;
if (creds->wrapped != NULL) { if (creds->wrapped != NULL) {
grpc_credentials_release(creds->wrapped); grpc_channel_credentials_release(creds->wrapped);
} }
efree(creds); efree(creds);
} }
/* Initializes an instance of wrapped_grpc_credentials to be associated with an /* Initializes an instance of wrapped_grpc_channel_credentials to be
* object of a class specified by class_type */ * associated with an object of a class specified by class_type */
zend_object_value create_wrapped_grpc_credentials(zend_class_entry *class_type zend_object_value create_wrapped_grpc_channel_credentials(
TSRMLS_DC) { zend_class_entry *class_type TSRMLS_DC) {
zend_object_value retval; zend_object_value retval;
wrapped_grpc_credentials *intern; wrapped_grpc_channel_credentials *intern;
intern = intern = (wrapped_grpc_channel_credentials *)emalloc(
(wrapped_grpc_credentials *)emalloc(sizeof(wrapped_grpc_credentials)); sizeof(wrapped_grpc_channel_credentials));
memset(intern, 0, sizeof(wrapped_grpc_credentials)); memset(intern, 0, sizeof(wrapped_grpc_channel_credentials));
zend_object_std_init(&intern->std, class_type TSRMLS_CC); zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type); object_properties_init(&intern->std, class_type);
retval.handle = zend_objects_store_put( retval.handle = zend_objects_store_put(
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
free_wrapped_grpc_credentials, NULL TSRMLS_CC); free_wrapped_grpc_channel_credentials, NULL TSRMLS_CC);
retval.handlers = zend_get_std_object_handlers(); retval.handlers = zend_get_std_object_handlers();
return retval; return retval;
} }
zval *grpc_php_wrap_credentials(grpc_credentials *wrapped) { zval *grpc_php_wrap_channel_credentials(grpc_channel_credentials *wrapped) {
zval *credentials_object; zval *credentials_object;
MAKE_STD_ZVAL(credentials_object); MAKE_STD_ZVAL(credentials_object);
object_init_ex(credentials_object, grpc_ce_credentials); object_init_ex(credentials_object, grpc_ce_channel_credentials);
wrapped_grpc_credentials *credentials = wrapped_grpc_channel_credentials *credentials =
(wrapped_grpc_credentials *)zend_object_store_get_object( (wrapped_grpc_channel_credentials *)zend_object_store_get_object(
credentials_object TSRMLS_CC); credentials_object TSRMLS_CC);
credentials->wrapped = wrapped; credentials->wrapped = wrapped;
return credentials_object; return credentials_object;
} }
/** /**
* Create a default credentials object. * Create a default channel credentials object.
* @return Credentials The new default credentials object * @return ChannelCredentials The new default channel credentials object
*/ */
PHP_METHOD(Credentials, createDefault) { PHP_METHOD(ChannelCredentials, createDefault) {
grpc_credentials *creds = grpc_google_default_credentials_create(); grpc_channel_credentials *creds = grpc_google_default_credentials_create();
zval *creds_object = grpc_php_wrap_credentials(creds); zval *creds_object = grpc_php_wrap_channel_credentials(creds);
RETURN_DESTROY_ZVAL(creds_object); RETURN_DESTROY_ZVAL(creds_object);
} }
@ -108,9 +110,9 @@ PHP_METHOD(Credentials, createDefault) {
* (optional) * (optional)
* @param string pem_cert_chain PEM encoding of the client's certificate chain * @param string pem_cert_chain PEM encoding of the client's certificate chain
* (optional) * (optional)
* @return Credentials The new SSL credentials object * @return ChannelCredentials The new SSL credentials object
*/ */
PHP_METHOD(Credentials, createSsl) { PHP_METHOD(ChannelCredentials, createSsl) {
char *pem_root_certs = NULL; char *pem_root_certs = NULL;
grpc_ssl_pem_key_cert_pair pem_key_cert_pair; grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
@ -121,71 +123,65 @@ PHP_METHOD(Credentials, createSsl) {
/* "|s!s!s! == 3 optional nullable strings */ /* "|s!s!s! == 3 optional nullable strings */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!", if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!s!",
&pem_root_certs, &root_certs_length, &pem_root_certs, &root_certs_length,
&pem_key_cert_pair.private_key, &private_key_length, &pem_key_cert_pair.private_key,
&private_key_length,
&pem_key_cert_pair.cert_chain, &pem_key_cert_pair.cert_chain,
&cert_chain_length) == FAILURE) { &cert_chain_length) == FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException, zend_throw_exception(spl_ce_InvalidArgumentException,
"createSsl expects 3 optional strings", 1 TSRMLS_CC); "createSsl expects 3 optional strings", 1 TSRMLS_CC);
return; return;
} }
grpc_credentials *creds = grpc_ssl_credentials_create( grpc_channel_credentials *creds = grpc_ssl_credentials_create(
pem_root_certs, pem_root_certs,
pem_key_cert_pair.private_key == NULL ? NULL : &pem_key_cert_pair, NULL); pem_key_cert_pair.private_key == NULL ? NULL : &pem_key_cert_pair, NULL);
zval *creds_object = grpc_php_wrap_credentials(creds); zval *creds_object = grpc_php_wrap_channel_credentials(creds);
RETURN_DESTROY_ZVAL(creds_object); RETURN_DESTROY_ZVAL(creds_object);
} }
/** /**
* Create composite credentials from two existing credentials. * Create composite credentials from two existing credentials.
* @param Credentials cred1 The first credential * @param ChannelCredentials cred1 The first credential
* @param Credentials cred2 The second credential * @param CallCredentials cred2 The second credential
* @return Credentials The new composite credentials object * @return ChannelCredentials The new composite credentials object
*/ */
PHP_METHOD(Credentials, createComposite) { PHP_METHOD(ChannelCredentials, createComposite) {
zval *cred1_obj; zval *cred1_obj;
zval *cred2_obj; zval *cred2_obj;
/* "OO" == 3 Objects */ /* "OO" == 3 Objects */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &cred1_obj, if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OO", &cred1_obj,
grpc_ce_credentials, &cred2_obj, grpc_ce_channel_credentials, &cred2_obj,
grpc_ce_credentials) == FAILURE) { grpc_ce_call_credentials) == FAILURE) {
zend_throw_exception(spl_ce_InvalidArgumentException, zend_throw_exception(spl_ce_InvalidArgumentException,
"createComposite expects 2 Credentials", 1 TSRMLS_CC); "createComposite expects 2 Credentials", 1 TSRMLS_CC);
return; return;
} }
wrapped_grpc_credentials *cred1 = wrapped_grpc_channel_credentials *cred1 =
(wrapped_grpc_credentials *)zend_object_store_get_object( (wrapped_grpc_channel_credentials *)zend_object_store_get_object(
cred1_obj TSRMLS_CC); cred1_obj TSRMLS_CC);
wrapped_grpc_credentials *cred2 = wrapped_grpc_call_credentials *cred2 =
(wrapped_grpc_credentials *)zend_object_store_get_object( (wrapped_grpc_call_credentials *)zend_object_store_get_object(
cred2_obj TSRMLS_CC); cred2_obj TSRMLS_CC);
grpc_credentials *creds = grpc_channel_credentials *creds =
grpc_composite_credentials_create(cred1->wrapped, cred2->wrapped, NULL); grpc_composite_channel_credentials_create(cred1->wrapped, cred2->wrapped,
zval *creds_object = grpc_php_wrap_credentials(creds); NULL);
zval *creds_object = grpc_php_wrap_channel_credentials(creds);
RETURN_DESTROY_ZVAL(creds_object); RETURN_DESTROY_ZVAL(creds_object);
} }
/** static zend_function_entry channel_credentials_methods[] = {
* Create Google Compute Engine credentials PHP_ME(ChannelCredentials, createDefault, NULL,
* @return Credentials The new GCE credentials object ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
*/ PHP_ME(ChannelCredentials, createSsl, NULL,
PHP_METHOD(Credentials, createGce) { ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
grpc_credentials *creds = grpc_google_compute_engine_credentials_create(NULL); PHP_ME(ChannelCredentials, createComposite, NULL,
zval *creds_object = grpc_php_wrap_credentials(creds); ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
RETURN_DESTROY_ZVAL(creds_object); PHP_FE_END};
}
static zend_function_entry credentials_methods[] = {
PHP_ME(Credentials, createDefault, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Credentials, createSsl, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Credentials, createComposite, NULL,
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Credentials, createGce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_FE_END};
void grpc_init_credentials(TSRMLS_D) { void grpc_init_channel_credentials(TSRMLS_D) {
zend_class_entry ce; zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "Grpc\\Credentials", credentials_methods); INIT_CLASS_ENTRY(ce, "Grpc\\ChannelCredentials",
ce.create_object = create_wrapped_grpc_credentials; channel_credentials_methods);
grpc_ce_credentials = zend_register_internal_class(&ce TSRMLS_CC); ce.create_object = create_wrapped_grpc_channel_credentials;
grpc_ce_channel_credentials = zend_register_internal_class(&ce TSRMLS_CC);
} }

@ -31,8 +31,8 @@
* *
*/ */
#ifndef NET_GRPC_PHP_GRPC_CREDENTIALS_H_ #ifndef NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_
#define NET_GRPC_PHP_GRPC_CREDENTIALS_H_ #define NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
@ -46,18 +46,18 @@
#include "grpc/grpc.h" #include "grpc/grpc.h"
#include "grpc/grpc_security.h" #include "grpc/grpc_security.h"
/* Class entry for the Credentials PHP class */ /* Class entry for the ChannelCredentials PHP class */
extern zend_class_entry *grpc_ce_credentials; extern zend_class_entry *grpc_ce_channel_credentials;
/* Wrapper struct for grpc_credentials that can be associated with a PHP /* Wrapper struct for grpc_channel_credentials that can be associated
* object */ * with a PHP object */
typedef struct wrapped_grpc_credentials { typedef struct wrapped_grpc_channel_credentials {
zend_object std; zend_object std;
grpc_credentials *wrapped; grpc_channel_credentials *wrapped;
} wrapped_grpc_credentials; } wrapped_grpc_channel_credentials;
/* Initializes the Credentials PHP class */ /* Initializes the ChannelCredentials PHP class */
void grpc_init_credentials(TSRMLS_D); void grpc_init_channel_credentials(TSRMLS_D);
#endif /* NET_GRPC_PHP_GRPC_CREDENTIALS_H_ */ #endif /* NET_GRPC_PHP_GRPC_CHANNEL_CREDENTIALS_H_ */

@ -10,8 +10,8 @@
<email>grpc-packages@google.com</email> <email>grpc-packages@google.com</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2015-10-07</date> <date>2015-10-21</date>
<time>13:40:54</time> <time>16:58:38</time>
<version> <version>
<release>0.6.1</release> <release>0.6.1</release>
<api>0.6.0</api> <api>0.6.0</api>
@ -30,16 +30,18 @@
<file baseinstalldir="/" md5sum="c8de0f819499c48adfc8d7f472c0196b" name="byte_buffer.h" role="src" /> <file baseinstalldir="/" md5sum="c8de0f819499c48adfc8d7f472c0196b" name="byte_buffer.h" role="src" />
<file baseinstalldir="/" md5sum="d64c9005993de02abac55664b0b9e0b2" name="call.c" role="src" /> <file baseinstalldir="/" md5sum="d64c9005993de02abac55664b0b9e0b2" name="call.c" role="src" />
<file baseinstalldir="/" md5sum="26acbf04c30162c2d2aca4688bb2aec8" name="call.h" role="src" /> <file baseinstalldir="/" md5sum="26acbf04c30162c2d2aca4688bb2aec8" name="call.h" role="src" />
<file baseinstalldir="/" md5sum="15e56239b32c803f073e8a2b9f96e8c3" name="channel.c" role="src" /> <file baseinstalldir="/" md5sum="cc48804689564aa1e18095f957f06685" name="call_credentials.c" role="src" />
<file baseinstalldir="/" md5sum="e45269975f9a30fd349a90daf6b31aa2" name="call_credentials.h" role="src" />
<file baseinstalldir="/" md5sum="00b3dc982f9171e03758ff12ddb6729b" name="channel.c" role="src" />
<file baseinstalldir="/" md5sum="ed4b00c0cf3702b115d0cfa87450dc09" name="channel.h" role="src" /> <file baseinstalldir="/" md5sum="ed4b00c0cf3702b115d0cfa87450dc09" name="channel.h" role="src" />
<file baseinstalldir="/" md5sum="55ab7a42f9dd9bfc7e28a61cfc5fca63" name="completion_queue.c" role="src" /> <file baseinstalldir="/" md5sum="55ab7a42f9dd9bfc7e28a61cfc5fca63" name="completion_queue.c" role="src" />
<file baseinstalldir="/" md5sum="f10b5bb232d74a6878e829e2e76cdaa2" name="completion_queue.h" role="src" /> <file baseinstalldir="/" md5sum="f10b5bb232d74a6878e829e2e76cdaa2" name="completion_queue.h" role="src" />
<file baseinstalldir="/" md5sum="a22f8eac0164761058cc4d9eb2ceb069" name="config.m4" role="src" /> <file baseinstalldir="/" md5sum="7d80c71737336f4548574da2a6f306d3" name="config.m4" role="src" />
<file baseinstalldir="/" md5sum="588752c908f7bc1663f7b8fc922ae661" name="credentials.c" role="src" /> <file baseinstalldir="/" md5sum="f9c2e18949c809acdc8ee1a17cfb7320" name="credentials.c" role="src" />
<file baseinstalldir="/" md5sum="6988d6e97c19c8f8e3eb92371cf8246b" name="credentials.h" role="src" /> <file baseinstalldir="/" md5sum="a86250e03f610ce6c2c7595a84e08821" name="credentials.h" role="src" />
<file baseinstalldir="/" md5sum="38a1bc979d810c36ebc2a52d4b7b5319" name="CREDITS" role="doc" /> <file baseinstalldir="/" md5sum="38a1bc979d810c36ebc2a52d4b7b5319" name="CREDITS" role="doc" />
<file baseinstalldir="/" md5sum="3f35b472bbdef5a788cd90617d7d0847" name="LICENSE" role="doc" /> <file baseinstalldir="/" md5sum="3f35b472bbdef5a788cd90617d7d0847" name="LICENSE" role="doc" />
<file baseinstalldir="/" md5sum="b77f1f3941aaf7a21090b493e9f26037" name="php_grpc.c" role="src" /> <file baseinstalldir="/" md5sum="c35ad9b424b18a5fb5eb9bd3e07893c5" name="php_grpc.c" role="src" />
<file baseinstalldir="/" md5sum="673b07859d9f69232f8a754c56780686" name="php_grpc.h" role="src" /> <file baseinstalldir="/" md5sum="673b07859d9f69232f8a754c56780686" name="php_grpc.h" role="src" />
<file baseinstalldir="/" md5sum="7533a6d3ea02c78cad23a9651de0825d" name="README.md" role="doc" /> <file baseinstalldir="/" md5sum="7533a6d3ea02c78cad23a9651de0825d" name="README.md" role="doc" />
<file baseinstalldir="/" md5sum="3e4e960454ebb2fc7b78a840493f5315" name="server.c" role="src" /> <file baseinstalldir="/" md5sum="3e4e960454ebb2fc7b78a840493f5315" name="server.c" role="src" />
@ -122,7 +124,7 @@ Update to wrap gRPC C Core version 0.10.0
<release>beta</release> <release>beta</release>
<api>beta</api> <api>beta</api>
</stability> </stability>
<date>2015-10-07</date> <date>2015-10-21</date>
<license>BSD</license> <license>BSD</license>
<notes> <notes>
- fixed undefined constant fatal error when run with apache/nginx #2275 - fixed undefined constant fatal error when run with apache/nginx #2275

@ -36,6 +36,7 @@
#include "server.h" #include "server.h"
#include "timeval.h" #include "timeval.h"
#include "credentials.h" #include "credentials.h"
#include "call_credentials.h"
#include "server_credentials.h" #include "server_credentials.h"
#include "completion_queue.h" #include "completion_queue.h"
@ -233,7 +234,8 @@ PHP_MINIT_FUNCTION(grpc) {
grpc_init_channel(TSRMLS_C); grpc_init_channel(TSRMLS_C);
grpc_init_server(TSRMLS_C); grpc_init_server(TSRMLS_C);
grpc_init_timeval(TSRMLS_C); grpc_init_timeval(TSRMLS_C);
grpc_init_credentials(TSRMLS_C); grpc_init_channel_credentials(TSRMLS_C);
grpc_init_call_credentials(TSRMLS_C);
grpc_init_server_credentials(TSRMLS_C); grpc_init_server_credentials(TSRMLS_C);
grpc_php_init_completion_queue(TSRMLS_C); grpc_php_init_completion_queue(TSRMLS_C);
return SUCCESS; return SUCCESS;

@ -33,7 +33,7 @@
*/ */
class SecureEndToEndTest extends PHPUnit_Framework_TestCase{ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{
public function setUp() { public function setUp() {
$credentials = Grpc\Credentials::createSsl( $channel_credentials = Grpc\ChannelCredentials::createSsl(
file_get_contents(dirname(__FILE__) . '/../data/ca.pem')); file_get_contents(dirname(__FILE__) . '/../data/ca.pem'));
$server_credentials = Grpc\ServerCredentials::createSsl( $server_credentials = Grpc\ServerCredentials::createSsl(
null, null,
@ -49,7 +49,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase{
[ [
'grpc.ssl_target_name_override' => $this->host_override, 'grpc.ssl_target_name_override' => $this->host_override,
'grpc.default_authority' => $this->host_override, 'grpc.default_authority' => $this->host_override,
'credentials' => $credentials 'credentials' => $channel_credentials
]); ]);
} }

Loading…
Cancel
Save