Mercurial > noffle
view src/log.c @ 288:c02c4eb95f95 noffle
[svn] * src/configfile.h,src/configfile.c,docs/noffle.conf.5: Add noffle-user
and noffle-group configs.
* src/configfile.c,src/fetch.c,src/fetchlist.c,src/protocol.c,
src/server.c: Replace strcpy() with Utl_cpyStr() where appropriate.
See Debian bug 168128.
* src/control.c,src/configfile.c,src/noffle.c: Replace [s]scanf("%s")
with [s]scanf(MAXCHAR_FMT).
* src/noffle.c: Log warning if noffle.conf is world readable.
* src/noffle.c: Restrict most options to news admins; i.e. those who
are root or news on running Noffle.
* Makefile.in,acconfig.h,aclocal.m4,config.h.in,configure,configure.in,
docs/Makefile.in,docs/noffle.conf.5,packages/Makefile.in,
packages/redhat/Makefile.in,src/Makefile.am,src/Makefile.in,
src/authenticate.c,src/authenticate.h,src/noffle.c,src/server.c:
Add basic authentication using either Noffle-specific user file
or authenticating via PAM (service 'noffle'). PAM authentication
needs to run as root, so a Noffle server that needs PAM
must be started by root. Helpful (?) error messages will be logged
if not. Noffle will switch ruid and euid to 'news' (or whatever
is configured) ASAP.
* src/noffle.c: Add uid checking.
author | bears |
---|---|
date | Fri, 10 Jan 2003 23:25:45 +0000 |
parents | 5eece4dfd945 |
children | de7f674d1224 |
line wrap: on
line source
/* log.c $Id: log.c 413 2002-12-27 21:48:25Z bears $ */ #if HAVE_CONFIG_H #include <config.h> #endif #include <syslog.h> #include <stdarg.h> #include "common.h" #include "lock.h" #include "log.h" #include "portable.h" #define MAXLENGTH 240 #define DEFAULT_DBG_MASK LOG_DBG_NONE static struct { Bool interactive; unsigned debugMask; } log = { FALSE, DEFAULT_DBG_MASK }; void Log_init( const char *name, Bool interactive, int facility ) { int option = LOG_PID | LOG_CONS; log.interactive = interactive; openlog( name, option, facility ); } #define DO_LOG( LEVEL ) \ va_list ap; \ Str t; \ \ va_start( ap, fmt ); \ vsnprintf( t, MAXCHAR, fmt, ap ); \ if ( MAXLENGTH < MAXCHAR ) \ t[ MAXLENGTH ] = '\0'; \ syslog( LEVEL, "%s", t ); \ if ( log.interactive ) \ fprintf( stderr, "%s\n", t ); \ va_end( ap ); void Log_inf( const char *fmt, ... ) { DO_LOG( LOG_INFO ); } void Log_err( const char *fmt, ... ) { DO_LOG( LOG_ERR ); } /* Ensure the condition "cond" is true; otherwise log an error and return 1 */ int Log_check(int cond, const char *fmt, ... ) { if (!cond) { DO_LOG( LOG_ERR ); return 1; } return 0; } void Log_ntc( const char *fmt, ... ) { DO_LOG( LOG_NOTICE ); } void Log_dbg( unsigned subsystem, const char *fmt, ... ) { if ( ( subsystem & log.debugMask ) != 0 ) { DO_LOG( LOG_DEBUG ); } } void Log_setDbgMask( unsigned mask ) { /* A non-zero mask always include Noffle logs */ if ( mask != 0 ) mask |= LOG_DBG_NOFFLE; log.debugMask = mask; } /* * A fatal error. Log it, close down as much as possible and * exit with EXIT_FAILURE. */ void Log_fatal( const char *fmt, ... ) { DO_LOG( LOG_ERR ); exit( EXIT_FAILURE ); /* NOTREACHED */ } /* Fatal error function for gdbm */ void Log_gdbm_fatal( const char *msg ) { Log_fatal( "gdbm: %s", msg ); /* NOTREACHED */ }