wok-stable view sheerdns/stuff/large-subdomains.u @ rev 11384
Compat: add binutils as a gmp BUILD_DEPENDS to ensure proper cookorder in tazwok
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sat Dec 10 04:32:17 2011 +0100 (2011-12-10) |
parents | |
children |
line source
1 --- dir.c
2 +++ dir.c
3 @@ -77,16 +77,17 @@
4 while (!get_file_name (buf, sizeof (buf), qtype, (unsigned char *) q)
5 && (fd = open (buf, O_RDONLY)) == -1 && (q = strchr (q, '.')) && q++ && (qtype == REQ_SOA
6 || qtype == REQ_NS));
7 - if (fd == -1) {
8 -/* try lookup "*.example.com" where asking for "nonexistant.example.com": */
9 + for (i = 0; fd == -1; i++) {
10 +/* try lookup "*.example.com" where asking for "nonexistant.example.com" or "any.where.example.com": */
11 char *t;
12 if (qtype == REQ_SOA || qtype == REQ_NS) /* probably a bad idea to wildcard these, so return */
13 return NULL;
14 q = t = (char *) strdup (s);
15 - while (*t && *t != '.')
16 + for (c = i; *t && *t != '.' || --c >= 0;)
17 t++;
18 - if (!*t || t == q || !(*--t = '*') || get_file_name (buf, sizeof (buf), qtype, (unsigned char *) t)
19 - || (fd = open (buf, O_RDONLY)) == -1) {
20 + t == q || !(*--t = '*') || get_file_name (buf, sizeof (buf), qtype, (unsigned char *) t)
21 + || (fd = open (buf, O_RDONLY));
22 + if (fd == -1 && !*++t ) {
23 free (q);
24 return NULL; }
25 free (q); }
27 --- dir.h
28 +++ dir.h
29 @@ -11,4 +11,4 @@
30 char **directory_lookup (int qtype, unsigned char *s);
31 time_t get_mtime (int qtype, unsigned char *s);
33 -#define SHEERDNS_DIR "/var/sheerdns"
34 +#define SHEERDNS_DIR "/var/sheerdns"