From: Peter Krempa <pkre...@redhat.com>

We now always load a list of certificates rather than only the first one
so this function is not used any more.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/rpc/virnettlscert.c | 41 -----------------------------------------
 src/rpc/virnettlscert.h |  3 ---
 2 files changed, 44 deletions(-)

diff --git a/src/rpc/virnettlscert.c b/src/rpc/virnettlscert.c
index 2724f55bbe..5e036a4f2b 100644
--- a/src/rpc/virnettlscert.c
+++ b/src/rpc/virnettlscert.c
@@ -367,47 +367,6 @@ static int virNetTLSCertCheckPair(gnutls_x509_crt_t cert,
 }


-gnutls_x509_crt_t virNetTLSCertLoadFromFile(const char *certFile,
-                                            bool isServer)
-{
-    gnutls_datum_t data;
-    gnutls_x509_crt_t cert = NULL;
-    g_autofree char *buf = NULL;
-    int ret = -1;
-
-    VIR_DEBUG("isServer %d certFile %s",
-              isServer, certFile);
-
-    if (gnutls_x509_crt_init(&cert) < 0) {
-        virReportError(VIR_ERR_SYSTEM_ERROR, "%s",
-                       _("Unable to initialize certificate"));
-        goto cleanup;
-    }
-
-    if (virFileReadAll(certFile, (1<<16), &buf) < 0)
-        goto cleanup;
-
-    data.data = (unsigned char *)buf;
-    data.size = strlen(buf);
-
-    if (gnutls_x509_crt_import(cert, &data, GNUTLS_X509_FMT_PEM) < 0) {
-        virReportError(VIR_ERR_SYSTEM_ERROR, isServer ?
-                       _("Unable to import server certificate %1$s") :
-                       _("Unable to import client certificate %1$s"),
-                       certFile);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    if (ret != 0) {
-        g_clear_pointer(&cert, gnutls_x509_crt_deinit);
-    }
-    return cert;
-}
-
-
 int virNetTLSCertLoadListFromFile(const char *certFile,
                                   gnutls_x509_crt_t *certs,
                                   unsigned int certMax,
diff --git a/src/rpc/virnettlscert.h b/src/rpc/virnettlscert.h
index a2f591d172..aa0fe16a91 100644
--- a/src/rpc/virnettlscert.h
+++ b/src/rpc/virnettlscert.h
@@ -38,9 +38,6 @@ char *virNetTLSCertValidate(gnutls_x509_crt_t cert,
                             const char *hostname,
                             const char *const *x509dnACL);

-gnutls_x509_crt_t virNetTLSCertLoadFromFile(const char *certFile,
-                                            bool isServer);
-
 int virNetTLSCertLoadListFromFile(const char *certFile,
                                   gnutls_x509_crt_t *certs,
                                   unsigned int certMax,
-- 
2.50.0

Reply via email to