diff options
author | djm@openbsd.org@openbsd.org <djm@openbsd.org@openbsd.org> | 2017-11-15 02:10:16 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-11-15 13:25:16 +1100 |
commit | 83a1e5dbec52d05775174f368e0c44b08619a308 (patch) | |
tree | 824efa545f1b8e8e34a177e30ed3453039de8307 /ssh-agent.c | |
parent | 93c68a8f3da8e5e6acdc3396f54d73919165e242 (diff) |
upstream commit
downgrade a couple more request parsing errors from
process-fatal to just returning failure, making them consistent with the
others that were already like that.
OpenBSD-Commit-ID: c111461f7a626690a2d53018ef26557b34652918
Diffstat (limited to 'ssh-agent.c')
-rw-r--r-- | ssh-agent.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/ssh-agent.c b/ssh-agent.c index a25f60a42..8cb00f620 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.225 2017/11/15 00:13:40 djm Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.226 2017/11/15 02:10:16 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -475,6 +475,11 @@ process_lock_agent(SocketEntry *e, int lock) | |||
475 | static u_int fail_count = 0; | 475 | static u_int fail_count = 0; |
476 | size_t pwlen; | 476 | size_t pwlen; |
477 | 477 | ||
478 | /* | ||
479 | * This is deliberately fatal: the user has requested that we lock, | ||
480 | * but we can't parse their request properly. The only safe thing to | ||
481 | * do is abort. | ||
482 | */ | ||
478 | if ((r = sshbuf_get_cstring(e->request, &passwd, &pwlen)) != 0) | 483 | if ((r = sshbuf_get_cstring(e->request, &passwd, &pwlen)) != 0) |
479 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 484 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
480 | if (pwlen == 0) { | 485 | if (pwlen == 0) { |
@@ -532,7 +537,7 @@ no_identities(SocketEntry *e) | |||
532 | static void | 537 | static void |
533 | process_add_smartcard_key(SocketEntry *e) | 538 | process_add_smartcard_key(SocketEntry *e) |
534 | { | 539 | { |
535 | char *provider = NULL, *pin, canonical_provider[PATH_MAX]; | 540 | char *provider = NULL, *pin = NULL, canonical_provider[PATH_MAX]; |
536 | int r, i, count = 0, success = 0, confirm = 0; | 541 | int r, i, count = 0, success = 0, confirm = 0; |
537 | u_int seconds; | 542 | u_int seconds; |
538 | time_t death = 0; | 543 | time_t death = 0; |
@@ -541,17 +546,23 @@ process_add_smartcard_key(SocketEntry *e) | |||
541 | Identity *id; | 546 | Identity *id; |
542 | 547 | ||
543 | if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 || | 548 | if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 || |
544 | (r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0) | 549 | (r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0) { |
545 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 550 | error("%s: buffer error: %s", __func__, ssh_err(r)); |
551 | goto send; | ||
552 | } | ||
546 | 553 | ||
547 | while (sshbuf_len(e->request)) { | 554 | while (sshbuf_len(e->request)) { |
548 | if ((r = sshbuf_get_u8(e->request, &type)) != 0) | 555 | if ((r = sshbuf_get_u8(e->request, &type)) != 0) { |
549 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 556 | error("%s: buffer error: %s", __func__, ssh_err(r)); |
557 | goto send; | ||
558 | } | ||
550 | switch (type) { | 559 | switch (type) { |
551 | case SSH_AGENT_CONSTRAIN_LIFETIME: | 560 | case SSH_AGENT_CONSTRAIN_LIFETIME: |
552 | if ((r = sshbuf_get_u32(e->request, &seconds)) != 0) | 561 | if ((r = sshbuf_get_u32(e->request, &seconds)) != 0) { |
553 | fatal("%s: buffer error: %s", | 562 | error("%s: buffer error: %s", |
554 | __func__, ssh_err(r)); | 563 | __func__, ssh_err(r)); |
564 | goto send; | ||
565 | } | ||
555 | death = monotime() + seconds; | 566 | death = monotime() + seconds; |
556 | break; | 567 | break; |
557 | case SSH_AGENT_CONSTRAIN_CONFIRM: | 568 | case SSH_AGENT_CONSTRAIN_CONFIRM: |
@@ -609,8 +620,10 @@ process_remove_smartcard_key(SocketEntry *e) | |||
609 | Identity *id, *nxt; | 620 | Identity *id, *nxt; |
610 | 621 | ||
611 | if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 || | 622 | if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 || |
612 | (r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0) | 623 | (r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0) { |
613 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 624 | error("%s: buffer error: %s", __func__, ssh_err(r)); |
625 | goto send; | ||
626 | } | ||
614 | free(pin); | 627 | free(pin); |
615 | 628 | ||
616 | if (realpath(provider, canonical_provider) == NULL) { | 629 | if (realpath(provider, canonical_provider) == NULL) { |