From d54512a31f1cf51b2b80f371270e35b1974ee8a8 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 4 Mar 2013 17:26:06 +0200 Subject: [PATCH] Add a -c option (login shell command) with an error message. (from Edoardo Spadolini) --- README | 2 ++ dgamelaunch.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README b/README index 2c1a60d..2ecc7ef 100644 --- a/README +++ b/README @@ -152,6 +152,7 @@ COMMANDLINE PARAMETERS ====================== -a Ignored. + -c Shows error message and exits. (login shell command) -e Ignored. -h Ignored. -i user Autologin and run the register -command hook for "user" @@ -191,6 +192,7 @@ ERROR CODES 11 Cannot run as root: Config file has shed_uid = 0 12 Config file has an unrecognized token 13 Config file: Negative value not accepted + 15 dgamelaunch called with -c (login shell command); exited 20 No menu defined, or no banner found for menu 60 Cannot create a new terminal, or no termcap files. 61 Cannot openpty() diff --git a/dgamelaunch.c b/dgamelaunch.c index cdacfb5..fbf6ef5 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -2719,10 +2719,15 @@ main (int argc, char** argv) __progname = basename(strdup(argv[0])); - while ((c = getopt(argc, argv, "sqh:pi:aeW:SD")) != -1) + while ((c = getopt(argc, argv, "c:sqh:pi:aeW:SD")) != -1) { switch (c) { + case 'c': + fprintf(stderr, "This is not a shell account, you can't execute " + "arbitrary commands.\n"); + graceful_exit(15); + break; case 's': showplayers = 1; break; -- 2.47.3