sandrodz/rainloop-change-password-plugin-mysql

vimbadmin and mysql plugin

sbrodriguez opened this issue · 10 comments

I have vimbadmin to manage the postfix accounts.
This software keeps all credentials in:
-dabatase: vimbadmin
-table: mailbox
-column: password
-user: vimbadmin
-password: ---

It keeps it in MD5 codification, but when I use this plugin from my email account it never runs properly.
My error logs:

2015/02/16 15:05:43 [error] 17563#0: *4012 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined offset: 0 in /var/www/rainloop/public_html/data/_data_b6d7009c76b044100a189b32856d83e0/default/plugins/change-password-mysql/ChangePasswordMysqlDriver.php on line 184" while reading response header from upstream, client: 192.168.0.15, server: correuweb.tiraquelibras.com, request: "POST /?/Ajax/&s=/_Lm3D8OQQI8dGDxbKszs9eEPbdnvVKW6bVH2bEYtqQCeHA6D7edfkDgPbH7IL6om-rmW17GZXv8TwjUp-A0pLSUvdiU4tAzhu4_T027yvz4CENRx83hk8GOmzl3LBr5JYm_NpGdyc3m_RbgVK0RYgYTTHjBhbJ-JPewEEGseE1YdSYim6Oskj9LVkxCVCKgwhn_6ZvDZMt-DVqNsaFLqjvrjpoPZZQUvxwI0zOudNsiU9jx0e_2neqwNtZTfb-4e1qLP2I_1Rv8OKVf0FjMdBMMcFSNEtiJewzRS7W2YBi3sXgzQwtzV6xndoGiILG3cPTV3YC3PuxI9QUmos40q0RrGVycg./ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "correuweb.tiraquelibras.com", referrer: "https://correuweb.tiraquelibras.com/"

Can you help me to find the problem, please?

Regards

Do you have any users in the table? try adding few.

Hello Sandrodz, of course, I have 4 users in the table currently, added before install this plugin.
Regards

Could anyone help me, please?
My Webservice (vimbadmin) uses md5 crypt to write passwords into mysql database.
Is possible that this php pluggin needs to modify his configuration?

Regards

As I told you, I use Vimbadmin to manage domains and mailboxes.
The Mysql db structure is:
db->vimbadmin;
table->mailbox;
Select * from mailbox;
+----+-------------------------------+----------------------------------+----------------------------------+--------------------------------+-------+-------------+-------------------+--------------------+--------+-------------+------+------+---------------------+---------------------+
| id | username | password | name | maildir | quota | local_part | domain | access_restriction | active | homedir | uid | gid | created | modified |

An example:

| 18 | prueba@xxx.com | f31cee15fb04999adee1d2075e524c25 | Prueba | xxx.com/prueba/ | 2000 | prueba | xxx.com | ALL | 1 | /var/vmail/ | 5000 | 5000 | 2015-02-16 13:18:11 | 2015-06-15 08:40:53 |

Perhaps I have to change the PHP code to write the corretc query, what do you mean?

Thanks for your answers!!!!

I wrote this such a long time ago, I cannot really remember the structure it uses.

But honestly, this is so simple to do, take a look inside the code, I'm sure you will figure it out.

p.s. this plugin is working fine on my installation.

I've read the code and tried some changes without any positive response after send the command.
Let me review the code again and I will update this treath asap.

Thanks for your answer sandrodz.

Did you ever resolve this issue? if yes please provide answer if not...

if you use md5 instead of crypt, take a look at this: crypt($sPrevPassword, $sCryptPass) === $sCryptPass and replace crypt with your md5 password checking mechanism.

Hi Sandrodz.

I am going to review the code with your information this afternoon.
I will send you news ASAP.

Regards, and thanks for your help.

I get the same error:

2015/08/23 18:58:39 [error] 21993#21993: *3327 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined offset: 0 in /var/www/rainloop/public_html/data/_data_b6d7009c76b044100a189b32856d83e0/default/plugins/change-password-mysql/ChangePasswordMysqlDriver.php on line 184" while reading response header from upstream, client: 192.168.0.10, server: correuweb.tiraquelibras.com, request: "POST /?/Ajax/&q[]=/_mMJeh2I1rZcpIegZdnWX3lWmEkTVKmhn0qH94QbSM2z7Ey4aIouFnl2hE4FBS67skZ2XCe__HQP7IcabspRGwACyxa0hqWZNoDlKGesj_ahFnPIqX-VcpUX3R7fwLY1z159eTb6b2ExEjWzr5pV_GH5BIygSEPLFMZBs5Ojpyzq3oxVoi_F8jiUC3MTip8CdTQn69gshxA6ImYy63SnUJPs5L0t5utAbMt_TZgTWf0mi8NdxOw2kZ3Fl4N1jboaJvgrauEHg0EVYoPbQV-gKu6zxvLo5RCBeeUWNbG6sAg5QBKVmg1Y7TOU7lZ-Rq-RI2sn5nn67Qvs9veB7YPT6hJv37zYMgFjjUPhsNDdrVSw./ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "correuweb.tiraquelibras.com", referrer: "https://correuweb.tiraquelibras.com/"

I've changed the code that you've told me:

                   if (0 < strlen($sCryptPass) && md5($sPrevPassword, $sCryptPass) === $sCryptPass && 7 < mb_strlen($sNewPassword) && 20 > mb_strlen($sNewPassword) && !preg_match('/[^A-Za-z0-9]+/', $sNewPassword))

Line 186 of ChangePasswordMysqlDriver.php file.
I don't know what I can to do more at this moment.

Regards.