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

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