X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/zone/blobdiff_plain/4bce58c333d7848d35ad28afd2eb01fd42a9c9ca..8a4f9a1858cade6284a71434dc7e6af21746699b:/zone.lisp 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*)