Author: pjd
Date: Thu Feb 28 01:24:24 2013
New Revision: 247442
URL: http://svnweb.freebsd.org/changeset/base/247442

Log:
  When we are waiting for new trail files we may have been disconnected and
  reconnected in the meantime. Check if reset is set before opening next trail
  file, as not doing so will result in sending OPEN message with the same
  file name twice and this is illegal - the second OPEN is send without first
  closing previous trail file.

Modified:
  head/contrib/openbsm/bin/auditdistd/sender.c

Modified: head/contrib/openbsm/bin/auditdistd/sender.c
==============================================================================
--- head/contrib/openbsm/bin/auditdistd/sender.c        Thu Feb 28 01:22:14 
2013        (r247441)
+++ head/contrib/openbsm/bin/auditdistd/sender.c        Thu Feb 28 01:24:24 
2013        (r247442)
@@ -394,6 +394,7 @@ read_thread_wait(void)
 
        mtx_lock(&adist_remote_mtx);
        if (adhost->adh_reset) {
+reset:
                adhost->adh_reset = false;
                if (trail_filefd(adist_trail) != -1)
                        trail_close(adist_trail);
@@ -408,6 +409,14 @@ read_thread_wait(void)
        while (trail_filefd(adist_trail) == -1) {
                newfile = true;
                wait_for_dir();
+               /*
+                * We may have been disconnected and reconnected in the
+                * meantime, check if reset is set.
+                */
+               mtx_lock(&adist_remote_mtx);
+               if (adhost->adh_reset)
+                       goto reset;
+               mtx_unlock(&adist_remote_mtx);
                if (trail_filefd(adist_trail) == -1)
                        trail_next(adist_trail);
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to