From 9db05ea50902410f80f4a7ebb0e015c6c5501971 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Fri, 31 Mar 2017 18:24:05 +0200
Subject: [PATCH] dns master is hive

---
 hsarback/src/de/hsadmin/mods/dom/zonefile.vm           |    2 +-
 hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
index c7fa57f..6598982 100644
--- a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
@@ -95,7 +95,6 @@
 		Domain dom = (Domain) newEntity;
 		Date now = new Date();
 		dom.setSince(now);
-		dom.setDnsMaster("dns.hostsharing.net");
 		if (dom.getName() == null || dom.getName().length() == 0) {
 			throw new HSAdminException("domain name required");
 		}
@@ -108,10 +107,13 @@
 		userQuery.setParameter("username", admin.getName());
 		admin = (UnixUser) userQuery.getSingleResult();
 		//TODO: Needs better implementation
-		String pacType = admin.getPac().getBasepac().getName();
+		final Pac pac = admin.getPac();
+		String pacType = pac.getBasepac().getName();
 		if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW) && !pacType.equals(BasePacType.PAC_SW)) {
 			throw new HSAdminException("not allowed for this packet type");
-	    }		
+	    }
+		final String hiveName = pac.getHive().getHiveName();
+		dom.setDnsMaster(hiveName + ".hostsharing.net");
 		// Standard domainoptions setzen. TODO: Alle defaults ├╝ber eigene Klasse aus der Datenbank holen. 
 		UnixUser loginUser = getTransaction().getLoginUser();
 		if (!loginUser.hasHostmasterRole()) {
diff --git a/hsarback/src/de/hsadmin/mods/dom/zonefile.vm b/hsarback/src/de/hsadmin/mods/dom/zonefile.vm
index 6997e03..7bb5e1a 100644
--- a/hsarback/src/de/hsadmin/mods/dom/zonefile.vm
+++ b/hsarback/src/de/hsadmin/mods/dom/zonefile.vm
@@ -1,5 +1,5 @@
 $TTL 6H
-${dom.name}. IN SOA ${hive.name}.hostsharing.net. hostmaster.hostsharing.net. (
+${dom.name}. IN SOA ${dom.dnsMaster}.hostsharing.net. hostmaster.hostsharing.net. (
 				${sio}	; serial secs since Jan 1 1970 
 				6H		; refresh (>=10000)
 				1H		; retry (>=1800)

--
Gitblit v1.9.0-SNAPSHOT