From e21db807bf9d4fd5a545b466f67e236b5c5be280 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 4 Mar 2001 17:42:29 +0000 Subject: 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. --- usr.bin/ssh/authfd.c | 4 ++-- usr.bin/ssh/channels.c | 4 ++-- usr.bin/ssh/dh.c | 4 ++-- usr.bin/ssh/log.c | 4 ++-- usr.bin/ssh/readconf.c | 8 ++++---- usr.bin/ssh/servconf.c | 22 +++++++++++----------- usr.bin/ssh/sftp-int.c | 4 ++-- usr.bin/ssh/ssh.c | 8 ++++---- usr.bin/ssh/sshconnect.c | 6 +++--- usr.bin/ssh/sshd.c | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/usr.bin/ssh/authfd.c b/usr.bin/ssh/authfd.c index 66e81f52abc..d375dbad8a2 100644 --- a/usr.bin/ssh/authfd.c +++ b/usr.bin/ssh/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 @@ -252,7 +252,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/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index 9171a06d97c..5689e8f1057 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/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/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c index f1f7e5d43fa..c88a014a5c3 100644 --- a/usr.bin/ssh/dh.c +++ b/usr.bin/ssh/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/usr.bin/ssh/log.c b/usr.bin/ssh/log.c index 765f6a2cbfb..34b4eb96158 100644 --- a/usr.bin/ssh/log.c +++ b/usr.bin/ssh/log.c @@ -34,7 +34,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: log.c,v 1.16 2001/03/03 23:59:34 markus Exp $"); +RCSID("$OpenBSD: log.c,v 1.17 2001/03/04 17:42:28 millert Exp $"); #include "log.h" #include "xmalloc.h" @@ -219,7 +219,7 @@ fatal_remove_cleanup(void (*proc) (void *context), void *context) return; } } - fatal("fatal_remove_cleanup: no such cleanup function: 0x%lx 0x%lx\n", + fatal("fatal_remove_cleanup: no such cleanup function: 0x%lx 0x%lx", (u_long) proc, (u_long) context); } diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c index 40c1b700eb3..e65a015fdd5 100644 --- a/usr.bin/ssh/readconf.c +++ b/usr.bin/ssh/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" @@ -186,7 +186,7 @@ add_local_forward(Options *options, u_short port, const char *host, Forward *fwd; 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."); if (options->num_local_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION) fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION); fwd = &options->local_forwards[options->num_local_forwards++]; @@ -532,7 +532,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; @@ -657,7 +657,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/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c index 1e77d32f7ec..1e38f3b60f5 100644 --- a/usr.bin/ssh/servconf.c +++ b/usr.bin/ssh/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/usr.bin/ssh/sftp-int.c b/usr.bin/ssh/sftp-int.c index 95e54a65f68..53136be0754 100644 --- a/usr.bin/ssh/sftp-int.c +++ b/usr.bin/ssh/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/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 1d82b5f06f5..6c2a64ff6c5 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/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 @@ -375,7 +375,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': @@ -531,14 +531,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/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index b068d0bc6cb..2534743a534 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/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 @@ -610,7 +610,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); @@ -711,7 +711,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/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index affd15dae39..3c51916a346 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/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 @@ -725,7 +725,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); } -- cgit v1.2.3