diff options
author | djm@openbsd.org <djm@openbsd.org> | 2016-12-30 22:08:02 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-01-03 15:24:42 +1100 |
commit | ddd3d34e5c7979ca6f4a3a98a7d219a4ed3d98c2 (patch) | |
tree | 181cd414e1acccae17cd491185a65bdf0cd38772 | |
parent | 30eee7d1b2fec33c14870cc11910610be5d2aa6f (diff) |
upstream commit
fix deadlock when keys/principals command produces a lot of
output and a key is matched early; bz#2655, patch from jboning AT gmail.com
Upstream-ID: e19456429bf99087ea994432c16d00a642060afe
-rw-r--r-- | auth2-pubkey.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/auth2-pubkey.c b/auth2-pubkey.c index 20f3309e1..70c021589 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-pubkey.c,v 1.60 2016/11/30 02:57:40 djm Exp $ */ | 1 | /* $OpenBSD: auth2-pubkey.c,v 1.61 2016/12/30 22:08:02 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -727,6 +727,9 @@ match_principals_command(struct passwd *user_pw, const struct sshkey *key) | |||
727 | 727 | ||
728 | ok = process_principals(f, NULL, pw, cert); | 728 | ok = process_principals(f, NULL, pw, cert); |
729 | 729 | ||
730 | fclose(f); | ||
731 | f = NULL; | ||
732 | |||
730 | if (exited_cleanly(pid, "AuthorizedPrincipalsCommand", command) != 0) | 733 | if (exited_cleanly(pid, "AuthorizedPrincipalsCommand", command) != 0) |
731 | goto out; | 734 | goto out; |
732 | 735 | ||
@@ -1050,6 +1053,9 @@ user_key_command_allowed2(struct passwd *user_pw, Key *key) | |||
1050 | 1053 | ||
1051 | ok = check_authkeys_file(f, options.authorized_keys_command, key, pw); | 1054 | ok = check_authkeys_file(f, options.authorized_keys_command, key, pw); |
1052 | 1055 | ||
1056 | fclose(f); | ||
1057 | f = NULL; | ||
1058 | |||
1053 | if (exited_cleanly(pid, "AuthorizedKeysCommand", command) != 0) | 1059 | if (exited_cleanly(pid, "AuthorizedKeysCommand", command) != 0) |
1054 | goto out; | 1060 | goto out; |
1055 | 1061 | ||