wok-4.x rev 2264

Sheerdns: extend wildcard scope
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 16 13:50:36 2009 +0000 (2009-02-16)
parents b234d450ada6
children f5075e7ed779
files sheerdns/receipt sheerdns/stuff/large-subdomains.u
line diff
     1.1 --- a/sheerdns/receipt	Mon Feb 16 10:12:08 2009 +0000
     1.2 +++ b/sheerdns/receipt	Mon Feb 16 13:50:36 2009 +0000
     1.3 @@ -14,6 +14,11 @@
     1.4  {
     1.5  	mv $PACKAGE $src 2> /dev/null
     1.6  	cd $src
     1.7 +	for i in $( cd ../stuff ; ls *.u); do
     1.8 +		[ -f done.$i ] && continue
     1.9 +		patch -p0 < ../stuff/$i
    1.10 +		touch done.$i
    1.11 +	done
    1.12  	make
    1.13  }
    1.14  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/sheerdns/stuff/large-subdomains.u	Mon Feb 16 13:50:36 2009 +0000
     2.3 @@ -0,0 +1,34 @@
     2.4 +--- dir.c
     2.5 ++++ dir.c
     2.6 +@@ -77,16 +77,17 @@
     2.7 +     while (!get_file_name (buf, sizeof (buf), qtype, (unsigned char *) q)
     2.8 + 	   && (fd = open (buf, O_RDONLY)) == -1 && (q = strchr (q, '.')) && q++ && (qtype == REQ_SOA
     2.9 + 										    || qtype == REQ_NS));
    2.10 +-    if (fd == -1) {
    2.11 +-/* try lookup "*.example.com" where asking for "nonexistant.example.com": */
    2.12 ++    for (i = 0; fd == -1; i++) {
    2.13 ++/* try lookup "*.example.com" where asking for "nonexistant.example.com" or "any.where.example.com": */
    2.14 + 	char *t;
    2.15 + 	if (qtype == REQ_SOA || qtype == REQ_NS)	/* probably a bad idea to wildcard these, so return */
    2.16 + 	    return NULL;
    2.17 + 	q = t = (char *) strdup (s);
    2.18 +-	while (*t && *t != '.')
    2.19 ++	for (c = i; *t && *t != '.' || --c >= 0;)
    2.20 + 	    t++;
    2.21 +-	if (!*t || t == q || !(*--t = '*') || get_file_name (buf, sizeof (buf), qtype, (unsigned char *) t)
    2.22 +-	    || (fd = open (buf, O_RDONLY)) == -1) {
    2.23 ++	t == q || !(*--t = '*') || get_file_name (buf, sizeof (buf), qtype, (unsigned char *) t)
    2.24 ++	    || (fd = open (buf, O_RDONLY));
    2.25 ++	if (fd == -1 && !*++t ) {
    2.26 + 	    free (q);
    2.27 + 	    return NULL; }
    2.28 + 	free (q); }
    2.29 +
    2.30 +--- dir.h
    2.31 ++++ dir.h
    2.32 +@@ -11,4 +11,4 @@
    2.33 + char **directory_lookup (int qtype, unsigned char *s);
    2.34 + time_t get_mtime (int qtype, unsigned char *s);
    2.35 + 
    2.36 +-#define SHEERDNS_DIR	"/var/sheerdns"
    2.37 ++#define SHEERDNS_DIR	"/var/sheerdns"