wok-6.x diff sheerdns/stuff/large-subdomains.u @ rev 10518
nfs-utils: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed May 25 16:10:05 2011 +0200 (2011-05-25) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sheerdns/stuff/large-subdomains.u Wed May 25 16:10:05 2011 +0200 1.3 @@ -0,0 +1,34 @@ 1.4 +--- dir.c 1.5 ++++ dir.c 1.6 +@@ -77,16 +77,17 @@ 1.7 + while (!get_file_name (buf, sizeof (buf), qtype, (unsigned char *) q) 1.8 + && (fd = open (buf, O_RDONLY)) == -1 && (q = strchr (q, '.')) && q++ && (qtype == REQ_SOA 1.9 + || qtype == REQ_NS)); 1.10 +- if (fd == -1) { 1.11 +-/* try lookup "*.example.com" where asking for "nonexistant.example.com": */ 1.12 ++ for (i = 0; fd == -1; i++) { 1.13 ++/* try lookup "*.example.com" where asking for "nonexistant.example.com" or "any.where.example.com": */ 1.14 + char *t; 1.15 + if (qtype == REQ_SOA || qtype == REQ_NS) /* probably a bad idea to wildcard these, so return */ 1.16 + return NULL; 1.17 + q = t = (char *) strdup (s); 1.18 +- while (*t && *t != '.') 1.19 ++ for (c = i; *t && *t != '.' || --c >= 0;) 1.20 + t++; 1.21 +- if (!*t || t == q || !(*--t = '*') || get_file_name (buf, sizeof (buf), qtype, (unsigned char *) t) 1.22 +- || (fd = open (buf, O_RDONLY)) == -1) { 1.23 ++ t == q || !(*--t = '*') || get_file_name (buf, sizeof (buf), qtype, (unsigned char *) t) 1.24 ++ || (fd = open (buf, O_RDONLY)); 1.25 ++ if (fd == -1 && !*++t ) { 1.26 + free (q); 1.27 + return NULL; } 1.28 + free (q); } 1.29 + 1.30 +--- dir.h 1.31 ++++ dir.h 1.32 +@@ -11,4 +11,4 @@ 1.33 + char **directory_lookup (int qtype, unsigned char *s); 1.34 + time_t get_mtime (int qtype, unsigned char *s); 1.35 + 1.36 +-#define SHEERDNS_DIR "/var/sheerdns" 1.37 ++#define SHEERDNS_DIR "/var/sheerdns"