|
|
057568 |
From 5cbc284813a85df42d8031612030f1f27d8ea075 Mon Sep 17 00:00:00 2001
|
|
|
057568 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
057568 |
Date: Thu, 3 Sep 2015 13:54:38 +0200
|
|
|
057568 |
Subject: [PATCH] curl: add posibility to use own Certificate Authority cert
|
|
|
057568 |
|
|
|
057568 |
Related to rhbz#1223805
|
|
|
057568 |
|
|
|
057568 |
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
057568 |
---
|
|
|
057568 |
src/include/libreport_curl.h | 1 +
|
|
|
057568 |
src/lib/curl.c | 2 ++
|
|
|
057568 |
2 files changed, 3 insertions(+)
|
|
|
057568 |
|
|
|
057568 |
diff --git a/src/include/libreport_curl.h b/src/include/libreport_curl.h
|
|
|
057568 |
index 4b41ecc..812738c 100644
|
|
|
057568 |
--- a/src/include/libreport_curl.h
|
|
|
057568 |
+++ b/src/include/libreport_curl.h
|
|
|
057568 |
@@ -37,6 +37,7 @@ typedef struct post_state {
|
|
|
057568 |
const char *password;
|
|
|
057568 |
const char *client_cert_path;
|
|
|
057568 |
const char *client_key_path;
|
|
|
057568 |
+ const char *cert_authority_cert_path;
|
|
|
057568 |
/* Results of POST transaction: */
|
|
|
057568 |
int http_resp_code;
|
|
|
057568 |
/* cast from CURLcode enum.
|
|
|
057568 |
diff --git a/src/lib/curl.c b/src/lib/curl.c
|
|
|
057568 |
index f7321b5..606d9ea 100644
|
|
|
057568 |
--- a/src/lib/curl.c
|
|
|
057568 |
+++ b/src/lib/curl.c
|
|
|
057568 |
@@ -542,6 +542,8 @@ post(post_state_t *state,
|
|
|
057568 |
xcurl_easy_setopt_ptr(handle, CURLOPT_SSLCERT, state->client_cert_path);
|
|
|
057568 |
xcurl_easy_setopt_ptr(handle, CURLOPT_SSLKEY, state->client_key_path);
|
|
|
057568 |
}
|
|
|
057568 |
+ if (state->cert_authority_cert_path)
|
|
|
057568 |
+ xcurl_easy_setopt_ptr(handle, CURLOPT_CAINFO, state->cert_authority_cert_path);
|
|
|
057568 |
|
|
|
057568 |
// This is the place where everything happens.
|
|
|
057568 |
// Here errors are not limited to "out of memory", can't just die.
|
|
|
057568 |
--
|
|
|
057568 |
2.4.3
|
|
|
057568 |
|