[sork] Passwd 4 hook problem
Kinglok, Fong
busywater at gmail.com
Thu Nov 24 00:34:11 UTC 2011
I am sorry to cause you trouble, I did not mean to abuse the bug report
system. As I am not a programmer, I know too little on coding.
What I did is to follow the example show in
/var/www/html/horde4/passwd/config/hook.php.dist and modify to suit my
need. Would you like to show how I can return user at example instead of user
in using expect inside the composite driver?
I believe, many users, like me, love using horde as to change password for
multiple systems, including email, wifi-authentication, samba and horde
itself.
Kinglok, Fong
On Thu, Nov 24, 2011 at 1:45 AM, Jan Schneider <jan at horde.org> wrote:
> 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/
>
> --
> Sork mailing list - Join the hunt: http://horde.org/bounties/#**sork<http://horde.org/bounties/#sork>
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: sork-unsubscribe at lists.horde.**org<sork-unsubscribe at lists.horde.org>
>
More information about the sork
mailing list