[Snort-devel] snort-1.9: Check for chrootdir before access(pv.log_dir)

Matthew Callaway matt at ...806...
Sun Oct 20 06:56:03 EDT 2002


When using the -t and -l options together, snort-1.9 does not check the
chroot path for the log directory.  A patch something like the one below
will fix that.

In general, it is not clear when the order of options given on the
command line is important.

Thanks,

Matt



--- snort.c.orig        Wed Sep 25 14:56:53 2002
+++ snort.c     Fri Oct 18 10:10:44 2002
@@ -1007,7 +1007,15 @@
                 break;

             case 'l':                /* use log dir <X> */
+                /* Test for chroot first, note that order matters
+                 * in specifying command line args */
                 strlcpy(pv.log_dir, optarg, STD_BUF);
+                if (sizeof(chrootdir))
+                {
+                    tmp = strdup(chrootdir);
+                    strlcat(tmp, pv.log_dir, sizeof(tmp)+sizeof(pv.log_dir) );
+                    strlcpy(pv.log_dir, tmp, STD_BUF);
+                }
                 if( access(pv.log_dir, 2) != 0 )
                 {
                     FatalError("ERROR: log directory '%s' does not exist\n", pv.log_dir);





More information about the Snort-devel mailing list