summaryrefslogtreecommitdiff
path: root/src/sp_curl_verify_certificates.c
diff options
context:
space:
mode:
authorxXx-caillou-xXx2018-08-29 18:09:51 +0200
committerjvoisin2018-08-29 16:09:51 +0000
commit89e859d09248de6b1b9b9cdd652cb72c9f7ff098 (patch)
treef24c9e82da5bede181607903fb4e98f59210a057 /src/sp_curl_verify_certificates.c
parent10552296658a87e59b60a20214fef1902320d390 (diff)
Change how we're validating certificates
Diffstat (limited to 'src/sp_curl_verify_certificates.c')
-rw-r--r--src/sp_curl_verify_certificates.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/sp_curl_verify_certificates.c b/src/sp_curl_verify_certificates.c
deleted file mode 100644
index 057ee29..0000000
--- a/src/sp_curl_verify_certificates.c
+++ /dev/null
@@ -1,33 +0,0 @@
1#include "php_snuffleupagus.h"
2#include "sp_config.h"
3
4ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
5
6PHP_FUNCTION(sp_curl_setopt) {
7 void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS);
8 zend_string *protocol_name = NULL;
9 zval *zid, *zvalue;
10 zend_long options;
11
12 ZEND_PARSE_PARAMETERS_START(3, 3)
13 Z_PARAM_RESOURCE(zid)
14 Z_PARAM_LONG(options)
15 Z_PARAM_ZVAL(zvalue)
16 ZEND_PARSE_PARAMETERS_END();
17
18 if (options & CURLOPT_SSL_VERIFYPEER && zval_get_long(zvalue) != 1) {
19 sp_log_err("verify_vertificates", "Please don't deactivate server certificate validation");
20 } else if (options & CURLOPT_SSL_VERIFYHOST && zval_get_long(zvalue) != 2) {
21 sp_log_err("verify_vertificates", "Please don't deactivate client certificate validation");
22 }
23
24 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
25}
26
27int hook_curl_verify_certificates() {
28 TSRMLS_FETCH();
29
30 HOOK_FUNCTION("curl_setopt", sp_internal_functions_hook, PHP_FN(sp_curl_setopt));
31
32 return SUCCESS;
33}