From 409661f0d99bf9bc82543eb7bab1f502c9170281 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 20 Nov 2009 15:16:35 +1100 Subject: - (djm) [ssh-rand-helper.c] Print error and usage() when passed command- line arguments as none are supported. Exit when passed unrecognised commandline flags. bz#1568 from gson AT araneus.fi --- ssh-rand-helper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ssh-rand-helper.c') diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c index 8b1c4b4f4..0fcda7fff 100644 --- a/ssh-rand-helper.c +++ b/ssh-rand-helper.c @@ -853,11 +853,17 @@ main(int argc, char **argv) default: error("Invalid commandline option"); usage(); + exit(1); } } - log_init(argv[0], ll, SYSLOG_FACILITY_USER, 1); + if (argc != optind) { + error("Unexpected commandline arguments."); + usage(); + exit(1); + } + #ifdef USE_SEED_FILES prng_read_seedfile(); #endif -- cgit v1.2.3 From 48b6021721fb2083898be696a72b261a9136c293 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 5 Mar 2010 11:40:19 +1100 Subject: - (djm) [ssh-rand-helper.c] declare optind, avoiding compilation failure on some platforms --- ChangeLog | 2 ++ ssh-rand-helper.c | 1 + 2 files changed, 3 insertions(+) (limited to 'ssh-rand-helper.c') diff --git a/ChangeLog b/ChangeLog index 7b50de5d3..ee1804fd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,8 @@ imorgan AT nas.nasa.gov - (tim) [ssh-pkcs11.c] Fix "non-constant initializer" errors in older compilers. OK djm@ + - (djm) [ssh-rand-helper.c] declare optind, avoiding compilation failure + on some platforms 20100304 - (djm) [ssh-keygen.c] Use correct local variable, instead of diff --git a/ssh-rand-helper.c b/ssh-rand-helper.c index 0fcda7fff..fa5070499 100644 --- a/ssh-rand-helper.c +++ b/ssh-rand-helper.c @@ -818,6 +818,7 @@ main(int argc, char **argv) unsigned char *buf; int ret, ch, debug_level, output_hex, bytes; extern char *optarg; + extern int optind; LogLevel ll; __progname = ssh_get_progname(argv[0]); -- cgit v1.2.3