[Freeciv-Dev] (PR#424) civserver --version as root
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
[gkoopman@xxxxxxxxx - Fri Jun 30 12:46:53 2000]:
> It's OK that the civserver and civclient executables refuse to work
> for root, but shouldn't it be possible to do run them with options
> like --help and --version?
This is a good point. Allowing it just require moving a few lines
(patch attached) so that we read in the command-line arguments (and
handle --help and --version) before calling dont_run_as_root.
Note that this causes audio_init to be run for civclient - should this
function also be moved down?
Are there any objections to this? Is it sufficiently secure? Or has
such a discussion taken place before?
jason
Index: server/civserver.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/civserver.c,v
retrieving revision 1.210
diff -u -r1.210 civserver.c
--- server/civserver.c 2002/06/12 07:24:48 1.210
+++ server/civserver.c 2002/11/12 09:33:40
@@ -55,9 +55,6 @@
/* initialize server */
srv_init();
- /* disallow running as root -- too dangerous */
- dont_run_as_root(argv[0], "freeciv_server");
-
/* parse command-line arguments... */
#ifdef GENERATING_MAC
@@ -148,6 +145,9 @@
fprintf(stderr, _("Report bugs to <%s>.\n"), BUG_EMAIL_ADDRESS);
exit(EXIT_SUCCESS);
}
+
+ /* disallow running as root -- too dangerous */
+ dont_run_as_root(argv[0], "freeciv_server");
/* have arguments, call the main server loop... */
srv_main();
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.150
diff -u -r1.150 civclient.c
--- client/civclient.c 2002/11/11 10:00:46 1.150
+++ client/civclient.c 2002/11/12 09:33:50
@@ -115,7 +115,6 @@
char *option=NULL;
init_nls();
- dont_run_as_root(argv[0], "freeciv_client");
audio_init();
/* default argument values are set in options.c */
@@ -182,6 +181,9 @@
}
i++;
} /* of while */
+
+ /* disallow running as root -- too dangerous */
+ dont_run_as_root(argv[0], "freeciv_client");
log_init(logfile, loglevel, NULL);
|
|