]>
Commit | Line | Data |
---|---|---|
27731caa CS |
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("/etc/init.d/hostapd start"); | |
20 | }else if (strcmp(argv[1], "stop") == 0){ | |
21 | safe_system("/etc/init.d/hostapd stop"); | |
8c2f203c CS |
22 | }else if (strcmp(argv[1], "restart") == 0){ |
23 | safe_system("cp /var/ipfire/wlanap/hostapd.conf /etc/hostapd.conf"); | |
24 | safe_system("/etc/init.d/hostapd restart"); | |
27731caa CS |
25 | }else if (strcmp(argv[1], "status") == 0){ |
26 | safe_system("/etc/init.d/hostapd status"); | |
27 | }else{ | |
28 | printf("invalid parameter(s)\n"); | |
29 | return(1); | |
30 | } | |
31 | ||
32 | return 0; | |
33 | } |