Roundcube Community Forum

 

PostfixAdmin bridge

Started by nejko, June 15, 2008, 06:07:06 PM

Previous topic - Next topic

nejko

Hello,

I have written a patchset for RoundCube, to integrate PostfixAdmin's functions:
password change, vacation, forwarding - and also to copy user's full name from
postfixadmin's db when creating the default identity.

You can get my code here: http://nejc.skoberne.net/rcpfa .

I hope you'll find it useful. Send bugs and feature requests to skoberne.net>.

Bye,
Nejc

guilichou

I didn't get it to work at all...

The first problem of your patch is that it implies that the postfix database and RC database are one unique database... Which isn't my case...

And when I dumped my RC database in the postfix database... it doesn't seem to work. I did look as the parameters you added in the main.inc.php but didn't change anything...
When I change the vacation message, I get a blank page...

nejko

Hey,

Quote from: guilichou;13123The first problem of your patch is that it implies that the postfix database and RC database are one unique database... Which isn't my case...

I assumed that most users use PostfixAdmin and Roundcube together this way. You can also add support for a separate database, of course. Patches are welcome.

Quote from: guilichou;13123And when I dumped my RC database in the postfix database... it doesn't seem to work. I did look as the parameters you added in the main.inc.php but didn't change anything...
When I change the vacation message, I get a blank page...

It works for me and many other people, so it is likely to be a problem with your setup. Saying "it doesn't seem to work" is completely helpless since I can't guess what errors did you get. If you could paste the errors you get in Apache error log file, the chances of getting help would increase. Getting blank page usually means something went wrong with a PHP script. It's perfectly possible you hit a bug since your configuration might be unusual.

Also, this morning (GMT+1) I released RCPFA 1.0.3, which fixes two annoying bugs. Check the project's page.

Oh, and what versions of software do you use?

Bye,
Nejc

STiAT

This one is far from perfect.
-> It requires that the rc and pa dbs are the same (?)
-> It requires that the login name actually is the e-mail address (why? just because pa wants it like this?)
-> In 1.0.3, I can't get it working at all - the newly gained tabs do not do anything at all in 0.2rc

Seems like it needs some fixing ...

nejko

Quote from: STiAT;13128This one is far from perfect.

I agree. But, we can make it better together, right?

Quote from: STiAT;13128-> It requires that the rc and pa dbs are the same (?)

Actually, after patching, you can configure the database which PostfixAdmin uses in db.inc.php:

// PEAR database DNS for read/write operations on PostfixAdmin database
$rcmail_config['pfa_db_dsnw'] = 'mysql://postfixadmin:mail2c0kq@localhost/postfix';

Quote from: STiAT;13128-> It requires that the login name actually is the e-mail address (why? just because pa wants it like this?)

Yes. What behaviour would you expect?

Quote from: STiAT;13128-> In 1.0.3, I can't get it working at all - the newly gained tabs do not do anything at all in 0.2rc

0.2rc? Am I missing something here? The latest official release is 0.2-alpha? As the project's page says, it works with 0.2-alpha and some latest SVN revisions (but not the latest).

Quote from: STiAT;13128Seems like it needs some fixing ...

I am interested in fixing it and providing a better link between RC and PA and it is great if you want to help me.

Thanks,
Nejc

jcip

Do you think it might be possible to modify this script to work with a Berkley DB based postfix install?  I believe that's what a vanilla OS X based mail server uses, I could be mistaken however.  I'd love to replace Squirrel Mail and have this functionality added in roundcube.

nejko

Quote from: jcip;13134Do you think it might be possible to modify this script to work with a Berkley DB based postfix install?  I believe that's what a vanilla OS X based mail server uses, I could be mistaken however.  I'd love to replace Squirrel Mail and have this functionality added in roundcube.

Hello, actually RCPFA only needs PostfixAdmin's database. Do you have MySQL database for PostfixAdmin? If not, what db do you use for PostfixAdmin (not Postfix)?

Bye,
Nejc

guilichou

Totally ready to help to improve the plugin!

Nevertheless, I can't get anything from the apache log... what parameter do use?
I have:
        LogLevel emerg (I tried warn, error)
        ErrorLog        /var/log/apache2/log-mailbeta.log
        CustomLog       /var/log/apache2/log-mailbeta.log combined

Thanks

nejko

Quote from: guilichou;13148Totally ready to help to improve the plugin!

Nevertheless, I can't get anything from the apache log... what parameter do use?
I have:
        LogLevel emerg (I tried warn, error)
        ErrorLog        /var/log/apache2/log-mailbeta.log
        CustomLog       /var/log/apache2/log-mailbeta.log combined

Make sure you have "log_errors = On" in php.ini. Try writing ErrorLog to another file than CustomLog. The error should appear in the ErrorLog.

Bye,
Nejc

guilichou

Followed your instructions, but i still couldn't get any interesting info out in the log files... i'll try and search the web to try and get more infos...

STiAT

@nejko:
I meant 0.2alpha actually. The buttons just never get active in the last version, and I havn't found the reason in the code yet.

Of course we can improve it.

The behaviour I'd expect is actually being able to provide a list of fields of a table which shall be taken for login.
In example, I configured roundcube and dovecot, so the users can either use their mail address OR a username to login (I simply used the name field in postfixadmin).

The reason for this is, that I'll one day disable mail logins. The reason is simple: Being able to be hacked just needs 2 informations: The e-mail and the password. Most likely, the guys trying to hack an address have the mail address of the user they'd like to log in to. If i disable the mail address, and just have a username to login, he'd need to hack two different informations, and has quite endless possibilities, and never knows the right account.

The patches seem to work properly (for the plugin side of view). Still, the plugin isn't functional. Allthough, as I said I'm still looking where the problem is located.

For the database: I've already found that there is a configuration, and adobted it. Allthough - still not working ;-).

// STi

denis123

Great patchset. works just fine. Thanks.

raffe1234

To get it to work, I needed to patch index.php manually (I think it has changed since the release of pfa patch).

Before it showed the new tabs, but when I clicked on them I just got to the "Settings" tab.

After the change, it worked OK.

After this code:
// allow 5 "redirects" to another action
$redirects = 0; $incstep = null;
while ($redirects < 5) {
  $stepfile = !empty($action_map[$RCMAIL->task][$RCMAIL->action]) ?
    $action_map[$RCMAIL->task][$RCMAIL->action] : strtr($RCMAIL->action, '-', '_') . '.inc';
   
  // try to include the step file
  if (is_file(($incfile = 'program/steps/'.$RCMAIL->task.'/'.$stepfile))) {
    include($incfile);
    $redirects++;
  }
  else {
    break;
  }
}

I put this code (the code is from index.php.diff)
 // >> pfa patch
  if ($RCMAIL->action=='vacation' || $RCMAIL->action=='save-vacation')
  {
    if ($RCMAIL->config->get('pfa_enable_vacation'))
      include('program/steps/settings/pfa_vacation.inc');
    else
 $OUTPUT->show_message('vacationdisabled', 'error');
  }
 
  if ($RCMAIL->action=='password' || $RCMAIL->action=='save-password')
  {
    if ($RCMAIL->config->get('pfa_enable_password'))
      include('program/steps/settings/pfa_password.inc');  
    else
 $OUTPUT->show_message('passworddisabled', 'error');
  }

  if ($RCMAIL->action=='forwarding' || $RCMAIL->action=='save-forwarding')
  {
    if ($RCMAIL->config->get('pfa_enable_forwarding'))
      include('program/steps/settings/pfa_forwarding.inc');
    else
 $OUTPUT->show_message('forwardingdisabled', 'error');
  }
  // << pfa patch

gyrex

Hi,

I'm running 0.2 beta and i've added this code to index.php. Unfortunately it's not working as expected though.

I can see the vacation password and forwarding tabs but when I click on them nothing happens. Has anyone been able to get this to work with the pfa patch?

Any help would be greatly appreciated!

gyrex

Sorry - the page was cached for some reason!!! It's all working now!

Many thanks!