summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2017-08-18 05:48:05 +0000
committerDamien Miller <djm@cvs.openbsd.org>2017-08-18 05:48:05 +0000
commit1da0cf8d55dd0de89b7806881498f8b79eeadc0a (patch)
treeff06f1c35cd5d6ee5a56e9477b03e25bfde51636
parent29925b9eaf53cfd7167481927a56c17e9af3d3b5 (diff)
add a "quiet" flag to exited_cleanly() that supresses errors about
exit status (failure due to signal is still reported)
-rw-r--r--usr.bin/ssh/auth2-pubkey.c6
-rw-r--r--usr.bin/ssh/misc.c7
-rw-r--r--usr.bin/ssh/misc.h4
3 files changed, 9 insertions, 8 deletions
diff --git a/usr.bin/ssh/auth2-pubkey.c b/usr.bin/ssh/auth2-pubkey.c
index 0665eddb68f..fe3c206aae5 100644
--- a/usr.bin/ssh/auth2-pubkey.c
+++ b/usr.bin/ssh/auth2-pubkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-pubkey.c,v 1.69 2017/08/18 05:36:45 djm Exp $ */
+/* $OpenBSD: auth2-pubkey.c,v 1.70 2017/08/18 05:48:04 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -434,7 +434,7 @@ match_principals_command(struct passwd *user_pw, const struct sshkey *key)
fclose(f);
f = NULL;
- if (exited_cleanly(pid, "AuthorizedPrincipalsCommand", command) != 0)
+ if (exited_cleanly(pid, "AuthorizedPrincipalsCommand", command, 0) != 0)
goto out;
/* Read completed successfully */
@@ -764,7 +764,7 @@ user_key_command_allowed2(struct passwd *user_pw, struct sshkey *key)
fclose(f);
f = NULL;
- if (exited_cleanly(pid, "AuthorizedKeysCommand", command) != 0)
+ if (exited_cleanly(pid, "AuthorizedKeysCommand", command, 0) != 0)
goto out;
/* Read completed successfully */
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c
index 286179824d7..672701d2e79 100644
--- a/usr.bin/ssh/misc.c
+++ b/usr.bin/ssh/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.112 2017/08/18 05:36:45 djm Exp $ */
+/* $OpenBSD: misc.c,v 1.113 2017/08/18 05:48:04 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -1504,7 +1504,7 @@ subprocess(const char *tag, struct passwd *pw, const char *command,
/* Returns 0 if pid exited cleanly, non-zero otherwise */
int
-exited_cleanly(pid_t pid, const char *tag, const char *cmd)
+exited_cleanly(pid_t pid, const char *tag, const char *cmd, int quiet)
{
int status;
@@ -1518,7 +1518,8 @@ exited_cleanly(pid_t pid, const char *tag, const char *cmd)
error("%s %s exited on signal %d", tag, cmd, WTERMSIG(status));
return -1;
} else if (WEXITSTATUS(status) != 0) {
- error("%s %s failed, status %d", tag, cmd, WEXITSTATUS(status));
+ do_log2(quiet ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_INFO,
+ "%s %s failed, status %d", tag, cmd, WEXITSTATUS(status));
return -1;
}
return 0;
diff --git a/usr.bin/ssh/misc.h b/usr.bin/ssh/misc.h
index ae8f1455450..f10347bc33d 100644
--- a/usr.bin/ssh/misc.h
+++ b/usr.bin/ssh/misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.h,v 1.62 2017/08/18 05:36:45 djm Exp $ */
+/* $OpenBSD: misc.h,v 1.63 2017/08/18 05:48:04 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -136,7 +136,7 @@ void child_set_env(char ***envp, u_int *envsizep, const char *name,
int argv_split(const char *, int *, char ***);
char *argv_assemble(int, char **argv);
-int exited_cleanly(pid_t, const char *, const char *);
+int exited_cleanly(pid_t, const char *, const char *, int);
#define SSH_SUBPROCESS_STDOUT_DISCARD (1) /* Discard stdout */
#define SSH_SUBPROCESS_STDOUT_CAPTURE (1<<1) /* Redirect stdout */