Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Feb 2013 01:24:25 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r247442 - head/contrib/openbsm/bin/auditdistd
Message-ID:  <201302280124.r1S1OPmv083936@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302280124.r1S1OPmv083936>