From owner-svn-src-head@FreeBSD.ORG Thu Feb 28 01:24:25 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 3A408612; Thu, 28 Feb 2013 01:24:25 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 2CA03F72; Thu, 28 Feb 2013 01:24:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1S1OPGN083937; Thu, 28 Feb 2013 01:24:25 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1S1OPmv083936; Thu, 28 Feb 2013 01:24:25 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201302280124.r1S1OPmv083936@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 28 Feb 2013 01:24:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247442 - head/contrib/openbsm/bin/auditdistd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2013 01:24:25 -0000 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); }