Author Topic: New File Added: Qmail+Mysql+Vpopmail Password Change Patch v1.1 (Updated)  (Read 31373 times)

Offline lucifer

  • Newbie
  • *
  • Posts: 8
After a long searching I have found Andy and Natasha Wheatley’s Blog. They have made a virtual host password change for roundcube 0.2-stable. But I tried to use it but having some problem. Then I have modified again for them who are using qmail, mysql and vpopmail for their mail server. Thanks all the people who have worked for this password plug-in.

Downloads: A new patch file has been added

Qmail+Mysql+Vpopmail Password Change Patch v1.0

Note: Please follow the instruction before using
« Last Edit: February 25, 2009, 02:38:22 PM by lucifer »

Offline lucifer

  • Newbie
  • *
  • Posts: 8

Offline lucifer

  • Newbie
  • *
  • Posts: 8

Offline crazy

  • Newbie
  • *
  • Posts: 2
nice job
« Reply #3 on: February 21, 2009, 12:01:54 PM »
It Worked! O0

This is really nice. but have some question.

what would be the proper permission for the roundcube database user to use vpopmail database ??

can you make a vacation and forwarder for qmail.

Offline lucifer

  • Newbie
  • *
  • Posts: 8
New File Added: Qmail+Mysql+Vpopmail Password Change Patch v1.0
« Reply #4 on: February 22, 2009, 01:09:34 PM »
for database just give select and update permission to roundcube db user.

I am working on vacation plug-in. soon you will get it. :cool:

Offline myrrhh

  • Newbie
  • *
  • Posts: 3
Multiple Domains
« Reply #5 on: February 23, 2009, 01:53:24 PM »
Hello,
Thanks so much for your excellent documentation and patch.

  I have a question about how to select and update one of multiple domain tables from the vpopmail mysql database.  Is there a way to extract the domain from the $emailuser variable (in password.inc) and select and update the proper domain table contained in the vpopmail DB? In my vpopmail database the domains are stored as tables containing the user information fields (pw_name,pw_passwd...etc) The table names have an underscore substituted for the dot in the domain name.

Example: email user domain= exdomain.com - vpopmail domain table name= exdomain_com

I have tried my primitive abilities with php and regex and am unable to get this to work properly.  Any help or direction that anyone can offer is much appreciated. Thanks again.

Cheers

Offline lucifer

  • Newbie
  • *
  • Posts: 8
New File Added: Qmail+Mysql+Vpopmail Password Change Patch v1.0
« Reply #6 on: February 23, 2009, 11:52:19 PM »
open /program/steps/settings/password.inc

and edit $passwordquery = "UPDATE vpopmail.domain_table SET pw_passwd = '$crypted',pw_clear_passwd='".$new_password."' WHERE pw_name = '$username';";

you can see red one is database name ie. vpopmail. and blue one is your table name ie. exdomain_com

just upadte this two value, I hope it will work.

Offline myrrhh

  • Newbie
  • *
  • Posts: 3
Multiple Domains
« Reply #7 on: February 24, 2009, 03:34:22 AM »
Thank you so much.  That does work for one domain... but if the vpopmail DB has multiple domains and users within those domains using one Round Cube interface then for each domain the "domain_table" must be different.  Since the $emailuser variable is set for each user after login can it be used to set the "domain_table" name within the vpopmail DB during a  password change?

Perhaps there could be a section of code within the function rcube_save_password that takes the $emailuser variable, splits out the email username and domain as two variables - $username and $domain.  then another line that replaces the dot(.) in the domain name variable $domain with an underscore and then assign it as variable $vdom.  Then lastly set up the mysql query string using the $vdom variable as the vpopmail."domain_table" name and the $username variable as the $pw_name variable(similar to below).  My poor regex, PHP and mysql skills prevent me from being able to modify this section properly.

I have tried adding code something like with no success...
 just after the line-

  $cryptedpw = mkpasswd3($new_password,$crypted);  

 list ($user,$domain) = split ( '@',$emailuser);
my bad php and regex
 $vdom = preg_replace ("/^[a-zA-Z0-9]+[\.][a-zA-Z]+/", "/^[a-zA-Z0-9]+[_][a-zA-Z]+/", $domain);  (I am soooo bad at regex)

$username = preg_replace( "/^([^@]+)(@.*)$/", "$1", $emailuser);

$passwordquery = "UPDATE vpopmail.'"$vdom"' SET pw_passwd = '$crypted',pw_clear_passwd='".$new_password."' WHERE pw_name = '$username';";

I can't figure out the php and  regex necessary for substituting the "_ " in the place of the "." in the $domain variable? and calling it $vdom

and then using this variable $vdom as the table name in the mysql query(or update)

I have no clue if something like this will work and am not the person to figure this out but perhaps you can help.  Any assistance with the regex and query string is greatly appreciated.  Many thanks to you for your consideration.
Cheers

Offline lucifer

  • Newbie
  • *
  • Posts: 8
New File Added: Qmail+Mysql+Vpopmail Password Change Patch v1.0
« Reply #8 on: February 24, 2009, 04:01:11 AM »
Sorry I didn't notice that you are asking for multiple domain. Just give me some time i am fixing it. it should be dynamic and have to make another function. no porbs. give you the update soon. and thanks again for pointing this issue.

Offline fritz001

  • Jr. Member
  • **
  • Posts: 22
New File Added: Qmail+Mysql+Vpopmail Password Change Patch v1.0
« Reply #9 on: February 24, 2009, 11:08:39 AM »
It seems there is a problem patching latest myroundcube !!

patch -p1 patching file index.php
Hunk #1 succeeded at 293 (offset 100 lines).
patching file program/js/app.js
Hunk #1 FAILED at 235.
Hunk #2 FAILED at 904.
2 out of 2 hunks FAILED -- saving rejects to file program/js/app.js.rej
patching file program/localization/en_GB/labels.inc
patching file program/localization/en_GB/messages.inc
patching file program/localization/en_US/labels.inc
patching file program/localization/en_US/messages.inc
patching file program/steps/settings/password.inc
patching file skins/default/includes/settingstabs.html
patching file skins/default/templates/password.html

Offline crazy

  • Newbie
  • *
  • Posts: 2
New File Added: Qmail+Mysql+Vpopmail Password Change Patch v1.0
« Reply #10 on: February 25, 2009, 01:01:46 AM »
It worked for me. I think you have already updated something in your app.js file. It's better you use a fresh roundcube folder and use the patch! or you can do it manually and just replace the patched password.inc file

Offline lucifer

  • Newbie
  • *
  • Posts: 8
New File Added: Qmail+Mysql+Vpopmail Password Change Patch v1.0
« Reply #11 on: February 25, 2009, 02:20:51 AM »
UPDATE FOR MULTIPLE DOMAIN

just update the function. It will work for multiple domain. I will update my patch soon.

function rcube_save_password($current_password, $new_password)
{
        global $OUTPUT, $RCMAIL;

        $emailuser=$_SESSION['username'];

        $db = rcmail::get_instance()->get_dbh();

        $crypted = '';
        $cryptedpw = mkpasswd3($new_password,$crypted);

        $domain = split("@",$emailuser);

        $dom_table = str_replace(".","_",$domain[1]);

        // ONLY CHANGE YOUR vpopmail DATABASE NAME !!!!!

        $passwordquery = "UPDATE vpopmail.$dom_table SET pw_passwd = '$crypted',pw_clear_passwd='".$new_password."' WHERE pw_name = '$domain[0]';";

        $db->query($passwordquery);

        $_SESSION['password'] = encrypt_password($new_password);

        $OUTPUT->show_message('successfullysaved', 'confirmation');
}



-Thanks
« Last Edit: February 25, 2009, 02:25:23 AM by lucifer »

Offline lucifer

  • Newbie
  • *
  • Posts: 8

Offline lucifer

  • Newbie
  • *
  • Posts: 8

Offline myrrhh

  • Newbie
  • *
  • Posts: 3
Great Work - Multiple Domains Mysql+Vpopmail Password Change!
« Reply #14 on: February 25, 2009, 04:44:24 PM »
lucifer,
 Thank you so much for your excellent work! The password change for multiple domains works flawlessly with vpopmail.  I didn't used the new patch though, just modified the existing code with the code from your earlier posting, changed the db update permissions and voila!!
Thanks again.  This is something that I have wanted since I first started using rOundcube.

Lasty did I mention thank you! Excellent Work!
Cheers-
myrrhh