[Dibbler-devel] two fixes for version cvs-20080529
Tero Pelander
tpeland at tkukoulu.fi
Wed Jun 4 07:29:07 CEST 2008
Problem 1)
Dibbler can't be compiled with multiple simultanous compilers. The "make
-j3" command using 3 compilers fails.
Fix: dibbler-make_-j3-fix.patch
Problem 2)
Under linux the "/etc/resolv.conf" handling is wrong in domain_del().
Ex.
Before starting dibbler make the resolv.conf file have following line:
"search sub.example.org"
Then use dibbler-client to get new data of "example.org".
"search sub.example.org example.org"
Last stop dibbler-client:
"search sub example.org"
The search line is corrupted.
In real life this can easily happen when ipv4 dhcp client gets different
search path then ipv6. Other possibility is that the admin manually
adds the more exact path before starting dibbler.
Fix: dibbler-domain_del-fix.patch
-------------- next part --------------
--- dibbler-cvs-20080529/Makefile.ORIG 2008-05-29 14:11:51.333285130 +0300
+++ dibbler-cvs-20080529/Makefile 2008-05-29 14:03:46.553272696 +0300
@@ -4,7 +4,7 @@
all: server client relay
-includes:
+includes: poslib-configure
cd $(INCDIR); $(MAKE) links
bison: bison/bison++
-------------- next part --------------
--- dibbler-cvs-20080529/Port-linux/lowlevel-options-linux.c.ORIG 2008-05-29 14:25:21.735718000 +0300
+++ dibbler-cvs-20080529/Port-linux/lowlevel-options-linux.c 2008-06-03 14:45:59.038718384 +0300
@@ -120,13 +120,16 @@
int domain_del(const char * ifname, int ifaceid, const char *domain) {
FILE * f, *f2;
- char buf[512];
+ char buf[512], searchbuf[512], *ptr;
int found=0;
- int x;
struct stat st;
memset(&st,0,sizeof(st));
stat(RESOLVCONF_FILE, &st);
+ if (strlen(domain) >= sizeof(searchbuf)-1 )
+ return LOWLEVEL_ERROR_UNSPEC;
+ searchbuf[0] = ' ';
+ strcpy(&(searchbuf[1]), domain);
unlink(RESOLVCONF_FILE".old");
rename(RESOLVCONF_FILE,RESOLVCONF_FILE".old");
if ( !(f = fopen(RESOLVCONF_FILE".old","r")) )
@@ -134,14 +137,11 @@
if ( !(f2= fopen(RESOLVCONF_FILE,"w+")))
return LOWLEVEL_ERROR_FILE;
while (fgets(buf,511,f)) {
- if ( (!found) && (strstr(buf, domain)) ) {
+ if ( (!found) && (ptr=strstr(buf, searchbuf)) ) {
found = 1;
- x = strstr(buf, domain) - buf;
- memmove (strstr(buf, domain)-1, strstr(buf, domain)+strlen(domain), 511-x);
+ strcpy(ptr, ptr+strlen(searchbuf));
if (strlen(buf)<11) /* 11=minimum length (one letter domain in 2letter top domain, e.g. "search x.pl") */
continue;
- fprintf(f2, "%s", buf);
- continue;
}
fprintf(f2,"%s",buf);
}
More information about the Dibbler-devel
mailing list