summaryrefslogtreecommitdiff
path: root/log-client.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-11-25 00:26:21 +1100
committerDamien Miller <djm@mindrot.org>1999-11-25 00:26:21 +1100
commit95def09838fc61b37b6ea7cd5c234a465b4b129b (patch)
tree042744f76f40a326b873cb1c3690a6d7d966bc3e /log-client.c
parent4d2f15f895f4c795afc008aeff3fd2ceffbc44f4 (diff)
- Merged very large OpenBSD source code reformat
- OpenBSD CVS updates - [channels.c cipher.c compat.c log-client.c scp.c serverloop.c] [ssh.h sshd.8 sshd.c] syslog changes: * Unified Logmessage for all auth-types, for success and for failed * Standard connections get only ONE line in the LOG when level==LOG: Auth-attempts are logged only, if authentication is: a) successfull or b) with passwd or c) we had more than AUTH_FAIL_LOG failues * many log() became verbose() * old behaviour with level=VERBOSE - [readconf.c readconf.h ssh.1 ssh.h sshconnect.c sshd.c] tranfer s/key challenge/response data in SSH_SMSG_AUTH_TIS_CHALLENGE messages. allows use of s/key in windows (ttssh, securecrt) and ssh-1.2.27 clients without 'ssh -v', ok: niels@ - [sshd.8] -V, for fallback to openssh in SSH2 compatibility mode - [sshd.c] fix sigchld race; cjc5@po.cwru.edu
Diffstat (limited to 'log-client.c')
-rw-r--r--log-client.c81
1 files changed, 40 insertions, 41 deletions
diff --git a/log-client.c b/log-client.c
index 63cc79445..4d40cf268 100644
--- a/log-client.c
+++ b/log-client.c
@@ -1,21 +1,21 @@
1/* 1/*
2 2 *
3log-client.c 3 * log-client.c
4 4 *
5Author: Tatu Ylonen <ylo@cs.hut.fi> 5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 6 *
7Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 7 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 All rights reserved 8 * All rights reserved
9 9 *
10Created: Mon Mar 20 21:13:40 1995 ylo 10 * Created: Mon Mar 20 21:13:40 1995 ylo
11 11 *
12Client-side versions of debug(), log(), etc. These print to stderr. 12 * Client-side versions of debug(), log(), etc. These print to stderr.
13This is a stripped down version of log-server.c. 13 * This is a stripped down version of log-server.c.
14 14 *
15*/ 15 */
16 16
17#include "includes.h" 17#include "includes.h"
18RCSID("$Id: log-client.c,v 1.2 1999/11/11 06:57:39 damien Exp $"); 18RCSID("$Id: log-client.c,v 1.3 1999/11/24 13:26:22 damien Exp $");
19 19
20#include "xmalloc.h" 20#include "xmalloc.h"
21#include "ssh.h" 21#include "ssh.h"
@@ -23,27 +23,26 @@ RCSID("$Id: log-client.c,v 1.2 1999/11/11 06:57:39 damien Exp $");
23static LogLevel log_level = SYSLOG_LEVEL_INFO; 23static LogLevel log_level = SYSLOG_LEVEL_INFO;
24 24
25/* Initialize the log. 25/* Initialize the log.
26 av0 program name (should be argv[0]) 26 * av0 program name (should be argv[0])
27 level logging level 27 * level logging level
28 */ 28 */
29 29
30void 30void
31log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2) 31log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2)
32{ 32{
33 switch (level) 33 switch (level) {
34 { 34 case SYSLOG_LEVEL_QUIET:
35 case SYSLOG_LEVEL_QUIET: 35 case SYSLOG_LEVEL_ERROR:
36 case SYSLOG_LEVEL_ERROR: 36 case SYSLOG_LEVEL_FATAL:
37 case SYSLOG_LEVEL_FATAL: 37 case SYSLOG_LEVEL_INFO:
38 case SYSLOG_LEVEL_INFO: 38 case SYSLOG_LEVEL_VERBOSE:
39 case SYSLOG_LEVEL_CHAT: 39 case SYSLOG_LEVEL_DEBUG:
40 case SYSLOG_LEVEL_DEBUG: 40 log_level = level;
41 log_level = level; 41 break;
42 break; 42 default:
43 default: 43 /* unchanged */
44 /* unchanged */ 44 break;
45 break; 45 }
46 }
47} 46}
48 47
49#define MSGBUFSIZE 1024 48#define MSGBUFSIZE 1024
@@ -51,13 +50,13 @@ log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2)
51void 50void
52do_log(LogLevel level, const char *fmt, va_list args) 51do_log(LogLevel level, const char *fmt, va_list args)
53{ 52{
54 char msgbuf[MSGBUFSIZE]; 53 char msgbuf[MSGBUFSIZE];
55 54
56 if (level > log_level) 55 if (level > log_level)
57 return; 56 return;
58 if (level == SYSLOG_LEVEL_DEBUG) 57 if (level == SYSLOG_LEVEL_DEBUG)
59 fprintf(stderr, "debug: "); 58 fprintf(stderr, "debug: ");
60 vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); 59 vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
61 fprintf(stderr, "%s", msgbuf); 60 fprintf(stderr, "%s", msgbuf);
62 fprintf(stderr, "\r\n"); 61 fprintf(stderr, "\r\n");
63} 62}