File: [local] / src / usr.bin / ssh / Attic / log-client.c (download)
Revision 1.4, Mon Nov 22 21:02:38 1999 UTC (24 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.3: +2 -2 lines
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
|
/*
log-client.c
Author: Tatu Ylonen <ylo@cs.hut.fi>
Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
All rights reserved
Created: Mon Mar 20 21:13:40 1995 ylo
Client-side versions of debug(), log(), etc. These print to stderr.
This is a stripped down version of log-server.c.
*/
#include "includes.h"
RCSID("$Id: log-client.c,v 1.4 1999/11/22 21:02:38 markus Exp $");
#include "xmalloc.h"
#include "ssh.h"
static LogLevel log_level = SYSLOG_LEVEL_INFO;
/* Initialize the log.
av0 program name (should be argv[0])
level logging level
*/
void
log_init(char *av0, LogLevel level, SyslogFacility ignored1, int ignored2)
{
switch (level)
{
case SYSLOG_LEVEL_QUIET:
case SYSLOG_LEVEL_ERROR:
case SYSLOG_LEVEL_FATAL:
case SYSLOG_LEVEL_INFO:
case SYSLOG_LEVEL_VERBOSE:
case SYSLOG_LEVEL_DEBUG:
log_level = level;
break;
default:
/* unchanged */
break;
}
}
#define MSGBUFSIZE 1024
void
do_log(LogLevel level, const char *fmt, va_list args)
{
char msgbuf[MSGBUFSIZE];
if (level > log_level)
return;
if (level == SYSLOG_LEVEL_DEBUG)
fprintf(stderr, "debug: ");
vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
fprintf(stderr, "%s", msgbuf);
fprintf(stderr, "\r\n");
}