From 13f1552ad232f23fa9e157cc3650a0ca947054aa Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Tue, 18 Jun 2019 19:06:10 +0200
Subject: [PATCH] fix zonefile

---
 hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java |    7 +++++++
 hsarback/src/de/hsadmin/mods/pac/pac-zonefile.vm          |   10 +++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
index 8e4f288..56c60b8 100644
--- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
+++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -140,6 +140,13 @@
 	private Processor createZonefileProc(final EntityManager em, final Pac pac) {
 		final Map<String, Object> zonefileTemplateVars = new HashMap<String, Object>();
 		zonefileTemplateVars.put("sio", Long.toString(System.currentTimeMillis()/1000L));
+		zonefileTemplateVars.put("pac", pac.getName()); 
+		zonefileTemplateVars.put("inet4Addr", pac.getCurINetAddr().getInet4Addr()); 
+		try {
+			zonefileTemplateVars.put("inet6Addr", pac.getCurINetAddr().getInet6Addr());
+		} catch (ProcessorException e) {
+			// dont care
+		} 
 		final String domName = pac.getName() + ".hostsharing.net";
 		final String zonefileTargetPath = "/etc/bind/pri." + domName;
 		final Processor zonefileTemplateProcessor = 
diff --git a/hsarback/src/de/hsadmin/mods/pac/pac-zonefile.vm b/hsarback/src/de/hsadmin/mods/pac/pac-zonefile.vm
index 87dbdd8..d7d5386 100644
--- a/hsarback/src/de/hsadmin/mods/pac/pac-zonefile.vm
+++ b/hsarback/src/de/hsadmin/mods/pac/pac-zonefile.vm
@@ -7,9 +7,9 @@
         1H    ; minimum
 )
 
-${pac.name}.hostsharing.net.      IN    NS  dns1.hostsharing.net.
-${pac.name}.hostsharing.net.      IN    NS  dns2.hostsharing.net.
-${pac.name}.hostsharing.net.      IN    NS  dns3.hostsharing.net.
+${pac}.hostsharing.net.      IN    NS  dns1.hostsharing.net.
+${pac}.hostsharing.net.      IN    NS  dns2.hostsharing.net.
+${pac}.hostsharing.net.      IN    NS  dns3.hostsharing.net.
 
-${pac.name}.hostsharing.net.      IN    A    ${pac.curINetAddr.inet4Addr}
-${pac.name}.hostsharing.net.      IN    AAAA ${pac.curINetAddr.inet6Addr}
+${pac}.hostsharing.net.      IN    A    ${inet4Addr}
+${pac}.hostsharing.net.      IN    AAAA ${inet6Addr}

--
Gitblit v1.9.0-SNAPSHOT