]> git.ipfire.org Git - ipfire-2.x.git/blob - src/misc-progs/wlanapctrl.c
IDS: Rename sourcefire VRT rulesets to Talos VRT rulesets
[ipfire-2.x.git] / src / misc-progs / wlanapctrl.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <unistd.h>
4 #include <stdlib.h>
5 #include <sys/types.h>
6 #include <fcntl.h>
7 #include "setuid.h"
8
9 int main(int argc, char *argv[]){
10 if ( argc < 2 ){
11 printf("invalid parameter(s)\n");
12 return(1);
13 }
14
15 if (!(initsetuid()))
16 exit(1);
17
18 if (strcmp(argv[1], "start") == 0){
19 safe_system("cp /var/ipfire/wlanap/hostapd.* /etc/");
20 safe_system("/etc/init.d/hostapd start");
21 }else if (strcmp(argv[1], "stop") == 0){
22 safe_system("/etc/init.d/hostapd stop");
23 }else if (strcmp(argv[1], "restart") == 0){
24 safe_system("cp /var/ipfire/wlanap/hostapd.* /etc/");
25 safe_system("/etc/init.d/hostapd restart");
26 }else if (strcmp(argv[1], "status") == 0){
27 safe_system("/etc/init.d/hostapd status");
28 }else{
29 printf("invalid parameter(s)\n");
30 return(1);
31 }
32
33 return 0;
34 }