diff options
author | djm@openbsd.org <djm@openbsd.org> | 2017-08-18 05:48:04 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-08-23 19:47:06 +1000 |
commit | b074c3c3f820000a21953441cea7699c4b17d72f (patch) | |
tree | 9304faf8fcaef5893524a7283450de2b75b1d8ea | |
parent | de4ae07f12dabf8815ecede54235fce5d22e3f63 (diff) |
upstream commit
add a "quiet" flag to exited_cleanly() that supresses
errors about exit status (failure due to signal is still reported)
Upstream-ID: db85c39c3aa08e6ff67fc1fb4ffa89f807a9d2f0
-rw-r--r-- | auth2-pubkey.c | 6 | ||||
-rw-r--r-- | misc.c | 7 | ||||
-rw-r--r-- | misc.h | 4 |
3 files changed, 9 insertions, 8 deletions
diff --git a/auth2-pubkey.c b/auth2-pubkey.c index 0b1e88deb..e1845d7d5 100644 --- a/auth2-pubkey.c +++ b/auth2-pubkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-pubkey.c,v 1.69 2017/08/18 05:36:45 djm Exp $ */ | 1 | /* $OpenBSD: auth2-pubkey.c,v 1.70 2017/08/18 05:48:04 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -437,7 +437,7 @@ match_principals_command(struct passwd *user_pw, const struct sshkey *key) | |||
437 | fclose(f); | 437 | fclose(f); |
438 | f = NULL; | 438 | f = NULL; |
439 | 439 | ||
440 | if (exited_cleanly(pid, "AuthorizedPrincipalsCommand", command) != 0) | 440 | if (exited_cleanly(pid, "AuthorizedPrincipalsCommand", command, 0) != 0) |
441 | goto out; | 441 | goto out; |
442 | 442 | ||
443 | /* Read completed successfully */ | 443 | /* Read completed successfully */ |
@@ -767,7 +767,7 @@ user_key_command_allowed2(struct passwd *user_pw, struct sshkey *key) | |||
767 | fclose(f); | 767 | fclose(f); |
768 | f = NULL; | 768 | f = NULL; |
769 | 769 | ||
770 | if (exited_cleanly(pid, "AuthorizedKeysCommand", command) != 0) | 770 | if (exited_cleanly(pid, "AuthorizedKeysCommand", command, 0) != 0) |
771 | goto out; | 771 | goto out; |
772 | 772 | ||
773 | /* Read completed successfully */ | 773 | /* Read completed successfully */ |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.112 2017/08/18 05:36:45 djm Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.113 2017/08/18 05:48:04 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
@@ -1570,7 +1570,7 @@ subprocess(const char *tag, struct passwd *pw, const char *command, | |||
1570 | 1570 | ||
1571 | /* Returns 0 if pid exited cleanly, non-zero otherwise */ | 1571 | /* Returns 0 if pid exited cleanly, non-zero otherwise */ |
1572 | int | 1572 | int |
1573 | exited_cleanly(pid_t pid, const char *tag, const char *cmd) | 1573 | exited_cleanly(pid_t pid, const char *tag, const char *cmd, int quiet) |
1574 | { | 1574 | { |
1575 | int status; | 1575 | int status; |
1576 | 1576 | ||
@@ -1584,7 +1584,8 @@ exited_cleanly(pid_t pid, const char *tag, const char *cmd) | |||
1584 | error("%s %s exited on signal %d", tag, cmd, WTERMSIG(status)); | 1584 | error("%s %s exited on signal %d", tag, cmd, WTERMSIG(status)); |
1585 | return -1; | 1585 | return -1; |
1586 | } else if (WEXITSTATUS(status) != 0) { | 1586 | } else if (WEXITSTATUS(status) != 0) { |
1587 | error("%s %s failed, status %d", tag, cmd, WEXITSTATUS(status)); | 1587 | do_log2(quiet ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_INFO, |
1588 | "%s %s failed, status %d", tag, cmd, WEXITSTATUS(status)); | ||
1588 | return -1; | 1589 | return -1; |
1589 | } | 1590 | } |
1590 | return 0; | 1591 | return 0; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.h,v 1.62 2017/08/18 05:36:45 djm Exp $ */ | 1 | /* $OpenBSD: misc.h,v 1.63 2017/08/18 05:48:04 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -138,7 +138,7 @@ void child_set_env(char ***envp, u_int *envsizep, const char *name, | |||
138 | 138 | ||
139 | int argv_split(const char *, int *, char ***); | 139 | int argv_split(const char *, int *, char ***); |
140 | char *argv_assemble(int, char **argv); | 140 | char *argv_assemble(int, char **argv); |
141 | int exited_cleanly(pid_t, const char *, const char *); | 141 | int exited_cleanly(pid_t, const char *, const char *, int); |
142 | 142 | ||
143 | #define SSH_SUBPROCESS_STDOUT_DISCARD (1) /* Discard stdout */ | 143 | #define SSH_SUBPROCESS_STDOUT_DISCARD (1) /* Discard stdout */ |
144 | #define SSH_SUBPROCESS_STDOUT_CAPTURE (1<<1) /* Redirect stdout */ | 144 | #define SSH_SUBPROCESS_STDOUT_CAPTURE (1<<1) /* Redirect stdout */ |