Bugfix: Canonify the zone source name.
authormdw <mdw>
Mon, 13 Feb 2006 12:02:56 +0000 (12:02 +0000)
committermdw <mdw>
Mon, 13 Feb 2006 12:02:56 +0000 (12:02 +0000)
Expect the variable *default-zone-source* to be already dotified.

zone.lisp

index 153ce71..90867ea 100644 (file)
--- a/zone.lisp
+++ b/zone.lisp
@@ -211,6 +211,11 @@ a non-contiguous netmask."
   (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 @@ units."
 
 (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 @@ soa structure representing the zone 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*)