summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-04-19 19:18:05 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2016-04-19 19:29:17 +0200
commit590a4116577e8834115e78cbfb06af3cfc6120c6 (patch)
tree32d10cd069b3b936d1ff5c5311f5d8997e46c6c6
parent2f476d67150e6436a5cf4b08947656cfaf69a684 (diff)
downloadgnutls-590a4116577e8834115e78cbfb06af3cfc6120c6.tar.gz
tools: avoid extracting the value of the app-proto alias
Instead always extract the starttls-proto value, as it seems that libopts doesn't report any value for the former. This corrects the starttls capability of danetool and gnutls-cli-debug.
-rw-r--r--src/cli-debug.c12
-rw-r--r--src/danetool.c4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/cli-debug.c b/src/cli-debug.c
index 31e03c31d0..8ebec4e426 100644
--- a/src/cli-debug.c
+++ b/src/cli-debug.c
@@ -192,7 +192,7 @@ int main(int argc, char **argv)
gnutls_session_t state;
char portname[6];
socket_st hd;
- const char *app_proto = NULL;
+ char app_proto[32] = "";
cmd_parser(argc, argv);
@@ -235,12 +235,12 @@ int main(int argc, char **argv)
}
#endif
- if (HAVE_OPT(APP_PROTO)) {
- app_proto = OPT_ARG(APP_PROTO);
+ if (HAVE_OPT(STARTTLS_PROTO)) {
+ snprintf(app_proto, sizeof(app_proto), "%s", OPT_ARG(STARTTLS_PROTO));
}
- if (app_proto == NULL) {
- app_proto = port_to_service(portname, "tcp");
+ if (app_proto[0] == 0) {
+ snprintf(app_proto, sizeof(app_proto), "%s", port_to_service(portname, "tcp"));
}
sockets_init();
@@ -340,7 +340,7 @@ static void cmd_parser(int argc, char **argv)
if (HAVE_OPT(PORT))
port = OPT_VALUE_PORT;
else {
- if (HAVE_OPT(APP_PROTO))
+ if (HAVE_OPT(STARTTLS_PROTO))
port = starttls_proto_to_port(OPT_ARG(STARTTLS_PROTO));
else
port = 443;
diff --git a/src/danetool.c b/src/danetool.c
index 49f0b2029e..895affc557 100644
--- a/src/danetool.c
+++ b/src/danetool.c
@@ -218,8 +218,8 @@ static void dane_check(const char *host, const char *proto,
if (!cinfo->cert) {
const char *app_proto = NULL;
- if (HAVE_OPT(APP_PROTO))
- app_proto = OPT_ARG(APP_PROTO);
+ if (HAVE_OPT(STARTTLS_PROTO))
+ app_proto = OPT_ARG(STARTTLS_PROTO);
cinfo->cert = obtain_cert(host, proto, port, app_proto, HAVE_OPT(QUIET));
del = 1;