From a66ffea41d7ea4e39a49bc146e6f6decb4fbd02c Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Thu, 28 Feb 2013 01:24:24 +0000 Subject: [PATCH] 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. --- contrib/openbsm/bin/auditdistd/sender.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/openbsm/bin/auditdistd/sender.c b/contrib/openbsm/bin/auditdistd/sender.c index 256fbb1f4759..ab90e6ce03d1 100644 --- a/contrib/openbsm/bin/auditdistd/sender.c +++ b/contrib/openbsm/bin/auditdistd/sender.c @@ -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); }