From 8bb036ac1e2c7d3a85c57df7729fb31ce45fce8f Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Tue, 15 Jun 2021 16:42:38 +0100 Subject: [PATCH] v1.0.0 --- ChangeLog | 2 +- README | 8 ++------ TODO | 6 ------ configure | 2 +- configure.in | 2 +- src/Makefile.am | 4 ++-- src/Makefile.in | 4 ++-- src/devcheck.c | 4 ++-- src/main.c | 5 +++-- src/rconfig.c | 10 ++-------- src/updateip.c | 2 ++ src/utils.c | 11 +++++++++-- 12 files changed, 27 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index f637021..efaf466 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,4 +22,4 @@ Version 0.03 Version 0.04 - * \ No newline at end of file + * diff --git a/README b/README index a02fc4d..d124c5b 100644 --- a/README +++ b/README @@ -1,14 +1,10 @@ -DHSD v0.03 Beta ---------------- +DHSD v1.0 +--------- DHSD is a dynamic update engine for the dhs.org dynamic dns service. The aim is to provide a quick and efficent update engine that will monitor selected network devices and check for changes of the IP address. -PLEASE NOTE, this is a CVS BETA release (in other words...half working) -i have put this code onto the CVS for users to take a look at and see -how it works. - Thanks go to: * Sourceforge for hosting my project diff --git a/TODO b/TODO index 9060d83..480c261 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,3 @@ -* Multiple Device/Host config (99%) -* Setuid/Setgid for daemon (needed?) (0%) -* More information in Syslog (50%) -* .pid file output and more daemon config options (0%) -* Error checking on http returns (99%) - Possible features: * Support more dyndns services diff --git a/configure b/configure index 5f550d8..0387ae2 100755 --- a/configure +++ b/configure @@ -693,7 +693,7 @@ fi PACKAGE=dhsd -VERSION=0.03 +VERSION=1.0 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } diff --git a/configure.in b/configure.in index 2e446fe..b2308ab 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/main.c) -AM_INIT_AUTOMAKE(dhsd, 0.03) +AM_INIT_AUTOMAKE(dhsd, 1.0) AC_PROG_MAKE_SET dnl Checks for programs. diff --git a/src/Makefile.am b/src/Makefile.am index 42f535b..92a4e8f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,10 +7,10 @@ dhsd_SOURCES = main.c dhsd.h rconfig.c pdetach.c updateip.c devcheck.c base64.c if DEBUG DBG = -DDEBUG=1 - CFLAGS = @CFLAGS@ $(DBG) + CFLAGS = @CFLAGS@ $(DBG) -O0 -g3 else DBG = - CFLAGS = @CFLAGS@ + CFLAGS = -O3 -march=pentium -mcpu=pentium -ffast-math -funroll-loops -fomit-frame-pointer -fforce-mem -fforce-addr -malign-double -fno-exceptions endif diff --git a/src/Makefile.in b/src/Makefile.in index 69fbbbe..00a09c1 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -272,9 +272,9 @@ maintainer-clean-generic clean mostlyclean distclean maintainer-clean @DEBUG_TRUE@ DBG = -DDEBUG=1 -@DEBUG_TRUE@ CFLAGS = @CFLAGS@ $(DBG) +@DEBUG_TRUE@ CFLAGS = @CFLAGS@ $(DBG) -O0 -g3 @DEBUG_FALSE@ DBG = -@DEBUG_FALSE@ CFLAGS = @CFLAGS@ +@DEBUG_FALSE@ CFLAGS = -O3 -march=pentium -mcpu=pentium -ffast-math -funroll-loops -fomit-frame-pointer -fforce-mem -fforce-addr -malign-double -fno-exceptions # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/devcheck.c b/src/devcheck.c index 50f2e21..5d94b09 100644 --- a/src/devcheck.c +++ b/src/devcheck.c @@ -47,8 +47,8 @@ int devcheck(char *dev) strncpy(ifr.ifr_name,dev,IFNAMSIZ); if (ioctl(fd,SIOCGIFADDR,&ifr)) { - pdebug("device ioctl failed"); - //oldaddr = 0; // Hackaratus? + pdebug("device is not up/online"); + oldaddr = 0; // Kludges r' us? return -1; } /* Now the buffer will contain the information we requested */ diff --git a/src/main.c b/src/main.c index 4804143..4e8f198 100644 --- a/src/main.c +++ b/src/main.c @@ -82,7 +82,7 @@ int main(int argc, char **argv) } do { - if (devcheck(config.device)) { + if (devcheck(config.device) == 1) { #ifdef HAVE_SYSLOG_H syslog(LOG_NOTICE,"device ip has changed, update initiated..."); #endif @@ -90,7 +90,8 @@ int main(int argc, char **argv) i = 0; do { - while(updateip(coldaddr,config.host[i])) {; + pdebug(coldaddr); + while(updateip(coldaddr,config.host[i])) { sleep(SLEEP_TIME); }; i++; diff --git a/src/rconfig.c b/src/rconfig.c index 11b3626..c9f80ce 100644 --- a/src/rconfig.c +++ b/src/rconfig.c @@ -26,13 +26,6 @@ #include #include "dhsd.h" -void addhost (char *hostname) -{ - strncat(config.host[config.noofhosts], hostname, strlen(hostname)); - pdebug(hostname); - config.noofhosts++; -} - void parseline(char *strbuf) { int strl; @@ -57,7 +50,8 @@ void parseline(char *strbuf) return; } if(!strcasecmp("HOST",cmd)) { - addhost(arg); + strncat(config.host[config.noofhosts], arg, strlen(arg)); + config.noofhosts++; return; } if(!strcasecmp("DEV",cmd)) { diff --git a/src/updateip.c b/src/updateip.c index 217ca93..579e928 100644 --- a/src/updateip.c +++ b/src/updateip.c @@ -66,6 +66,8 @@ int updateip(char *ipaddr, char *host) bzero(hostn,32); bzero(domn,32); + pdebug(ipaddr); + splitstr(host, '.', hostn, domn); encbasic(b64str,config.username,config.passwd); diff --git a/src/utils.c b/src/utils.c index 377032f..b866e5c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -52,15 +52,22 @@ void filtercr(char *str) bzero(tmpstr,256); - if (strl > 0) { + if (strl > 1) { while (i < strl) { - if (str[i] == '\n') { + if (str[i] == 13) { strncpy(tmpstr, &str[0], i-1); + pdebug(tmpstr); tmpstr[strlen(tmpstr)] = '\0'; bzero(str,strl); str = tmpstr; + break; } i++; }; + str = str; + } else { + if (str[0] == 13) { + str = ""; + } } }