|
|
bb7cd1 |
From f63d4b3749fd76796a26f1c1f07bdddcb681a768 Mon Sep 17 00:00:00 2001
|
|
|
bb7cd1 |
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
|
|
|
bb7cd1 |
Date: Mon, 13 Mar 2017 13:30:48 +0100
|
|
|
bb7cd1 |
Subject: [PATCH 80/90] tcurl test: add support for client certificate
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
Reviewed-by: Simo Sorce <simo@redhat.com>
|
|
|
bb7cd1 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
bb7cd1 |
(cherry picked from commit ae6b11229d9961e26922918183c7c1de7780b8d6)
|
|
|
bb7cd1 |
---
|
|
|
bb7cd1 |
src/tests/tcurl_test_tool.c | 13 +++++++++++++
|
|
|
bb7cd1 |
1 file changed, 13 insertions(+)
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
diff --git a/src/tests/tcurl_test_tool.c b/src/tests/tcurl_test_tool.c
|
|
|
bb7cd1 |
index 63a3e26b561781795873c2a4d72ac071a4da9939..fbc2790357b131ebb21b4be041688e5f699d73e7 100644
|
|
|
bb7cd1 |
--- a/src/tests/tcurl_test_tool.c
|
|
|
bb7cd1 |
+++ b/src/tests/tcurl_test_tool.c
|
|
|
bb7cd1 |
@@ -47,6 +47,9 @@ struct tool_options {
|
|
|
bb7cd1 |
const char *capath;
|
|
|
bb7cd1 |
const char *cacert;
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+ const char *clientcert;
|
|
|
bb7cd1 |
+ const char *clientkey;
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
const char *username;
|
|
|
bb7cd1 |
const char *password;
|
|
|
bb7cd1 |
};
|
|
|
bb7cd1 |
@@ -201,6 +204,14 @@ prepare_requests(TALLOC_CTX *mem_ctx,
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
}
|
|
|
bb7cd1 |
|
|
|
bb7cd1 |
+ if (opts->clientcert != NULL) {
|
|
|
bb7cd1 |
+ ret = tcurl_req_set_client_cert(requests[i], opts->clientcert,
|
|
|
bb7cd1 |
+ opts->clientkey);
|
|
|
bb7cd1 |
+ if (ret != EOK) {
|
|
|
bb7cd1 |
+ goto done;
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+ }
|
|
|
bb7cd1 |
+
|
|
|
bb7cd1 |
if (opts->username != NULL && opts->password != NULL) {
|
|
|
bb7cd1 |
ret = tcurl_req_http_basic_auth(requests[i], opts->username,
|
|
|
bb7cd1 |
opts->password);
|
|
|
bb7cd1 |
@@ -317,6 +328,8 @@ int main(int argc, const char *argv[])
|
|
|
bb7cd1 |
{ "verify-host", '\0', POPT_ARG_NONE, &opts.verify_host, '\0', "Verify host when TLS is enabled", NULL },
|
|
|
bb7cd1 |
{ "capath", '\0', POPT_ARG_STRING, &opts.capath, '\0', "Path to CA directory where peer certificate is stored", NULL },
|
|
|
bb7cd1 |
{ "cacert", '\0', POPT_ARG_STRING, &opts.cacert, '\0', "Path to CA certificate", NULL },
|
|
|
bb7cd1 |
+ { "clientcert", '\0', POPT_ARG_STRING, &opts.clientcert, '\0', "Path to client's certificate", NULL },
|
|
|
bb7cd1 |
+ { "clientkey", '\0', POPT_ARG_STRING, &opts.clientkey, '\0', "Path to client's private key", NULL },
|
|
|
bb7cd1 |
/* BASIC AUTH */
|
|
|
bb7cd1 |
{ "username", '\0', POPT_ARG_STRING, &opts.username, '\0', "Username for basic authentication", NULL },
|
|
|
bb7cd1 |
{ "password", '\0', POPT_ARG_STRING, &opts.password, '\0', "Password for basic authentication", NULL },
|
|
|
bb7cd1 |
--
|
|
|
bb7cd1 |
2.9.3
|
|
|
bb7cd1 |
|