From fbbb1f4132027231d0d1bc9f29b879550daddca7 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Tue, 16 Oct 2012 15:39:55 +0200 Subject: [PATCH] error in update of file virtual.conf corrected --- hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java | 6 +++--- .../src/de/hsadmin/mods/pac/PacProcessorFactory.java | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java b/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java index 32ae06f..1ed2d7d 100644 --- a/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java +++ b/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java @@ -113,10 +113,10 @@ public class PacModuleImpl extends AbstractModuleImpl { public AbstractEntity update(AbstractEntity entity) throws HSAdminException { UnixUser loginUser = getTransaction().getLoginUser(); - if (entity instanceof Pac) { - Pac pac = (Pac) entity; - } else { + if (!(entity instanceof Pac)) { throw new AuthorisationException(loginUser, "update", entity); +// } else { +// Pac pac = (Pac) entity; } needsWriteAccessOn(entity, "update"); return super.update(entity); diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java index f764792..27c8ed3 100644 --- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java @@ -57,14 +57,17 @@ public class PacProcessorFactory implements EntityProcessorFactory { private Processor createHttpdVirtualProc( String pacName, List> pacValuesList) throws ProcessorException { Processor domSetupProcessor = new CompoundProcessor( - new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.jtpl", new HashMap(), pacValuesList.iterator(), "/etc/apache2/virtual.conf.tmp", "root", "root", "644", true), + new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.jtpl", + new HashMap(), pacValuesList.iterator(), + "/etc/apache2/virtual.conf.tmp", "root", "root", "644", true), new ShellProcessor("ls /etc/apache2/pems/" + pacName + ".pem >/dev/null 2>&1 " + "&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/apache.conf.tmp" + " && (ls /etc/apache2/pems/" + pacName + ".chain.pem >/dev/null 2>&1" + " || sed -i '/SSLCertificateChain.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp)" + " || sed -i '/SSLCertificate.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp"), - new ShellProcessor("(diff -q /etc/apache2/apache.conf.tmp /etc/apache2/apache.conf" - + " && rm /etc/apache2/apache.conf.tmp)" - + " || invoke-rc.d apache2 reload >/dev/null 2>&1")); + new ShellProcessor("(diff -q /etc/apache2/virtual.conf.tmp /etc/apache2/virtual.conf" + + " && rm /etc/apache2/virtual.conf.tmp )" + + " || ( mv /etc/apache2/virtual.conf.tmp /etc/apache2/virtual.conf " + + " && invoke-rc.d apache2 reload >/dev/null 2>&1 ) ")); return domSetupProcessor; }