if (asus_ddns == 2) { //Peanuthull DDNS
if( (fp = fopen("/etc/phddns.conf", "w")) != NULL ) {
fprintf(fp, "[settings]\n");
fprintf(fp, "szHost = phddns60.oray.net\n");
fprintf(fp, "szUserID = %s\n", user);
fprintf(fp, "szUserPWD = %s\n", passwd);
fprintf(fp, "nicName = %s\n", wan_ifname);
fprintf(fp, "szLog = /var/log/phddns.log\n");
fclose(fp);
eval("phddns", "-c", "/etc/phddns.conf", "-d");
}
}
if( (fp = fopen(INADYNCONF, "w"))) { // Inadyn
chmod(INADYNCONF, 0600);
if (*service && asus_ddns != 2) {
if (asus_ddns == 10) {
fprintf(fp, "custom namecheap {\n");
fprintf(fp, "ddns-server = dynamicdns.park-your-domain.com\n");
// We store the domain.tld in the username nvram
fprintf(fp, "ddns-path = \"/update?domain=%%u&password=%%p&host=%%h\"\n");
} else {
fprintf(fp, "provider %s {\n", service);
}
fprintf(fp, "hostname = %s\n", host);
str_escape_quotes(tmp, user, sizeof(tmp));
fprintf(fp, "username = \"%s\"\n", tmp);
str_escape_quotes(tmp, passwd, sizeof(tmp));
fprintf(fp, "password = \"%s\"\n", tmp);
if (nvram_get_int("ddns_ipcheck") == 0) // Internal (local)
#ifdef HND_ROUTER
fprintf(fp, "checkip-command = \"/bin/nvram get %sipaddr\"\n", prefix);
#else
fprintf(fp, "checkip-command = \"/usr/sbin/nvram get %sipaddr\"\n", prefix);
#endif
if (wild)
fprintf(fp, "wildcard = true\n");
fprintf(fp, "}\n");
}
append_custom_config("inadyn.conf", fp);
run_postconf("inadyn",INADYNCONF);
fclose(fp);
if((time_fp=fopen("/tmp/ddns.cache","w"))) {
fprintf(time_fp,"%ld,%s",time(&now),wan_ip);
fclose(time_fp);
}
if (nvram_get_int("ddns_debug") == 1)
loglevel = "debug";
else
loglevel = "notice";
char *argv[] = { "/usr/sbin/inadyn", "-once",
"-e", "/sbin/ddns_updated",
"--exec-nochg", "/sbin/ddns_updated",
"-l", loglevel,
NULL };
_eval(argv, NULL, 0, &pid);
}
if (*service) {
run_custom_script("ddns-start", wan_ip);
} else {
// Block until it completes and updates the DDNS update results in nvram
run_custom_script_blocking("ddns-start", wan_ip, NULL);
}
return 0;
}