From f760c73a508d858660486f31306d4ae066957cf6 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 15 Apr 2014 15:02:31 +0100 Subject: [PATCH] zone.lisp: Apply pathname templates to DKIM and SSHFP files. Organization: Straylight/Edgeware From: Mark Wooding Makes zone files nicer. Alas, not compatible; sorry. --- zone.lisp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/zone.lisp b/zone.lisp index a6c4944..f03b9dd 100644 --- a/zone.lisp +++ b/zone.lisp @@ -626,6 +626,11 @@ (defzoneparse :txt (name data rec) ":txt TEXT" (rec :data data)) +(export '*dkim-pathname-defaults*) +(defvar *dkim-pathname-defaults* + (make-pathname :directory '(:relative "keys") + :type "dkim")) + (defzoneparse :dkim (name data rec) ":dkim (KEYFILE {:TAG VALUE}*)" (destructuring-bind (file &rest plist) (listify data) @@ -655,7 +660,8 @@ (defzoneparse :dkim (name data rec) (emit (with-output-to-string (out) (write-string "p=" out) (when file - (with-open-file (in file :direction :input) + (with-open-file + (in (merge-pathnames file *dkim-pathname-defaults*)) (loop (when (string= (read-line in) "-----BEGIN PUBLIC KEY-----") @@ -678,10 +684,15 @@ (eval-when (:load-toplevel :execute) (setf (get sym prop) val) (export sym)))) +(export '*sshfp-pathname-defaults*) +(defvar *sshfp-pathname-defaults* + (make-pathname :directory '(:relative "keys") + :type "sshfp")) + (defzoneparse :sshfp (name data rec) ":sshfp { FILENAME | ((FPR :alg ALG :type HASH)*) }" (if (stringp data) - (with-open-file (in data) + (with-open-file (in (merge-pathnames data *sshfp-pathname-defaults*)) (loop (let ((line (read-line in nil))) (unless line (return)) (let ((words (str-split-words line))) -- [mdw]