[Tickets #12284] Expect driver params broken when used with Composite driver

noreply at bugs.horde.org noreply at bugs.horde.org
Thu May 30 13:39:30 UTC 2013


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/12284
------------------------------------------------------------------------------
  Ticket             | 12284
  Created By         | delrio at mie.utoronto.ca
  Summary            | Expect driver params broken when used with Composite
                     | driver
  Queue              | Passwd
  Version            | 5.0.0RC1
  Type               | Bug
  State              | Unconfirmed
  Priority           | 1. Low
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


delrio at mie.utoronto.ca (2013-05-30 13:39) wrote:

The Expect driver works well by itself, with the following backend.local.php

  $backends['expect']['disabled'] = false;
  $backends['expect']['params']['script'] = PASSWD_BASE .  
'/scripts/passwd-expect';
  $backends['expect']['params']['params'] = '-host servername';

The successful command called by Driver/Expect.php is

LANG=C LC_ALL=C /usr/bin/expect -f  
'/horde/passwd/lib/../scripts/passwd-expect' -- -host servername -log  
'/var/tmp/passwdZ4aqha'

Now trying to use Expect with the Composite driver:

$backends['combo'] = array(
     'disabled' => false,
     'name' => 'Passwords',
     'driver' => 'Composite',
     'policy' => array(
         'minLength' => 6,
         'minNumeric' => 1,
     ),
     'params' => array('drivers' => array(
         'expect' => array(
             'name' => 'Unix Server',
             'driver' => 'Expect',
             'required' => true,
             'params' => array(
                 'program' => '/usr/bin/expect',
                 'script' => PASSWD_BASE . '/scripts/passwd-expect',
                 'params' => '-host servername',
             ),
         ),
         'samba' => array(
             'name' => 'Samba Server',
             'driver' => 'Smbpasswd',
             'params' => array(
                 'program' => '/usr/bin/smbpasswd',
                 'host' => 'sambaserver',
             ),
         ),
     )),
);

Expect fail to connect to server.  Debugging the code in  
Driver/Expect.php, the command that it is trying to execute is

LANG=C LC_ALL=C /usr/bin/expect -f  
'/horde/passwd/lib/../scripts/passwd-expect' -- Array -log  
'/var/tmp/passwdiBa4pa'

Note "Array" in the command instead of the script params "-host  
servername"  ($this->_params['params'] in the Expect.php code)

The following is a workaround for the Expect driver, but the bug might  
be somewhere in the Composite driver:

--- Driver/Expect.php.orig      Wed May 29 12:07:22 2013
+++ Driver/Expect.php   Wed May 29 14:16:33 2013
@@ -34,10 +34,12 @@
          // Temporary logfile for error messages.
          $log = Horde::getTempFile('passwd');

+        $params = is_array($this->_params['params']) ?  
$this->_params['params']['params'] : $this->_params['params'];
+
          // Open expect script for writing.
          $prog = 'LANG=C LC_ALL=C ' . $this->_params['program'] .
              ' -f ' . escapeshellarg($this->_params['script']) .
-            ' -- ' . $this->_params['params'] . ' -log ' .  
escapeshellarg($log);
+            ' -- ' . $params . ' -log ' . escapeshellarg($log);

          $exp = @popen($prog, 'w');
          @fwrite($exp, $user . "\n");






More information about the bugs mailing list