From 219a6dab8995aad9ac4860cc1a84d6f3509a03a4 Mon Sep 17 00:00:00 2001 From: wbx Date: Sun, 17 May 2009 14:41:34 +0200 Subject: Initial import --- package/ez-ipupdate/patches/patch-configure | 19 + package/ez-ipupdate/patches/patch-example-dhs_conf | 20 + .../ez-ipupdate/patches/patch-example-dyndns_conf | 27 ++ .../ez-ipupdate/patches/patch-example-dyns_conf | 20 + .../ez-ipupdate/patches/patch-example-easydns_conf | 20 + .../ez-ipupdate/patches/patch-example-gnudip_conf | 20 + .../patches/patch-example-heipv6tb_conf | 27 ++ .../patches/patch-example-justlinux_conf | 20 + package/ez-ipupdate/patches/patch-example-ods_conf | 20 + .../ez-ipupdate/patches/patch-example-pgpow_conf | 20 + package/ez-ipupdate/patches/patch-example-tzo_conf | 20 + package/ez-ipupdate/patches/patch-example_conf | 9 + package/ez-ipupdate/patches/patch-ez-ipupdate_c | 540 +++++++++++++++++++++ 13 files changed, 782 insertions(+) create mode 100644 package/ez-ipupdate/patches/patch-configure create mode 100644 package/ez-ipupdate/patches/patch-example-dhs_conf create mode 100644 package/ez-ipupdate/patches/patch-example-dyndns_conf create mode 100644 package/ez-ipupdate/patches/patch-example-dyns_conf create mode 100644 package/ez-ipupdate/patches/patch-example-easydns_conf create mode 100644 package/ez-ipupdate/patches/patch-example-gnudip_conf create mode 100644 package/ez-ipupdate/patches/patch-example-heipv6tb_conf create mode 100644 package/ez-ipupdate/patches/patch-example-justlinux_conf create mode 100644 package/ez-ipupdate/patches/patch-example-ods_conf create mode 100644 package/ez-ipupdate/patches/patch-example-pgpow_conf create mode 100644 package/ez-ipupdate/patches/patch-example-tzo_conf create mode 100644 package/ez-ipupdate/patches/patch-example_conf create mode 100644 package/ez-ipupdate/patches/patch-ez-ipupdate_c (limited to 'package/ez-ipupdate/patches') diff --git a/package/ez-ipupdate/patches/patch-configure b/package/ez-ipupdate/patches/patch-configure new file mode 100644 index 000000000..7227b9574 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-configure @@ -0,0 +1,19 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/configure Thu Apr 17 17:38:52 2003 ++++ ez-ipupdate-3.0.11b8/configure Tue Jul 31 12:33:09 2007 +@@ -1804,11 +1804,15 @@ echo "configure:1804: checking whether u + # Check whether --enable-debug or --disable-debug was given. + if test "${enable_debug+set}" = set; then + enableval="$enable_debug" ++ if test x"yes" = x"$enable_debug"; then + cat >> confdefs.h <<\EOF + #define DEBUG 1 + EOF + + echo "$ac_t""yes" 1>&6 ++ else ++ echo "$ac_t""no" 1>&6 ++ fi + else + echo "$ac_t""no" 1>&6 + fi diff --git a/package/ez-ipupdate/patches/patch-example-dhs_conf b/package/ez-ipupdate/patches/patch-example-dhs_conf new file mode 100644 index 000000000..9e1c6b813 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-dhs_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-dhs.conf Sat Nov 18 23:01:45 2000 ++++ ez-ipupdate-3.0.11b8/example-dhs.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -10,8 +10,8 @@ user=myuserid:mypassword + host=mydomain.whatever.com + interface=eth1 + +-# if you use run-as ensure the user has permission to write this file +-cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-dyndns_conf b/package/ez-ipupdate/patches/patch-example-dyndns_conf new file mode 100644 index 000000000..08d4ed42b --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-dyndns_conf @@ -0,0 +1,27 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-dyndns.conf Sat Nov 18 23:01:49 2000 ++++ ez-ipupdate-3.0.11b8/example-dyndns.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -12,14 +12,9 @@ host=mydomain.whatever.com + interface=eth1 + max-interval=2073600 + +-# please create this file and ensure that the user that ez-ipupdate is running +-# as has write permissions to it then uncomment this line, if you don't your +-# dyndns account will probably get banned. if you run ez-ipupdate as root (bad +-# idea, use "run-as-user") then you can just uncomment this line. +-#cache-file=/etc/ez-ipupdate.cache.eth1 +- +-# for the mean time we'll just use a cache file in the temp directory +-cache-file=/tmp/ez-ipupdate.cache ++# if you don't use a cache file your dyndns account will probably get banned. ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-dyns_conf b/package/ez-ipupdate/patches/patch-example-dyns_conf new file mode 100644 index 000000000..d2556cf51 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-dyns_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-dyns.conf Wed Nov 29 20:08:34 2000 ++++ ez-ipupdate-3.0.11b8/example-dyns.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -10,8 +10,8 @@ user=myuserid:mypassword + host=myhost + #interface=eth1 + +-# if you use run-as ensure the user has permission to write this file +-#cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-easydns_conf b/package/ez-ipupdate/patches/patch-example-easydns_conf new file mode 100644 index 000000000..472689f54 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-easydns_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-easydns.conf Sat Nov 18 23:00:48 2000 ++++ ez-ipupdate-3.0.11b8/example-easydns.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -10,8 +10,8 @@ user=myuserid:mypassword + host=mydomain.whatever.com + interface=eth1 + +-# if you use run-as ensure the user has permission to write this file +-cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-gnudip_conf b/package/ez-ipupdate/patches/patch-example-gnudip_conf new file mode 100644 index 000000000..14c6105b9 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-gnudip_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-gnudip.conf Sat Nov 18 23:02:14 2000 ++++ ez-ipupdate-3.0.11b8/example-gnudip.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -14,8 +14,8 @@ max-interval=2073600 + # any other value is ignored + #address=0.0.0.0 + +-# if you use run-as ensure the user has permission to write this file +-cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-heipv6tb_conf b/package/ez-ipupdate/patches/patch-example-heipv6tb_conf new file mode 100644 index 000000000..7387b885f --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-heipv6tb_conf @@ -0,0 +1,27 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-heipv6tb.conf Sat Jul 7 21:18:42 2001 ++++ ez-ipupdate-3.0.11b8/example-heipv6tb.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -11,14 +11,9 @@ user=myuserid:mypassword + interface=eth1 + max-interval=2073600 + +-# please create this file and ensure that the user that ez-ipupdate is running +-# as has write permissions to it then uncomment this line, if you don't your +-# dyndns account will probably get banned. if you run ez-ipupdate as root (bad +-# idea, use "run-as-user") then you can just uncomment this line. +-#cache-file=/etc/ez-ipupdate.cache.eth1 +- +-# for the mean time we'll just use a cache file in the temp directory +-cache-file=/tmp/ez-ipupdate.cache ++# if you don't use a cache file your account will probably get banned. ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-justlinux_conf b/package/ez-ipupdate/patches/patch-example-justlinux_conf new file mode 100644 index 000000000..a63fe2690 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-justlinux_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-justlinux.conf Sat Nov 18 23:02:22 2000 ++++ ez-ipupdate-3.0.11b8/example-justlinux.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -10,8 +10,8 @@ user=myuserid:mypassword + host=mydomain.penguinpowered.com + interface=eth1 + +-# if you use run-as ensure the user has permission to write this file +-cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-ods_conf b/package/ez-ipupdate/patches/patch-example-ods_conf new file mode 100644 index 000000000..1b9ee44d8 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-ods_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-ods.conf Sat Nov 18 23:02:24 2000 ++++ ez-ipupdate-3.0.11b8/example-ods.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -10,8 +10,8 @@ user=myuserid:mypassword + host=mydomain.ods.org + interface=eth1 + +-# if you use run-as ensure the user has permission to write this file +-cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-pgpow_conf b/package/ez-ipupdate/patches/patch-example-pgpow_conf new file mode 100644 index 000000000..1c2ea9f2c --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-pgpow_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-pgpow.conf Sat Nov 18 23:02:26 2000 ++++ ez-ipupdate-3.0.11b8/example-pgpow.conf Tue Jul 31 12:33:09 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -10,8 +10,8 @@ user=myuserid:mypassword + host=mydomain.penguinpowered.com + interface=eth1 + +-# if you use run-as ensure the user has permission to write this file +-cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example-tzo_conf b/package/ez-ipupdate/patches/patch-example-tzo_conf new file mode 100644 index 000000000..95719931f --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example-tzo_conf @@ -0,0 +1,20 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example-tzo.conf Sat Nov 18 23:02:28 2000 ++++ ez-ipupdate-3.0.11b8/example-tzo.conf Tue Jul 31 12:33:10 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # +@@ -14,8 +14,8 @@ host=mydomain.whatever.com + max-interval=2073600 + interface=eth1 + +-# if you use run-as ensure the user has permission to write this file +-cache-file=/tmp/ez-ipupdate.cache ++run-as-user=ez-ipupd ++cache-file=/var/cache/ez-ipupdate/default-cache + + # uncomment this once you have everything working how you want and you are + # ready to have ez-ipupdate running in the background all the time. to stop it diff --git a/package/ez-ipupdate/patches/patch-example_conf b/package/ez-ipupdate/patches/patch-example_conf new file mode 100644 index 000000000..c1b0055c5 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-example_conf @@ -0,0 +1,9 @@ +$Id$ +--- ez-ipupdate-3.0.11b8.orig/example.conf Sat Jul 7 21:15:15 2001 ++++ ez-ipupdate-3.0.11b8/example.conf Tue Jul 31 12:33:09 2007 +@@ -1,4 +1,4 @@ +-#!/usr/local/bin/ez-ipupdate -c ++#!/usr/sbin/ez-ipupdate -c + # + # example config file for ez-ipupdate + # diff --git a/package/ez-ipupdate/patches/patch-ez-ipupdate_c b/package/ez-ipupdate/patches/patch-ez-ipupdate_c new file mode 100644 index 000000000..15252b5a5 --- /dev/null +++ b/package/ez-ipupdate/patches/patch-ez-ipupdate_c @@ -0,0 +1,540 @@ +$Id$ + + cjb.net support by + +--- ez-ipupdate-3.0.11b8.orig/ez-ipupdate.c Mon Mar 11 23:31:25 2002 ++++ ez-ipupdate-3.0.11b8/ez-ipupdate.c Tue Jul 31 14:05:00 2007 +@@ -87,6 +87,10 @@ + #define JUSTL_REQUEST "/bin/controlpanel/dyndns/jlc.pl" + #define JUSTL_VERSION "2.0" + ++#define CJB_DEFAULT_SERVER "www.cjb.net" ++#define CJB_DEFAULT_PORT "80" ++#define CJB_REQUEST "/cgi-bin/dynip.cgi" ++ + #define DYNS_DEFAULT_SERVER "www.dyns.cx" + #define DYNS_DEFAULT_PORT "80" + #define DYNS_REQUEST "/postscript.php" +@@ -139,6 +143,9 @@ + #if HAVE_SIGNAL_H + # include + #endif ++#if HAVE_TIME_H ++# include ++#endif + #if HAVE_SYS_TIME_H + # include + #endif +@@ -165,7 +172,7 @@ + #endif + + +-#if __linux__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__ ++#if __GLIBC__ || __SVR4 || __OpenBSD__ || __FreeBSD__ || __NetBSD__ + # define IF_LOOKUP 1 + # include + # include +@@ -325,6 +332,10 @@ int JUSTL_update_entry(void); + int JUSTL_check_info(void); + static char *JUSTL_fields_used[] = { "server", "user", "host", NULL }; + ++int CJB_update_entry(void); ++int CJB_check_info(void); ++static char *CJB_fields_used[] = { "server", "user", NULL }; ++ + int DYNS_update_entry(void); + int DYNS_check_info(void); + static char *DYNS_fields_used[] = { "server", "user", "host", NULL }; +@@ -474,6 +485,16 @@ struct service_t services[] = { + JUSTL_DEFAULT_PORT, + JUSTL_REQUEST + }, ++ { "cjb.net", ++ { "cjb", 0, 0, }, ++ NULL, ++ CJB_update_entry, ++ CJB_check_info, ++ CJB_fields_used, ++ CJB_DEFAULT_SERVER, ++ CJB_DEFAULT_PORT, ++ CJB_REQUEST ++ }, + { "dyns", + { "dyns", 0, 0, }, + NULL, +@@ -640,7 +661,7 @@ void print_usage( void ) + fprintf(stdout, " -q, --quiet \t\t\tbe quiet\n"); + fprintf(stdout, " -r, --retrys \t\tnumber of trys (default: 1)\n"); + fprintf(stdout, " -R, --run-as-user \tchange to for running, be ware\n\t\t\t\tthat this can cause problems with handeling\n\t\t\t\tSIGHUP properly if that user can't read the\n\t\t\t\tconfig file. also it can't write it's pid file \n\t\t\t\tto a root directory\n"); +- fprintf(stdout, " -Q, --run-as-euser \tchange to effective for running, \n\t\t\t\tthis is NOT secure but it does solve the \n\t\t\t\tproblems with run-as-user and config files and \n\t\t\t\tpid files.\n"); ++ fprintf(stdout, " -Q, --run-as-euser \tchange to effective for running, \n\t\t\t\tthis is NOT secure but it does solve the \n\t\t\t\tproblems with run-as-user and config files and \n\t\t\t\tpid files\n"); + fprintf(stdout, " -s, --server \tthe server to connect to\n"); + fprintf(stdout, " -S, --service-type \tthe type of service that you are using\n"); + width = fprintf(stdout, "\t\t\t\ttry one of: ") + 4*7; +@@ -682,7 +703,7 @@ void print_credits( void ) + + void print_signalhelp( void ) + { +- fprintf(stdout, "\nsignals are only really used when in daemon mode.\n\n"); ++ fprintf(stdout, "\nsignals are only really used when in daemon mode\n\n"); + fprintf(stdout, "signals: \n"); + fprintf(stdout, " HUP\t\tcauses it to re-read its config file\n"); + fprintf(stdout, " TERM\t\twake up and possibly perform an update\n"); +@@ -693,7 +714,7 @@ void print_signalhelp( void ) + #if HAVE_SIGNAL_H + RETSIGTYPE sigint_handler(int sig) + { +- char message[] = "interupted.\n"; ++ char message[] = "interrupted\n"; + close(client_sockfd); + write(2, message, sizeof(message)-1); + +@@ -704,6 +725,10 @@ RETSIGTYPE sigint_handler(int sig) + } + #endif + ++#if HAVE_SYSLOG_H ++ closelog(); ++#endif ++ + exit(1); + } + RETSIGTYPE generic_sig_handler(int sig) +@@ -798,7 +823,7 @@ void show_message(char *fmt, ...) + sprintf(buf, "message incomplete because your OS sucks: %s\n", fmt); + #endif + +- syslog(LOG_NOTICE, buf); ++ syslog(LOG_NOTICE, "%s", buf); + } + else + { +@@ -1439,7 +1464,7 @@ int do_connect(int *sock, char *host, ch + if(!(options & OPT_QUIET)) + { + fprintf(stderr, +- "connected to %s (%s) on port %d.\n", ++ "connected to %s (%s) on port %d\n", + host, + inet_ntoa(address.sin_addr), + ntohs(address.sin_port)); +@@ -1683,7 +1708,7 @@ static int ODS_read_response(char *buf, + close(client_sockfd); + return(-1); + } +- if(strstr(buf, "\r\n") > 0) ++ if(strstr(buf, "\n") != NULL) + { + break; + } +@@ -1702,8 +1727,8 @@ int NULL_check_info(void) + + if(options & OPT_DAEMON) + { +- fprintf(stderr, "no compile time default service was set therefor you must " +- "specify a service type.\n"); ++ fprintf(stderr, "no compile time default service was set, you must " ++ "specify a service type\n"); + + return(-1); + } +@@ -2039,7 +2064,7 @@ int DYNDNS_update_entry(void) + } + else if(strstr(buf, "\nnumhost") != NULL) + { +- show_message("Too many or too few hosts found\n"); ++ show_message("too many or too few hosts found\n"); + retval = UPDATERES_SHUTDOWN; + } + else if(strstr(buf, "\ndnserr") != NULL) +@@ -2051,17 +2076,17 @@ int DYNDNS_update_entry(void) + } + else if(strstr(buf, "\n911") != NULL) + { +- show_message("Ahhhh! call 911!\n"); ++ show_message("ahhhh! call 911!\n"); + retval = UPDATERES_SHUTDOWN; + } + else if(strstr(buf, "\n999") != NULL) + { +- show_message("Ahhhh! call 999!\n"); ++ show_message("ahhhh! call 999!\n"); + retval = UPDATERES_SHUTDOWN; + } + else if(strstr(buf, "\n!donator") != NULL) + { +- show_message("a feature requested is only available to donators, please donate.\n", host); ++ show_message("a feature requested is only available to donators, please donate\n", host); + retval = UPDATERES_OK; + } + // this one should be last as it is a stupid string to signify waits +@@ -2095,9 +2120,9 @@ int DYNDNS_update_entry(void) + sprintf(reason, "problem parsing reason for wait response"); + } + +- show_message("Wait response received, waiting for %s before next update.\n", ++ show_message("wait response received, waiting for %s before next update\n", + format_time(howlong)); +- show_message("Wait response reason: %d\n", N_STR(reason)); ++ show_message("wait response reason: %d\n", N_STR(reason)); + sleep(howlong); + retval = UPDATERES_ERROR; + } +@@ -3370,7 +3395,7 @@ int GNUDIP_check_info(void) + { + if(!(options & OPT_QUIET)) + { +- fprintf(stderr, "warning: for GNUDIP the \"address\" parpameter is only used if set to \"0.0.0.0\" thus making an offline request.\n"); ++ fprintf(stderr, "warning: for GNUDIP the \"address\" parameter is only used if set to \"0.0.0.0\" thus making an offline request\n"); + } + } + +@@ -3392,7 +3417,7 @@ int GNUDIP_update_entry(void) + + // send an offline request if address 0.0.0.0 is used + // otherwise, we ignore the address and send an update request +- gnudip_request[0] = strcmp(address, "0.0.0.0") == 0 ? '1' : '0'; ++ gnudip_request[0] = address && strcmp(address, "0.0.0.0") == 0 ? '1' : '0'; + gnudip_request[1] = '\0'; + + // find domainname +@@ -3660,6 +3685,140 @@ int JUSTL_update_entry(void) + return(UPDATERES_OK); + } + ++int CJB_check_info(void) ++{ ++ char buf[BUFSIZ+1]; ++ ++ if(interface == NULL && address == NULL) ++ { ++ if(options & OPT_DAEMON) ++ { ++ fprintf(stderr, "you must provide either an interface or an address\n"); ++ return(-1); ++ } ++ if(interface) { free(interface); } ++ printf("interface: "); ++ *buf = '\0'; ++ fgets(buf, BUFSIZ, stdin); ++ chomp(buf); ++ option_handler(CMD_interface, buf); ++ } ++ ++ warn_fields(service->fields_used); ++ ++ return 0; ++} ++ ++int CJB_update_entry(void) ++{ ++ char buf[BUFFER_SIZE+1]; ++ char *bp = buf; ++ int bytes; ++ int btot; ++ int ret; ++ ++ buf[BUFFER_SIZE] = '\0'; ++ ++ if(do_connect((int*)&client_sockfd, server, port) != 0) ++ { ++ if(!(options & OPT_QUIET)) ++ { ++ show_message("error connecting to %s:%s\n", server, port); ++ } ++ return(UPDATERES_ERROR); ++ } ++ ++ snprintf(buf, BUFFER_SIZE, "GET %s?", request); ++ output(buf); ++ snprintf(buf, BUFFER_SIZE, "%s=%s&", "username", user_name); ++ output(buf); ++ snprintf(buf, BUFFER_SIZE, "%s=%s", "password", password); ++ output(buf); ++#if 0 ++ /* cjb does IP address autodetection */ ++ snprintf(buf, BUFFER_SIZE, "&%s=%s", "ip", address); ++ output(buf); ++#endif ++ snprintf(buf, BUFFER_SIZE, " HTTP/1.0\015\012"); ++ output(buf); ++ snprintf(buf, BUFFER_SIZE, "User-Agent: %s-%s %s [%s] (%s)\015\012", ++ "ez-update", VERSION, OS, (options & OPT_DAEMON) ? "daemon" : "", "by OpenADK"); ++ output(buf); ++ snprintf(buf, BUFFER_SIZE, "\015\012"); ++ output(buf); ++ ++ bp = buf; ++ bytes = 0; ++ btot = 0; ++ while((bytes=read_input(bp, BUFFER_SIZE-btot)) > 0) ++ { ++ bp += bytes; ++ btot += bytes; ++ dprintf((stderr, "btot: %d\n", btot)); ++ } ++ close(client_sockfd); ++ buf[btot] = '\0'; ++ ++ dprintf((stderr, "server output: %s\n", buf)); ++ ++ if(sscanf(buf, " HTTP/1.%*c %3d", &ret) != 1) ++ { ++ ret = -1; ++ } ++ ++ switch(ret) ++ { ++ case -1: ++ if(!(options & OPT_QUIET)) ++ { ++ show_message("strange server response, are you connecting to the right server?\n"); ++ } ++ return(UPDATERES_ERROR); ++ break; ++ ++ case 200: ++ if(strstr(buf, " updated ") != NULL) ++ { ++ if(!(options & OPT_QUIET)) ++ { ++ printf("request successful\n"); ++ } ++ } ++ else ++ { ++ show_message("error processing request\n"); ++ if(!(options & OPT_QUIET)) ++ { ++ fprintf(stderr, "server output: %s\n", buf); ++ } ++ return(UPDATERES_ERROR); ++ } ++ break; ++ ++ case 401: ++ if(!(options & OPT_QUIET)) ++ { ++ show_message("authentication failure\n"); ++ } ++ return(UPDATERES_SHUTDOWN); ++ break; ++ ++ default: ++ if(!(options & OPT_QUIET)) ++ { ++ // reuse the auth buffer ++ *auth = '\0'; ++ sscanf(buf, " HTTP/1.%*c %*3d %255[^\r\n]", auth); ++ show_message("unknown return code: %d\n", ret); ++ show_message("server response: %s\n", auth); ++ } ++ return(UPDATERES_ERROR); ++ break; ++ } ++ ++ return(UPDATERES_OK); ++} ++ + int DYNS_check_info(void) + { + char buf[BUFSIZ+1]; +@@ -3943,22 +4102,22 @@ int HN_update_entry(void) + break; + + case 201: +- show_message("Last update was less than %d seconds ago.\n", 300); ++ show_message("last update was less than %d seconds ago\n", 300); + return(UPDATERES_ERROR); + break; + + case 202: +- show_message("Server error.\n"); ++ show_message("server error\n"); + return(UPDATERES_ERROR); + break; + + case 203: +- show_message("Failure because account is frozen (by admin).\n"); ++ show_message("failure because account is frozen (by admin)\n"); + return(UPDATERES_SHUTDOWN); + break; + + case 204: +- show_message("Failure because account is locked (by user).\n"); ++ show_message("failure because account is locked (by user)\n"); + return(UPDATERES_SHUTDOWN); + break; + +@@ -4215,8 +4374,6 @@ int HEIPV6TB_update_entry(void) + + switch(ret) + { +- char *p; +- + case -1: + if(!(options & OPT_QUIET)) + { +@@ -4349,7 +4506,7 @@ void handle_sig(int sig) + case SIGHUP: + if(config_file) + { +- show_message("SIGHUP recieved, re-reading config file\n"); ++ show_message("SIGHUP received, re-reading config file\n"); + if(parse_conf_file(config_file, conf_commands) != 0) + { + show_message("error parsing config file \"%s\"\n", config_file); +@@ -4384,6 +4541,7 @@ void handle_sig(int sig) + + int main(int argc, char **argv) + { ++ char *tmp; + int ifresolve_warned = 0; + int i; + int retval = 1; +@@ -4395,9 +4553,10 @@ int main(int argc, char **argv) + mcheck(NULL); + #endif + +- dprintf((stderr, "staring...\n")); ++ dprintf((stderr, "starting...\n")); + +- program_name = argv[0]; ++ tmp = strrchr(argv[0], '/'); ++ program_name = tmp ? tmp + 1 : argv[0]; + options = 0; + *user = '\0'; + timeout.tv_sec = DEFAULT_TIMEOUT; +@@ -4417,7 +4576,7 @@ int main(int argc, char **argv) + + if(!(options & OPT_QUIET) && !(options & OPT_DAEMON)) + { +- fprintf(stderr, "ez-ipupdate Version %s\nCopyright (C) 1998-2001 Angus Mackay.\n", VERSION); ++ fprintf(stderr, "%s Version %s\nCopyright (C) 1998-2001 Angus Mackay\n", program_name, VERSION); + } + + dprintf((stderr, "options: 0x%04X\n", options)); +@@ -4434,7 +4593,7 @@ int main(int argc, char **argv) + { + if(service->check_info() != 0) + { +- fprintf(stderr, "invalid data to perform requested action.\n"); ++ fprintf(stderr, "invalid data to perform requested action\n"); + exit(1); + } + } +@@ -4456,13 +4615,13 @@ int main(int argc, char **argv) + dprintf((stderr, "user_name: %s\n", user_name)); + dprintf((stderr, "password: %s\n", password)); + } +- if(*user_name == '\0') ++ if(*user_name == '\0' && !(options & OPT_DAEMON)) + { + printf("user name: "); + fgets(user_name, sizeof(user_name), stdin); + chomp(user_name); + } +- if(*password == '\0') ++ if(*password == '\0' && !(options & OPT_DAEMON)) + { + strncpy(password, getpass("password: "), sizeof(password)); + } +@@ -4480,7 +4639,7 @@ int main(int argc, char **argv) + + if(service->check_info() != 0) + { +- fprintf(stderr, "invalid data to perform requested action.\n"); ++ fprintf(stderr, "invalid data to perform requested action\n"); + exit(1); + } + +@@ -4503,7 +4662,7 @@ int main(int argc, char **argv) + + if(interface == NULL) + { +- fprintf(stderr, "invalid data to perform requested action.\n"); ++ fprintf(stderr, "invalid data to perform requested action\n"); + fprintf(stderr, "you must provide an interface for daemon mode"); + exit(1); + } +@@ -4519,23 +4678,25 @@ int main(int argc, char **argv) + if(fork() > 0) { exit(0); } /* parent */ + } + ++# if HAVE_SYSLOG_H ++ openlog(program_name, LOG_PID, LOG_DAEMON ); ++ //options |= OPT_QUIET; ++# endif ++ show_message("version %s, interface %s, host %s, server %s, service %s\n", ++ VERSION, N_STR(interface), N_STR(host), server, service->title); ++ + #if HAVE_GETPID + if(pid_file && pid_file_create(pid_file) != 0) + { +- fprintf(stderr, "exiting...\n"); ++ show_message("could not create pid file %s (%s), exiting\n", ++ pid_file, strerror(errno)); ++#if HAVE_SYSLOG_H ++ closelog(); ++#endif + exit(1); + } + #endif + +-# if HAVE_SYSLOG_H +- openlog(program_name, LOG_PID, LOG_USER ); +- options |= OPT_QUIET; +-# endif +- show_message("ez-ipupdate Version %s, Copyright (C) 1998-2001 Angus Mackay.\n", +- VERSION); +- show_message("%s started for interface %s host %s using server %s and service %s\n", +- program_name, N_STR(interface), N_STR(host), server, service->title); +- + memset(&sin, 0, sizeof(sin)); + + if(cache_file) +@@ -4560,7 +4721,7 @@ int main(int argc, char **argv) + strftime(timebuf, sizeof(timebuf), "%Y/%m/%d %H:%M", ts); + show_message("got last update %s on %s from cache file\n", ipstr, timebuf); + } +- else ++ else if(ipstr||ipdate) + { + show_message("malformed cache file: %s\n", cache_file); + } +@@ -4647,7 +4808,7 @@ int main(int argc, char **argv) + } + else + { +- show_message("failure to update %s->%s (%s)\n", ++ show_message("failed to update %s->%s (%s)\n", + interface, inet_ntoa(sin.sin_addr), N_STR(host)); + memset(&sin, 0, sizeof(sin)); + +@@ -4671,7 +4832,7 @@ int main(int argc, char **argv) + dprintf((stderr, "updateres: %d\n", updateres)); + if(updateres == UPDATERES_SHUTDOWN) + { +- show_message("shuting down updater for %s due to fatal error\n", ++ show_message("shutting down updater for %s due to fatal error\n", + N_STR(host)); + + if(notify_email && *notify_email != '\0') +@@ -4711,7 +4872,7 @@ int main(int argc, char **argv) + #endif + + #else +- fprintf(stderr, "sorry, this mode is only available on platforms that the "); ++ fprintf(stderr, "sorry, this mode is only available on platforms where the "); + fprintf(stderr, "IP address \ncan be determined. feel free to hack the code"); + fprintf(stderr, " though.\n"); + exit(1); +@@ -4799,7 +4960,7 @@ int main(int argc, char **argv) + } + else + { +- show_message("could not resolve ip address for %s.\n", interface); ++ show_message("could not resolve ip address for %s\n", interface); + exit(1); + } + close(sock); -- cgit v1.2.3