HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2011-05-20 32e231850ed74a882b7d91928fc34e27dc518933
nur erlaubte aliases anlegen
2 files modified
20 ■■■■■ changed files
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java 5 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java 15 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -79,10 +79,11 @@
        for (String queueName : mailServerQueues) {
            relayDomainsProcessor = new CompoundProcessor(
                new ShellProcessor("postmap -r -i /etc/postfix-mailin/relaydomains", 
                            domName + " anything" + "\n." + domName + " anything"),
                            domName + " anything\n" +
                            "." + domName + " anything\n"),
                new ShellProcessor("postmap -r -i /etc/postfix-mailin/transport", 
                            domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n" +
                            "." + domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n.")
                            "." + domName + " smtp:[" + pac.getName() + ".hostsharing.net]\n")
            );
            mainProcessor.appendProcessor(queueName, relayDomainsProcessor, queueName + ".hostsharing.net");
        }
hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AuthenticationException;
import de.hsadmin.core.model.HSAdminException;
public class EMailAliasModuleImpl extends AbstractModuleImpl {
@@ -16,5 +17,19 @@
        }
        return super.search(entityClass, condition, orderBy);
    }
    @Override
    public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException {
        EMailAlias alias = (EMailAlias) newEntity;
        String name = alias.getName();
        String pacname = alias.getPac().getName();
        if (!name.startsWith(pacname)) {
            throw new AuthenticationException("alias not allowed");
        }
        if (name.length() > 5 && (name.charAt(5) != '-') || name.length() == 6) {
            throw new AuthenticationException("alias not allowed");
        }
        return super.add(newEntity);
    }
    
}