diff --git a/lib/clcomm.c b/lib/clcomm.c index f2473cd6..9b901471 100644 --- a/lib/clcomm.c +++ b/lib/clcomm.c @@ -1,11 +1,10 @@ /***************************************************************************** * - * File ..................: clcomm.c + * $Id$ * Purpose ...............: Client/Server communications - * Last modification date : 23-May-2001 * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -41,6 +40,7 @@ int most_debug = FALSE; /* Toggle normal/most debugging */ char progname[21]; /* Program name */ char logfile[PATH_MAX]; /* Normal logfile */ char errfile[PATH_MAX]; /* Error logfile */ +char mgrfile[PATH_MAX]; /* Area/File- mgr logfile */ long loggrade; /* Logging grade */ pid_t mypid; /* Original parent pid if child */ unsigned long lcrc = 0, tcrc = 1; /* CRC value of logstring */ @@ -50,6 +50,7 @@ extern char cpath[108]; extern char spath[108]; + char *xmalloc(size_t size) { char *tmp; @@ -99,7 +100,7 @@ char *xstrcat(char *src, char *add) -void InitClient(char *user, char *myname, char *where, char *log, long loggr, char *err) +void InitClient(char *user, char *myname, char *where, char *log, long loggr, char *err, char *mgr) { if ((getenv("MBSE_ROOT")) == NULL) { printf("Could not get the MBSE_ROOT environment variable\n"); @@ -111,6 +112,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch sprintf(progname, "%s", myname); sprintf(logfile, "%s", log); sprintf(errfile, "%s", err); + sprintf(mgrfile, "%s", mgr); loggrade = loggr; sprintf(cpath, "%s/tmp/%s%d", getenv("MBSE_ROOT"), progname, getpid()); @@ -234,6 +236,9 @@ void WriteError(const char *format, ...) +/* + * Standard system logging + */ void Syslog(int level, const char *format, ...) { char *outstr; @@ -250,6 +255,9 @@ void Syslog(int level, const char *format, ...) +/* + * System logging without string formatting. + */ void Syslogp(int level, char *outstr) { long mask = 0; @@ -321,6 +329,31 @@ void Syslogp(int level, char *outstr) +void Mgrlog(const char *format, ...) +{ + char *outstr; + va_list va_ptr; + int i; + + outstr = calloc(10240, sizeof(char)); + + va_start(va_ptr, format); + vsprintf(outstr, format, va_ptr); + va_end(va_ptr); + + for (i = 0; i < strlen(outstr); i++) + if (outstr[i] == '\r' || outstr[i] == '\n') + outstr[i] = ' '; + if (strlen(outstr) > (SS_BUFSIZE - 64)) + outstr[SS_BUFSIZE - 64] = '\0'; + + SockS("ALOG:5,%s,%s,%d,+,%s;", mgrfile, progname, mypid, outstr); + Syslogp('+', outstr); + free(outstr); +} + + + void IsDoing(const char *format, ...) { char *outputstr; diff --git a/lib/clcomm.h b/lib/clcomm.h index 023462fc..a6abfdf2 100644 --- a/lib/clcomm.h +++ b/lib/clcomm.h @@ -58,13 +58,14 @@ extern char SigName[32][16]; char *xmalloc(size_t); char *xstrcpy(char *); char *xstrcat(char *, char *); -void InitClient(char *, char *, char *, char *, long, char *); +void InitClient(char *, char *, char *, char *, long, char *, char *); void ExitClient(int); void SockS(const char *, ...); char *SockR(const char *, ...); void WriteError(const char *, ...); void Syslog(int, const char *, ...); void Syslogp(int, char *); +void Mgrlog(const char *, ...); void RegTCP(void); void IsDoing(const char *, ...); void SetTTY(char *); diff --git a/lib/structs.h b/lib/structs.h index 63d1b772..5dc6ab39 100644 --- a/lib/structs.h +++ b/lib/structs.h @@ -796,6 +796,9 @@ struct sysconfig { int maxarticles; /* Default max articles */ char bbs_macros[65]; /* Default macros path */ char out_queue[65]; /* Outbound queue path */ + + char mgrlog[15]; /* Area/File-mgr logfile */ + char aname[32][17]; /* Name of areas flags */ }; @@ -1289,6 +1292,8 @@ struct _nodes { char Ct_cellphone[21]; /* Node's cellphone */ char Ct_email[31]; /* Node's email */ char Ct_remark[65]; /* Remark */ + + securityrec Security; /* Security flags */ };