]> TLD Linux GIT Repositories - packages/php.git/blob - php-mysql-ssl-context.patch
- sync patches with PLD
[packages/php.git] / php-mysql-ssl-context.patch
1 ; obey default context options
2 ; https://bugs.php.net/bug.php?id=68344
3 diff -urbB php-5.6.12/ext/mysqlnd/mysqlnd_net.c php-5.6.12/ext/mysqlnd/mysqlnd_net.c
4 --- php-5.6.12/ext/mysqlnd/mysqlnd_net.c        2015-08-06 09:55:57.000000000 +0200
5 +++ php-5.6.12/ext/mysqlnd/mysqlnd_net.c        2015-08-10 13:25:30.187912101 +0200
6 @@ -29,6 +29,7 @@
7  #include "mysqlnd_ext_plugin.h"
8  #include "php_network.h"
9  #include "zend_ini.h"
10 +#include "ext/standard/file.h"
11  #ifdef MYSQLND_COMPRESSION_ENABLED
12  #include <zlib.h>
13  #endif
14 @@ -868,6 +868,21 @@ MYSQLND_METHOD(mysqlnd_net, enable_ssl)(
15                 DBG_RETURN(FAIL);
16         }
17  
18 +       if (FG(default_context)) {
19 +               zval **tmpzval = NULL;
20 +               int i = 0;
21 +               /* copy values from default stream settings */
22 +               char *opts[] = { "allow_self_signed", "cafile", "capath", "ciphers", "CN_match",
23 +                       "disable_compression", "local_cert", "local_pk", "no_ticket", "passphrase",
24 +                       "peer_fingerprint", "peer_name", "SNI_enabled", "SNI_server_certs", "SNI_server_name",
25 +                       "verify_depth", "verify_peer", "verify_peer_name", NULL };
26 +               while (opts[i]) {
27 +                       if (php_stream_context_get_option(FG(default_context), "ssl", opts[i], &tmpzval) == SUCCESS)
28 +                               php_stream_context_set_option(context, "ssl", opts[i], *tmpzval);
29 +                       i++;
30 +               }
31 +       }
32 +
33         if (net->data->options.ssl_key) {
34                 zval key_zval;
35                 ZVAL_STRING(&key_zval, net->data->options.ssl_key, 0);
36