summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2008-10-08 23:34:03 +0000
committerdjm <djm@openbsd.org>2008-10-08 23:34:03 +0000
commitc5f6d1ebf2a3bb19ac389fbe89b9a14998b4fa0d (patch)
tree9acfb4c2590d59e9e5c2f9f71f196cd2b796ab13 /usr.bin/ssh/ssh.c
parentdocument -d. ok millert@ (diff)
downloadwireguard-openbsd-c5f6d1ebf2a3bb19ac389fbe89b9a14998b4fa0d.tar.xz
wireguard-openbsd-c5f6d1ebf2a3bb19ac389fbe89b9a14998b4fa0d.zip
Add -y option to force logging via syslog rather than stderr.
Useful for daemonised ssh connection (ssh -f). Patch originally from and ok'd by markus@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r--usr.bin/ssh/ssh.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 42e6da01e98..a0c3841bad8 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.319 2008/09/11 14:22:37 markus Exp $ */
+/* $OpenBSD: ssh.c,v 1.320 2008/10/08 23:34:03 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -195,7 +195,7 @@ void muxserver_listen(void);
int
main(int ac, char **av)
{
- int i, opt, exit_status;
+ int i, opt, exit_status, use_syslog;
char *p, *cp, *line, buf[256];
struct stat st;
struct passwd *pw;
@@ -256,10 +256,11 @@ main(int ac, char **av)
/* Parse command-line arguments. */
host = NULL;
+ use_syslog = 0;
again:
while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
- "ACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) {
+ "ACD:F:I:KL:MNO:PR:S:TVw:XYy")) != -1) {
switch (opt) {
case '1':
options.protocol = SSH_PROTO_1;
@@ -286,6 +287,9 @@ main(int ac, char **av)
case 'X':
options.forward_x11 = 1;
break;
+ case 'y':
+ use_syslog = 1;
+ break;
case 'Y':
options.forward_x11 = 1;
options.forward_x11_trusted = 1;
@@ -601,7 +605,7 @@ main(int ac, char **av)
*/
log_init(av[0],
options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
- SYSLOG_FACILITY_USER, 1);
+ SYSLOG_FACILITY_USER, !use_syslog);
/*
* Read per-user configuration file. Ignore the system wide config
@@ -627,7 +631,7 @@ main(int ac, char **av)
channel_set_af(options.address_family);
/* reinit */
- log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, 1);
+ log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, !use_syslog);
if (options.user == NULL)
options.user = xstrdup(pw->pw_name);