Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: sasi on July 28, 2010, 11:59:34 PM

Title: Password Plugin
Post by: sasi on July 28, 2010, 11:59:34 PM
HI Team,

      While searching for the password plugin guys you  gave me one link the link is carrying me to the hmail password plugin so that can utilized that for my Roundcube Webmail.
Title: Password Plugin
Post by: rosali on July 29, 2010, 12:45:37 AM
The default password plugin is shipped with Roundcube 0.4beta or SVN trunk (Roundcube Webmail (http://trac.roundcube.net)).
Title: Password Plugin
Post by: sasi on July 29, 2010, 01:04:22 AM
Quote from: rosali;29015
The default password plugin is shipped with Roundcube 0.4beta or SVN trunk (Roundcube Webmail (http://trac.roundcube.net)).


Hi Rosali,

    Actually I had fully configured in Stable 0.3.1 Version so it might be a big work for me so please guide can i use the hmail password plugin
These are the links what i got from our  Team,

Plugin_Repository ? Roundcube Webmail (http://trac.roundcube.net/wiki/Plugin_Repository)

Doc_Plugins ? Roundcube Webmail (http://trac.roundcube.net/wiki/Doc_Plugins#InstallingPluginsandActivatingPlugins)
Title: Password Plugin
Post by: rosali on July 29, 2010, 01:12:11 AM
Hmmm, I do not get your problem ...

You can use the hmail_password plugin if you have hMailserver as backend. Otherwise you have to use the default password plugin.
Title: password plugin
Post by: sasi on July 29, 2010, 01:52:36 AM
Quote from: rosali;29018
Hmmm, I do not get your problem ...

You can use the hmail_password plugin if you have hMailserver as backend. Otherwise you have to use the default password plugin.


HI Rosali,

            Iam using Roundcube  Cube with Mysql has the database with dovecot and postfix,
So can u please guide how to finish my work with the default plugin.
Title: Password Plugin
Post by: rosali on July 29, 2010, 06:01:10 AM
Dovecot/Postfix users please jump in ...
Title: Password Plugin
Post by: sasi on July 29, 2010, 06:42:12 AM
Quote from: rosali;29038
Dovecot/Postfix users please jump in ...


Hi Rosali,

  I cant understand.
Title: Password Plugin
Post by: rosali on July 29, 2010, 11:53:22 AM
I'm not familiar with Dovecot/Postfix. I hope you get assistance by other guys.
Title: Password Plugin
Post by: kmn on July 30, 2010, 12:26:12 AM
Hello,

The plugin that Rosali mentioned works only with Hmailserver. In your case, perhaps the new plugin shipped alongwith the new RC version will work. Rosali could you comment please?.
Title: Password Plugin
Post by: rosali on July 30, 2010, 12:17:42 PM
Yes, kmn. Could you assist to setup the default password plugin for Dovecot/Postfix?
Title: password plugin
Post by: sasi on July 31, 2010, 07:02:51 AM
Quote from: rosali;29080
Yes, kmn. Could you assist to setup the default password plugin for Dovecot/Postfix?


HI KNM& Rosali,

   In the version 0.3.1 the roundcube having the password plugin content,In my case  i have enabled the password in the array in main.inc.php  and i want to conect the password plugin with the MYSQL DB to save the details,

                       Now iam getting connection error and iam attaching the screen shot
  has i came threw some document they mentioned to work with password_db_dsn and password_query  so please help to finish up this problem


// PEAR database DSN for performing the query. By default
// Roundcube DB settings are used.
$rcmail_config['password_db_dsn'] ='mysql://roundcube:forever@localhost';

// The SQL query used to change the password.
// The query can contain the following macros that will be expanded as follows:
//      %p is replaced with the plaintext new password
//      %c is replaced with the crypt version of the new password, MD5 if available
//         otherwise DES.
//      %o is replaced with the password before the change
//      %n is replaced with the hashed version of the new password
//      %q is replaced with the hashed password before the change
//      %h is replaced with the imap host (from the session info)
//      %u is replaced with the username (from the session info)
//      %l is replaced with the local part of the username
//         (in case the username is an email address)
//      %d is replaced with the domain part of the username
//         (in case the username is an email address)
// Escaping of macros is handled by this module.
// Default: "SELECT update_passwd(%c, %u)"
$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';
Title: Password Plugin
Post by: Schmatze on August 18, 2010, 10:05:31 AM
I'm tryng to get this plugin running. But I allways get this error-message:

Quote
DB Error: MDB2 Error: syntax error Query: _doQuery: [Error message: Could not execute statement] [Last executed query: see_next_code_block] [Native code: 1064] [Native message: You have an error in your SQL syntax; check the m in /path/to/roundcube/program/include/rcube_mdb2.php on line 644 (POST /?_task=settings&_action=plugin.password-save?_task=&_action=)


Here is my query (which works fine in phpmyadmin):
Quote
$rcmail_config['password_query'] = 'CREATE TEMPORARY TABLE userID (SELECT `id` FROM `virtual_users` WHERE `domain_id` =(SELECT `id` FROM `virtual_domains` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )); UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` =(SELECT `id` FROM userID) LIMIT 1 ;';


I don't understand this error-message. I hope you does. Thanks.
Title: Password Plugin
Post by: SKaero on August 18, 2010, 10:10:08 AM
At the end of your query you have:
Code: [Select]
;';the first ; shouldn't be there, it should be:
Code: [Select]
$rcmail_config['password_query'] = 'CREATE TEMPORARY TABLE userID (SELECT `id` FROM `virtual_users` WHERE `domain_id` =(SELECT `id` FROM `virtual_domains` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )); UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` =(SELECT `id` FROM userID) LIMIT 1';
EDIT: Oops I just read your query a little bit closer and noticed that you trying to run 2 query, RoundCube only supports running 1 query.
Title: Password Plugin
Post by: Schmatze on August 18, 2010, 11:24:13 AM
Quote from: skaero;29478
Oops I just read your query a little bit closer and noticed that you trying to run 2 query, RoundCube only supports running 1 query.


Do you have any suggestion how I can change this?

The problem is, that I need the id of the user, so I have to select the same table I want to update. And MySQL doesn't like this in one query.
Title: Password Plugin
Post by: SKaero on August 18, 2010, 11:34:49 AM
Can you do:
Code: [Select]
$rcmail_config['password_query'] = 'UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` = (SELECT `id` FROM `virtual_users` WHERE `domain_id` = (SELECT `id` FROM `virtual_domains` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )) LIMIT 1';
Or does that also return a error (and if so what error)
Title: Password Plugin
Post by: Schmatze on August 18, 2010, 11:51:13 AM
This was the first one I tried. Doesn't work either.

Code: [Select]
You can't specify target table 'virtual_users' for update in FROM clause

Thats why I tried it with a temporary table.
Title: Password Plugin
Post by: SKaero on August 18, 2010, 12:13:01 PM
Ok I think its just a mysql format problem, try this:
Code: [Select]

$rcmail_config['password_query'] = 'UPDATE `mail`.`virtual_users` SET `password` = MD5( %p ) WHERE `virtual_users`.`id` = (SELECT `id` FROM `mail`.`virtual_users` WHERE `domain_id` = (SELECT `id` FROM `mail`.`virtual_users` WHERE `name` = %d) AND `user` = %l AND `password` = MD5( %o )) LIMIT 1';
Title: Password Plugin
Post by: Schmatze on August 18, 2010, 12:37:59 PM
Ok, I made a view now with the password and the mail-address inside.

Works fine now.

Here is my query:

Code: [Select]
UPDATE `mail`.`view_users` SET `password` = MD5( %p ) WHERE `email` = %u AND `password` = MD5( %o ) LIMIT 1

Thanks for your help. ;)