Problem Install Roundcube plugin - Change Password

All,

I am trying to install change password plugin to roundcube but it does not work. The error log show

DB Error: MDB2 Error: not found Query: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd(’…’, ‘…’)] [Native code: 1305] [Native message: FUNCTION abc_roundcube.update_passwd does not exist] in /home/abc/public_html/webmail/program/include/rcube_mdb2.php on line 727 (POST /webmail/?_task=settings&_action=plugin.password-save?_task=&_action=)

Anyone can help me to solve.

thanks
Keith

Howdy,

Note that we didn’t actually write that particular plugin. However, I sat down recently, and tinkered with it a bit to get it up and running.

It actually works quite well!

I wrote up instructions on how to get it working, those are attached to this post.

Thanks for reply but i cannot access the link and show access denied!

Thank
Keith

Durn! Okay, I attached them to the post above :slight_smile:

Let us know how those work for you!

Thank you so much and write the step. I tried but still no lucky. It show below error on log.

PHP Error: Password plugin: Unable to execute /home/abc/public_html/webmail/plugins/password/helpers/chgvirtualminpasswd in /home/abc/public_html/webmail/plugins/password/drivers/virtualmin.php on line 73 (POST /webmail/?_task=settings&_action=plugin.password-save?_task=&_action=)

any ideal of this error.

thanks
Keith

Are you seeing any errors in your Apache error logs, in $HOME/logs/error_log?

Thanks for follow and help,below is a error log when I change the password :

[Mon Sep 24 12:51:17 2012] [warn] [client 192.168.1.10] mod_fcgid: stderr: PHP Notice: Undefined offset: 1 in /home/abc/public_html/webmail/skins/larry/svggradient.php on line 26, referer: http://www.abc.com/webmail/?_task=settings&_action=plugin.password-save

thanks
Keith

Hi all,

Anyone can help to solve the problem ?

thanks
Keith

I do not currently know what the problem is… so far, I’ve only been able to reproduce the problem you’re seeing on CentOS.

Is that by chance what you’re using?

I did notice that it seems to work on CentOS if the PHP Execution mode is set to mod_php.

We don’t normally recommend that, as it’s less secure, but that might get you up and running with that plugin in the meantime.

-Eric

Eric,

Well, I still working solution for password change and currently virtualmin installed on ubuntu 12.04 LTS version.

I tested the command “./chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass” on console. It worked, therefore I believe that it is some problem on PHP or something wrong.

If you have any idea, please share on post.

thanks
keith

Eric,

Just found that I used username@domain for format but the change passward code passed wrong information to command and caused unable to change passward. I am checking the code.

thanks
Keith

I did discover one issue… while I’m not sure about the user@domain issue you saw, I did see that even when using the user.domain format, it could still run into issues where Virtualmin was getting confused, thinking it’s being called from a web browser.

But it’s technically not, it’s command line API is being called.

You may need to set (or rather, unset) an environment variable where RoundCube is calling out to the Virtualmin command line program.

If you edit this file:

roundcube/plugins/password/drivers/virtualmin.php

And jump to line 64, you’ll see this line:

exec("$curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue);

Change that to read as follows:

exec("SCRIPT_NAME='' $curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue);

You’re adding in this part:

SCRIPT_NAME=’’

That will assure that Virtualmin doesn’t think it’s being executed as a
web app.

After making that change, I was able to use it on CentOS 6.3, which wasn’t previously working for me.

Let us know if that does the trick for you!

-Eric

Eric,
Thanks again. I found the problem that when the command exec("$curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue); triggered. It is incorrect information passed to value.

For example :
The virtualmin email format is user@domain

If the email address is “keith@abc.com”, the result of value is

$domain = abc.com (correct)
$username = keith-abc.com (incorrect), problem is here. It should be “keith”, therefore it caused error here.
$newpass = 12345 (correct)

any idea where convert the value to $username ?

thanks
Keith

Okay, if you jump to line 51 of “roundcube/plugins/password/drivers/virtualmin.php”, you’ll see this case statement:

case 8: // domain taken from alias, username left as it was $email = $rcmail->user->data['alias']; $domain = substr(strrchr($email, "@"), 1); break;

Try adding in the following $username line, so that it looks like this:

case 8: // domain taken from alias, username left as it was $email = $rcmail->user->data['alias']; $domain = substr(strrchr($email, "@"), 1); $username = str_replace("-$domain", "", $username); break;

When using the user@domain format, that should correct it so that it passes in a username that Virtualmin understands.

Let us know if that does the trick!

-Eric

Sorry for jumping into an old thread I have followed every relevant thing:

I followed the guide at http://www.virtualmin.com/node/23427#comment-105978

I also implemented the suggessions in the following: http://www.virtualmin.com/node/23427#comment-106123

AND

http://www.virtualmin.com/node/23427#comment-106157

But I am still getting new password could not be saved:

[01-Apr-2013 18:21:08 +0100]: PHP Error: Password plugin: Unable to execute /home/conjurenet/domains/webmailapp.domain.com/public_html/plugins/password/helpers/chgvirtualminpasswd in /home/mycompany/domains/webmailapp.domain.com/public_html/plugins/password/drivers/virtualmin.php on line 75 (POST /?_task=settings&_action=plugin.password-save?_task=&_action=)

Same problem here tried to use versions 0.8.1, 0.8.4, 0.8.6 all of them get “password could not be saved” and that’s all no errors, nothing.

I get the following error in my Apache file:

sh: …/public_html/roundcube/plugins/password/helpers/chgvirtualminpasswd: No such file or directory

i have read:

http://www.virtualmin.com/system/files/roundcube_virtualmin_password_change.txt

I have done

chown root.mydomain.com plugins/password/helpers/chgvirtualminpasswd.c
(note the .c above - since there is no chgvirtualminpasswd file)

also done chmod 4550 on the chgvirtualminpasswd.c file

But passwordchange still not working.

I still get the same error in my Apache file

chown root.mydomain.com plugins/password/helpers/chgvirtualminpasswd.c (note the .c above - since there is no chgvirtualminpasswd file)

Yeah, that’s the problem there :slight_smile:

If you don’t have the file “chgvirtualminpasswd”, that’ll cause the error you’re seeing.

That suggests you may have missed a step in the documentation you linked to :slight_smile:

I’d suggest going over those steps again, and making sure they’re all complete. Pay particular attention to the step where you compile the program by running ‘gcc’.

-Eric

the .c file was downloaded when installing the plugin. There was no file “chgvirtualminpasswd” included in the download. Can I just rename the chgvirtualminpasswd.c into chgvirtualminpasswd? (maybe a stupid question as I am not familiar with running gcc)

The instructions in the link you mentioned above explain all that :slight_smile:

Just make sure you follow all the steps in the instructions, and in there you’ll see the exact commands you need to run (including the gcc step).

-Eric