[sork] Passwd 4 hook problem

Jan Schneider jan at horde.org
Wed Nov 23 17:45:19 UTC 2011


DON'T TOP-POST.

Zitat von "Kinglok, Fong" <busywater at gmail.com>:

> On Sun, Nov 20, 2011 at 10:10 PM, Ralf Lang <lang at b1-systems.de> wrote:
>
>> **
>>
>> Am Samstag, 19. November 2011, 19:20:23 schrieb Kinglok, Fong:
>>
>> > I am using horde 4.0.11, IMP 5.0.14. Horde authentication is done by SQL.
>>
>> > I also make use of horde username hook. IMP login is done by configuring
>>
>> > the backends.php.
>>
>> >
>>
>> > I would like to use Passwd to update both passwords of horde and email
>>
>> > backend (running vpopmail). Therefore, horde (user) and vpopmail (
>>
>> > user at example.com) have to be updated in the same time. It seems me that
>>
>> > hook of Passwd must be used.
>>
>> >
>>
>> > My method is to strip the domain from $userid in function username and
>> then
>>
>> > add the domain back if the backend is 'expect'.
>>
>> >
>>
>> > However, the screen just turn white whenever I try to reset a user's
>>
>> > password. After some investigation, I believe the problem is from the
>>
>> > statement: foreach ($driver->_params['drivers'] as $backend =>
>>
>> > $config) {
>>
>> >
>>
>> > Any comment?
>>
>> >
>>
>> > Kinglok, Fong
>>
>> >
>>
>> > */var/www/html/webmail/passwd/hook.php*
>>
>> > =================================
>>
>> > class Passwd_Hooks
>>
>> > {
>>
>> > /**
>>
>> > * Username hook.
>>
>> > *
>>
>> > * @param string $userid The username.
>>
>> > * @param TODO $driver TODO
>>
>> > *
>>
>> > * @return string TODO
>>
>> > */
>>
>> > public function username($userid, $driver)
>>
>> > {
>>
>> > * $userid = substr($userid,0,strpos($userid,"@"));
>>
>> > *
>>
>> > if ($driver instanceof Passwd_Driver_Expect) {
>>
>> > return $userid . '@example.com';
>>
>> > }
>>
>> >
>>
>> > if ($driver instanceof Passwd_Driver_Composite) {
>>
>> > foreach ($driver->_params['drivers'] as $backend => $config) {
>>
>> > if ($backend == 'expect') {
>>
>> >
>>
>> > $driver->_params['drivers']['expect']['params']['be_username'] = $userid
>> .
>>
>> > '@example.com';
>>
>> > break;
>>
>> > }
>>
>> > }
>>
>> > }
>>
>> > return $userid;
>>
>> > }
>>
>> > }
>>
>> > =============================================
>>
>> >
>>
>> > */var/www/html/webmail/passwd/backends.php*
>>
>> > ========================
>>
>> > <?php
>>
>> > $backends['composite'] = array(
>>
>> > 'name' => 'All Services',
>>
>> > 'preferred' => '',
>>
>> > 'password policy' => array(
>>
>> > 'minLength' => 3,
>>
>> > 'maxLength' => 20,
>>
>> > //'minClasses' => 2,
>>
>> > ),
>>
>> > 'driver' => 'composite',
>>
>> > 'params' => array(
>>
>> > 'drivers' => array(
>>
>> > 'sql' => array(
>>
>> > 'name' => 'Horde Authentication',
>>
>> > 'driver' => 'Sql',
>>
>> > 'required' => true,
>>
>> > 'params' => array(
>>
>> > 'phptype' => 'mysql',
>>
>> > 'hostspec' => 'localhost',
>>
>> > 'username' => 'hordeuser',
>>
>> > 'password' => 'XXXXXXXXXXX',
>>
>> > 'encryption' => 'plain',
>>
>> > 'database' => 'horde4',
>>
>> > 'table' => 'horde_users',
>>
>> > 'user_col' => 'user_uid',
>>
>> > 'pass_col' => 'user_pass',
>>
>> > 'show_encryption' => false
>>
>> > // 'query_lookup' => '',
>>
>> > // 'query_modify' => '',
>>
>> > ),
>>
>> > ),
>>
>> > 'expect' => array(
>>
>> > 'name' => 'Webmail Password',
>>
>> > 'preferred' => '',
>>
>> > 'driver' => 'expect',
>>
>> > 'required' => true,
>>
>> > 'params' => array(
>>
>> > 'program' => '/usr/bin/expect',
>>
>> > 'script' => dirname(__FILE__) .
>>
>> > '/../scripts/vpopmail_cdb_expect',
>>
>> > 'be_username' => '',
>>
>> > ),
>>
>> > ),
>>
>> > }
>>
>> > }
>>
>> > }
>>
>>
>> Youse the composite backend.
>>
> Hi,
>
> Following the advice to setup php error logging, I caught the following log
> when changing password:
> Nov 22 20:44:05 mail apache2: PHP Fatal error:  Cannot access protected
> property Passwd_Driver_Composite::$_params in
> /var/www/html/horde4/passwd/config/hooks.php on line 36
> Nov 22 20:44:05 mail apache2: PHP Fatal error:  Cannot access protected
> property Passwd_Driver_Composite::$_params in
> /var/www/html/horde4/passwd/config/hooks.php on line 36
> Nov 22 20:44:05 mail apache2: PHP Fatal error:  Cannot access protected
> property Passwd_Driver_Composite::$_params in
> /var/www/html/horde4/passwd/config/hooks.php on line 36
>
> Should I file a bug?

No, because it isn't a bug. You are trying to access a protected  
property in the hook. The bug is in your code.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the sork mailing list