Skip to content

Commit 9b8a449

Browse files
committed
Allow fapolicyd to have other paths
In fapolicyd-cli, when doing the check-status command, it checks to see if the application pointed to be fapolicyd.pid really is fapolicyd by checking the complete path against the hardcoded path. This prevents getting a status report if it is started from somewhere else. Adjust the check to only check the basename of the application. That will allow execution from other places.
1 parent 2f9d2dc commit 9b8a449

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/cli/fapolicyd-cli.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <signal.h>
4444
#include <ftw.h>
4545
#include <mntent.h>
46+
#include <libgen.h> // basename
4647
#include "policy.h"
4748
#include "database.h"
4849
#include "file-cli.h"
@@ -1377,7 +1378,7 @@ static int do_status_report(void)
13771378
reason = "can't read proc file";
13781379
goto err_out;
13791380
}
1380-
if (strcmp(exe_buf, DAEMON_PATH)) {
1381+
if (strcmp(basename(exe_buf), "fapolicyd")) {
13811382
reason = "pid file doesn't point to fapolicyd";
13821383
goto err_out;
13831384
}

src/library/paths.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#ifndef GLOBALS_H
2525
#define GLOBALS_H
2626

27-
#define DAEMON_PATH "/usr/sbin/fapolicyd"
2827
#define CONFIG_FILE "/etc/fapolicyd/fapolicyd.conf"
2928
#define OLD_RULES_FILE "/etc/fapolicyd/fapolicyd.rules"
3029
#define RULES_FILE "/etc/fapolicyd/compiled.rules"

0 commit comments

Comments
 (0)