X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=src%2Fmisc-progs%2Ftorctrl.c;fp=src%2Fmisc-progs%2Ftorctrl.c;h=686a8da4025dea2ae2cb4162b0cdd7a379c94ea1;hb=27cb780589dd7436f16f68b12694898a171b3829;hp=0000000000000000000000000000000000000000;hpb=13b5ce6e4068de1719ba69b67ea5b96291b7fe71;p=people%2Fteissler%2Fipfire-2.x.git diff --git a/src/misc-progs/torctrl.c b/src/misc-progs/torctrl.c new file mode 100644 index 000000000..686a8da40 --- /dev/null +++ b/src/misc-progs/torctrl.c @@ -0,0 +1,32 @@ +/* This file is part of the IPFire Firewall. + * + * This program is distributed under the terms of the GNU General Public + * Licence. See the file COPYING for details. + * + */ + +#include +#include +#include +#include +#include +#include "setuid.h" + +int main(int argc, char *argv[]) { + if (!(initsetuid())) + exit(1); + + if (argc < 2) { + fprintf(stderr, "\nNo argument given.\n\ntorctrl (restart)\n\n"); + exit(1); + } + + if (strcmp(argv[1], "restart") == 0) { + safe_system("/etc/rc.d/init.d/tor reload-or-restart"); + } else { + fprintf(stderr, "\nBad argument given.\n\ntorctrl (restart)\n\n"); + exit(1); + } + + return 0; +}