]> git.ipfire.org Git - ipfire-2.x.git/blame - src/misc-progs/ddnsctrl.c
igb: update to 5.3.4.4
[ipfire-2.x.git] / src / misc-progs / ddnsctrl.c
CommitLineData
1a8999b3
SS
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
15const char *conffile = "/var/ipfire/ddns/ddns.conf";
16
17int 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}