summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2017-02-28 13:32:31 +0100
committerLukas Slebodnik <lslebodn@redhat.com>2017-03-30 19:07:13 +0200
commitc2ea75da72b426d98ba489039e220d417bfb4c2a (patch)
tree666294bebdd975d7a345cf1f963e616895cd0666 /src/tests
parent886e0f75e6f4c7877a23a3625f8a20c09109b09d (diff)
tcurl: add support for http basic auth
Reviewed-by: Simo Sorce <simo@redhat.com> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/tcurl_test_tool.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tests/tcurl_test_tool.c b/src/tests/tcurl_test_tool.c
index 9cec000fb..4ceef8e06 100644
--- a/src/tests/tcurl_test_tool.c
+++ b/src/tests/tcurl_test_tool.c
@@ -45,6 +45,9 @@ struct tool_options {
const char *socket_path;
const char *capath;
const char *cacert;
+
+ const char *username;
+ const char *password;
};
static void request_done(struct tevent_req *req)
@@ -194,6 +197,14 @@ prepare_requests(TALLOC_CTX *mem_ctx,
}
}
+ if (opts->username != NULL && opts->password != NULL) {
+ ret = tcurl_req_http_basic_auth(requests[i], opts->username,
+ opts->password);
+ if (ret != EOK) {
+ goto done;
+ }
+ }
+
i++;
}
@@ -299,6 +310,9 @@ int main(int argc, const char *argv[])
{ "verify-host", '\0', POPT_ARG_NONE, &opts.verify_host, '\0', "Verify host when TLS is enabled", NULL },
{ "capath", '\0', POPT_ARG_STRING, &opts.capath, '\0', "Path to CA directory where peer certificate is stored", NULL },
{ "cacert", '\0', POPT_ARG_STRING, &opts.cacert, '\0', "Path to CA certificate", NULL },
+ /* BASIC AUTH */
+ { "username", '\0', POPT_ARG_STRING, &opts.username, '\0', "Username for basic authentication", NULL },
+ { "password", '\0', POPT_ARG_STRING, &opts.password, '\0', "Password for basic authentication", NULL },
POPT_TABLEEND
};