This commit is contained in:
2021-06-15 16:42:38 +01:00
parent 14ee7379b0
commit 8bb036ac1e
12 changed files with 27 additions and 33 deletions

View File

@@ -22,4 +22,4 @@ Version 0.03
Version 0.04
*
*

8
README
View File

@@ -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

6
TODO
View File

@@ -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

2
configure vendored
View File

@@ -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; }

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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 */

View File

@@ -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++;

View File

@@ -26,13 +26,6 @@
#include <string.h>
#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)) {

View File

@@ -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);

View File

@@ -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 = "";
}
}
}