[PATCH] sftp-server argument error handling

This is a discussion on [PATCH] sftp-server argument error handling within the OpenSSH Development forums, part of the Networking and Network Related category; When you give sftp-server a bogus -l or -f parameter, it logs a useful error message then blunders on ...


Go Back   Usenet Forums > Networking and Network Related > OpenSSH Development

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-18-2007
Tony Finch
 
Posts: n/a
Default [PATCH] sftp-server argument error handling

When you give sftp-server a bogus -l or -f parameter, it logs a useful
error message then blunders on to call log_init() with the bogus value.
log_init() then prints a less useful message to stderr and exits. The
following patch tidies this up by only printing the more useful error to
stderr and not blundering on afterwards.

--- sftp-server.c.orig Mon Jun 18 16:37:46 2007
+++ sftp-server.c Mon Jun 18 16:39:14 2007
@@ -1220,7 +1220,8 @@
sanitise_stdfd();

__progname = ssh_get_progname(argv[0]);
- log_init(__progname, log_level, log_facility, log_stderr);
+ /* Send any argument errors to stderr */
+ log_init(__progname, log_level, log_facility, 1);

while (!skipargs && (ch = getopt(argc, argv, "C:f:l:che")) != -1) {
switch (ch) {
@@ -1237,12 +1238,12 @@
case 'l':
log_level = log_level_number(optarg);
if (log_level == SYSLOG_LEVEL_NOT_SET)
- error("Invalid log level \"%s\"", optarg);
+ fatal("Invalid log level \"%s\"", optarg);
break;
case 'f':
log_facility = log_facility_number(optarg);
if (log_level == SYSLOG_FACILITY_NOT_SET)
- error("Invalid log facility \"%s\"", optarg);
+ fatal("Invalid log facility \"%s\"", optarg);
break;
case 'h':
default:

Tony.
--
f.a.n.finch <dot@dotat.at> http://dotat.at/
HUMBER THAMES: SOUTHEASTERLY, VEERING SOUTHWESTERLY FOR A TIME, 3 OR 4
OCCASIONALLY 5. SLIGHT OR MODERATE. SHOWERS. MODERATE OR GOOD.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
http://lists.mindrot.org/mailman/lis...enssh-unix-dev
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:18 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0