From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Jan 17 04:20:06 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8C0516A41F for ; Tue, 17 Jan 2006 04:20:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 598C143D45 for ; Tue, 17 Jan 2006 04:20:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k0H4K44U063902 for ; Tue, 17 Jan 2006 04:20:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k0H4K46U063896; Tue, 17 Jan 2006 04:20:04 GMT (envelope-from gnats) Resent-Date: Tue, 17 Jan 2006 04:20:04 GMT Resent-Message-Id: <200601170420.k0H4K46U063896@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Anish Mistry" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75D9F16A41F for ; Tue, 17 Jan 2006 04:14:03 +0000 (GMT) (envelope-from amistry@am-productions.biz) Received: from smtp2.fuse.net (mail-out2.fuse.net [216.68.8.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id E798E43D45 for ; Tue, 17 Jan 2006 04:14:02 +0000 (GMT) (envelope-from amistry@am-productions.biz) Received: from gx4.fuse.net ([69.61.164.22]) by smtp2.fuse.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20060117041401.RXJL1908.smtp2.fuse.net@gx4.fuse.net> for ; Mon, 16 Jan 2006 23:14:01 -0500 Received: from bigguy.am-productions.biz ([69.61.164.22]) by gx4.fuse.net (InterMail vG.1.02.00.02 201-2136-104-102-20041210) with ESMTP id <20060117041401.SZEY29854.gx4.fuse.net@bigguy.am-productions.biz>; Mon, 16 Jan 2006 23:14:01 -0500 Message-Id: <1137471407.94144@bigguy.am-productions.biz> Date: Mon, 16 Jan 2006 23:16:47 -0500 From: "Anish Mistry" To: "FreeBSD gnats submit" X-Send-Pr-Version: gtk-send-pr 0.4.7 Cc: martin@matuska.org Subject: ports/91899: Add STARTTLS support to Net_Sieve X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jan 2006 04:20:06 -0000 >Number: 91899 >Category: ports >Synopsis: Add STARTTLS support to Net_Sieve >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Tue Jan 17 04:20:03 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Anish Mistry >Release: FreeBSD 6.0-STABLE i386 >Organization: AM Productions >Environment: System: FreeBSD 6.0-STABLE #10: Fri Jan 6 17:53:21 EST 2006 amistry@bigguy.am-productions.biz:/usr/obj/usr/src/sys/BIGGUY >Description: The attached patch will update Net_Sieve to support STARTTLS. I've already tried to contact the upstream authors and the port maintainer with no response. Hopefully Martin will weigh in on this PR. >How-To-Repeat: >Fix: --- pear-Net_Sieve-STARTTLS.patch begins here --- diff -ruN pear-Net_Sieve.orig/Makefile pear-Net_Sieve/Makefile --- pear-Net_Sieve.orig/Makefile Mon Jan 16 23:04:35 2006 +++ pear-Net_Sieve/Makefile Mon Jan 16 23:09:09 2006 @@ -7,6 +7,7 @@ PORTNAME= Net_Sieve PORTVERSION= 1.1.1 +PORTREVISION= 1 CATEGORIES= net www pear MAINTAINER= martin@matuska.org diff -ruN pear-Net_Sieve.orig/files/patch-Sieve.php pear-Net_Sieve/files/patch-Sieve.php --- pear-Net_Sieve.orig/files/patch-Sieve.php Wed Dec 31 19:00:00 1969 +++ pear-Net_Sieve/files/patch-Sieve.php Wed Jan 4 14:39:08 2006 @@ -0,0 +1,123 @@ +--- Sieve.php.orig Sat Dec 17 17:48:27 2005 ++++ Sieve.php Wed Jan 4 14:37:54 2006 +@@ -331,7 +331,7 @@ + * @param string $port Port of server + * @return mixed True on success, PEAR_Error otherwise + */ +- function connect($host, $port) ++ function connect($host, $port, $options = null) + { + if (NET_SIEVE_STATE_DISCONNECTED != $this->_state) { + $msg='Not currently in DISCONNECTED state'; +@@ -339,16 +339,16 @@ + return $this->_raiseError($msg,$code); + } + +- if (PEAR::isError($res = $this->_sock->connect($host, $port, null, 5))) { ++ if (PEAR::isError($res = $this->_sock->connect($host, $port, null, 5, $options))) { + return $res; + } + +- + $this->_state = NET_SIEVE_STATE_AUTHORISATION; + if (PEAR::isError($res = $this->_doCmd())) { + return $res; + } +- /* ++ ++ /* + if(PEAR::isError($res = $this->_cmdCapability() )) { + $msg='Failed to connect, server said: ' . $res->getMessage(); + $code=2; +@@ -358,6 +358,15 @@ + // Get logon greeting/capability and parse + $this->_parseCapability($res); + ++ // check if we can enable TLS via STARTTLS ++ if($this->_capability['starttls'] == true && function_exists('stream_socket_enable_crypto') == true) ++ {// begin enable TLS ++ if (PEAR::isError($res = $this->_startTLS())) { ++ return $res; ++ } ++ }// end enable TLS ++ ++ + return true; + } + +@@ -806,7 +815,7 @@ + $data = preg_split('/\r?\n/', $data, -1, PREG_SPLIT_NO_EMPTY); + + for ($i = 0; $i < count($data); $i++) { +- if (preg_match('/^"([a-z]+)" ("(.*)")?$/i', $data[$i], $matches)) { ++ if (preg_match('/^"([a-z]+)"( "(.*)")?$/i', $data[$i], $matches)) { + switch (strtolower($matches[1])) { + case 'implementation': + $this->_capability['implementation'] = $matches[3]; +@@ -822,6 +831,7 @@ + + case 'starttls': + $this->_capability['starttls'] = true; ++ break; + } + } + } +@@ -946,8 +956,10 @@ + if (preg_match('/^bye \(referral "(sieve:\/\/)?([^"]+)/i', $line, $matches)) { + // Check for referral, then follow it. Otherwise, carp an error. + //$this->_data['host'] = $matches[1]; +- $this->_data['host'] = $matches[2]; +- if (PEAR::isError($error = $this->_handleConnectAndLogin() ) ){ ++ //$this->_data['host'] = $matches[2]; ++ //replace the old host with the referral host preserving any protocol prefix ++ $this->_data['host'] = preg_replace('/\w+(?!(\w|\:\/\/)).*/',$matches[2],$this->_data['host']); ++ if (PEAR::isError($error = $this->_handleConnectAndLogin() ) ){ + $msg="Can't follow referral to " . $this->_data['host'] . ", The error was= " . $error->getMessage() ; + $code=5; + return $this->_raiseError($msg,$code); +@@ -1133,7 +1145,7 @@ + + + /** +- * Return true if tyhe server has that extension ++ * Return true if the server has that extension + * + * @access public + * @param string the extension to compare +@@ -1157,9 +1169,32 @@ + return false; + } + ++ /** ++ * Return true if the TLS negotiation was successful ++ * ++ * @access public ++ * @return mixed true on success, PEAR_Error on failure ++ */ ++ function _startTLS() ++ { ++ if (PEAR::isError($res = $this->_doCmd("STARTTLS"))) { ++ return $res; ++ } ++ ++ if(stream_socket_enable_crypto($this->_sock->fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT) == false) { ++ $msg='Failed to establish TLS connection'; ++ $code=2; ++ return $this->_raiseError($msg,$code); ++ } + +- +- ++ // RFC says we need to query the server capabilities again ++ if(PEAR::isError($res = $this->_cmdCapability() )) { ++ $msg='Failed to connect, server said: ' . $res->getMessage(); ++ $code=2; ++ return $this->_raiseError($msg,$code); ++ } ++ return true; ++ } + + } +-?> +\ No newline at end of file ++?> --- pear-Net_Sieve-STARTTLS.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: