|
|
4b6aa8 |
From 6cfe559cb537c2f34837c5d9a40c80b2cda37d4c Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
4b6aa8 |
Date: Mon, 9 Nov 2015 13:23:55 +0100
|
|
|
4b6aa8 |
Subject: [PATCH] curl: add possibility to configure SSH keys
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Related to rhbz#1289513
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Conflicts:
|
|
|
4b6aa8 |
src/lib/curl.c
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
src/include/libreport_curl.h | 3 +++
|
|
|
4b6aa8 |
src/lib/curl.c | 6 ++++++
|
|
|
4b6aa8 |
2 files changed, 9 insertions(+)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/src/include/libreport_curl.h b/src/include/libreport_curl.h
|
|
|
4b6aa8 |
index b9277ad..ec2e0b3 100644
|
|
|
4b6aa8 |
--- a/src/include/libreport_curl.h
|
|
|
4b6aa8 |
+++ b/src/include/libreport_curl.h
|
|
|
4b6aa8 |
@@ -38,6 +38,9 @@ typedef struct post_state {
|
|
|
4b6aa8 |
const char *client_cert_path;
|
|
|
4b6aa8 |
const char *client_key_path;
|
|
|
4b6aa8 |
const char *cert_authority_cert_path;
|
|
|
4b6aa8 |
+ /* SSH key files */
|
|
|
4b6aa8 |
+ const char *client_ssh_public_keyfile;
|
|
|
4b6aa8 |
+ const char *client_ssh_private_keyfile;
|
|
|
4b6aa8 |
/* Results of POST transaction: */
|
|
|
4b6aa8 |
int http_resp_code;
|
|
|
4b6aa8 |
/* cast from CURLcode enum.
|
|
|
4b6aa8 |
diff --git a/src/lib/curl.c b/src/lib/curl.c
|
|
|
4b6aa8 |
index a64c464..2cc1058 100644
|
|
|
4b6aa8 |
--- a/src/lib/curl.c
|
|
|
4b6aa8 |
+++ b/src/lib/curl.c
|
|
|
4b6aa8 |
@@ -351,6 +351,12 @@ post(post_state_t *state,
|
|
|
4b6aa8 |
xcurl_easy_setopt_ptr(handle, CURLOPT_PASSWORD, (state->password ? state->password : ""));
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
+ /* set SSH public and private keyfile if configured */
|
|
|
4b6aa8 |
+ if (state->client_ssh_public_keyfile)
|
|
|
4b6aa8 |
+ xcurl_easy_setopt_ptr(handle, CURLOPT_SSH_PUBLIC_KEYFILE, state->client_ssh_public_keyfile);
|
|
|
4b6aa8 |
+ if (state->client_ssh_private_keyfile)
|
|
|
4b6aa8 |
+ xcurl_easy_setopt_ptr(handle, CURLOPT_SSH_PRIVATE_KEYFILE, state->client_ssh_private_keyfile);
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
if (data_size != POST_DATA_FROMFILE_PUT)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
// Do a HTTP POST. This also makes curl use
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
1.8.3.1
|
|
|
4b6aa8 |
|