[horde] [PATCH] SSL support in lib/VFS/ftp.php

Etienne Goyer etienne.goyer at linuxquebec.com
Wed Sep 3 13:16:36 PDT 2003


Hi,

Here is a trivial patch that add SSL support (aka FTPS) to the VFS ftp
driver.  This can be used, for example, with Proftpd + mod_tls.  I will
post a patch to the Gollem mailing list that add the required param with
explanation in gollem/config/backends.php if this one is accepted.

This patch is to be applied to lib/VFS/ftp.php.  To make use of it, pass
an 'ssl' parameter along with 'hostspec' and 'port' to the VFS 
constructor.

Thanks !

-- 
Etienne Goyer                    Linux Québec Technologies Inc.
http://www.LinuxQuebec.com       etienne.goyer at linuxquebec.com
-------------- next part --------------
--- lib/VFS/ftp.php.orig	Fri Aug 29 16:06:09 2003
+++ lib/VFS/ftp.php	Wed Sep  3 15:59:42 2003
@@ -690,13 +690,17 @@
 
             $required = array('hostspec', 'username', 'password');
             foreach ($required as $val) {
-                if (!isset($this->params[$val])) {
+                if (!isset($this->_params[$val])) {
                     return PEAR::raiseError(sprintf(_("Required '%s' not specified in VFS configuration."), $val));
                 }
             }
 
             /* Connect to the ftp server using the supplied parameters. */
-            $this->_stream = @ftp_connect($this->_params['hostspec'], $this->_params['port']);
+            if ($this->_params['ssl']) {
+                $this->_stream = @ftp_ssl_connect($this->_params['hostspec'], $this->_params['port']);
+            } else {
+                $this->_stream = @ftp_connect($this->_params['hostspec'], $this->_params['port']);
+            }
             if (!$this->_stream) {
                 return PEAR::raiseError(_("Connection to FTP server failed."));
             }


More information about the horde mailing list