[dev] small patch for ingo

Martin Luethi horde at humbapa.ch
Wed Jan 28 01:23:35 PST 2004


hi list,

I configured my vfs-ftp-driver with one global ftp-user:

$split = explode('@', Auth::getAuth());
$backends['procmail'] = array(
   'driver' => 'vfs',
   'preferred' => '',
   'hordeauth' => '',
   'params' => array(
       'hostspec' => 'localhost',
       'procmailrc' => '/'.$split[1].'/_mail/'.$split[0].'/.procmailrc',
       'port' => 21,
       'username' => 'linux',
       'password' => '*****',
       'vfstype' => 'ftp'
   ),
   'script' => 'procmail',
   'scriptparams' => array(
       'path_style' => 'maildir'
   )
);

when I now try to activate a script the methode "setScriptActive"
(lib/Driver/vfs.php) overrides the params "username" and "password"
even with "'hordeauth' => ''".

I fixed that in "lib/Ingo.php" (see patch)

g. martin luethi
-------------- next part --------------
Index: lib/Ingo.php
===================================================================
RCS file: /repository/ingo/lib/Ingo.php,v
retrieving revision 1.56
diff -u -r1.56 Ingo.php
--- lib/Ingo.php	18 Jan 2004 23:58:33 -0000	1.56
+++ lib/Ingo.php	26 Jan 2004 10:40:56 -0000
@@ -107,11 +107,21 @@
 
         require_once INGO_BASE . '/lib/Driver.php';
 
-        $uid = ($_SESSION['ingo']['backend']['hordeauth'] === 'full')
-               ? Auth::getAuth() : Auth::getBareAuth();
+        // Set authentication parameters.
+        if (!empty($_SESSION['ingo']['backend']['hordeauth'])) {
+            $username = ($_SESSION['ingo']['backend']['hordeauth'] === 'full')
+                        ? Auth::getAuth() : Auth::getBareAuth();
+            $password = Auth::getCredential('password');
+        } else if (isset($_SESSION['ingo']['backend']['params']['username']) && isset($_SESSION['ingo']['backend']['params']['password'])) {
+            $username = $_SESSION['ingo']['backend']['params']['username'];
+            $password = $_SESSION['ingo']['backend']['params']['password'];
+        } else {
+            $username = Auth::getBareAuth();
+            $password = Auth::getCredential('password');
+        }
 
         $driver = &Ingo_Driver::singleton($_SESSION['ingo']['backend']['driver'], $_SESSION['ingo']['backend']['params']);
-        $res = $driver->setScriptActive($script, $uid, Auth::getCredential('password'));
+        $res = $driver->setScriptActive($script, $username, $password);
         if (is_a($res, 'PEAR_Error')) {
             $msg = ($deactivate)
               ? _("There was an error deactivating the script.")


More information about the dev mailing list