richardphibel / rpms / librepo

Forked from rpms/librepo 2 years ago
Clone

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

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