]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/misc-progs/ddnsctrl.c
Merge remote-tracking branch 'mfischer/python' into next
[people/pmueller/ipfire-2.x.git] / src / misc-progs / ddnsctrl.c
1 /* This file is part of the IPFire Firewall.
2 *
3 * This program is distributed under the terms of the GNU General Public
4 * Licence. See the file COPYING for details.
5 *
6 */
7
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <string.h>
11 #include <unistd.h>
12
13 #include "setuid.h"
14
15 const char *conffile = "/var/ipfire/ddns/ddns.conf";
16
17 int main(int argc, char *argv[]) {
18 char cmd[STRING_SIZE];
19
20 if (!(initsetuid()))
21 exit(1);
22
23 if (argc < 2) {
24 fprintf(stderr, "\nNo argument given.\n\nddnsctrl (update-all)\n\n");
25 exit(1);
26 }
27
28 if (strcmp(argv[1], "update-all") == 0) {
29 snprintf(cmd, sizeof(cmd), "/usr/bin/ddns --config %s update-all >/dev/null 2>&1", conffile);
30 safe_system(cmd);
31 } else {
32 fprintf(stderr, "\nBad argument given.\n\nddnsctrl (update-all)\n\n");
33 exit(1);
34 }
35
36 return 0;
37 }