diff cli-runopts.c @ 1214:61d3f56808a4

Merge pull request #18 from annulen/dbclient_syslog Support syslog logging in dbclient.
author Matt Johnston <matt@ucc.asn.au>
date Tue, 15 Dec 2015 21:55:51 +0800
parents 7fd1211a1f63
children d058e15ea213
line wrap: on
line diff
--- a/cli-runopts.c	Tue Dec 15 21:40:32 2015 +0800
+++ b/cli-runopts.c	Tue Dec 15 21:55:51 2015 +0800
@@ -173,6 +173,9 @@
 	opts.cipher_list = NULL;
 	opts.mac_list = NULL;
 #endif
+#ifndef DISABLE_SYSLOG
+	opts.usingsyslog = 0;
+#endif
 	/* not yet
 	opts.ipv4 = 1;
 	opts.ipv6 = 1;
@@ -488,7 +491,7 @@
 	keytype = DROPBEAR_SIGNKEY_ANY;
 	if ( readhostkey(filename, key, &keytype) != DROPBEAR_SUCCESS ) {
 		if (warnfail) {
-			fprintf(stderr, "Failed loading keyfile '%s'\n", filename);
+			dropbear_log(LOG_WARNING, "Failed loading keyfile '%s'\n", filename);
 		}
 		sign_key_free(key);
 	} else {
@@ -861,6 +864,9 @@
 #ifdef ENABLE_CLI_ANYTCPFWD
 			"\tExitOnForwardFailure\n"
 #endif
+#ifndef DISABLE_SYSLOG
+			"\tUseSyslog\n"
+#endif
 		);
 		exit(EXIT_SUCCESS);
 	}
@@ -872,5 +878,12 @@
 	}
 #endif
 
+#ifndef DISABLE_SYSLOG
+	if (match_extendedopt(&optstr, "UseSyslog") == DROPBEAR_SUCCESS) {
+		opts.usingsyslog = parse_flag_value(optstr);
+		return;
+	}
+#endif
+
 	dropbear_exit("Bad configuration option '%s'", origstr);
 }