aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2025-11-09 00:54:45 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2025-11-09 00:54:45 +0100
commit7f3ce5c27502a845289daa8daf2497e67ff39af6 (patch)
tree6450381fb2c8b6c6bef4ad74e76f3dccd486e414 /FICS
parent789e3fa888e48a2ae5a3c4b42cb89e76f5d3207c (diff)
Require root privileges if the FICS prefix compares to anything else than '/home'
Diffstat (limited to 'FICS')
-rw-r--r--FICS/makerank.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/FICS/makerank.c b/FICS/makerank.c
index aa92ae0..e50886a 100644
--- a/FICS/makerank.c
+++ b/FICS/makerank.c
@@ -15,6 +15,7 @@
#include "common.h"
#include "ficsmain.h"
#include "makerank.h"
+#include "prep_dir_for_privdrop.h"
#include "utils.h"
static ENTRY **list;
@@ -340,6 +341,16 @@ main(int argc, char **argv)
return EXIT_FAILURE;
}
+ if (strncmp(FICS_PREFIX, "/home", 5) == 0) {
+ if (is_super_user())
+ errx(1, "Do not run as root");
+ } else {
+ if (!is_super_user())
+ errx(1, "Need root privileges");
+ else if (drop_root_privileges(FICS_PREFIX) == -1)
+ errx(1, "Privdrop failed");
+ }
+
makerank();
return EXIT_SUCCESS;
}