aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/fics_addplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'FICS/fics_addplayer.c')
-rw-r--r--FICS/fics_addplayer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/FICS/fics_addplayer.c b/FICS/fics_addplayer.c
index 18d42c4..b5ca47f 100644
--- a/FICS/fics_addplayer.c
+++ b/FICS/fics_addplayer.c
@@ -29,6 +29,9 @@
Markus Uhlin 24/05/25 Added command-line option 'a'
Markus Uhlin 25/03/23 Output restart notice if the
player is admin.
+ Markus Uhlin 25/11/02 Require root privileges if the
+ FICS prefix compares to anything
+ else than '/home'.
*/
#include "stdinclude.h"
@@ -42,6 +45,7 @@
#include "fics_getsalt.h"
#include "ficsmain.h"
#include "playerdb.h"
+#include "prep_dir_for_privdrop.h"
#include "settings.h"
#include "utils.h"
@@ -136,6 +140,16 @@ main(int argc, char *argv[])
settings_init();
settings_read_conf(FICS_SETTINGS);
+ 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");
+ }
+
player_init(0);
p = player_new();