12
12
* directly using the email address [email protected] .
13
13
*/
14
14
15
+ #include "modsecurity.h"
15
16
#include "re.h"
16
17
#include "msc_pcre.h"
17
18
#include "msc_geo.h"
@@ -1307,6 +1308,11 @@ static int msre_op_pmFromFile_param_init(msre_rule *rule, char **error_msg) {
1307
1308
1308
1309
if (curl ) {
1309
1310
struct curl_slist * headers_chunk = NULL ;
1311
+ #ifdef WIN32
1312
+ char * buf = malloc (sizeof (TCHAR ) * (2048 + 1 ));
1313
+ char * ptr = NULL ;
1314
+ DWORD res_len ;
1315
+ #endif
1310
1316
curl_easy_setopt (curl , CURLOPT_URL , fn );
1311
1317
1312
1318
headers_chunk = curl_slist_append (headers_chunk , apr_id );
@@ -1321,6 +1327,14 @@ static int msre_op_pmFromFile_param_init(msre_rule *rule, char **error_msg) {
1321
1327
/* Make it TLS 1.x only. */
1322
1328
curl_easy_setopt (curl , CURLOPT_SSLVERSION , CURL_SSLVERSION_TLSv1 );
1323
1329
1330
+ #ifdef WIN32
1331
+ res_len = SearchPathA (NULL , "curl-ca-bundle.crt" , NULL , (2048 + 1 ), buf , & ptr );
1332
+ if (res_len > 0 ) {
1333
+ curl_easy_setopt (curl , CURLOPT_CAINFO , strdup (buf ));
1334
+ }
1335
+ free (buf );
1336
+ #endif
1337
+
1324
1338
/* those are the default options, but lets make sure */
1325
1339
curl_easy_setopt (curl , CURLOPT_SSL_VERIFYPEER , 1 );
1326
1340
curl_easy_setopt (curl , CURLOPT_SSL_VERIFYHOST , 1 );
@@ -1333,7 +1347,22 @@ static int msre_op_pmFromFile_param_init(msre_rule *rule, char **error_msg) {
1333
1347
res = curl_easy_perform (curl );
1334
1348
1335
1349
if (res != CURLE_OK )
1336
- fprintf (stderr , "curl_easy_perform() failed: %s\n" , curl_easy_strerror (res ));
1350
+ {
1351
+ if (remote_rules_fail_action == REMOTE_RULES_WARN_ON_FAIL )
1352
+ {
1353
+ ap_log_error (APLOG_MARK , APLOG_NOTICE , 0 , NULL ,
1354
+ "Failed to fetch \"%s\" error: %s " , fn ,
1355
+ curl_easy_strerror (res ));
1356
+ return 1 ;
1357
+ }
1358
+ else
1359
+ {
1360
+ * error_msg = apr_psprintf (rule -> ruleset -> mp ,
1361
+ "Failed to fetch \"%s\" error: %s " , fn ,
1362
+ curl_easy_strerror (res ));
1363
+ return 0 ;
1364
+ }
1365
+ }
1337
1366
1338
1367
curl_easy_cleanup (curl );
1339
1368
curl_slist_free_all (headers_chunk );
0 commit comments