diff --git a/hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java b/hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java index efbc1e2..ed63ee5 100644 --- a/hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java +++ b/hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java @@ -35,7 +35,7 @@ import de.hsadmin.core.model.onetier.TicketValidator; public class CLIClientConnectorServlet extends HttpServlet { private static final long serialVersionUID = 7150004719303750077L; - public static final String version = "1.0.9 (2010/Oct/05 18:34)"; + public static final String version = "CLI Servlet 2.0.0 (2011/May/21 09:00 MEST)"; private Map> componentmap; private Map componentDescriptions; diff --git a/hsarback/src/de/hsadmin/mods/user/UnixUserProcessorFactory.java b/hsarback/src/de/hsadmin/mods/user/UnixUserProcessorFactory.java index 6bc8db7..64add79 100644 --- a/hsarback/src/de/hsadmin/mods/user/UnixUserProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/user/UnixUserProcessorFactory.java @@ -1,8 +1,5 @@ package de.hsadmin.mods.user; -import java.text.SimpleDateFormat; -import java.util.Date; - import javax.persistence.EntityManager; import de.hsadmin.core.model.AbstractEntity; @@ -55,18 +52,22 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory { /** * @return a Processor which deletes an existing UNIX user account */ - public Processor createDeleteProcessor(EntityManager em, - T entity) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyMMdd-HHmm-"); - String trashPrefix = "/home/trash/" + sdf.format(new Date()); - + public Processor createDeleteProcessor(EntityManager em, T entity) { UnixUser user = (UnixUser) entity; - CompoundProcessor aCP = new CompoundProcessor(); - if (user.isDefaultHomedir()) - aCP.appendProcessor(new ShellProcessor("mv '" + user.getHomedir() - + "' '" + trashPrefix + user.getName() + "'")); - aCP.appendProcessor(new ShellProcessor("userdel " + user.getName())); - return aCP; + String uid = user.getName(); + if (uid != null && uid.length() > 4) { + Processor userdelProc = null; + if (user.isDefaultHomedir()) { + userdelProc = new ShellProcessor("userdel " + uid + " && rm -rf '" + user.getHomedir() + "'"); + } else { + userdelProc = new ShellProcessor("userdel " + uid); + } + CompoundProcessor proc = new CompoundProcessor(userdelProc); + proc.appendProcessor(new ShellProcessor("rm -f /var/spool/cron/crontabs/" + uid)); + proc.appendProcessor(new ShellProcessor("rm -f /var/mail/" + uid)); + return proc; + } + return null; } private void appendSetQuotaProcessor(CompoundProcessor aCP, UnixUser user) {