[sork] backends.local.php not obeyed.

Simon Brereton simon.brereton at buongiorno.com
Mon Nov 14 19:03:49 UTC 2011


On 11 November 2011 17:52, Ben Klang <bklang at horde.org> wrote:
> On Nov 11, 2011, at 5:43 PM, Simon Brereton wrote:
>
>> On 8 November 2011 14:56, Simon Brereton <simon.brereton at buongiorno.com> wrote:
>>> On 8 November 2011 13:37, Simon Brereton <simon.brereton at buongiorno.com> wrote:
>>>> On 8 November 2011 11:17, Ralf Lang <lang at b1-systems.de> wrote:
>>>>> Am Dienstag, 8. November 2011, 16:22:00 schrieb Simon Brereton:
>>>>>> On 8 November 2011 09:37, Ralf Lang <lang at b1-systems.de> wrote:
>>>>>>> Am Dienstag, 8. November 2011, 15:31:12 schrieb Simon Brereton:
>>>>>>>> On 2 November 2011 15:18, Simon Brereton
>>>>>>>> <simon.brereton at buongiorno.com>
>>>>>>>>
>>>>>>>> wrote:
>>>>>>>>> On 2 November 2011 15:03, Simon Brereton
>>>>>>>>> <simon.brereton at buongiorno.com>
>>>>>>>>>
>>>>>>>>> wrote:
>>>>
>>>>>>>>> "/usr/share/horde4/passwd/config/backends.php"]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 116 $backends['hordesql'] = array (
>>>>>>>>> 117     'disabled' => false,
>>>>>>>>> 118     'name' => 'Horde SQL Authentication',
>>>>>>>>> 119     'preferred' => '',
>>>>>>>>> 120     'policy' => array(
>>>>>>>>> 121         'minLength' => 6,
>>>>>>>>> 122         'minNumeric' => 1,
>>>>>>>>> 123     ),
>>>>>>>>> 124     'driver' => 'Sql',
>>>>>>>>> 125     'params' => array_merge(
>>>>>>>>> 126         $GLOBALS['conf']['sql'],
>>>>>>>>> 127         array('table' => 'horde_users',
>>>>>>>>> 128               'user_col' => 'user_uid',
>>>>>>>>> 129               'pass_col' => 'user_pass',
>>>>>>>>> 130               'show_encryption' => false,
>>>>>>>>> 131               'encryption' =>
>>>>>>>>> $GLOBALS['conf']['auth']['params']['encryption'])
>>>>>>>>> 132     ),
>>>>>>>>> 133 );
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I haven't touched anything in backends.php
>>>> After a fashion - that is to say, my next issue is with the query..  I
>>>> get this error:
>>>>
>>>> Failure in changing password for All Services: sql: unable to load sub
>>>> driver: Could not instantiate PDO with DSN
>>>> "mysql:encryption=crypt;table=Mail;user_col=Email;pass_col=Password;query_lookup=SELECT
>>>> Password FROM Mail WHERE Email = %u;query_modify=UPDATE Mail SET
>>>> Password = %e WHERE Email = %u;name=Mail and VPN
>>>> Services;driver=Sql;required=1;is_subdriver=1;host=127.0.0.1;dbname=Mail".
>>>> PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on
>>>> '127.0.0.1' (111)[Tue 08 Nov 2011 01:29:43 PM EST]
>>>>
>>>> 139        'sql' => array(
>>>> 140                         'name' => 'Mail and VPN Services',
>>>> 141                         'driver' => 'Sql',
>>>> 142                         'required' => true,
>>>> 143                         'params' => array(
>>>> 144          'phptype'    => 'mysql',
>>>> 145          'hostspec'   => 'localhost',
>>>> 146          'username'   => 'noneedtoknowbutitsright',
>>>> 147          'password'   => 'imnottellingyouthat',
>>>> 148          'encryption' => 'crypt',
>>>> 149          'database'   => 'Mail',
>>>> 150          'table'      => 'Mail',
>>>> 151          'user_col'   => 'Email',
>>>> 152          'pass_col'   => 'Password',
>>>> 153          'show_encryption' => false,
>>>> 154          // The following two settings allow you to specify custom
>>>> queries for
>>>> 155          // lookup and modify functions if special functions need to be
>>>> 156          // performed.  In places where a username or a password needs to be
>>>> 157          // used, refer to this placeholder reference:
>>>> 158          //    %u -> gets substituted with the user
>>>> 159          //    %p -> gets substituted with the plaintext password
>>>> 160          //    %e -> gets substituted with the encrypted password
>>>> 161          //
>>>> 162          'query_lookup' => 'SELECT Password FROM Mail WHERE Email = %u',
>>>> 163          'query_modify' => 'UPDATE Mail SET Password = %e WHERE Email = %u',
>>>> 164         ),
>>>> 165     ))
>>>> 166  ));
>>>>
>>>>
>>>> I so wasn't expecting it to complain about not being able to connect
>>>> to mysql that I don't know where to go next.  I was at least expecting
>>>> to debug the query - but the connection..?
>>>
>>>
>>> Is it possible to connect to MySQL on a socket?
>>>
>>> mail:~# mysql -u root -p -h 127.0.0.1
>>> Enter password:
>>> ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
>>>
>>> I have networking for mysql turned off.  Since everything is running
>>> on the same host, I have no wish to turn that on.
>>
>> Would anyone like to comment on this?
>>
>> It used to work just fine in H3 without needing a connection (I'm
>> pretty sure - I don't have that platform any more to check, but I'm
>> sure network connections to mysql were turned off).
>>
>> Thanks.
>
> It sounds like PHP can't find the path to your MySQL socket.  Try locating your mysqld.sock file and specify the path to it in the Horde config for Unix socket ($conf['sql']['socket']). Also, make sure you protocol is set to "Unix sockets" and not "TCP/IP".

Hi

I actually only use sockets.  in ../horde4/config/conf.php I have:
$conf['sql']['socket'] = '/var/run/mysqld/mysqld.sock';


But there seems to be no way in backends.php that specifies that the
sql driver is using networking and not sockets.

I don't know php well enough, but if I look
at/usr/share/horde4/passwd/lib/Driver/Sql.php I see

125         /* Execute the query. */
126         try {
127             $this->_db->update($sql, $values);

$sql is declared as  $sql  = 'SELECT ' . $this->_params['pass_col'] .
' FROM ' . $this->_params['table'] .

The failure message specifies the host - but I see no definition for
host in the Sql driver.  Horde can clearly talk to the db over
sockets, so I don't see why passwd can't talk to a different db with a
socket.

Should I file a bug?  Or an enhancement request?

Simon


More information about the sork mailing list