diff options
author | mestre <> | 2016-11-30 07:56:23 +0000 |
---|---|---|
committer | mestre <> | 2016-11-30 07:56:23 +0000 |
commit | 29a4eba2660e15d6604929fab28ea9dcabe0c013 (patch) | |
tree | 4c29647750f947849c17395c0a6cf3c1d7b59dc5 | |
parent | 60f1a54409e7682c49f9538405e9f43abb317363 (diff) | |
download | openbsd-29a4eba2660e15d6604929fab28ea9dcabe0c013.tar.gz openbsd-29a4eba2660e15d6604929fab28ea9dcabe0c013.tar.bz2 openbsd-29a4eba2660e15d6604929fab28ea9dcabe0c013.zip |
Check return value of tls_config_set_protocols(3) and tls_config_set_ciphers(3)
and bail out in case of failure
Feedback and OK jsing@
-rw-r--r-- | src/usr.bin/nc/netcat.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index 783aea25ed..c103aa6350 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: netcat.c,v 1.170 2016/11/06 13:33:30 beck Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.171 2016/11/30 07:56:23 mestre Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
4 | * Copyright (c) 2015 Bob Beck. All rights reserved. | 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. |
@@ -464,8 +464,11 @@ main(int argc, char *argv[]) | |||
464 | if (oflag && tls_config_set_ocsp_staple_file(tls_cfg, oflag) == -1) | 464 | if (oflag && tls_config_set_ocsp_staple_file(tls_cfg, oflag) == -1) |
465 | errx(1, "%s", tls_config_error(tls_cfg)); | 465 | errx(1, "%s", tls_config_error(tls_cfg)); |
466 | if (TLSopt & TLS_ALL) { | 466 | if (TLSopt & TLS_ALL) { |
467 | tls_config_set_protocols(tls_cfg, TLS_PROTOCOLS_ALL); | 467 | if (tls_config_set_protocols(tls_cfg, |
468 | tls_config_set_ciphers(tls_cfg, "all"); | 468 | TLS_PROTOCOLS_ALL) != 0) |
469 | errx(1, "%s", tls_config_error(tls_cfg)); | ||
470 | if (tls_config_set_ciphers(tls_cfg, "all") != 0) | ||
471 | errx(1, "%s", tls_config_error(tls_cfg)); | ||
469 | } | 472 | } |
470 | if (!lflag && (TLSopt & TLS_CCERT)) | 473 | if (!lflag && (TLSopt & TLS_CCERT)) |
471 | errx(1, "clientcert is only valid with -l"); | 474 | errx(1, "clientcert is only valid with -l"); |