You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
(9) |
Nov
(12) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
From: Alexandros V. <av...@us...> - 2005-12-06 15:05:42
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16700 Modified Files: sieve-php.lib.php Log Message: Oops. scriptname should be put outside the single quote. Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sieve-php.lib.php 6 Dec 2005 12:38:04 -0000 1.9 --- sieve-php.lib.php 6 Dec 2005 15:05:28 -0000 1.10 *************** *** 547,551 **** $len=strlen($this->script); ! $this->lastcmd = 'PUTSCRIPT "$scriptname" {'.$len.'+}'."\r\n".$this->script."\r\n"; fputs($this->fp, $this->lastcmd); return sieve::get_response(); --- 547,551 ---- $len=strlen($this->script); ! $this->lastcmd = 'PUTSCRIPT "'.$scriptname.'" {'.$len.'+}'."\r\n".$this->script."\r\n"; fputs($this->fp, $this->lastcmd); return sieve::get_response(); |
From: Alexandros V. <av...@us...> - 2005-12-06 12:38:12
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6951 Modified Files: sieve-php.lib.php CHANGELOG Log Message: Fix curly braces escaping, thanks to Oded Arbel Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sieve-php.lib.php 6 Dec 2005 12:23:23 -0000 1.8 --- sieve-php.lib.php 6 Dec 2005 12:38:04 -0000 1.9 *************** *** 547,551 **** $len=strlen($this->script); ! $this->lastcmd = "PUTSCRIPT \"$scriptname\" \{$len+}\r\n$this->script\r\n"; fputs($this->fp, $this->lastcmd); return sieve::get_response(); --- 547,551 ---- $len=strlen($this->script); ! $this->lastcmd = 'PUTSCRIPT "$scriptname" {'.$len.'+}'."\r\n".$this->script."\r\n"; fputs($this->fp, $this->lastcmd); return sieve::get_response(); *************** *** 693,697 **** $this->len=strlen($auth); ! fputs($this->fp, "AUTHENTICATE \"PLAIN\" \{$this->len+}\r\n"); fputs($this->fp, "$auth\r\n"); --- 693,697 ---- $this->len=strlen($auth); ! fputs($this->fp, 'AUTHENTICATE "PLAIN" {' . $this->len . '+}' . "\r\n"); fputs($this->fp, "$auth\r\n"); Index: CHANGELOG =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/CHANGELOG,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CHANGELOG 6 Dec 2005 12:24:33 -0000 1.5 --- CHANGELOG 6 Dec 2005 12:38:04 -0000 1.6 *************** *** 9,12 **** --- 9,15 ---- Sirius Corporation + * Fix curly braces '{' escaping, to work correctly in PHP 5.1. (Thanks to + Oded Arbel). + * Cosmetic changes to the test PHP script. |
From: Alexandros V. <av...@us...> - 2005-12-06 12:24:57
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4647 Modified Files: testsieve.php CHANGELOG Log Message: Cosmetic fixes for the test script Index: testsieve.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/testsieve.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testsieve.php 5 Nov 2003 17:34:45 -0000 1.9 --- testsieve.php 6 Dec 2005 12:24:33 -0000 1.10 *************** *** 133,137 **** } else { ! print "Sieve Error: ".$sieve->error; } } else --- 133,140 ---- } else { ! print "Failed.<br />Error Message: "; ! print_r($sieve->error); ! print ' '; ! print_r($sieve->error_raw); } } else *************** *** 160,169 **** print "New script: <small><pre>\n$activescript\n</pre></small>"; ! print "<p>Sending $testscriptname..."; if($sieve->sieve_sendscript($testscriptname,$activescript)) { ! print "Upload Succeded.<br>"; } else { ! print "Failed.<br />Error Message:"; print_r($sieve->error); print_r($sieve->error_raw); } --- 163,173 ---- print "New script: <small><pre>\n$activescript\n</pre></small>"; ! print "<p>Sending $testscriptname... "; if($sieve->sieve_sendscript($testscriptname,$activescript)) { ! print "Upload Succeded.<br/>"; } else { ! print "Failed.<br />Error Message: "; print_r($sieve->error); + print ' '; print_r($sieve->error_raw); } *************** *** 173,178 **** print "Succedded.<br />"; } else { ! print "Failed.<br />Error Message:"; print_r($sieve->error); print_r($sieve->error_raw); } --- 177,183 ---- print "Succedded.<br />"; } else { ! print "Failed.<br />Error Message: "; print_r($sieve->error); + print ' '; print_r($sieve->error_raw); } Index: CHANGELOG =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/CHANGELOG,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CHANGELOG 6 Dec 2005 12:23:23 -0000 1.4 --- CHANGELOG 6 Dec 2005 12:24:33 -0000 1.5 *************** *** 9,12 **** --- 9,13 ---- Sirius Corporation + * Cosmetic changes to the test PHP script. 0.1.0 |
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 |
From: Alexandros V. <av...@us...> - 2004-12-06 17:49:34
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8464 Modified Files: CHANGELOG Log Message: Changelog for latest fixes Index: CHANGELOG =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/CHANGELOG,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CHANGELOG 18 Dec 2003 13:23:19 -0000 1.2 --- CHANGELOG 6 Dec 2004 17:49:22 -0000 1.3 *************** *** 1,2 **** --- 1,9 ---- + 0.1.1 (CVS) + + * Fix off-by-one serious error in MANAGESIEVE class. The bug could DoS the + Apache server by getting PHP into an endless loop. Closes: 1000027 + + * Applied REFERRAL Patch, by Michael Loftis. Patch: 927030 + 0.1.0 |
From: Alexandros V. <av...@us...> - 2004-12-06 17:45:51
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7591 Modified Files: sieve-php.lib.php Log Message: Patch 927030, Support for REFERRAL Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sieve-php.lib.php 6 Dec 2004 17:43:13 -0000 1.6 --- sieve-php.lib.php 6 Dec 2004 17:45:41 -0000 1.7 *************** *** 101,104 **** --- 101,110 ---- var $error_raw; var $responses; + + // lastcmd is for referral processing + var $lastcmd; + var $reftok; + var $refsv; + //maybe we should add an errorlvl that the user will pass to new sieve = sieve(,,,,E_WARN) *************** *** 208,211 **** --- 214,251 ---- } /* end elseif */ + elseif(strstr($this->token[1], '(REFERRAL "' ) ){ + /* process a referral, retry the lastcmd, return the results. this is + sort of messy, really I should probably try to use parse_for_quotes + but the problem is I still have the ( )'s to deal with. This is + atleast true for timsieved as it sits in 2.1.16, if someone has a + BYE (REFERRAL ...) example for later timsieved please forward it to + me and I'll code it in proper-like! - ml...@wg... */ + $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; + $this->loggedin = false; + /* flush buffers or anything? probably not, and the remote has already closed it's + end by now! */ + fclose($this->fp); + + if( sieve::sieve_login() ) { + fputs($this->fp, $this->lastcmd); + return sieve::get_response(); + } /* end good case happy ending */ + else{ + /* what to do? login failed, should we punt and die? or log back into the referrer? + i'm electing to retn EC_UNKNOWN for now and set the error string. */ + + $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 */ + + /* should never make it here! */ + + } /* end elseif */ else{ $this->error = EC_UNKNOWN; *************** *** 495,501 **** $this->script=stripslashes($script); $len=strlen($this->script); ! fputs($this->fp, "PUTSCRIPT \"$scriptname\" \{$len+}\r\n"); ! fputs($this->fp, "$this->script\r\n"); ! return sieve::get_response(); --- 535,541 ---- $this->script=stripslashes($script); $len=strlen($this->script); ! ! $this->lastcmd = "PUTSCRIPT \"$scriptname\" \{$len+}\r\n$this->script\r\n"; ! fputs($this->fp, $this->lastcmd); return sieve::get_response(); *************** *** 522,526 **** if($this->loggedin==false) return false; ! fputs($this->fp, "HAVESPACE \"$scriptname\" $scriptsize\r\n"); return sieve::get_response(); } --- 562,568 ---- if($this->loggedin==false) return false; ! ! $this->lastcmd = "HAVESPACE \"$scriptname\" $scriptsize\r\n"; ! fputs($this->fp, $this->lastcmd); return sieve::get_response(); } *************** *** 535,540 **** if($this->loggedin==false) return false; ! ! fputs($this->fp, "SETACTIVE \"$scriptname\"\r\n"); return sieve::get_response(); --- 577,583 ---- if($this->loggedin==false) return false; ! ! $this->lastcmd = "SETACTIVE \"$scriptname\"\r\n"; ! fputs($this->fp, $this->lastcmd); return sieve::get_response(); *************** *** 554,559 **** if($this->loggedin==false) return false; ! ! fputs($this->fp, "GETSCRIPT \"$scriptname\"\r\n"); return sieve::get_response(); } --- 597,603 ---- if($this->loggedin==false) return false; ! ! $this->lastcmd = "GETSCRIPT \"$scriptname\"\r\n"; ! fputs($this->fp, $this->lastcmd); return sieve::get_response(); } *************** *** 571,576 **** if($this->loggedin==false) return false; ! ! fputs($this->fp, "DELETESCRIPT \"$scriptname\"\r\n"); return sieve::get_response(); --- 615,621 ---- if($this->loggedin==false) return false; ! ! $this->lastcmd = "DELETESCRIPT \"$scriptname\"\r\n"; ! fputs($this->fp, $this->lastcmd); return sieve::get_response(); *************** *** 588,592 **** */ function sieve_listscripts() { ! fputs($this->fp, "LISTSCRIPTS\r\n"); sieve::get_response(); //should always return true, even if there are no scripts... if(isset($this->found_script) and $this->found_script) --- 633,638 ---- */ function sieve_listscripts() { ! $this->lastcmd = "LISTSCRIPTS\r\n"; ! fputs($this->fp, $this->lastcmd); sieve::get_response(); //should always return true, even if there are no scripts... if(isset($this->found_script) and $this->found_script) |
From: Alexandros V. <av...@us...> - 2004-12-06 17:43:23
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6899 Modified Files: sieve-php.lib.php Log Message: Fix off-by-one error, closes 1000027 Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sieve-php.lib.php 18 Dec 2003 13:23:19 -0000 1.5 --- sieve-php.lib.php 6 Dec 2004 17:43:13 -0000 1.6 *************** *** 138,142 **** $this->err_recv = strlen($this->line); ! while($this->err_recv < $this->err_len){ //print "<br>Trying to receive ".($this->err_len-$this->err_recv)." bytes for result<br>"; $this->line = fgets($this->fp, ($this->err_len-$this->err_recv)); --- 138,142 ---- $this->err_recv = strlen($this->line); ! while($this->err_recv < $this->err_len-1){ //print "<br>Trying to receive ".($this->err_len-$this->err_recv)." bytes for result<br>"; $this->line = fgets($this->fp, ($this->err_len-$this->err_recv)); |
From: <av...@us...> - 2003-12-18 13:23:22
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv7160 Modified Files: CHANGELOG sieve-php.lib.php Log Message: Freeze for release of 0.1.0 Index: CHANGELOG =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/CHANGELOG,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CHANGELOG 5 Nov 2003 18:37:53 -0000 1.1 --- CHANGELOG 18 Dec 2003 13:23:19 -0000 1.2 *************** *** 1,10 **** ! 0.1.0cvs * Fixed bug with SASL PLAIN authentication. The authentication and authorization user names were upside down. ! * Added LOGIN authentication mechanism (still untested). (Ilya Pizik, polzun at ! scar.jinr.ru) * Added DIGEST-MD5 authentication mechanism. (Scott Russell, lnxgeek at --- 1,10 ---- ! 0.1.0 * Fixed bug with SASL PLAIN authentication. The authentication and authorization user names were upside down. ! * Added LOGIN authentication mechanism (Ilya Pizik, polzun at ! scar.jinr.ru, and Nigel Hathaway, nigel at bprj.co.uk) * Added DIGEST-MD5 authentication mechanism. (Scott Russell, lnxgeek at *************** *** 22,25 **** --- 22,30 ---- automatically with phpDocumentor (http://www.phpdoc.org). Documentation has been updated/corrected. + + * Added a function that returns the available SIEVE capabilities. + + * Added STARTTLS capability checking. STARTTLS itself is not supported, + however. Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sieve-php.lib.php 18 Dec 2003 13:18:05 -0000 1.4 --- sieve-php.lib.php 18 Dec 2003 13:23:19 -0000 1.5 *************** *** 20,24 **** * @package sieve-php * @copyright Copyright 2002-2003, Dan Ellis, All Rights Reserved. ! * @version 0.1.0cvs */ --- 20,24 ---- * @package sieve-php * @copyright Copyright 2002-2003, Dan Ellis, All Rights Reserved. ! * @version 0.1.0 */ *************** *** 68,72 **** * @example vacationset-sieve.php A more elaborate example of vacation script * handling. ! * @version 0.1.0cvs * @package sieve-php * @todo Maybe add the NOOP function. --- 68,72 ---- * @example vacationset-sieve.php A more elaborate example of vacation script * handling. ! * @version 0.1.0 * @package sieve-php * @todo Maybe add the NOOP function. *************** *** 751,756 **** }//end switch } - - /** --- 751,754 ---- |
From: <av...@us...> - 2003-12-18 13:18:08
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv6255 Modified Files: sieve-php.lib.php Log Message: Fixed LOGIN auth. mechanism, Nigel Hathaway Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sieve-php.lib.php 18 Dec 2003 12:58:49 -0000 1.3 --- sieve-php.lib.php 18 Dec 2003 13:18:05 -0000 1.4 *************** *** 627,631 **** * such as PLAIN or DIGEST-MD5. * - * @todo Bugfix and test LOGIN authenticate code. */ function authenticate() { --- 627,630 ---- *************** *** 726,751 **** case "LOGIN": ! /* ! // Untested code! ! ! $login=base64_encode($this->user); ! $pass=base64_encode($this->pass); ! ! fputs($this->fp, "AUTHENTICATE \"LOGIN\" {0+}\r\n\r\n"); ! fputs($this->fp, "{".strlen($login)."+}\r\n"); ! fputs($this->fp, "$login\r\n"); ! fputs($this->fp, "{".strlen($pass)."+}\r\n"); ! fputs($this->fp, "$pass\r\n"); ! ! $this->line=fgets($this->fp,1024); ! while(sieve::status($this->line) == F_DATA) ! $this->line=fgets($this->fp,1024); ! ! if(sieve::status($this->line) == F_NO) ! return false; ! $this->loggedin=true; ! return true; ! break; ! */ default: --- 725,747 ---- case "LOGIN": ! $login=base64_encode($this->user); ! $pass=base64_encode($this->pass); ! ! fputs($this->fp, "AUTHENTICATE \"LOGIN\"\r\n"); ! fputs($this->fp, "{".strlen($login)."+}\r\n"); ! fputs($this->fp, "$login\r\n"); ! fputs($this->fp, "{".strlen($pass)."+}\r\n"); ! fputs($this->fp, "$pass\r\n"); ! ! $this->line=fgets($this->fp,1024); ! while(sieve::status($this->line) == F_HEAD || ! sieve::status($this->line) == F_DATA) ! $this->line=fgets($this->fp,1024); ! ! if(sieve::status($this->line) == F_NO) ! return false; ! $this->loggedin=true; ! return true; ! break; default: |
From: <av...@us...> - 2003-12-18 12:59:18
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv3000 Modified Files: test.php Log Message: Fixed test script to work Index: test.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/test.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test.php 5 Nov 2003 17:34:45 -0000 1.14 --- test.php 18 Dec 2003 12:59:10 -0000 1.15 *************** *** 14,20 **** */ - include_once "./sieve-php.lib.php"; if(isset($_POST['action'])) { $action = $_POST['action']; --- 14,44 ---- */ include_once "./sieve-php.lib.php"; + function display_login($form="") { + if(!strcmp($form, "admin")) { + print "<p align=center><b>Sieve-php Administrator demo site</b><br><i>Please login.</i>"; + print "<table border=0 align=center><form method=POST>"; + print "<tr><td bgcolor=#d0d0d0>User Account [joeblow]: </td><td><input type=text name=uacctname></td></tr>"; + print "<tr><td bgcolor=#d0d0d0>Admin Account [cyrus-admin]: </td><td><input type=text name=uadminacct></td></tr>"; + print "<tr><td bgcolor=#d0d0d0>Admin Password: </td><td><input type=password name=uacctpass></td></tr>"; + print "<tr><td bgcolor=#d0d0d0>Server Name [mail.example.com]: </td><td><input type=text name=userver></td></tr>"; + print "<tr><td bgcolor=#d0d0d0>Server Port [2000]: </td><td><input type=text name=uport></td></tr>"; + print "<tr><td><input type=submit name=\"Login\" action=test.php&><td></tr>"; + print "</form></table>"; + print "<br><br><a href=test.php?setform=none><i>Access the normal-user login page</i></a></p></body></html>"; + } else { + print "<p align=center><b>Sieve-php demo site</b><br><i>Please login.</i>"; + print "<table border=0 align=center><form method=POST>"; + print "<tr><td bgcolor=#d0d0d0>Account Name [joeblow]: </td><td><input type=text name=uacctname></td></tr>"; + print "<tr><td bgcolor=#d0d0d0>Password: </td><td><input type=password name=uacctpass></td></tr>"; + print "<tr><td bgcolor=#d0d0d0>Server Name [mail.example.com]: </td><td><input type=text name=userver></td></tr>"; + print "<tr><td bgcolor=#d0d0d0>Server Port [2000]: </td><td><input type=text name=uport></td></tr>"; + print "<tr><td><input type=submit name=\"Login\" action=test.php&><td></tr>"; + print "</form></table>"; + print "<br><br><a href=test.php?setform=admin><i>Access the administrator's page</i></a></p></body></html>"; + } + } + if(isset($_POST['action'])) { $action = $_POST['action']; *************** *** 272,300 **** print "</body></html>"; - function display_login($form="") - { - if(!strcmp($form, "admin")) { - print "<p align=center><b>Sieve-php Administrator demo site</b><br><i>Please login.</i>"; - print "<table border=0 align=center><form method=POST>"; - print "<tr><td bgcolor=#d0d0d0>User Account [joeblow]: </td><td><input type=text name=uacctname></td></tr>"; - print "<tr><td bgcolor=#d0d0d0>Admin Account [cyrus-admin]: </td><td><input type=text name=uadminacct></td></tr>"; - print "<tr><td bgcolor=#d0d0d0>Admin Password: </td><td><input type=password name=uacctpass></td></tr>"; - print "<tr><td bgcolor=#d0d0d0>Server Name [mail.example.com]: </td><td><input type=text name=userver></td></tr>"; - print "<tr><td bgcolor=#d0d0d0>Server Port [2000]: </td><td><input type=text name=uport></td></tr>"; - print "<tr><td><input type=submit name=\"Login\" action=test.php&><td></tr>"; - print "</form></table>"; - print "<br><br><a href=test.php?setform=none><i>Access the normal-user login page</i></a></p></body></html>"; - } - else { - print "<p align=center><b>Sieve-php demo site</b><br><i>Please login.</i>"; - print "<table border=0 align=center><form method=POST>"; - print "<tr><td bgcolor=#d0d0d0>Account Name [joeblow]: </td><td><input type=text name=uacctname></td></tr>"; - print "<tr><td bgcolor=#d0d0d0>Password: </td><td><input type=password name=uacctpass></td></tr>"; - print "<tr><td bgcolor=#d0d0d0>Server Name [mail.example.com]: </td><td><input type=text name=userver></td></tr>"; - print "<tr><td bgcolor=#d0d0d0>Server Port [2000]: </td><td><input type=text name=uport></td></tr>"; - print "<tr><td><input type=submit name=\"Login\" action=test.php&><td></tr>"; - print "</form></table>"; - print "<br><br><a href=test.php?setform=admin><i>Access the administrator's page</i></a></p></body></html>"; - } - } ?> --- 296,298 ---- |
From: <av...@us...> - 2003-12-18 12:58:52
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv2925 Modified Files: sieve-php.lib.php Log Message: Added get capability function Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sieve-php.lib.php 5 Nov 2003 18:40:29 -0000 1.2 --- sieve-php.lib.php 18 Dec 2003 12:58:49 -0000 1.3 *************** *** 754,758 **** --- 754,835 ---- }//end switch + } + + + + /** + * Return an array of available capabilities. + * + * @return array + */ + function sieve_get_capability() { + if($this->loggedin==false) + return false; + fputs($this->fp, "CAPABILITY\r\n"); + $this->line=fgets($this->fp,1024); + + //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. + + if(ereg("IMPLEMENTATION",$this->line)) + { + //we're on the Cyrus V2 sieve server + while(sieve::status($this->line) == F_DATA){ + + $this->item = sieve::parse_for_quotes($this->line); + + if(strcmp($this->item[0], "IMPLEMENTATION") == 0) + $this->capabilities["implementation"] = $this->item[1]; + + elseif(strcmp($this->item[0], "SIEVE") == 0 or strcmp($this->item[0], "SASL") == 0){ + + if(strcmp($this->item[0], "SIEVE") == 0) + $this->cap_type="modules"; + else + $this->cap_type="auth"; + + $this->modules = split(" ", $this->item[1]); + if(is_array($this->modules)){ + foreach($this->modules as $this->module) + $this->capabilities[$this->cap_type][$this->module]=true; + } /* end if */ + elseif(is_string($this->modules)) + $this->capabilites[$this->cap_type][$this->modules]=true; + } + else{ + $this->capabilities["unknown"][]=$this->line; + } + $this->line=fgets($this->fp,1024); + + }// end while + } + else + { + //we're on the older Cyrus V1. server + //this version does not support module reporting. We only have auth types. + $this->cap_type="auth"; + + //break apart at the "Cyrus timsieve...." "SASL={......}" + $this->item = sieve::parse_for_quotes($this->line); + $this->capabilities["implementation"] = $this->item[0]; + + //we should have "SASL={..........}" now. Break out the {xx,yyy,zzzz} + $this->modules = substr($this->item[1], strpos($this->item[1], "{"),strlen($this->item[1])-1); + + //then split again at the ", " stuff. + $this->modules = split($this->modules, ", "); + + //fill up our $this->modules property + if(is_array($this->modules)){ + foreach($this->modules as $this->module) + $this->capabilities[$this->cap_type][$this->module]=true; + } /* end if */ + elseif(is_string($this->modules)) + $this->capabilites[$this->cap_type][$this->module]=true; + } + + return $this->modules; } *************** *** 784,788 **** * calculate data's HMAC. * @return string HMAC Digest string - */ */ function hmac_md5($data, $key='') { --- 861,864 ---- |
From: <av...@us...> - 2003-12-18 12:58:29
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv2873 Modified Files: README Log Message: Documentation updates Index: README =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/README,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** README 5 Nov 2003 18:37:53 -0000 1.9 --- README 18 Dec 2003 12:58:25 -0000 1.10 *************** *** 29,34 **** Documentation ! The [4]documentation is available online. It is also included in the ! distribution. Demo --- 29,34 ---- Documentation ! The [4]documentation is available online. It is also included in a ! separate distribution file. Demo *************** *** 53,58 **** Dan has kindly passed on maintainership to [10]Alexandros Vellis, in ! order to apply some patches that were lying around and fix just one or ! two bugs that are lying around. Programs Using this Library --- 53,58 ---- Dan has kindly passed on maintainership to [10]Alexandros Vellis, in ! order to apply some patches and fix just one or two bugs that are ! lying around. Programs Using this Library *************** *** 81,85 **** 2. http://www.cyrusoft.com/sieve/ 3. http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt ! 4. file://localhost/var/www/edunet/sieve-php/doc/html/documentation.html 5. http://members.rushmore.com/~dane/test.php 6. http://email.uoa.gr/projects/squirrelmail/demo.php --- 81,85 ---- 2. http://www.cyrusoft.com/sieve/ 3. http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt ! 4. file://localhost/var/www/edunet/sieve-php/docs/ 5. http://members.rushmore.com/~dane/test.php 6. http://email.uoa.gr/projects/squirrelmail/demo.php |
From: <av...@us...> - 2003-12-18 12:46:23
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv826 Modified Files: README.html INSTALL Log Message: Documentation updates Index: README.html =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/README.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.html 5 Nov 2003 18:37:53 -0000 1.1 --- README.html 18 Dec 2003 12:46:20 -0000 1.2 *************** *** 49,54 **** <h2>Documentation</h2> ! <p>The <a href="documentation.html">documentation is available online</a>. It ! is also included in the distribution.</p> --- 49,54 ---- <h2>Documentation</h2> ! <p>The <a href="docs/">documentation is available online</a>. It ! is also included in a separate distribution file.</p> *************** *** 85,89 **** - <h2>Authors</h2> --- 85,88 ---- *************** *** 93,99 **** <p>Dan has kindly passed on maintainership to <a href="http://www.noc.uoa.gr/~avel/">Alexandros Vellis</a>, in order to apply ! some patches that were lying around and fix just one or two bugs that are lying ! around.</p> ! --- 92,96 ---- <p>Dan has kindly passed on maintainership to <a href="http://www.noc.uoa.gr/~avel/">Alexandros Vellis</a>, in order to apply ! some patches and fix just one or two bugs that are lying around.</p> *************** *** 137,155 **** Application</a></li> - - </ul> - <div class="center"> <p> - <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=35727&type=4" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a> - </p> <p> - <a href="http://validator.w3.org/check/referer"><img border="0" src="/images/valid-xhtml10.png" --- 134,146 ---- Index: INSTALL =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/INSTALL,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** INSTALL 5 Nov 2003 18:37:53 -0000 1.1 --- INSTALL 18 Dec 2003 12:46:20 -0000 1.2 *************** *** 16,20 **** If you have any trouble or have any bugs, problems or ideas to report, write to ! sieve-php development list: sie...@li.... A web interface to subscribe to this list is available at: https://lists.sourceforge.net/mailman/listinfo/sieve-php-devel --- 16,20 ---- If you have any trouble or have any bugs, problems or ideas to report, write to ! sieve-php development list: sieve-php-devel at lists.sourceforge.net. A web interface to subscribe to this list is available at: https://lists.sourceforge.net/mailman/listinfo/sieve-php-devel |
From: <av...@us...> - 2003-11-06 11:25:33
|
Update of /cvsroot/sieve-php/sieve-php/examples In directory sc8-pr-cvs1:/tmp/cvs-serv20173 Added Files: simple_example.php vacationset-sieve.php Log Message: Adding Example PHP files --- NEW FILE: simple_example.php --- <? include "sieve-php.lib.php"; $sieve=new sieve($server, $port, $acctname, $acctpass, $auth_types); if(!$sieve->sieve_login()); /* standard results in $sieve->error and $sieve->error_raw; */ if(!$scripts_avail=$sieve->sieve_listscripts()) /* standard results in $sieve->error and $sieve->error_raw; */ else /* standard results in $sieve->response; */ if(!$sieve->sieve_getscript($scriptname)) /* standard results in $sieve->error and $sieve->error_raw[]; */ else /* standard results in $sieve->response; */ $sieve-><whatever function you find in the *.lib file> $sieve->sieve_logout(); ?> --- NEW FILE: vacationset-sieve.php --- <?php /* $Id: vacationset-sieve.php,v 1.1 2003/11/06 11:25:30 avel Exp $ vacationset-sieve.phtml is a PHP script that sets up a vacation message via Cyrus sieve Note: This script was written as part of work done for the Cooperative Housing Federation of Canada <http://www.chfc.ca/> where I help manage email and other related LAN services. Copyright (C) 2003 Russell McOrmond <http://www.flora.ca/russell/> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html ---cut--- This script uses a library from http://sourceforge.net/projects/sieve-php/ And interacts with the sieve server part of Cyrus IMAPD http://asg.web.cmu.edu/cyrus/imapd/ */ // sieve-php library mentioned above include "./sieve-php.lib"; // Domain this script is being used on. $domain = "chfc.ca"; $sieveserver = "localhost"; $sieveport = 2000; // Directory writeable by HTTP server, stores vacation messages/etc. $tempdir = "temp-sieve/"; function authenticate() { Header("WWW-Authenticate: Basic realm=\"Email Username/password\""); Header("HTTP/1.0 401 Unauthorized"); echo "You didn't authenticate - sorry\n"; exit; } function setvacation() { global $userid, $password, $message, $aliases, $sieve; $alias = preg_split ("/[\s,]+/", $aliases); $scriptaliases=""; foreach ($alias as $result) { if ($result == "") continue; if ($scriptaliases != "") $scriptaliases .=", "; $scriptaliases .= "\"$result\""; } if ($scriptaliases != "") $scriptalias = ":addresses [$scriptaliases]"; $vacationscript="# Set by vacationset-sieve.phtml require \"vacation\"; vacation $scriptalias \"" . addslashes($message) . "\";"; // echo "<PRE>$vacationscript</PRE>"; return $sieve->sieve_sendscript("vacationset",$vacationscript); } function read_aliases() { global $aliases, $userid, $tempdir; $aliases=""; $filename = "$tempdir/$userid.vacation.aliases"; if ($fd = @fopen ($filename, "r")) { while ($fd && !feof ($fd)) { $aliases .= fgets($fd, 4096); } fclose ($fd); } cleanup_aliases(); } function cleanup_aliases() { global $aliases, $userid, $emailaddr; if ($aliases == "") { $aliases="$emailaddr\n"; } else if (preg_match ("/\S/",$aliases)) { $alias = preg_split ("/[\s,]+/", $aliases); reset ($alias); $aliases="$emailaddr\n"; while (list(, $email) = each ($alias)) { // Ignore main email address if it is already in the list. if($email == $emailaddr) continue; // Ignore lines that don't look like Email addresses if(eregi( "^[a-z0-9]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$",$email)) $aliases .= "$email\n"; } } } function save_aliases() { global $aliases, $userid, $tempdir; cleanup_aliases(); $filename = "$tempdir/$userid.vacation.aliases"; if ($fd = @fopen ($filename, "w")) { @fwrite($fd,$aliases); fclose($fd); } } function html_head() { ?> <HTML> <HEAD> <TITLE>CHF Canada: auto-responder for e-mail</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <H1>CHF Canada e-mail auto-responder</H1> <B>Note:</B><BR> This is the new vacation system that is part of the new email server software. Your old vacation messages may need to be reset. <?php } function html_foot() { ?> </BODY> </HTML> <?php } function ask_active_script($scriptname) { global $deactivatescript; html_head(); ?><H2>Other script is active</H2> Another script named "<?php echo $scriptname;?>" is currently active. This version of the vacation system does not modify existing scripts, it just sets a new script. If you wish to use this vacation system you must deactivate current script. <P> <A HREF="<?php echo $PHP_SELF . "?deactivatescript=yes"; ?>">Deactivate script?</A> <?php html_foot(); exit; } // Start of Body of code... // Make sure user is authenticated... if(!isset($PHP_AUTH_USER)) { authenticate(); } $userid=$PHP_AUTH_USER; $password=$PHP_AUTH_PW; $emailaddr = "$userid@$domain"; // Connect to sieve server $sieve=new sieve($sieveserver, $sieveport, $userid, $password); // Right password for this user? if(!$sieve->sieve_login()) { authenticate(); } // If the user requested, deactivate current script if($deactivatescript) { $sieve->sieve_setactivescript(""); } // Verify that other script is not active if($sieve->sieve_listscripts()) if(isset($sieve->response["ACTIVE"])) if($sieve->response["ACTIVE"] != "vacationset") ask_active_script($sieve->response["ACTIVE"]); if(!isset($message)) { read_aliases(); html_head(); ?> <FORM METHOD="POST" ACTION="<?php echo $PHP_SELF;?>"> <OL TYPE="A"> <LI><H2>Enable/Disable</H2> <blockquote> <INPUT TYPE="radio" NAME="mode" VALUE="set" checked> Enable auto-response message <BR> <INPUT TYPE="radio" NAME="mode" VALUE="unset"> Disable auto-response message </blockquote> <LI><H2>Message</H2> <?php $filename="$tempdir/$userid.vacation.msg"; if($fd = @fopen ($filename, "r")) { $vacationmsg = fread ($fd, filesize ($filename)); fclose ($fd); ?> <P> Here is your existing outgoing message. <BR> <TEXTAREA NAME="message" ROWS="12" COLS="70"> <?php echo htmlspecialchars($vacationmsg);?> </TEXTAREA> <?php } else { ?> You had no outgoing message. Here is the default to start with. <BR> <TEXTAREA NAME="message" ROWS="12" COLS="70"> Hello, I am gone for a while and will read your message upon my return. </TEXTAREA> <?php } ?> <p>You should edit the body of the message to indicate when you will return and perhaps pass on other instructions. <P>The subject of your reply will be "Re " and whatever they put as the subject. <BR><HR><BR> <INPUT TYPE="reset" VALUE="Reset"> If you have made any changes to the above text and wish to start over, press reset to clear your changes. <P> <LI><H2>Aliases</H2> <P> If you have other e-mail accounts that you have forwarded to your main CHF address <<?php echo $emailaddr; ?>>, you may want to have the auto-responder reply to messages addressed to those accounts as well. <P> Please add to the box below any addresses that are forwarded to this mailbox, for which you wish the auto-responder program to also send replies. <P> <TEXTAREA NAME="aliases" ROWS="5" COLS="40"> <?php echo htmlspecialchars($aliases);?> </TEXTAREA> <P> <LI><H2>Finished</H2> When you are satisfied with the above choices, select Submit. <P> <INPUT TYPE="submit" VALUE="Submit"> </OL> </FORM> <?php // $message was set } else { save_aliases(); $filename="$tempdir/$userid.vacation.msg"; if($fd = @fopen ($filename, "w")) { @fwrite($fd,stripslashes(chop($message))."\n"); fclose($fd); } html_head(); if (setvacation()) { if ($mode == "set") $sieve->sieve_setactivescript("vacationset"); else $sieve->sieve_setactivescript(""); ?> <P> <H2>Your choices have been saved.</H2> <?php } else { ?> <P> <H2>Error setting vacation.</H2> <?php echo "Error: " . $sieve->error . "<BR>\n"; foreach($sieve->error_raw as $errorline) print "errorline: $errorline<br>"; } ?> <P> <A HREF="/">Back to server homepage</A><BR> <A HREF="<?php echo $PHP_SELF;?>">Look at your auto-responder settings again</A> <?php } html_foot(); ?> |
From: <av...@us...> - 2003-11-05 21:32:10
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv5483 Modified Files: sieve-php.lib.php Log Message: More docblock updates Index: sieve-php.lib.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/sieve-php.lib.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sieve-php.lib.php 5 Nov 2003 17:33:51 -0000 1.1 --- sieve-php.lib.php 5 Nov 2003 18:40:29 -0000 1.2 *************** *** 47,54 **** * $sieve->error_raw, and successful responses in $sieve->responses. * * @author Dan Ellis ! * @example doc/example.php * @version 0.1.0cvs * @package sieve-php */ class sieve { --- 47,76 ---- * $sieve->error_raw, and successful responses in $sieve->responses. * + * NOTE: a major change since version (0.0.5) is the inclusion of a standard + * method to retrieve server responses. All functions will return either true + * or false and will fill in $sieve->error with a defined error code like + * EC_QUOTA, raw server errors in $sieve->error_raw, and successful responses + * in $sieve->responses. + * + * Usage is pretty simple. The basics is login, do what you need and logout. + * There are two sample files (which suck) test.php and testsieve.php. + * test.php allows you to create/delete/view scripts and testsieve.php is a + * very basic sieve server test. + * + * Please let us know of any bugs, problems or ideas at sieve-php development + * list: sie...@li.... A web interface to subscribe + * to this list is available at: + * https://lists.sourceforge.net/mailman/listinfo/sieve-php-devel + * * @author Dan Ellis ! * @example simple_example.php A simple example that shows usage of sieve-php ! * class. ! * @example vacationset-sieve.php A more elaborate example of vacation script ! * handling. * @version 0.1.0cvs * @package sieve-php + * @todo Maybe add the NOOP function. + * @todo Have timing mechanism when port problems arise. + * @todo Provide better error diagnostics. */ class sieve { *************** *** 223,226 **** --- 245,254 ---- * (ex. "PLAIN DIGEST-MD5 CRAM-MD5" The method the library will try first * is PLAIN.) The default for this value is PLAIN. + * + * Note: $user, if included, is the account name (and $pass will be the + * password) of an administrator account that can act on behalf of the user. + * If you are using Cyrus, you must make sure that the admin account has + * rights to admin the user. This is to allow admins to edit/view users + * scripts without having to know the user's password. Very handy. */ function sieve($host, $port, $user, $pass, $auth="", $auth_types='PLAIN') { *************** *** 282,285 **** --- 310,316 ---- * * This should probably be replaced by a smarter parser. + * + * @param $string string Input that contains status responses. + * @todo remove this function and dependencies */ function status($string) { *************** *** 310,316 **** /** ! * This function will attemp to log into the sieve server. It will return ! * false if it fails, true if all is well. This also loads some arrays up ! * with some handy information: * * capabilities["implementation"] contains the sieve version information --- 341,348 ---- /** ! * Attemp to log in to the sieve server. ! * ! * It will return false if it fails, true if all is well. This also loads ! * some arrays up with some handy information: * * capabilities["implementation"] contains the sieve version information *************** *** 328,337 **** * may have sent * ! * Note: $authuser, if included, is the account name (and $acctpass will ! * be the password) of an administrator account that can act on behalf of the ! * user. If you are using Cyrus, you must make sure that the admin account ! * has rights to admin the user. This is to allow admins to edit/view users ! * scripts without having to know the user's password. Very handy. ! * */ function sieve_login() { --- 360,364 ---- * may have sent * ! * @return boolean */ function sieve_login() { *************** *** 442,447 **** * @return boolean Always returns true at this point. */ ! function sieve_logout() ! { if($this->loggedin==false) return false; --- 469,473 ---- * @return boolean Always returns true at this point. */ ! function sieve_logout() { if($this->loggedin==false) return false; *************** *** 464,469 **** * @return boolean Returns true if script has been successfully uploaded. */ ! function sieve_sendscript($scriptname, $script) ! { if($this->loggedin==false) return false; --- 490,494 ---- * @return boolean Returns true if script has been successfully uploaded. */ ! function sieve_sendscript($scriptname, $script) { if($this->loggedin==false) return false; *************** *** 492,495 **** --- 517,521 ---- * @param $scriptsize integer The size of the SIEVE script. * @return boolean + * @todo Does not work; bug fix and test. */ function sieve_havespace($scriptname, $scriptsize) { *************** *** 600,603 **** --- 626,631 ---- * Attempts to authenticate to SIEVE, using some SASL authentication method * such as PLAIN or DIGEST-MD5. + * + * @todo Bugfix and test LOGIN authenticate code. */ function authenticate() { |
From: <av...@us...> - 2003-11-05 21:28:06
|
Update of /cvsroot/sieve-php/sieve-php/examples In directory sc8-pr-cvs1:/tmp/cvs-serv4462/examples Removed Files: vacationset-sieve.phtml Log Message: moving around files... --- vacationset-sieve.phtml DELETED --- |
From: <av...@us...> - 2003-11-05 21:27:59
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv4462 Removed Files: CHANGES RELEASE Log Message: moving around files... --- CHANGES DELETED --- --- RELEASE DELETED --- |
From: <av...@us...> - 2003-11-05 21:25:16
|
Update of /cvsroot/sieve-php/sieve-php/doc In directory sc8-pr-cvs1:/tmp/cvs-serv28089 Removed Files: USAGE RELEASE Log Message: Remove useless files. --- USAGE DELETED --- --- RELEASE DELETED --- |
From: <av...@us...> - 2003-11-05 21:25:06
|
Update of /cvsroot/sieve-php/sieve-php/doc In directory sc8-pr-cvs1:/tmp/cvs-serv28534 Removed Files: AUTHORS CHANGES COPYING README Log Message: Move files around for GNU style documentation files --- AUTHORS DELETED --- --- CHANGES DELETED --- --- COPYING DELETED --- --- README DELETED --- |
From: <av...@us...> - 2003-11-05 18:43:38
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv4844 Modified Files: AUTHORS README Added Files: CHANGELOG INSTALL README.html Log Message: Bring documentation to sync. --- NEW FILE: CHANGELOG --- 0.1.0cvs * Fixed bug with SASL PLAIN authentication. The authentication and authorization user names were upside down. * Added LOGIN authentication mechanism (still untested). (Ilya Pizik, polzun at scar.jinr.ru) * Added DIGEST-MD5 authentication mechanism. (Scott Russell, lnxgeek at us.ibm.com) * Added support function hmac_md5 (from Squirrelmail, thanks to Chris Hilts). * Bugfix in "OK" response check (Aaron Stone). * Changed Dan's email to the email of the sieve-php-devel mailing list. * Updated testsieve.php test script. * API Documentation resides inside the class (Javadoc-style) and is created automatically with phpDocumentor (http://www.phpdoc.org). Documentation has been updated/corrected. 0.0.8 Added a test for when list_scripts may fail. --- NEW FILE: INSTALL --- To install this class, simply copy sieve-php.lib.php in a directory that is in the include path of your PHP scripts. Afterwards, just include the file as in include('/path/to/sieve-php.lib.php'); and read the online documentation on how to use it. An example comes with the class documentation. API Documentation resides inside the class itself and is automatically generated with phpdoc (http://www.phpdoc.org). It is available in the docs/ subdirectory, or you can browse it online at: http://sieve-php.sourceforge.net/docs/ If you have any trouble or have any bugs, problems or ideas to report, write to sieve-php development list: sie...@li.... A web interface to subscribe to this list is available at: https://lists.sourceforge.net/mailman/listinfo/sieve-php-devel --- NEW FILE: README.html --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>sieve-php, a PHP class for managing SIEVE scripts</title> <link rel="STYLESHEET" type="text/css" href="/style/pacific.css" title="Default Theme Stylesheet" /> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body> <h1>sieve-php</h1> <!-- $Id: README.html,v 1.1 2003/11/05 18:37:53 avel Exp $ --> <h2>What is SIEVE and sieve-php?</h2> <p><strong>SIEVE</strong> is a mail filtering language, intended for server-side filtering of emails. See <a href="http://www.faqs.org/rfcs/rfc3028.html">RFC 3028</a> and <a href="http://www.cyrusoft.com/sieve/">Cyrusoft's page about SIEVE</a> for more details.</p> <p>In a nutshell, with SIEVE, all email gets filtered even before the mail hits your inbox. This has numerous implications, both good and bad. The language was designed to have no variables and no methods for iterating, thus making the language very secure.</p> <p><strong><a href="http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt">MANAGESIEVE</a></strong> is a protocol for managing (uploading, downloading, activating) SIEVE scripts on a remote mail server. Cyrus IMAP project's <em>timsieved</em> is the most popular impelementation of SIEVE and MANAGESIEVE in the open source world.</a> <p><strong>sieve-php</strong> is a class written in PHP that supports the MANAGESIEVE protocol, in order to allow users of web interfaces written in PHP to interact with such servers without knowing any of the backend details.</p> <p>Currently sieve-php is just a library, not an application. Although it does include some sample scripts to show off its capabilities, which actually work(!), you should not expect to download a complete application. Remember, this is a library!</p> <h2>Documentation</h2> <p>The <a href="documentation.html">documentation is available online</a>. It is also included in the distribution.</p> <h2>Demo</h2> <p>To see a sieve-php demo in action, try one of these:</p> <ul> <li><a href="http://members.rushmore.com/~dane/test.php">Test script by Dan Ellis.</a> Included with the sieve-php distribution.</li> <li><a href="http://email.uoa.gr/projects/squirrelmail/demo.php">Squirrelmail + avelsieve Demo Site.</a> This will be up in a few days' time.</li> </ul> <h2>Download</h2> <p><a href="https://sourceforge.net/project/showfiles.php?group_id=35727">Sourceforge Download Site</a></p> <h2>Support</h2> <p>Please join <a href="http://lists.sourceforge.net/lists/listinfo/sieve-php-devel">sieve-php-devel mailing list</a>. </p> <h2>Authors</h2> <p>The original author is <strong><a href=mailto:danellis@rushmore.com>Dan Ellis</a></strong>. <p>Dan has kindly passed on maintainership to <a href="http://www.noc.uoa.gr/~avel/">Alexandros Vellis</a>, in order to apply some patches that were lying around and fix just one or two bugs that are lying around.</p> <h2>Programs Using this Library</h2> <ul> <li><a href="http://www.developer.ch/sections/softwares/horde/sieve-filters/"> Sieve Filters Interface for Horde/IMP.</a></li> <li><a href="http://email.uoa.gr/projects/squirrelmail/avelsieve.php">avelsieve, SIEVE Mail Filters Plugin for Squirrelmail</a></li> </ul> <h2>Links</h2> <p>These related projects might be of interest:</p> <ul> <li><a href="http://asg.web.cmu.edu/cyrus/">The Cyrus Project.</a> <li><a href="http://www.cyrusoft.com/sieve/">Cyrusoft's Page about SIEVE, a wealth of SIEVE links.</a></li> <li><a href="http://www.faqs.org/rfcs/rfc3028.html">RFC 3028, SIEVE</a></li> <li><a href="http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt">MANAGESIEVE Internet Draft</a></li> <li><a href="http://libsieve.sourceforge.net">libsieve, a C library for parsing SIEVE scripts.</a></li> <li><a href="http://www.horde.org/imp/">Horde IMP Webmail Application</a></li> <li><a href="http://www.squirrelmail.org">Squirrelmail Webmail Application</a></li> </ul> <div class="center"> <p> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=35727&type=4" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a> </p> <p> <a href="http://validator.w3.org/check/referer"><img border="0" src="/images/valid-xhtml10.png" alt="Valid XHTML 1.0!" height="31" width="88" /></a> </p> </div> </body> </html> Index: AUTHORS =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/AUTHORS,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AUTHORS 5 Aug 2003 11:10:40 -0000 1.1 --- AUTHORS 5 Nov 2003 18:37:53 -0000 1.2 *************** *** 7,10 **** Contributors: ! Add Patch authors here. --- 7,15 ---- Contributors: ! Atif Ghaffar ! Andrew Sterling Hanenkamp <ste...@ha...> ! Ilya Pizik <po...@sc...> (AUTH LOGIN) ! Scott Russell <ln...@us...> (DIGEST-MD5 & CRAM-MD5) ! Chris Hilts of Squirrelmail Team <URL:http://www.squirrelmail.org> ! (hmac_md5 function) Index: README =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/README,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** README 5 Aug 2003 15:33:08 -0000 1.8 --- README 5 Nov 2003 18:37:53 -0000 1.9 *************** *** 29,33 **** Documentation ! The documentation is available online. It is also included in the distribution. --- 29,33 ---- Documentation ! The [4]documentation is available online. It is also included in the distribution. *************** *** 35,56 **** To see a sieve-php demo in action, try one of these: ! * [4]Test script by Dan Ellis. Included with the sieve-php distribution. ! * [5]Squirrelmail + avelsieve Demo Site. This will be up in a few days' time. Download ! [6]Sourceforge Download Site Support ! Please join [7]sieve-php-devel mailing list. Authors ! The original author is [8]Dan Ellis. ! Dan has kindly passed on maintainership to [9]Alexandros Vellis, in order to apply some patches that were lying around and fix just one or two bugs that are lying around. --- 35,56 ---- To see a sieve-php demo in action, try one of these: ! * [5]Test script by Dan Ellis. Included with the sieve-php distribution. ! * [6]Squirrelmail + avelsieve Demo Site. This will be up in a few days' time. Download ! [7]Sourceforge Download Site Support ! Please join [8]sieve-php-devel mailing list. Authors ! The original author is [9]Dan Ellis. ! Dan has kindly passed on maintainership to [10]Alexandros Vellis, in order to apply some patches that were lying around and fix just one or two bugs that are lying around. *************** *** 58,76 **** Programs Using this Library ! * [10]Sieve Filters Interface for Horde/IMP. ! * [11]avelsieve, SIEVE Mail Filters Plugin for Squirrelmail Links These related projects might be of interest: ! * [12]The Cyrus Project. ! * [13]Cyrusoft's Page about SIEVE, a wealth of SIEVE links. ! * [14]RFC 3028, SIEVE ! * [15]MANAGESIEVE Internet Draft ! * [16]libsieve, a C library for parsing SIEVE scripts. ! * [17]Horde IMP Webmail Application ! * [18]Squirrelmail Webmail Application ! [19]Valid XHTML 1.0! References --- 58,78 ---- Programs Using this Library ! * [11]Sieve Filters Interface for Horde/IMP. ! * [12]avelsieve, SIEVE Mail Filters Plugin for Squirrelmail Links These related projects might be of interest: ! * [13]The Cyrus Project. ! * [14]Cyrusoft's Page about SIEVE, a wealth of SIEVE links. ! * [15]RFC 3028, SIEVE ! * [16]MANAGESIEVE Internet Draft ! * [17]libsieve, a C library for parsing SIEVE scripts. ! * [18]Horde IMP Webmail Application ! * [19]Squirrelmail Webmail Application ! [20]SourceForge.net Logo ! ! [21]Valid XHTML 1.0! References *************** *** 79,96 **** 2. http://www.cyrusoft.com/sieve/ 3. http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt ! 4. http://members.rushmore.com/~dane/test.php ! 5. http://email.uoa.gr/projects/squirrelmail/demo.php ! 6. https://sourceforge.net/project/showfiles.php?group_id=35727 ! 7. http://lists.sourceforge.net/lists/listinfo/sieve-php-devel ! 8. mailto:dan...@ru... ! 9. http://www.noc.uoa.gr/~avel/ ! 10. http://www.developer.ch/sections/softwares/horde/sieve-filters/ ! 11. http://email.uoa.gr/projects/squirrelmail/avelsieve.php ! 12. http://asg.web.cmu.edu/cyrus/ ! 13. http://www.cyrusoft.com/sieve/ ! 14. http://www.faqs.org/rfcs/rfc3028.html ! 15. http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt ! 16. http://libsieve.sourceforge.net/ ! 17. http://www.horde.org/imp/ ! 18. http://www.squirrelmail.org/ ! 19. http://validator.w3.org/check/referer --- 81,100 ---- 2. http://www.cyrusoft.com/sieve/ 3. http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt ! 4. file://localhost/var/www/edunet/sieve-php/doc/html/documentation.html ! 5. http://members.rushmore.com/~dane/test.php ! 6. http://email.uoa.gr/projects/squirrelmail/demo.php ! 7. https://sourceforge.net/project/showfiles.php?group_id=35727 ! 8. http://lists.sourceforge.net/lists/listinfo/sieve-php-devel ! 9. mailto:dan...@ru... ! 10. http://www.noc.uoa.gr/~avel/ ! 11. http://www.developer.ch/sections/softwares/horde/sieve-filters/ ! 12. http://email.uoa.gr/projects/squirrelmail/avelsieve.php ! 13. http://asg.web.cmu.edu/cyrus/ ! 14. http://www.cyrusoft.com/sieve/ ! 15. http://www.faqs.org/rfcs/rfc3028.html ! 16. http://www.ietf.org/internet-drafts/draft-martin-managesieve-04.txt ! 17. http://libsieve.sourceforge.net/ ! 18. http://www.horde.org/imp/ ! 19. http://www.squirrelmail.org/ ! 20. http://sourceforge.net/ ! 21. http://validator.w3.org/check/referer |
From: <av...@us...> - 2003-11-05 17:55:39
|
Update of /cvsroot/sieve-php/sieve-php/doc/html In directory sc8-pr-cvs1:/tmp/cvs-serv27288 Removed Files: index.html documentation.html Log Message: Removed Obsolete Documentation files --- index.html DELETED --- --- documentation.html DELETED --- |
From: <av...@us...> - 2003-11-05 17:45:31
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv24132 Modified Files: testsieve_config.php testsieve.php test.php Log Message: phpdoc documentation updates Index: testsieve_config.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/testsieve_config.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testsieve_config.php 22 Oct 2003 12:56:21 -0000 1.1 --- testsieve_config.php 5 Nov 2003 17:34:45 -0000 1.2 *************** *** 1,13 **** <?php ! ! /* This is a test file to examine whether sieve-php.lib can interact with your ! * sieve server properly. * * Modify the information below and run testsieve.php after installing the * library. */ ! /* Modify these variable to match your account and server settings */ $server = "mail.example.com"; --- 1,19 ---- <?php ! /** ! * This is the configuration for the test script, testsieve.php, so as to ! * examine whether sieve-php.lib can interact with your sieve server properly. * * Modify the information below and run testsieve.php after installing the * library. + * + * @author Alexandros Vellis + * @package sieve-php */ ! /** ! * These variable have to be modified so as to match your account and server ! * settings ! */ $server = "mail.example.com"; Index: testsieve.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/testsieve.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testsieve.php 5 Nov 2003 15:48:57 -0000 1.8 --- testsieve.php 5 Nov 2003 17:34:45 -0000 1.9 *************** *** 1,5 **** <?php ! ! /* * $Id$ * --- 1,9 ---- <?php ! /** ! * This is a test file to examine whether sieve-php.lib can interact with your ! * sieve server properly. ! * ! * Run this script after installing the library. ! * * $Id$ * *************** *** 8,19 **** * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ ! /* This is a test file to examine whether sieve-php.lib can interact with your sieve server properly. ! Run this script after installing the library. */ ! ! include "./sieve-php.lib"; include "./testsieve_config.php"; - /* You should not need to modify anything below this line */ --- 12,22 ---- * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. + * + * @author Dan Ellis + * @package sieve-php */ ! include "./sieve-php.lib.php"; include "./testsieve_config.php"; /* You should not need to modify anything below this line */ Index: test.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/test.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test.php 5 Nov 2003 15:48:56 -0000 1.13 --- test.php 5 Nov 2003 17:34:45 -0000 1.14 *************** *** 1,5 **** <?php ! ! /* * $Id$ * --- 1,6 ---- <?php ! /** ! * Test Script for sieve-php library. ! * * $Id$ * *************** *** 8,14 **** * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ ! include "./sieve-php.lib"; if(isset($_POST['action'])) { --- 9,19 ---- * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. + * + * @author Dan Ellis + * @package sieve-php */ ! ! include_once "./sieve-php.lib.php"; if(isset($_POST['action'])) { |
From: <av...@us...> - 2003-11-05 17:40:17
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv23963 Added Files: sieve-php.lib.php Removed Files: sieve-php.lib Log Message: Rename of sieve-php.lib to sieve-php.lib.php. A lot of formatting for PHPDocumentor API Documentation has been done. --- NEW FILE: sieve-php.lib.php --- <?php /** * sieve-php.lib.php * * $Id: sieve-php.lib.php,v 1.1 2003/11/05 17:33:51 avel Exp $ * * Copyright 2001-2003 Dan Ellis <dan...@ru...> * * This program is released under the GNU Public License. See the enclosed * file COPYING for license information. If you did not receive this file, see * http://www.fsf.org/copyleft/gpl.html. * * You should have received a copy of the GNU Public License along with this * package; if not, write to the Free Software Foundation, Inc., 59 Temple * Place - Suite 330, Boston, MA 02111-1307, USA. * * See CHANGES for updates since last release * * @author Dan Ellis * @package sieve-php * @copyright Copyright 2002-2003, Dan Ellis, All Rights Reserved. * @version 0.1.0cvs */ /** * Constants */ define ("F_NO", 0); define ("F_OK", 1); define ("F_DATA", 2); define ("F_HEAD", 3); define ("EC_NOT_LOGGED_IN", 0); define ("EC_QUOTA", 10); define ("EC_NOSCRIPTS", 20); define ("EC_UNKNOWN", 255); /** * SIEVE class - A Class that implements MANAGESIEVE in PHP4|5. * * This program provides a handy interface into the Cyrus timsieved server * under php4. It is tested with Sieve server included in Cyrus 2.0, but it * has been upgraded (not tested) to work with older Sieve server versions. * * All functions will return either true or false and will fill in * $sieve->error with a defined error code like EC_QUOTA, raw server errors in * $sieve->error_raw, and successful responses in $sieve->responses. * * @author Dan Ellis * @example doc/example.php * @version 0.1.0cvs * @package sieve-php */ class sieve { var $host; var $port; var $user; var $pass; /** * a comma seperated list of allowed auth types, in order of preference */ var $auth_types; /** * type of authentication attempted */ var $auth_in_use; var $line; var $fp; var $retval; var $tmpfile; var $fh; var $len; var $script; var $loggedin; var $capabilities; var $error; var $error_raw; var $responses; //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?!? /** * get response */ function get_response() { if($this->loggedin == false or feof($this->fp)){ $this->error = EC_NOT_LOGGED_IN; $this->error_raw = "You are not logged in."; return false; } unset($this->response); unset($this->error); unset($this->error_raw); $this->line=fgets($this->fp,1024); $this->token = split(" ", $this->line, 2); if($this->token[0] == "NO"){ /* we need to try and extract the error code from here. There are two possibilites: one, that it will take the form of: NO ("yyyyy") "zzzzzzz" or, two, NO {yyyyy} "zzzzzzzzzzz" */ $this->x = 0; list($this->ltoken, $this->mtoken, $this->rtoken) = split(" ", $this->line." ", 3); if($this->mtoken[0] == "{"){ while($this->mtoken[$this->x] != "}" or $this->err_len < 1){ $this->err_len = substr($this->mtoken, 1, $this->x); $this->x++; } //print "<br>Trying to receive $this->err_len bytes for result<br>"; $this->line = fgets($this->fp,$this->err_len); $this->error_raw[]=substr($this->line, 0, strlen($this->line) -2); //we want to be nice and strip crlf's $this->err_recv = strlen($this->line); while($this->err_recv < $this->err_len){ //print "<br>Trying to receive ".($this->err_len-$this->err_recv)." bytes for result<br>"; $this->line = fgets($this->fp, ($this->err_len-$this->err_recv)); $this->error_raw[]=substr($this->line, 0, strlen($this->line) -2); //we want to be nice and strip crlf's $this->err_recv += strlen($this->line); } /* end while */ $this->line = fgets($this->fp, 1024); //we need to grab the last crlf, i think. this may be a bug... $this->error=EC_UNKNOWN; } /* end if */ elseif($this->mtoken[0] == "("){ switch($this->mtoken){ case "(\"QUOTA\")": $this->error = EC_QUOTA; $this->error_raw=$this->rtoken; break; default: $this->error = EC_UNKNOWN; $this->error_raw=$this->rtoken; break; } /* end switch */ } /* end elseif */ else{ $this->error = EC_UNKNOWN; $this->error_raw = $this->line; } return false; } /* end if */ elseif(substr($this->token[0],0,2) == "OK"){ return true; } /* end elseif */ elseif($this->token[0][0] == "{"){ /* Unable wild assumption: that the only function that gets here is the get_script(), doesn't really matter though */ /* the first line is the len field {xx}, which we don't care about at this point */ $this->line = fgets($this->fp,1024); while(substr($this->line,0,2) != "OK" and substr($this->line,0,2) != "NO"){ $this->response[]=$this->line; $this->line = fgets($this->fp, 1024); } if(substr($this->line,0,2) == "OK") return true; else return false; } /* end elseif */ elseif($this->token[0][0] == "\""){ /* I'm going under the _assumption_ that the only function that will get here is the listscripts(). I could very well be mistaken here, if I am, this part needs some rework */ $this->found_script=false; while(substr($this->line,0,2) != "OK" and substr($this->line,0,2) != "NO"){ $this->found_script=true; list($this->ltoken, $this->rtoken) = explode(" ", $this->line." ",2); //hmmm, a bug in php, if there is no space on explode line, a warning is generated... if(strcmp(rtrim($this->rtoken), "ACTIVE")==0){ $this->response["ACTIVE"] = substr(rtrim($this->ltoken),1,-1); } else $this->response[] = substr(rtrim($this->ltoken),1,-1); $this->line = fgets($this->fp, 1024); } /* end while */ return true; } /* end elseif */ else{ $this->error = EC_UNKNOWN; $this->error_raw = $this->line; print '<b><i>UNKNOWN ERROR (Please report this line to <a href="mailto:sie...@li...">sieve-php-devel Mailing List</a> to include in future releases): '.$this->line.'</i></b><br>'; return false; } /* end else */ } /* end get_response() */ /** * Initialization of the SIEVE class. * * It will return * false if it fails, true if all is well. This also loads some arrays up * with some handy information: * * @param $host string hostname to connect to. Usually the IMAP server where * a SIEVE daemon, such as timsieved, is listening. * * @param $port string Numeric port to connect to. SIEVE daemons usually * listen to port 2000. * * @param $user string is a super-user or proxy-user that has ACL rights to * login on behalf of the $auth. * * @param $pass string password to use for authentication * * @param $auth string is the authorized user identity for which the SIEVE * scripts will be managed. * * @param $auth_types string a string containing all the allowed * authentication types allowed in order of preference, seperated by spaces. * (ex. "PLAIN DIGEST-MD5 CRAM-MD5" The method the library will try first * is PLAIN.) The default for this value is PLAIN. */ function sieve($host, $port, $user, $pass, $auth="", $auth_types='PLAIN') { $this->host=$host; $this->port=$port; $this->user=$user; $this->pass=$pass; if(!strcmp($auth, "")) /* If there is no auth user, we deem the user itself to be the auth'd user */ $this->auth = $this->user; else $this->auth = $auth; $this->auth_types=$auth_types; /* Allowed authentication types */ $this->fp=0; $this->line=""; $this->retval=""; $this->tmpfile=""; $this->fh=0; $this->len=0; $this->capabilities=""; $this->loggedin=false; $this->error= ""; $this->error_raw=""; } /** * Tokenize a line of input by quote marks and return them as an array * * @param $string string Input line to parse for quotes * @return array Array of broken by quotes parts of original string */ function parse_for_quotes($string) { $start = -1; $index = 0; for($ptr = 0; $ptr < strlen($string); $ptr++){ if($string[$ptr] == '"' and $string[$ptr] != '\\'){ if($start == -1){ $start = $ptr; } /* end if */ else{ $token[$index++] = substr($string, $start + 1, $ptr - $start - 1); $found = true; $start = -1; } /* end else */ } /* end if */ } /* end for */ if(isset($token)) return $token; else return false; } /* end function */ /** * Parser for status responses. * * This should probably be replaced by a smarter parser. */ function status($string) { /* Need to remove this and all dependencies from the class */ switch (substr($string, 0,2)){ case "NO": return F_NO; //there should be some function to extract the error code from this line //NO ("quota") "You are oly allowed x number of scripts" break; case "OK": return F_OK; break; default: switch ($string[0]){ case "{": //do parse here for curly braces - maybe modify //parse_for_quotes to handle any parse delimiter? return F_HEAD; break; default: return F_DATA; break; } } } /** * This function will attemp to log into the sieve server. It will return * false if it fails, true if all is well. This also loads some arrays up * with some handy information: * * capabilities["implementation"] contains the sieve version information * * capabilities["auth"] contains the supported authentication modes by the * SIEVE server. * * capabilities["modules"] contains the built in modules like "reject", * "redirect", etc. * * capabilities["starttls"] , if is set and equal to true, will show that the * server supports the STARTTLS extension. * * capabilities["unknown"] contains miscellaneous/extraneous header info sieve * may have sent * * Note: $authuser, if included, is the account name (and $acctpass will * be the password) of an administrator account that can act on behalf of the * user. If you are using Cyrus, you must make sure that the admin account * has rights to admin the user. This is to allow admins to edit/view users * scripts without having to know the user's password. Very handy. * */ function sieve_login() { $this->fp=fsockopen($this->host,$this->port); if($this->fp == false) return false; $this->line=fgets($this->fp,1024); //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. if(ereg("IMPLEMENTATION",$this->line)) { //we're on the Cyrus V2 sieve server while(sieve::status($this->line) == F_DATA){ $this->item = sieve::parse_for_quotes($this->line); if(strcmp($this->item[0], "IMPLEMENTATION") == 0) $this->capabilities["implementation"] = $this->item[1]; elseif(strcmp($this->item[0], "SIEVE") == 0 or strcmp($this->item[0], "SASL") == 0){ if(strcmp($this->item[0], "SIEVE") == 0) $this->cap_type="modules"; else $this->cap_type="auth"; $this->modules = split(" ", $this->item[1]); if(is_array($this->modules)){ foreach($this->modules as $this->module) $this->capabilities[$this->cap_type][$this->module]=true; } /* end if */ elseif(is_string($this->modules)) $this->capabilites[$this->cap_type][$this->modules]=true; } elseif(strcmp($this->item[0], "STARTTLS") == 0) { $this->capabilities['starttls'] = true; } else{ $this->capabilities["unknown"][]=$this->line; } $this->line=fgets($this->fp,1024); }// end while } else { //we're on the older Cyrus V1. server //this version does not support module reporting. We only have auth types. $this->cap_type="auth"; //break apart at the "Cyrus timsieve...." "SASL={......}" $this->item = sieve::parse_for_quotes($this->line); $this->capabilities["implementation"] = $this->item[0]; //we should have "SASL={..........}" now. Break out the {xx,yyy,zzzz} $this->modules = substr($this->item[1], strpos($this->item[1], "{"),strlen($this->item[1])-1); //then split again at the ", " stuff. $this->modules = split($this->modules, ", "); //fill up our $this->modules property if(is_array($this->modules)){ foreach($this->modules as $this->module) $this->capabilities[$this->cap_type][$this->module]=true; } /* end if */ elseif(is_string($this->modules)) $this->capabilites[$this->cap_type][$this->module]=true; } if(sieve::status($this->line) == F_NO){ //here we should do some returning of error codes? $this->error=EC_UNKNOWN; $this->error_raw = "Server not allowing connections."; return false; } /* decision login to decide what type of authentication to use... */ /* Loop through each allowed authentication type and see if the server allows the type */ foreach(explode(" ", $this->auth_types) as $auth_type) { if ($this->capabilities["auth"][$auth_type]) { /* We found an auth type that is allowed. */ $this->auth_in_use = $auth_type; } } /* call our authentication program */ return sieve::authenticate(); } /** * Log out of the sieve server. * * @return boolean Always returns true at this point. */ function sieve_logout() { if($this->loggedin==false) return false; fputs($this->fp,"LOGOUT\r\n"); fclose($this->fp); $this->loggedin=false; return true; } /** * Send the script contained in $script to the server. * * It will return any error results it finds (in $sieve->error and * $sieve->error_raw), and return true if it is successfully sent. The * function does _not_ automatically make the script the active script. * * @param $scriptname string The name of the SIEVE script. * @param $script The script to be uploaded. * @return boolean Returns true if script has been successfully uploaded. */ function sieve_sendscript($scriptname, $script) { if($this->loggedin==false) return false; $this->script=stripslashes($script); $len=strlen($this->script); fputs($this->fp, "PUTSCRIPT \"$scriptname\" \{$len+}\r\n"); fputs($this->fp, "$this->script\r\n"); return sieve::get_response(); } /** * Check if there is enough space for a script to be uploaded. * * This function returns true or false based on whether the sieve server will * allow your script to be sent and your quota has not been exceeded. This * function does not currently work due to a believed bug in timsieved. It * could be my code too. * * It appears the timsieved does not honor the NUMBER type. see lex.c in * timsieved src. don't expect this function to work yet. I might have * messed something up here, too. * * @param $scriptname string The name of the SIEVE script. * @param $scriptsize integer The size of the SIEVE script. * @return boolean */ function sieve_havespace($scriptname, $scriptsize) { if($this->loggedin==false) return false; fputs($this->fp, "HAVESPACE \"$scriptname\" $scriptsize\r\n"); return sieve::get_response(); } /** * Set the script active on the sieve server. * * @param $scriptname string The name of the SIEVE script. * @return boolean */ function sieve_setactivescript($scriptname) { if($this->loggedin==false) return false; fputs($this->fp, "SETACTIVE \"$scriptname\"\r\n"); return sieve::get_response(); } /** * Return the contents of the requested script. * * If you want to display the script, you will need to change all CrLf to * '.'. * * @param $scriptname string The name of the SIEVE script. * @return arr SIEVE script data. */ function sieve_getscript($scriptname) { unset($this->script); if($this->loggedin==false) return false; fputs($this->fp, "GETSCRIPT \"$scriptname\"\r\n"); return sieve::get_response(); } /** * Attempt to delete the script requested. * * If the script is currently active, the server will not have any active * script after the deletion. * * @param $scriptname string The name of the SIEVE script. * @return mixed */ function sieve_deletescript($scriptname) { if($this->loggedin==false) return false; fputs($this->fp, "DELETESCRIPT \"$scriptname\"\r\n"); return sieve::get_response(); } /** * List available scripts on the SIEVE server. * * This function returns true or false. $sieve->response will be filled * with the names of the scripts found. If a script is active, the * $sieve->response["ACTIVE"] will contain the name of the active script. * * @return boolean */ function sieve_listscripts() { fputs($this->fp, "LISTSCRIPTS\r\n"); sieve::get_response(); //should always return true, even if there are no scripts... if(isset($this->found_script) and $this->found_script) return true; else{ $this->error=EC_NOSCRIPTS; //sieve::getresponse has no way of telling wether a script was found... $this->error_raw="No scripts found for this account."; return false; } } /** * Check availability of connection to the SIEVE server. * * This function returns true or false based on whether the connection to the * sieve server is still alive. * * @return boolean */ function sieve_alive() { if(!isset($this->fp) or $this->fp==0){ $this->error = EC_NOT_LOGGED_IN; return false; } elseif(feof($this->fp)){ $this->error = EC_NOT_LOGGED_IN; return false; } else return true; } /** * Perform SASL authentication to SIEVE server. * * Attempts to authenticate to SIEVE, using some SASL authentication method * such as PLAIN or DIGEST-MD5. */ function authenticate() { switch ($this->auth_in_use) { case "PLAIN": $auth=base64_encode("$this->auth\0$this->user\0$this->pass"); $this->len=strlen($auth); fputs($this->fp, "AUTHENTICATE \"PLAIN\" \{$this->len+}\r\n"); fputs($this->fp, "$auth\r\n"); $this->line=fgets($this->fp,1024); while(sieve::status($this->line) == F_DATA) $this->line=fgets($this->fp,1024); if(sieve::status($this->line) == F_NO) return false; $this->loggedin=true; return true; break; case "DIGEST-MD5": // SASL DIGEST-MD5 support works with timsieved 1.1.0 // follows rfc2831 for generating the $response to $challenge fputs($this->fp, "AUTHENTICATE \"DIGEST-MD5\"\r\n"); // $clen is length of server challenge, we ignore it. $clen = fgets($this->fp, 1024); // read for 2048, rfc2831 max length allowed $challenge = fgets($this->fp, 2048); // vars used when building $response_value and $response $cnonce = base64_encode(bin2hex(hmac_md5(microtime()))); $ncount = "00000001"; $qop_value = "auth"; $digest_uri_value = "sieve/$this->host"; // decode the challenge string $result = decode_challenge($challenge); // verify server supports qop=auth $qop = explode(",",$result['qop']); if (!in_array($qop_value, $qop)) { // rfc2831: client MUST fail if no qop methods supported return false; } // build the $response_value $string_a1 = utf8_encode($this->user).":"; $string_a1 .= utf8_encode($result['realm']).":"; $string_a1 .= utf8_encode($this->pass); $string_a1 = hmac_md5($string_a1); $A1 = $string_a1.":".$result['nonce'].":".$cnonce.":".utf8_encode($this->auth); $A1 = bin2hex(hmac_md5($A1)); $A2 = bin2hex(hmac_md5("AUTHENTICATE:$digest_uri_value")); $string_response = $result['nonce'].":".$ncount.":".$cnonce.":".$qop_value; $response_value = bin2hex(hmac_md5($A1.":".$string_response.":".$A2)); // build the challenge $response $reply = "charset=utf-8,username=\"".$this->user."\",realm=\"".$result['realm']."\","; $reply .= "nonce=\"".$result['nonce']."\",nc=$ncount,cnonce=\"$cnonce\","; $reply .= "digest-uri=\"$digest_uri_value\",response=$response_value,"; $reply .= "qop=$qop_value,authzid=\"".utf8_encode($this->auth)."\""; $response = base64_encode($reply); fputs($this->fp, "\"$response\"\r\n"); $this->line = fgets($this->fp, 1024); while(sieve::status($this->line) == F_DATA) $this->line = fgets($this->fp,1024); if(sieve::status($this->line) == F_NO) return false; $this->loggedin = TRUE; return TRUE; break; case "CRAM-MD5": // SASL CRAM-MD5 support works with timsieved 1.1.0 // follows rfc2195 for generating the $response to $challenge // CRAM-MD5 does not support proxy of $auth by $user // requires php mhash extension fputs($this->fp, "AUTHENTICATE \"CRAM-MD5\"\r\n"); // $clen is the length of the challenge line the server gives us $clen = fgets($this->fp, 1024); // read for 1024, should be long enough? $challenge = fgets($this->fp, 1024); // build a response to the challenge $hash = bin2hex(hmac_md5(base64_decode($challenge), $this->pass)); $response = base64_encode($this->user." ".$hash); // respond to the challenge string fputs($this->fp, "\"$response\"\r\n"); $this->line = fgets($this->fp, 1024); while(sieve::status($this->line) == F_DATA) $this->line = fgets($this->fp,1024); if(sieve::status($this->line) == F_NO) return false; $this->loggedin = TRUE; return TRUE; break; case "LOGIN": /* // Untested code! $login=base64_encode($this->user); $pass=base64_encode($this->pass); fputs($this->fp, "AUTHENTICATE \"LOGIN\" {0+}\r\n\r\n"); fputs($this->fp, "{".strlen($login)."+}\r\n"); fputs($this->fp, "$login\r\n"); fputs($this->fp, "{".strlen($pass)."+}\r\n"); fputs($this->fp, "$pass\r\n"); $this->line=fgets($this->fp,1024); while(sieve::status($this->line) == F_DATA) $this->line=fgets($this->fp,1024); if(sieve::status($this->line) == F_NO) return false; $this->loggedin=true; return true; break; */ default: return false; break; }//end switch } } /** * The following functions are support functions and might be handy to the * sieve class. */ if(!function_exists('hmac_md5')) { /** * Creates a HMAC digest that can be used for auth purposes. * See RFCs 2104, 2617, 2831 * Uses mhash() extension if available * * Squirrelmail has this function in functions/auth.php, and it might have been * included already. However, it helps remove the dependancy on mhash.so PHP * extension, for some sites. If mhash.so _is_ available, it is used for its * speed. * * This function is Copyright (c) 1999-2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * @param string $data Data to apply hash function to. * @param string $key Optional key, which, if supplied, will be used to * calculate data's HMAC. * @return string HMAC Digest string */ */ function hmac_md5($data, $key='') { // See RFCs 2104, 2617, 2831 // Uses mhash() extension if available if (extension_loaded('mhash')) { if ($key== '') { $mhash=mhash(MHASH_MD5,$data); } else { $mhash=mhash(MHASH_MD5,$data,$key); } return $mhash; } if (!$key) { return pack('H*',md5($data)); } $key = str_pad($key,64,chr(0x00)); if (strlen($key) > 64) { $key = pack("H*",md5($key)); } $k_ipad = $key ^ str_repeat(chr(0x36), 64) ; $k_opad = $key ^ str_repeat(chr(0x5c), 64) ; /* Heh, let's get recursive. */ $hmac=hmac_md5($k_opad . pack("H*",md5($k_ipad . $data)) ); return $hmac; } } /** * A hack to decode the challenge from timsieved 1.1.0. * * This function may not work with other versions and most certainly won't work * with other DIGEST-MD5 implentations * * @param $input string Challenge supplied by timsieved. */ function decode_challenge ($input) { $input = base64_decode($input); preg_match("/nonce=\"(.*)\"/U",$input, $matches); $resp['nonce'] = $matches[1]; preg_match("/realm=\"(.*)\"/U",$input, $matches); $resp['realm'] = $matches[1]; preg_match("/qop=\"(.*)\"/U",$input, $matches); $resp['qop'] = $matches[1]; return $resp; } // vim:ts=4:et:ft=php ?> --- sieve-php.lib DELETED --- |
From: <av...@us...> - 2003-11-05 16:06:53
|
Update of /cvsroot/sieve-php/sieve-php/doc In directory sc8-pr-cvs1:/tmp/cvs-serv4676 Modified Files: CHANGES Log Message: Changelog Index: CHANGES =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/doc/CHANGES,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CHANGES 22 Oct 2003 14:10:02 -0000 1.3 --- CHANGES 5 Nov 2003 16:00:47 -0000 1.4 *************** *** 11,19 **** us.ibm.com) ! * Added support function hmac_md5 (from Squirrelmail). * Bugfix in "OK" response check (Aaron Stone). * Changed Dan's email to the email of the sieve-php-devel mailing list. --- 11,21 ---- us.ibm.com) ! * Added support function hmac_md5 (from Squirrelmail, thanks to Chris Hilts). * Bugfix in "OK" response check (Aaron Stone). * Changed Dan's email to the email of the sieve-php-devel mailing list. + + * Updated testsieve.php test script. |
From: <av...@us...> - 2003-11-05 15:52:58
|
Update of /cvsroot/sieve-php/sieve-php In directory sc8-pr-cvs1:/tmp/cvs-serv2488 Modified Files: test.php testsieve.php Log Message: Corrections to the test scripts Index: test.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/test.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test.php 10 Nov 2001 02:37:11 -0000 1.12 --- test.php 5 Nov 2003 15:48:56 -0000 1.13 *************** *** 1,3 **** ! <? /* --- 1,3 ---- ! <?php /* *************** *** 12,18 **** include "./sieve-php.lib"; $bgcolor="#c0c0c0"; ! if($action=="logout"){ unset($acctname); unset($acctpass); --- 12,38 ---- include "./sieve-php.lib"; + if(isset($_POST['action'])) { + $action = $_POST['action']; + } elseif(isset($_GET['action'])) { + $action = $_POST['action']; + } else { + $action = false; + } + + if(isset($_POST['script'])) { + $script = $_POST['script']; + + } elseif(isset($_GET['script'])) { + $script = $_GET['script']; + + } else { + $script = false; + + } + + $bgcolor="#c0c0c0"; ! if(isset($action) && $action=="logout"){ unset($acctname); unset($acctpass); Index: testsieve.php =================================================================== RCS file: /cvsroot/sieve-php/sieve-php/testsieve.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testsieve.php 22 Oct 2003 13:07:21 -0000 1.7 --- testsieve.php 5 Nov 2003 15:48:57 -0000 1.8 *************** *** 24,28 **** print "</head>"; print "<body>"; ! print "<h1>seive-php.lib test script</h1>"; print "<h2>[Step 1] Trying to login to sieve server:</h2>"; --- 24,28 ---- print "</head>"; print "<body>"; ! print '<h1><a href="http://sieve-php.sourceforge.net/">sieve-php.lib</a> test script</h1>'; print "<h2>[Step 1] Trying to login to sieve server:</h2>"; *************** *** 159,163 **** print "<p>Sending $testscriptname..."; if($sieve->sieve_sendscript($testscriptname,$activescript)) { ! print "Upload Succedded.<br>"; } else { print "Failed.<br />Error Message:"; --- 159,163 ---- print "<p>Sending $testscriptname..."; if($sieve->sieve_sendscript($testscriptname,$activescript)) { ! print "Upload Succeded.<br>"; } else { print "Failed.<br />Error Message:"; |