summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-11-03 19:22:37 +1100
committerDamien Miller <djm@mindrot.org>2008-11-03 19:22:37 +1100
commite272a5bb2937f1a8297c412c9312c38133f829c1 (patch)
tree2e169ea656fa0775c69935c8818cbde3fd3e2de9 /ssh.c
parentc4d1b36cc2fb89566fe01b990abf8b635e0dce74 (diff)
- djm@cvs.openbsd.org 2008/10/08 23:34:03
[ssh.1 ssh.c] 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 'ssh.c')
-rw-r--r--ssh.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ssh.c b/ssh.c
index a91d886ce..ff47a6c28 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.319 2008/09/11 14:22:37 markus Exp $ */ 1/* $OpenBSD: ssh.c,v 1.320 2008/10/08 23:34:03 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
@@ -203,7 +203,7 @@ void muxserver_listen(void);
203int 203int
204main(int ac, char **av) 204main(int ac, char **av)
205{ 205{
206 int i, opt, exit_status; 206 int i, opt, exit_status, use_syslog;
207 char *p, *cp, *line, buf[256]; 207 char *p, *cp, *line, buf[256];
208 struct stat st; 208 struct stat st;
209 struct passwd *pw; 209 struct passwd *pw;
@@ -269,10 +269,11 @@ main(int ac, char **av)
269 269
270 /* Parse command-line arguments. */ 270 /* Parse command-line arguments. */
271 host = NULL; 271 host = NULL;
272 use_syslog = 0;
272 273
273 again: 274 again:
274 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" 275 while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx"
275 "ACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) { 276 "ACD:F:I:KL:MNO:PR:S:TVw:XYy")) != -1) {
276 switch (opt) { 277 switch (opt) {
277 case '1': 278 case '1':
278 options.protocol = SSH_PROTO_1; 279 options.protocol = SSH_PROTO_1;
@@ -299,6 +300,9 @@ main(int ac, char **av)
299 case 'X': 300 case 'X':
300 options.forward_x11 = 1; 301 options.forward_x11 = 1;
301 break; 302 break;
303 case 'y':
304 use_syslog = 1;
305 break;
302 case 'Y': 306 case 'Y':
303 options.forward_x11 = 1; 307 options.forward_x11 = 1;
304 options.forward_x11_trusted = 1; 308 options.forward_x11_trusted = 1;
@@ -614,7 +618,7 @@ main(int ac, char **av)
614 */ 618 */
615 log_init(av[0], 619 log_init(av[0],
616 options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, 620 options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
617 SYSLOG_FACILITY_USER, 1); 621 SYSLOG_FACILITY_USER, !use_syslog);
618 622
619 /* 623 /*
620 * Read per-user configuration file. Ignore the system wide config 624 * Read per-user configuration file. Ignore the system wide config
@@ -640,7 +644,7 @@ main(int ac, char **av)
640 channel_set_af(options.address_family); 644 channel_set_af(options.address_family);
641 645
642 /* reinit */ 646 /* reinit */
643 log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, 1); 647 log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, !use_syslog);
644 648
645 seed_rng(); 649 seed_rng();
646 650