|
From: Sirius C. C. s. <cyr...@si...> - 2005-10-17 16:24:14
|
Hello Below is a patch for sieve-php which intends to do two things: - support Cyrus 2.2-style referrals, which are of the format BYE (REFERRAL "sieve://otherhost") "Try Remote." - support referrals in sieve::sieve_get_capability() This has had limited testing in SquirrelMail/avelsieve talking to a murder of Cyrus 2.2 servers. If anyone still has a murder of Cyrus 2.1 systems, I would welcome your feedback. Thanks Duncan -- Duncan Gibb, Technical Architect Sirius Corporation - The Open Source Experts http://www.siriusit.co.uk/ Tel: +44 870 608 0063 -- diff -rub avelsieve-1.9.3/include/managesieve.lib.php avelsieve-DG/include/managesieve.lib.php --- avelsieve-1.9.3/include/managesieve.lib.php 2005-06-27 12:33:46.000000000 +0100 +++ avelsieve-DG/include/managesieve.lib.php 2005-10-17 16:44:38.000000000 +0100 @@ -223,7 +223,8 @@ $this->reftok = split(" ", $this->token[1], 3); $this->refsv = substr($this->reftok[1], 0, -2); $this->refsv = substr($this->refsv, 1); - $this->host = $this->refsv; + $tmp = array_reverse( explode( '/', $this->refsv ) ); + $this->host = $tmp[0]; $this->loggedin = false; /* flush buffers or anything? probably not, and the remote has already closed it's end by now! */ @@ -808,6 +809,24 @@ fputs($this->fp, "CAPABILITY\r\n"); $this->line=fgets($this->fp,1024); + $tmp = array(); + if(preg_match('|^BYE \(REFERRAL "(sieve://)?([^/"]+)"\)|', $this->line, $tmp ) ){ + $this->host = $tmp[2]; + $this->loggedin = false; + fclose($this->fp); + + if( sieve::sieve_login() ) { + return $this->sieve_get_capability(); + } /* end good case happy ending */ + else{ + $this->loggedin = false; + fclose($this->fp); + $this->error = EC_UNKNOWN; + $this->error_raw = 'UNABLE TO REFERRAL - ' . $this->line; + return false; + } /* end else of the unhappy ending */ + } + //Hack for older versions of Sieve Server. They do not respond with the Cyrus v2. standard //response. They repsond as follows: "Cyrus timsieved v1.0.0" "SASL={PLAIN,........}" //So, if we see IMLEMENTATION in the first line, then we are done. |