From 54b974dcab3a3e8486caf6181ad0555efd181154 Mon Sep 17 00:00:00 2001 From: mouring Date: Mon, 5 Mar 2001 07:47:23 +0000 Subject: [PATCH] - millert@cvs.openbsd.org 2001/03/04 17:42:28 [authfd.c channels.c dh.c log.c readconf.c servconf.c sftp-int.c ssh.c sshconnect.c sshd.c] log functions should not be passed strings that end in newline as they get passed on to syslog() and when logging to stderr, do_log() appends its own newline. --- ChangeLog | 6 ++++++ authfd.c | 4 ++-- channels.c | 4 ++-- dh.c | 4 ++-- log.c | 6 +++--- readconf.c | 8 ++++---- servconf.c | 22 +++++++++++----------- sftp-int.c | 4 ++-- ssh.c | 8 ++++---- sshconnect.c | 6 +++--- sshd.c | 4 ++-- 11 files changed, 41 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08183e1b..c044b9ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -159,6 +159,12 @@ - stevesk@cvs.openbsd.org 2001/03/04 12:54:04 [sshd.8] spelling + - millert@cvs.openbsd.org 2001/03/04 17:42:28 + [authfd.c channels.c dh.c log.c readconf.c servconf.c sftp-int.c + ssh.c sshconnect.c sshd.c] + log functions should not be passed strings that end in newline as they + get passed on to syslog() and when logging to stderr, do_log() appends + its own newline. 20010304 - (bal) Remove make-ssh-known-hosts.1 since it's no longer valid. diff --git a/authfd.c b/authfd.c index 74518e3f..76e91775 100644 --- a/authfd.c +++ b/authfd.c @@ -35,7 +35,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: authfd.c,v 1.36 2001/03/01 02:11:25 deraadt Exp $"); +RCSID("$OpenBSD: authfd.c,v 1.37 2001/03/04 17:42:27 millert Exp $"); #include @@ -254,7 +254,7 @@ ssh_get_num_identities(AuthenticationConnection *auth, int version) /* Get the number of entries in the response and check it for sanity. */ auth->howmany = buffer_get_int(&auth->identities); if (auth->howmany > 1024) - fatal("Too many identities in authentication reply: %d\n", + fatal("Too many identities in authentication reply: %d", auth->howmany); return auth->howmany; diff --git a/channels.c b/channels.c index 1d74efe0..bb872dc9 100644 --- a/channels.c +++ b/channels.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: channels.c,v 1.97 2001/03/04 00:03:59 markus Exp $"); +RCSID("$OpenBSD: channels.c,v 1.98 2001/03/04 17:42:28 millert Exp $"); #include #include @@ -521,7 +521,7 @@ channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) * We have received an X11 connection that has bad * authentication information. */ - log("X11 connection rejected because of wrong authentication.\r\n"); + log("X11 connection rejected because of wrong authentication."); buffer_clear(&c->input); buffer_clear(&c->output); close(c->sock); diff --git a/dh.c b/dh.c index f1f7e5d4..c88a014a 100644 --- a/dh.c +++ b/dh.c @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: dh.c,v 1.6 2001/01/21 19:05:49 markus Exp $"); +RCSID("$OpenBSD: dh.c,v 1.7 2001/03/04 17:42:28 millert Exp $"); #include "xmalloc.h" @@ -90,7 +90,7 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg) return (1); fail: - error("Bad prime description in line %d\n", linenum); + error("Bad prime description in line %d", linenum); return (0); } diff --git a/log.c b/log.c index c9c1631c..ad93f515 100644 --- a/log.c +++ b/log.c @@ -34,7 +34,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: log.c,v 1.17 2001/03/04 17:42:28 millert Exp $"); +RCSID("$OpenBSD: log.c,v 1.16 2001/03/03 23:59:34 markus Exp $"); #include "log.h" #include "xmalloc.h" @@ -265,7 +265,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) log_level = level; break; default: - fprintf(stderr, "Unrecognized internal syslog level code %d\n", + fprintf(stderr, "Unrecognized internal syslog level code %d", (int) level); exit(1); } @@ -315,7 +315,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) break; default: fprintf(stderr, - "Unrecognized internal syslog facility code %d\n", + "Unrecognized internal syslog facility code %d", (int) facility); exit(1); } diff --git a/readconf.c b/readconf.c index 7cce9231..33649a8d 100644 --- a/readconf.c +++ b/readconf.c @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: readconf.c,v 1.63 2001/02/24 10:37:55 deraadt Exp $"); +RCSID("$OpenBSD: readconf.c,v 1.64 2001/03/04 17:42:28 millert Exp $"); #include "ssh.h" #include "xmalloc.h" @@ -187,7 +187,7 @@ add_local_forward(Options *options, u_short port, const char *host, #ifndef HAVE_CYGWIN extern uid_t original_real_uid; if (port < IPPORT_RESERVED && original_real_uid != 0) - fatal("Privileged ports can only be forwarded by root.\n"); + fatal("Privileged ports can only be forwarded by root."); #endif if (options->num_local_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION); @@ -534,7 +534,7 @@ parse_int: arg = strdelim(&s); value = log_level_number(arg); if (value == (LogLevel) - 1) - fatal("%.200s line %d: unsupported log level '%s'\n", + fatal("%.200s line %d: unsupported log level '%s'", filename, linenum, arg ? arg : ""); if (*activep && (LogLevel) * intptr == -1) *intptr = (LogLevel) value; @@ -659,7 +659,7 @@ read_config_file(const char *filename, const char *host, Options *options) } fclose(f); if (bad_options > 0) - fatal("%s: terminating, %d bad configuration options\n", + fatal("%s: terminating, %d bad configuration options", filename, bad_options); } diff --git a/servconf.c b/servconf.c index 1e77d32f..1e38f3b6 100644 --- a/servconf.c +++ b/servconf.c @@ -10,7 +10,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: servconf.c,v 1.69 2001/03/04 11:16:06 stevesk Exp $"); +RCSID("$OpenBSD: servconf.c,v 1.70 2001/03/04 17:42:28 millert Exp $"); #ifdef KRB4 #include @@ -318,7 +318,7 @@ add_listen_addr(ServerOptions *options, char *addr) hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0; snprintf(strport, sizeof strport, "%d", options->ports[i]); if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) - fatal("bad addr or host: %s (%s)\n", + fatal("bad addr or host: %s (%s)", addr ? addr : "", gai_strerror(gaierr)); for (ai = aitop; ai->ai_next; ai = ai->ai_next) @@ -371,11 +371,11 @@ read_server_config(ServerOptions *options, const char *filename) fatal("%s line %d: ports must be specified before " "ListenAdress.\n", filename, linenum); if (options->num_ports >= MAX_PORTS) - fatal("%s line %d: too many ports.\n", + fatal("%s line %d: too many ports.", filename, linenum); arg = strdelim(&cp); if (!arg || *arg == '\0') - fatal("%s line %d: missing port number.\n", + fatal("%s line %d: missing port number.", filename, linenum); options->ports[options->num_ports++] = atoi(arg); break; @@ -405,7 +405,7 @@ parse_int: case sListenAddress: arg = strdelim(&cp); if (!arg || *arg == '\0') - fatal("%s line %d: missing inet addr.\n", + fatal("%s line %d: missing inet addr.", filename, linenum); add_listen_addr(options, arg); break; @@ -591,7 +591,7 @@ parse_flag: arg = strdelim(&cp); value = log_facility_number(arg); if (value == (SyslogFacility) - 1) - fatal("%.200s line %d: unsupported log facility '%s'\n", + fatal("%.200s line %d: unsupported log facility '%s'", filename, linenum, arg ? arg : ""); if (*intptr == -1) *intptr = (SyslogFacility) value; @@ -602,7 +602,7 @@ parse_flag: arg = strdelim(&cp); value = log_level_number(arg); if (value == (LogLevel) - 1) - fatal("%.200s line %d: unsupported log level '%s'\n", + fatal("%.200s line %d: unsupported log level '%s'", filename, linenum, arg ? arg : ""); if (*intptr == -1) *intptr = (LogLevel) value; @@ -615,7 +615,7 @@ parse_flag: case sAllowUsers: while ((arg = strdelim(&cp)) && *arg != '\0') { if (options->num_allow_users >= MAX_ALLOW_USERS) - fatal("%s line %d: too many allow users.\n", + fatal("%s line %d: too many allow users.", filename, linenum); options->allow_users[options->num_allow_users++] = xstrdup(arg); } @@ -624,7 +624,7 @@ parse_flag: case sDenyUsers: while ((arg = strdelim(&cp)) && *arg != '\0') { if (options->num_deny_users >= MAX_DENY_USERS) - fatal( "%s line %d: too many deny users.\n", + fatal( "%s line %d: too many deny users.", filename, linenum); options->deny_users[options->num_deny_users++] = xstrdup(arg); } @@ -633,7 +633,7 @@ parse_flag: case sAllowGroups: while ((arg = strdelim(&cp)) && *arg != '\0') { if (options->num_allow_groups >= MAX_ALLOW_GROUPS) - fatal("%s line %d: too many allow groups.\n", + fatal("%s line %d: too many allow groups.", filename, linenum); options->allow_groups[options->num_allow_groups++] = xstrdup(arg); } @@ -642,7 +642,7 @@ parse_flag: case sDenyGroups: while ((arg = strdelim(&cp)) && *arg != '\0') { if (options->num_deny_groups >= MAX_DENY_GROUPS) - fatal("%s line %d: too many deny groups.\n", + fatal("%s line %d: too many deny groups.", filename, linenum); options->deny_groups[options->num_deny_groups++] = xstrdup(arg); } diff --git a/sftp-int.c b/sftp-int.c index 95e54a65..53136be0 100644 --- a/sftp-int.c +++ b/sftp-int.c @@ -28,7 +28,7 @@ /* XXX: recursive operations */ #include "includes.h" -RCSID("$OpenBSD: sftp-int.c,v 1.23 2001/03/01 02:18:04 deraadt Exp $"); +RCSID("$OpenBSD: sftp-int.c,v 1.24 2001/03/04 17:42:28 millert Exp $"); #include "buffer.h" #include "xmalloc.h" @@ -579,7 +579,7 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd) break; case I_LPWD: if (!getcwd(path_buf, sizeof(path_buf))) - error("Couldn't get local cwd: %s\n", + error("Couldn't get local cwd: %s", strerror(errno)); else printf("Local working directory: %s\n", diff --git a/ssh.c b/ssh.c index c22002bd..631900f1 100644 --- a/ssh.c +++ b/ssh.c @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.102 2001/03/04 10:57:53 stevesk Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.103 2001/03/04 17:42:28 millert Exp $"); #include #include @@ -388,7 +388,7 @@ main(int ac, char **av) options.log_level++; break; } else { - fatal("Too high debugging level.\n"); + fatal("Too high debugging level."); } /* fallthrough */ case 'V': @@ -544,14 +544,14 @@ main(int ac, char **av) /* Do not allocate a tty if stdin is not a tty. */ if (!isatty(fileno(stdin)) && !force_tty_flag) { if (tty_flag) - log("Pseudo-terminal will not be allocated because stdin is not a terminal.\n"); + log("Pseudo-terminal will not be allocated because stdin is not a terminal."); tty_flag = 0; } /* Get user data. */ pw = getpwuid(original_real_uid); if (!pw) { - log("You don't exist, go away!\n"); + log("You don't exist, go away!"); exit(1); } /* Take a copy of the returned structure. */ diff --git a/sshconnect.c b/sshconnect.c index 623caed7..9962d49b 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -13,7 +13,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.97 2001/02/15 23:19:59 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.98 2001/03/04 17:42:28 millert Exp $"); #include @@ -618,7 +618,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, "Are you sure you want to continue connecting (yes/no)? ", host, ip, type, key_fingerprint(host_key)); if (!read_yes_or_no(prompt, -1)) - fatal("Aborted by user!\n"); + fatal("Aborted by user!"); } if (options.check_host_ip && ip_status == HOST_NEW) { snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); @@ -719,7 +719,7 @@ check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, } else if (options.strict_host_key_checking == 2) { if (!read_yes_or_no("Are you sure you want " \ "to continue connecting (yes/no)? ", -1)) - fatal("Aborted by user!\n"); + fatal("Aborted by user!"); } } diff --git a/sshd.c b/sshd.c index 7b9b1420..838ac0d7 100644 --- a/sshd.c +++ b/sshd.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshd.c,v 1.171 2001/03/04 01:46:30 djm Exp $"); +RCSID("$OpenBSD: sshd.c,v 1.172 2001/03/04 17:42:28 millert Exp $"); #include #include @@ -738,7 +738,7 @@ main(int ac, char **av) options.protocol &= ~SSH_PROTO_2; } if (!(options.protocol & (SSH_PROTO_1|SSH_PROTO_2))) { - log("sshd: no hostkeys available -- exiting.\n"); + log("sshd: no hostkeys available -- exiting."); exit(1); } -- 2.45.2