summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 60df3e9)
raw | patch | inline | side by side (parent: 60df3e9)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 9 Jun 2008 11:21:03 +0000 (11:21 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 9 Jun 2008 11:21:03 +0000 (11:21 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11264 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc b/gosa-plugins/mail/personal/mail/class_mail-methods-cyrus.inc
index c73154f6420e23f65f1ff4604f866af6e47ec818..4022b03d73372cf2203691f46adebfb1fb9c155e 100644 (file)
/* Log into the mail server */
$sieve= new sieve($cfg["sieve_server"], $cfg["sieve_port"], $user,
- $cfg["password"], $cfg["admin"]);
+ $cfg["password"], $cfg["admin"],$cfg["sieve_option"]);
if (!$sieve->sieve_login()){
msg_dialog::display(_("SIEVE error"), sprintf(_("Cannot log into SIEVE server: %s"), '<br><br><i>'.to_string($sieve->error_raw).'</i>'), ERROR_DIALOG);
diff --git a/gosa-plugins/mail/personal/mail/sieve/class_sieve.inc b/gosa-plugins/mail/personal/mail/sieve/class_sieve.inc
index c45d0f18e2da2878bac90b0441461aa487eaf8fa..666ef1c0e8bd8af446b910b0fa64b9ecc08d370f 100644 (file)
var $error;
var $error_raw;
var $responses;
+ var $options = "";
//maybe we should add an errorlvl that the user will pass to new sieve = sieve(,,,,E_WARN)
//so we can decide how to handle certain errors?!?
} /* end else */
} /* end get_response() */
- function sieve($host, $port, $user, $pass, $auth="", $auth_types="PLAIN DIGEST-MD5")
+ function sieve($host, $port, $user, $pass, $auth="",$options ="", $auth_types="PLAIN DIGEST-MD5")
{
$this->host=$host;
$this->port=$port;
$this->loggedin=false;
$this->error= "";
$this->error_raw="";
+ $this->options = $options;
}
function parse_for_quotes($string)
return true;
}
+
function authenticate()
{
+ /* Check if a TLS bases connection is required
+ */
+ if(preg_match("/^tls$/",$this->options)){
+
+ /* Check if PHP supports TLS encryption for sockets
+ */
+ if(function_exists("stream_socket_enable_crypto")){
+
+ if (@ fputs ($this->fp, "STARTTLS\r\n") === false) {
+ $this->error_raw = "fputs() returned 'false'"; return (false);
+ } @ $linha = fgets ($this->fp, 1024); if ($linha === false) {
+ $this->error_raw = "fgets() returned 'false'"; return (false);
+ } if (! preg_match ("/\\s*OK\\s/i", $linha)) {
+ $this->error_raw = "expected an 'OK', but server replied: '" . trim ($linha) . "'"; return (false);
+ } if (! @ stream_socket_enable_crypto ($this->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
+ $this->error_raw = "stream_socket_enable_crypto() returned 'false'"; return (false);
+ }else{
+ echo "Done";
+ }
+ }
+ }
+
switch ($this->auth_in_use) {
case "PLAIN":
diff --git a/gosa-plugins/mail/personal/mail/sieve/class_sieveManagement.inc b/gosa-plugins/mail/personal/mail/sieve/class_sieveManagement.inc
index a47cd4bda0892fdb39b3247277149fab56cc5e8c..fa829e575e25d4a6cea527ee001a4b34f2bc3046 100644 (file)
$cfg["sieve_port"],
$this->parent->$uattrib,
$cfg["password"],
- $cfg["admin"]);
+ $cfg["admin"],
+ $cfg["sieve_option"]);
/* Try to login */
if (!@$this->sieve_handle->sieve_login()){