--------------------- PatchSet 12056 Date: 2008/04/21 02:55:27 Author: hno Branch: SQUID_2_6 Tag: (none) Log: Add support for the resolv.conf domain directive, and also automatically derived default domain this patch adds the domain resolv.conf directive, similar to search but only accepting a single domain. In addition it adds support for automatically deriving the domain from the fully qualified hostname. Members: src/dns_internal.c:1.61.2.1->1.61.2.2 Index: squid/src/dns_internal.c =================================================================== RCS file: /cvsroot/squid/squid/src/dns_internal.c,v retrieving revision 1.61.2.1 retrieving revision 1.61.2.2 diff -u -r1.61.2.1 -r1.61.2.2 --- squid/src/dns_internal.c 23 Jun 2007 21:34:09 -0000 1.61.2.1 +++ squid/src/dns_internal.c 21 Apr 2008 02:55:27 -0000 1.61.2.2 @@ -1,6 +1,6 @@ /* - * $Id: dns_internal.c,v 1.61.2.1 2007/06/23 21:34:09 hno Exp $ + * $Id: dns_internal.c,v 1.61.2.2 2008/04/21 02:55:27 hno Exp $ * * DEBUG: section 78 DNS lookups; interacts with lib/rfc1035.c * AUTHOR: Duane Wessels @@ -248,7 +248,7 @@ { FILE *fp; char buf[RESOLV_BUFSZ]; - char *t; + const char *t; fp = fopen(_PATH_RESCONF, "r"); if (fp == NULL) { debug(78, 1) ("%s: %s\n", _PATH_RESCONF, xstrerror()); @@ -267,7 +267,15 @@ continue; debug(78, 1) ("Adding nameserver %s from %s\n", t, _PATH_RESCONF); idnsAddNameserver(t); + } else if (strcasecmp(t, "domain") == 0) { + idnsFreeSearchpath(); + t = strtok(NULL, w_space); + if (NULL == t) + continue; + debug(78, 1) ("Adding domain %s from %s\n", t, _PATH_RESCONF); + idnsAddPathComponent(t); } else if (strcasecmp(t, "search") == 0) { + idnsFreeSearchpath(); while (NULL != t) { t = strtok(NULL, w_space); if (NULL == t) @@ -292,6 +300,12 @@ } } fclose(fp); + + if (npc == 0 && (t = getMyHostname())) { + t = strchr(t, '.'); + if (t) + idnsAddPathComponent(t + 1); + } } #endif