From a8502c948d849c2d12233cf6b087a813fd2b9118 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 9 Jun 2008 11:21:40 +0000 Subject: [PATCH] Updated imap/sieve service to allow setting TLS based connections git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11265 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/imap/class_goImapServer.inc | 40 ++++++++++++------- .../systems/services/imap/goImapServer.tpl | 6 +-- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/gosa-plugins/mail/admin/systems/services/imap/class_goImapServer.inc b/gosa-plugins/mail/admin/systems/services/imap/class_goImapServer.inc index b2b5ea9aa..552fccff4 100644 --- a/gosa-plugins/mail/admin/systems/services/imap/class_goImapServer.inc +++ b/gosa-plugins/mail/admin/systems/services/imap/class_goImapServer.inc @@ -15,7 +15,7 @@ class goImapServer extends goService { var $dn = NULL; var $StatusFlag = "goImapServerStatus"; var $attributes = array("goImapName","goImapConnect","goImapAdmin","goImapPassword", - "goImapSieveServer","goImapSievePort", + "goImapSieveServer", "cyrusImap","cyrusImapSSL","cyrusPop3","cyrusPop3SSL"); var $cn = ""; @@ -27,7 +27,6 @@ class goImapServer extends goService { var $goImapSieveServer = ""; var $goImapSievePort = ""; - var $goImapServerStatus = ""; var $cyrusImap = false; @@ -63,7 +62,7 @@ class goImapServer extends goService { $this->view_logged = TRUE; new log("view","server/".get_class($this),$this->dn); } - + /* set new status */ if(isset($_POST['ExecAction'])){ if(isset($this->Actions[$_POST['action']])){ @@ -88,6 +87,7 @@ class goImapServer extends goService { foreach($tmp['plProvidedAcls'] as $name => $translation){ $smarty->assign($name."ACL",$this->getacl($name)); } + $smarty->assign("Actions",$this->Actions); $smarty->assign("is_new",$this->dn); $smarty->assign("is_acc",$this->initially_was_account); @@ -111,7 +111,17 @@ class goImapServer extends goService { } if(empty($this->goImapConnect)){ $message[] = msgPool::required(_("Connect URL")); - } + }elseif(!preg_match('/^\{[^:]+:[0-9]+.*\}$/', $this->goImapConnect)){ + $message[]= msgPool::invalid(_("Connect URL"),"","","{server-name:port/options}"); + } + + if(empty($this->goImapSieveServer)){ + $message[] = msgPool::required(_("Sieve connect URL")); + }elseif(!preg_match('/^\{[^:]+:[0-9]+.*\}$/', $this->goImapSieveServer)){ + $message[]= msgPool::invalid(_("Sieve connect URL"),"","","{server-name:port/options}"." ". + sprintf(_("Valid options are: %s"),"tls,notls")); + } + if(empty($this->goImapAdmin)){ $message[] = msgPool::required(_("Admin user")); } @@ -119,13 +129,11 @@ class goImapServer extends goService { $message[] = msgPool::required(_("Password")); } - /* Check connect string */ - if (!preg_match('/^\{[^:]+:[0-9]+.*\}$/', $this->goImapConnect)){ - $message[]= msgPool::invalid(_("Connect URL"),"","{server-name:port/options}"); - } - if (!preg_match('/^[0-9]+$/', $this->goImapSievePort)){ - $message[]= msgPool::invalid(_("Sieve port"),$this->goImapSievePort,"/[0-9]/"); - } +# if(empty($this->goImapSievePort)){ +# $message[] = msgPool::required(_("Sieve port")); +# }elseif (!preg_match('/^[0-9]+$/', $this->goImapSievePort)){ +# $message[]= msgPool::invalid(_("Sieve port"),$this->goImapSievePort,"/[0-9]/"); +# } return ($message); } @@ -153,10 +161,11 @@ class goImapServer extends goService { /* Save service */ function save() { - /* Move cn to sieve server */ - $this->goImapSieveServer= $this->cn; - + plugin::save(); + + $this->attrs['goImapSievePort'] = preg_replace("/^\{[^:]+:([0-9]*)\/.*$/","\\1",$this->goImapSieveServer); + /* Check if this is a new entry ... add/modify */ $ldap = $this->config->get_ldap_link(); $ldap->cat($this->dn,array("objectClass")); @@ -203,7 +212,8 @@ class goImapServer extends goService { "goImapConnect" =>_("Connect URL"), "goImapAdmin" =>_("Admin user"), "goImapPassword" =>_("Admin password"), - "goImapSievePort" =>_("Sieve port"), +// "goImapSievePort" =>_("Sieve port"), + "goImapSieveServer"=>_("Sieve connect URL"), "cyrusImap" =>_("Start IMAP service"), "cyrusImapSSL" =>_("Start IMAP SSL service"), "cyrusPop3" =>_("Start POP3 service"), diff --git a/gosa-plugins/mail/admin/systems/services/imap/goImapServer.tpl b/gosa-plugins/mail/admin/systems/services/imap/goImapServer.tpl index e2078d740..e0f0b849f 100644 --- a/gosa-plugins/mail/admin/systems/services/imap/goImapServer.tpl +++ b/gosa-plugins/mail/admin/systems/services/imap/goImapServer.tpl @@ -40,11 +40,11 @@ - {t}Sieve port{/t}{$must} + {t}Sieve connect URL{/t}{$must} -{render acl=$goImapSievePortACL} - +{render acl=$goImapSieveServerACL} + {/render} -- 2.30.2