|
From: Alexandros V. <av...@us...> - 2005-12-06 12:23:48
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4394 Modified Files: CHANGELOG sieve-php.lib.php Log Message: Applied fix for Cyrus 2.2-style referrals, courtesy of Duncan Gibb of Sirius Corporation Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sieve-php.lib.php 6 Dec 2004 17:45:41 -0000 1.7 --- sieve-php.lib.php 6 Dec 2005 12:23:23 -0000 1.8 *************** *** 113,116 **** --- 113,118 ---- /** * get response + * @todo Test Cyrus version 2.2 vs version 2.1 style referrals parsing + * @todo Perhaps do referrals like in functin sieve_get_capability() */ function get_response() *************** *** 224,228 **** $this->refsv = substr($this->reftok[1], 0, -2); $this->refsv = substr($this->refsv, 1); ! $this->host = $this->refsv; $this->loggedin = false; /* flush buffers or anything? probably not, and the remote has already closed it's --- 226,239 ---- $this->refsv = substr($this->reftok[1], 0, -2); $this->refsv = substr($this->refsv, 1); ! ! /* TODO - perform more testing */ ! if(strstr($this->capabilities['implementation'], 'v2.1')) { ! /* Cyrus 2.1 - Style referrals */ ! $this->host = $this->refsv; ! } else { ! /* Cyrus 2.2 - Style referrals */ ! $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 *************** *** 241,245 **** fclose($this->fp); $this->error = EC_UNKNOWN; ! $this->error_raw = 'UNABLE TO REFERRAL - ' . $this->line; return false; } /* end else of the unhappy ending */ --- 252,256 ---- fclose($this->fp); $this->error = EC_UNKNOWN; ! $this->error_raw = 'UNABLE TO FOLLOW REFERRAL - ' . $this->line; return false; } /* end else of the unhappy ending */ *************** *** 809,812 **** --- 820,840 ---- $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(); + } else { + $this->loggedin = false; + fclose($this->fp); + $this->error = EC_UNKNOWN; + $this->error_raw = 'UNABLE TO FOLLOW REFERRAL - ' . $this->line; + return false; + } + } + //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,........}" Index: CHANGELOG =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/CHANGELOG,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CHANGELOG 6 Dec 2004 17:49:22 -0000 1.3 --- CHANGELOG 6 Dec 2005 12:23:23 -0000 1.4 *************** *** 1,3 **** ! 0.1.1 (CVS) * Fix off-by-one serious error in MANAGESIEVE class. The bug could DoS the --- 1,3 ---- ! 0.9.0 (CVS) * Fix off-by-one serious error in MANAGESIEVE class. The bug could DoS the *************** *** 6,9 **** --- 6,12 ---- * Applied REFERRAL Patch, by Michael Loftis. Patch: 927030 + * Applied REFERRAL fixes for Cyrus v2.2 / v2.3, by Duncan Gibb of + Sirius Corporation + 0.1.0 |