[Snort-devel] [PATCH] snort.c

Peter Moore peter at ...799...
Sun Nov 4 23:47:01 EST 2001


for BeOS BONE.
quite a few additions 
1) add BeOS to the list of non-Win32 calls.
2) bypass chroot call and initgroups call
3) BeOS doesnt have LOG_NOWAIT

snort-1.8.2->diff -u snort.c.orig snort.c
--- snort.c.orig        Fri Nov  2 17:18:29 2001
+++ snort.c     Mon Nov  5 18:42:43 2001
@@ -68,7 +68,7 @@

 #endif
 #ifndef WIN32
-    #if defined(LINUX) || defined(FREEBSD) || defined(OPENBSD) || 
defined(SOLARIS)
+    #if defined(LINUX) || defined(FREEBSD) || defined(OPENBSD) || 
defined(SOLARIS) || defined(BEOS)
         sigset_t set;

         sigemptyset(&set);
@@ -285,8 +285,11 @@
     {
         if(chdir(chrootdir) < 0)
             FatalError("Can not chdir to \"%s\"\n", chrootdir);
+#ifndef BEOS
+               // BeOS doesnt have a chroot but it should
         if(chroot(chrootdir) < 0)
             FatalError("Can not chroot to %s\n", chrootdir);
+#endif  /* BEOS */
         if(chdir("/") < 0)
             FatalError("Can not chdir to \"/\"\n");

@@ -363,7 +366,11 @@
         if(pv.syslog_flag)
         {
             AddFuncToOutputList(SyslogAlert, NT_OUTPUT_ALERT, NULL);
+#ifdef BEOS
+            openlog("snort", LOG_PID | LOG_NDELAY, LOG_AUTH);
+#else
             openlog("snort", LOG_PID | LOG_NDELAY | LOG_NOWAIT, LOG_AUTH);
+#endif
         }
         else if(pv.smbmsg_flag)
         {
@@ -2937,10 +2944,12 @@
     }
     if(username != NULL)
     {
+#ifndef BEOS
+/* BEOS doesnt have initgroups */
         if(getuid() == 0 && initgroups(username, groupid) < 0)
             FatalError("Can not initgroups(%s,%lu)",
                        username, (u_long) groupid);
-
+#endif /* !BEOS */
         /** just to be on a safe side... **/
         endgrent();
         endpwent();
@@ -2957,7 +2966,7 @@
 void SigUSR1Wrap(int sig)
 {
 #ifndef WIN32
-#if defined(LINUX) || defined(FREEBSD) || defined(OPENBSD) || 
defined(SOLARIS)
+#if defined(LINUX) || defined(FREEBSD) || defined(OPENBSD) || 
defined(SOLARIS) || defined(BEOS)
     sigset_t set;

     sigemptyset(&set); 





More information about the Snort-devel mailing list