From 8a4f9a1858cade6284a71434dc7e6af21746699b Mon Sep 17 00:00:00 2001 Message-Id: <8a4f9a1858cade6284a71434dc7e6af21746699b.1714900257.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 13 Feb 2006 12:02:56 +0000 Subject: [PATCH 1/1] Bugfix: Canonify the zone source name. Organization: Straylight/Edgeware From: mdw Expect the variable *default-zone-source* to be already dotified. --- zone.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zone.lisp b/zone.lisp index 153ce71..90867ea 100644 --- a/zone.lisp +++ b/zone.lisp @@ -211,6 +211,11 @@ (defun resolve-hostname (name) (let ((he (ext:lookup-host-entry name))) (and he (ext:host-entry-addr he)))) +(defun canonify-hostname (name) + "Resolve a hostname to canonical form using the DNS, or return nil." + (let ((he (ext:lookup-host-entry name))) + (and he + (ext:host-entry-name he)))) (defun parse-ipaddr (addr) "Convert the string ADDR into an IP address: tries all sorts of things: @@ -365,7 +370,7 @@ (defstruct (zone (:predicate zonep)) (defvar *default-zone-source* (let ((hn (unix:unix-gethostname))) - (and hn (resolve-hostname hn))) + (and hn (concatenate 'string (canonify-hostname hn) "."))) "The default zone source: the current host's name.") (defvar *default-zone-refresh* (* 24 60 60) "Default zone refresh interval: one day.") @@ -673,7 +678,7 @@ (defun zone-parse-head (head) (destructuring-bind (zname &key - (source (concatenate 'string *default-zone-source* ".")) + (source *default-zone-source*) (admin (or *default-zone-admin* (format nil "hostmaster@~A" zname))) (refresh *default-zone-refresh*) -- [mdw]