richardphibel / rpms / librepo

Forked from rpms/librepo 2 years ago
Clone

Blame SOURCES/0002-Add-support-for-pkcs11-certificate-and-key-for-repos.patch

64c3ea
From 1e7673d07308081f13e7bb1829cfed2ccd865ea0 Mon Sep 17 00:00:00 2001
64c3ea
From: Masahiro Matsuya <mmatsuya@redhat.com>
64c3ea
Date: Fri, 13 Nov 2020 17:37:59 +0100
64c3ea
Subject: [PATCH] Add support for pkcs11 certificate and key for repository
64c3ea
 authorization
64c3ea
64c3ea
msg: Add support for pkcs11 certificate and key for repository authorization
64c3ea
type: enhancement
64c3ea
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1859495
64c3ea
---
64c3ea
 librepo/handle.c | 6 ++++++
64c3ea
 1 file changed, 6 insertions(+)
64c3ea
64c3ea
diff --git a/librepo/handle.c b/librepo/handle.c
64c3ea
index d8728c4..33edf5d 100644
64c3ea
--- a/librepo/handle.c
64c3ea
+++ b/librepo/handle.c
64c3ea
@@ -649,6 +649,9 @@ lr_handle_setopt(LrHandle *handle,
64c3ea
             lr_free(handle->sslclientcert);
64c3ea
         handle->sslclientcert = g_strdup(va_arg(arg, char *));
64c3ea
         c_rc = curl_easy_setopt(c_h, CURLOPT_SSLCERT, handle->sslclientcert);
64c3ea
+        if (c_rc == CURLE_OK && handle->sslclientcert && !strncasecmp(handle->sslclientcert, "pkcs11:", 7)) {
64c3ea
+            c_rc = curl_easy_setopt(c_h, CURLOPT_SSLCERTTYPE, "ENG");
64c3ea
+        }
64c3ea
         break;
64c3ea
 
64c3ea
     case LRO_SSLCLIENTKEY:
64c3ea
@@ -656,6 +659,9 @@ lr_handle_setopt(LrHandle *handle,
64c3ea
             lr_free(handle->sslclientkey);
64c3ea
         handle->sslclientkey = g_strdup(va_arg(arg, char *));
64c3ea
         c_rc = curl_easy_setopt(c_h, CURLOPT_SSLKEY, handle->sslclientkey);
64c3ea
+        if (c_rc == CURLE_OK && handle->sslclientkey && !strncasecmp(handle->sslclientkey, "pkcs11:", 7)) {
64c3ea
+            c_rc = curl_easy_setopt(c_h, CURLOPT_SSLKEYTYPE, "ENG");
64c3ea
+        }
64c3ea
         break;
64c3ea
 
64c3ea
     case LRO_SSLCACERT:
64c3ea
-- 
64c3ea
2.26.2
64c3ea