Blame SOURCES/0179-curl-add-possibility-to-configure-SSH-keys.patch

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