From c0e4d12fb7913449a3450c198080a36d0be25744 Mon Sep 17 00:00:00 2001 From: Niten Date: Wed, 11 Nov 2020 14:58:07 -0800 Subject: [PATCH] Verified working again? --- README.md | 9 +++++---- backplane-dns.lisp | 17 +++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fe3f995..15c92ac 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -# dns-backplane -### _Your Name _ +# backplane-dns +### _Niten _ -This is a project to do ... something. +Common lisp server to listen on an XMPP backplane connection for notifications +of DNS changes, and update a postgresql database accordingly. The data can then +be served by PowerDNS with the gpgsql backend. ## License Specify license here - diff --git a/backplane-dns.lisp b/backplane-dns.lisp index c85adee..76d5a3c 100644 --- a/backplane-dns.lisp +++ b/backplane-dns.lisp @@ -73,7 +73,7 @@ (make-instance 'result/error :message msg)) (defparameter *hostname-rx* - "([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])") + "(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])") (defun get-domain (name) (car (select-dao 'dns-domain (:= 'name name)))) @@ -86,14 +86,14 @@ (get-domain) (id)))) (car (select-dao 'dns-record - (:= 'name hostname) + (:= 'name (format nil "~A.~A" hostname domain)) (:= 'domain-id domain-id) (:= 'type "A"))) (error 'domain-name-missing :domain domain))) (defun set-host-v4ip (host domain v4ip) (let* ((full-hostname (format nil "~A.~A" host domain)) - (a-record (host-a-record full-hostname domain))) + (a-record (host-a-record host domain))) (if a-record (progn (setf (record-content a-record) v4ip) (update-dao a-record)) @@ -175,7 +175,7 @@ (xmpp:auth backplane xmpp-username xmpp-password - "server" + (format nil "backplane-~A" (machine-instance)) :mechanism :sasl-plain) (funcall f backplane))) @@ -188,10 +188,11 @@ db-username db-password db-tls) - (postmodern:with-connection (list db-name db-username db-password db-host) - (with-backplane xmpp-host xmpp-username xmpp-password - (lambda (backplane) - (xmpp:receive-stanza-loop backplane))))) + (let ((postmodern:*ignore-unknown-columns* t)) + (postmodern:with-connection (list db-name db-username db-password db-host) + (with-backplane xmpp-host xmpp-username xmpp-password + (lambda (backplane) + (xmpp:receive-stanza-loop backplane)))))) (defun read-file-line (filename) (let ((input (open filename :if-does-not-exist nil)))