]> git.sur5r.net Git - bacula/bacula/commitdiff
Add security message class + put host.access rejects messages in M_SECURITY class
authorKern Sibbald <kern@sibbald.com>
Mon, 9 Feb 2004 10:30:21 +0000 (10:30 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 9 Feb 2004 10:30:21 +0000 (10:30 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1035 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/ChangeLog
bacula/src/lib/bnet_server.c
bacula/src/lib/message.c
bacula/src/lib/message.h

index 4e1851b4aa496b06f83a8f2d8639b3fe4978bf2e..5e6c713a485cf9eb96b489000ad3b3d1ed195e9c 100644 (file)
@@ -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
index 3f5ccf0b205cf23e22f7f7494832bc1d9098ce98..b050d88405b61658aa41abddcffa19cd30b92bab 100644 (file)
@@ -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;
index 0993165bcca5c8939f676e5da2419ab261820a88..91701359301c36968f94128e74444ea1dd95c686 100755 (executable)
@@ -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;
index 06b248e1c550eef565cf667a04ac11b05ca8d775..601bbe6f9a27460c29b7601cd082e5e584dd1639 100644 (file)
@@ -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. 
  *
  *  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 */