From a8a7f8fb5cfe95f28cd5f7ff4b4679ca122fe410 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Wed, 2 Oct 2019 13:38:18 +0200
Subject: [PATCH] sepolgen: don't hardcode search for ausearch in /sbin

ausearch may be installed in another location, just rely on PATH to
find ausearch.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 sepolgen/src/sepolgen/audit.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sepolgen/src/sepolgen/audit.py b/sepolgen/src/sepolgen/audit.py
index 4adb851f..5eafa587 100644
--- a/sepolgen/src/sepolgen/audit.py
+++ b/sepolgen/src/sepolgen/audit.py
@@ -41,7 +41,7 @@ def get_audit_boot_msgs():
     s = time.localtime(time.time() - off)
     bootdate = time.strftime("%x", s)
     boottime = time.strftime("%X", s)
-    output = subprocess.Popen(["/sbin/ausearch", "-m", "AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_START,SELINUX_ERR", "-ts", bootdate, boottime],
+    output = subprocess.Popen(["ausearch", "-m", "AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_START,SELINUX_ERR", "-ts", bootdate, boottime],
                               stdout=subprocess.PIPE).communicate()[0]
     if util.PY3:
         output = util.decode_input(output)
@@ -56,7 +56,7 @@ def get_audit_msgs():
        string contain all of the audit messages returned by ausearch.
     """
     import subprocess
-    output = subprocess.Popen(["/sbin/ausearch", "-m", "AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_START,SELINUX_ERR"],
+    output = subprocess.Popen(["ausearch", "-m", "AVC,USER_AVC,MAC_POLICY_LOAD,DAEMON_START,SELINUX_ERR"],
                               stdout=subprocess.PIPE).communicate()[0]
     if util.PY3:
         output = util.decode_input(output)
-- 
2.21.0