diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-06-03 18:30:40 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-06-03 18:30:40 +0800 |
commit | e42291049072cfee02408394850b33b3580dbd83 (patch) | |
tree | 54dfd3c6450f38890e400001bd0d6343f2a4751e /util | |
parent | ab7fd5ecdca4ff9fc31e8695453f97bf82fdb6e1 (diff) | |
download | pttbbs-e42291049072cfee02408394850b33b3580dbd83.tar pttbbs-e42291049072cfee02408394850b33b3580dbd83.tar.gz pttbbs-e42291049072cfee02408394850b33b3580dbd83.tar.bz2 pttbbs-e42291049072cfee02408394850b33b3580dbd83.tar.lz pttbbs-e42291049072cfee02408394850b33b3580dbd83.tar.xz pttbbs-e42291049072cfee02408394850b33b3580dbd83.tar.zst pttbbs-e42291049072cfee02408394850b33b3580dbd83.zip |
only port 23 using root permission
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@279 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r-- | util/bbsctl.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/util/bbsctl.c b/util/bbsctl.c index 64e54e61..9618f5de 100644 --- a/util/bbsctl.c +++ b/util/bbsctl.c @@ -1,4 +1,3 @@ -#include <grp.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -6,6 +5,7 @@ #include <signal.h> #include <sys/types.h> #include <dirent.h> +#include <grp.h> #include <fcntl.h> #include <ctype.h> #include "config.h" @@ -53,23 +53,32 @@ int HaveBBSADM(void) int startbbs(int argc, char **argv) { + int i; + char *port[] = {"3000", "3001", "3002", "3003", "3004", "3005", + "3006", "3007", "3008", "3009", "3010", NULL}; + pid_t pid; + + for( i = 0 ; port[i] != NULL ; ++i ){ + if( (pid = fork()) < 0 ){ + perror("fork()"); + return 1; + } + else if( pid == 0 ){ + printf("starting mbbsd at port %s\n", port[i]); + execl("/home/bbs/bin/mbbsd", "mbbsd", port[i], NULL); + printf("start port[%s] failed\n", port[i]); + return 1; + } + } + if( setuid(0) < 0 ){ perror("setuid(0)"); exit(1); } - puts("starting mbbsd: 23"); system("/home/bbs/bin/mbbsd 23"); - puts("starting mbbsd:3000"); system("/home/bbs/bin/mbbsd 3000"); - puts("starting mbbsd:3001"); system("/home/bbs/bin/mbbsd 3001"); - puts("starting mbbsd:3002"); system("/home/bbs/bin/mbbsd 3002"); - puts("starting mbbsd:3003"); system("/home/bbs/bin/mbbsd 3003"); - puts("starting mbbsd:3004"); system("/home/bbs/bin/mbbsd 3004"); - puts("starting mbbsd:3005"); system("/home/bbs/bin/mbbsd 3005"); - puts("starting mbbsd:3006"); system("/home/bbs/bin/mbbsd 3006"); - puts("starting mbbsd:3007"); system("/home/bbs/bin/mbbsd 3007"); - puts("starting mbbsd:3008"); system("/home/bbs/bin/mbbsd 3008"); - puts("starting mbbsd:3009"); system("/home/bbs/bin/mbbsd 3009"); - puts("starting mbbsd:3010"); system("/home/bbs/bin/mbbsd 3010"); - return 0; + printf("starting mbbsd at port %s\n", "23"); + execl("/home/bbs/bin/mbbsd", "mbbsd", "23", NULL); + printf("start port[%s] failed\n", "23"); + return 1; } int stopbbs(int argc, char **argv) @@ -200,8 +209,9 @@ int permreport(int argc, char **argv) struct { int perm; char *desc; - } check[] = {{PERM_ACCOUNTS, "PERM_ACCOUNTS"}, + } check[] = {{PERM_BBSADM, "PERM_BBSADM"}, {PERM_SYSOP, "PERM_SYSOP"}, + {PERM_ACCOUNTS, "PERM_ACCOUNTS"}, {PERM_SYSSUBOP, "PERM_SYSSUBOP"}, {PERM_MANAGER, "PERM_MANAGER"}, {0, NULL}}; |