From: Kern Sibbald Date: Mon, 9 Feb 2004 10:30:21 +0000 (+0000) Subject: Add security message class + put host.access rejects messages in M_SECURITY class X-Git-Tag: Release-1.34.0~143 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=42529a20a8b04cc01f9946880a5eb1b6f1b973b8;p=bacula%2Fbacula Add security message class + put host.access rejects messages in M_SECURITY class git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1035 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/ChangeLog b/bacula/ChangeLog index 4e1851b4aa..5e6c713a48 100644 --- a/bacula/ChangeLog +++ b/bacula/ChangeLog @@ -1,5 +1,10 @@ - +09Feb04 +- Add \n to hosts.access reject message. +- Implement security message class and make hosts.access message use + that class. +08Feb04 +- Fix check_memory bug in ua_query.c, which gives a bus error on Solaris. 07Feb04 - Added backup to cdwriter script to examples provided by Johan Decock. - Fixed a bug where ls really did lsmark (just invert command table diff --git a/bacula/src/lib/bnet_server.c b/bacula/src/lib/bnet_server.c index 3f5ccf0b20..b050d88405 100644 --- a/bacula/src/lib/bnet_server.c +++ b/bacula/src/lib/bnet_server.c @@ -153,7 +153,7 @@ bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_w fromhost(&request); if (!hosts_access(&request)) { V(mutex); - Jmsg2(NULL, M_WARNING, 0, _("Connection from %s:%d refused by hosts.access"), + Jmsg2(NULL, M_SECURITY, 0, _("Connection from %s:%d refused by hosts.access\n"), inet_ntoa(cli_addr.sin_addr), ntohs(cli_addr.sin_port)); close(newsockfd); continue; @@ -303,7 +303,7 @@ bnet_accept(BSOCK *bsock, char *who) fromhost(&request); if (!hosts_access(&request)) { V(mutex); - Emsg2(M_WARNING, 0, _("Connection from %s:%d refused by hosts.access"), + Emsg2(M_SECURITY, 0, _("Connection from %s:%d refused by hosts.access\n"), inet_ntoa(cli_addr.sin_addr), ntohs(cli_addr.sin_port)); close(newsockfd); return NULL; diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index 0993165bcc..9170135930 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -901,6 +901,9 @@ e_msg(char *file, int line, int type, int level, char *fmt,...) case M_WARNING: len = bsnprintf(buf, sizeof(buf), "%s: Warning: ", my_name); break; + case M_SECURITY: + len = bsnprintf(buf, sizeof(buf), "%s: Security violation: ", my_name); + break; default: len = bsnprintf(buf, sizeof(buf), "%s: ", my_name); break; @@ -995,6 +998,9 @@ Jmsg(JCR *jcr, int type, int level, char *fmt,...) case M_WARNING: len = bsnprintf(rbuf, sizeof(rbuf), "%s: %s Warning: ", my_name, job); break; + case M_SECURITY: + len = bsnprintf(rbuf, sizeof(rbuf), "%s: %s Security violation: ", my_name, job); + break; default: len = bsnprintf(rbuf, sizeof(rbuf), "%s: ", my_name); break; diff --git a/bacula/src/lib/message.h b/bacula/src/lib/message.h index 06b248e1c5..601bbe6f9a 100644 --- a/bacula/src/lib/message.h +++ b/bacula/src/lib/message.h @@ -36,6 +36,7 @@ #undef M_ERROR_TERM #undef M_TERM #undef M_RESTORED +#undef M_SECURITY /* * Most of these message levels are more or less obvious. @@ -61,23 +62,29 @@ * * M_RESTORED An ls -l of each restored file. * + * M_SECURITY For security viloations. This is equivalent to FATAL. + * (note, this is currently being implemented in 1.33). + * */ -#define M_DEBUG 1 /* debug message */ -#define M_ABORT 2 /* MUST abort immediately */ -#define M_FATAL 3 /* Fatal error, stopping job */ -#define M_ERROR 4 /* Error, but recoverable */ -#define M_WARNING 5 /* Warning message */ -#define M_INFO 6 /* Informational message */ -#define M_SAVED 7 /* Info on saved file */ -#define M_NOTSAVED 8 /* Info on notsaved file */ -#define M_SKIPPED 9 /* File skipped by option setting */ -#define M_MOUNT 10 /* Mount requests */ -#define M_ERROR_TERM 11 /* Error termination request (no dump) */ -#define M_TERM 12 /* Terminating daemon */ -#define M_RESTORED 13 /* ls -l of restored files */ +enum { + M_DEBUG = 1, /* debug message */ + M_ABORT, /* MUST abort immediately */ + M_FATAL, /* Fatal error, stopping job */ + M_ERROR, /* Error, but recoverable */ + M_WARNING, /* Warning message */ + M_INFO, /* Informational message */ + M_SAVED, /* Info on saved file */ + M_NOTSAVED, /* Info on notsaved file */ + M_SKIPPED, /* File skipped during backup by option setting */ + M_MOUNT, /* Mount requests */ + M_ERROR_TERM, /* Error termination request (no dump) */ + M_TERM, /* Terminating daemon normally */ + M_RESTORED, /* ls -l of restored files */ + M_SECURITY, /* security violation */ +}; -#define M_MAX M_RESTORED /* keep this updated ! */ +#define M_MAX M_SECURITY /* keep this updated ! */ /* Define message destination structure */ /* *** FIXME **** where should be extended to handle multiple values */