diff options
| author | beck <> | 2016-05-28 20:14:58 +0000 |
|---|---|---|
| committer | beck <> | 2016-05-28 20:14:58 +0000 |
| commit | 65c8b2b5e47029e67e45d0eff9cc3c8c5e36fe44 (patch) | |
| tree | f1698990770eee94b68ae13263779569b2ed59a5 /src | |
| parent | e479cbbb4e2e2b99b6caa4de1c40b4992027ebe2 (diff) | |
| download | openbsd-65c8b2b5e47029e67e45d0eff9cc3c8c5e36fe44.tar.gz openbsd-65c8b2b5e47029e67e45d0eff9cc3c8c5e36fe44.tar.bz2 openbsd-65c8b2b5e47029e67e45d0eff9cc3c8c5e36fe44.zip | |
Fix pledge violation with -P s used and we need to supply a password
for an http proxy - we need tty in this case. Found and fixed by
Anthony Coulter <bsd@anthonycoulter.name>.
ok tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/nc/netcat.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index 1b22308d5a..95f276bc89 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.151 2016/05/28 19:39:16 beck Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.152 2016/05/28 20:14:58 beck 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. |
| @@ -323,7 +323,13 @@ main(int argc, char *argv[]) | |||
| 323 | if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) | 323 | if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1) |
| 324 | err(1, "pledge"); | 324 | err(1, "pledge"); |
| 325 | } else if (Fflag) { | 325 | } else if (Fflag) { |
| 326 | if (pledge("stdio inet dns sendfd", NULL) == -1) | 326 | if (Pflag) { |
| 327 | if (pledge("stdio inet dns sendfd tty", NULL) == -1) | ||
| 328 | err(1, "pledge"); | ||
| 329 | } else if (pledge("stdio inet dns sendfd", NULL) == -1) | ||
| 330 | err(1, "pledge"); | ||
| 331 | } else if (Pflag) { | ||
| 332 | if (pledge("stdio inet dns tty", NULL) == -1) | ||
| 327 | err(1, "pledge"); | 333 | err(1, "pledge"); |
| 328 | } else if (usetls) { | 334 | } else if (usetls) { |
| 329 | if (pledge("stdio rpath inet dns", NULL) == -1) | 335 | if (pledge("stdio rpath inet dns", NULL) == -1) |
| @@ -434,7 +440,10 @@ main(int argc, char *argv[]) | |||
| 434 | if (Kflag && (privkey = tls_load_file(Kflag, &privkeylen, NULL)) == NULL) | 440 | if (Kflag && (privkey = tls_load_file(Kflag, &privkeylen, NULL)) == NULL) |
| 435 | errx(1, "unable to load TLS key file %s", Kflag); | 441 | errx(1, "unable to load TLS key file %s", Kflag); |
| 436 | 442 | ||
| 437 | if (pledge("stdio inet dns", NULL) == -1) | 443 | if (Pflag) { |
| 444 | if (pledge("stdio inet dns tty", NULL) == -1) | ||
| 445 | err(1, "pledge"); | ||
| 446 | } else if (pledge("stdio inet dns", NULL) == -1) | ||
| 438 | err(1, "pledge"); | 447 | err(1, "pledge"); |
| 439 | 448 | ||
| 440 | if (tls_init() == -1) | 449 | if (tls_init() == -1) |
