postfixadmin squirrelmail plugin (with added PostgreSQL support)

Postfixadmin Squirrelmail plugin

I found a Squirrelmail plugin for Postfixadmin the other day on Sourceforge. It provides support for setting vacation/auto-response messages, adding aliases/forwards and changing your password.

Unfortunately it didn't support PostgreSQL, and as we later found out, it was full of SQL injection holes....

So we've now cleaned it up quite a bit, and Sam and I have migrated it to use Pear::MDB2

If you're interested in using it, see postfixadmin-0.4.tar.gz.

I've emailed the last author to notify them of my changes, but I suspect that as the package hasn't been updated since 2004, that it is effectively unmaintained.

Comments

Version 0.4.1 released

Version 0.4.1 has been released, this fixes a bug in the vacation support, so now there is only ever one '@' sign used in an alias (which makes Postfix happier).

There have also been minor code cleanups.

See : here for some further info.

(Thanks to Chris Jacobs who brought this to my attention)

Download from http://codepoets.co.uk/files/postfixadmin-0.4.1.tar.gz

Thanks for this code! Daniel

Thanks for this code!
Daniel

Aliases not written correctly when vacation is active, see patch


--- postfixadmin_forward.php~ 2007-06-04 19:45:45.000000000 -0600
+++ postfixadmin_forward.php 2007-06-04 20:31:00.000000000 -0600
@@ -63,2 +63,3 @@
$tmp = preg_split ('/@/', $USERID_USERNAME);
+$USERID_LOCALPART = $tmp[0];
$USERID_DOMAIN = $tmp[1];
@@ -139,3 +140,3 @@
{
- $goto = $USERID_USERNAME . '#' . $CONF['vacation_domain'] . ',' . $goto;
+ $goto = $USERID_LOCALPART . '#' . $USERID_DOMAIN . '@' . $CONF['vacation_domain'] . ',' . $goto;
}
@@ -157,3 +158,3 @@
textdomain('postfixadmin');
- echo "". _("Alias successfully changend!"). "\n";
+ echo "". _("Alias successfully changed!"). "\n";
bindtextdomain('squirrelmail', SM_PATH . 'locale');

thanks for the patch :-)

I've included it, and SquirrelMail-PostfixAdmin 0.4.2 is now released...

See : http://codepoets.co.uk/files/postfixadmin-0.4.2.tar.gz

Thanks!
David.

Hi, After adding this

Hi,

After adding this plugin, I can't see it anywhere?

Anything I missed out?

regards
CH

run squirrelmail-configure?

Hi,

Have you run squirrelmail-configure, and enabled it in there?

It should be quite obvious when you view your individual options/settings page.

David.

RE : Hi, After adding this

CH, the installation instructions leave out one very important thing : you need to rename the postfixadmin-0.4.2 sub-directory to just postfixadmin after untarring the thing (i.e. at the end of step 1). If you don't do this, the plugin seems to fail to load when Squirrelmail starts, and you see no extra options.

I spent about two weeks killing myself over this until I stumbled upon it earlier tonight.

David, would it be possible to add :

mv postfixadmin-0.x.x postfixadmin

to INSTALL at the end of step 1? Because that one line is kind of crucial in getting the thing working.

Btw, thanks for the great little plugin!

SK

oooooh thank you!

Hi,

Thanks for that; I'll definitely add it into the INSTALL file; I've been running my active copy out of a svn controlled directory, and just create the tar ball with a 'versioned' directory name in an attempt to follow 'best practices'.

fwiw

I should also point out that I'm not the original author; I just fixed something I found that was broken. I then tried to contact the original authors, but they didn't respond (or email addresses weren't valid) so I ended up 'publishing' it here.

coming soon

Once I pull my finger out - I've got Polish translation files from one kind contributor to add. So, there should soon be a new version released.... I guess it's time I sorted out 'hosting' it somewhere (svn+trac).

Trac / Subversion access

I've moved the project to have it's own trac/suvbversion repository, which should allow others to become involved in the future (should they so wish!).

It's at http://squirrelmail-postfixadmin.palepurple.co.uk and contains the latest version etc.

Catchable fatal error

Hello i have installed your plugin on FreeBSD 6.2 with php 5.2.4 and lighttpd.

When i trie to load the page (vacation and forward) i'll get the following error.

vacation:
Catchable fatal error: Object of class MDB2_Error could not be converted to string in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_vacation.php on line 54

forward:
Catchable fatal error: Object of class MDB2_Error could not be converted to string in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_forward.php on line 70

Also password gives some errors.
Notice: Undefined variable: tMessage in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 137

Notice: Undefined variable: stMessage in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 138

Notice: Undefined variable: pPassword_admin_text in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 138

Notice: Undefined variable: pPassword_password_current_text in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 139

Notice: Undefined variable: pPassword_password_text in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 140

regards,
Johan

Thanks for the bug report

See : http://squirrelmail-postfixadmin.palepurple.co.uk/index.cgi/ticket/1

I suspect your database connections are somehow not right; but I'll work on fixing the error handling anyway.

thanks
David.

My fault

Ok it was the database password. oops sorry

But now i get other errors.

set vacation page
Notice: Undefined variable: tMessage in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_vacation.php on line 106
then when i set the vacation by clicking on going away button!
Notice: Undefined index: fBack in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_vacation.php on line 131

Your auto response has been set!
it looks it works, also in postfixadmin it shows the user is on vacation.

When i go to the vacation page again it nicely tells me i am away,
By clicking on coming back the following errors appears:
Notice: Undefined index: fSubject in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_vacation.php on line 128

Notice: Undefined index: fBody in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_vacation.php on line 129

Notice: Undefined index: fAway in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_vacation.php on line 130

Your auto response has been removed!

With the forwarding page i'll get
Notice: Undefined variable: tMessage in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_forward.php on line 197
when loading the page and:
Notice: Undefined variable: error in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_forward.php on line 128

Notice: Undefined index: logging in /usr/local/www/squirrelmail/plugins/postfixadmin/functions.inc.php on line 277

Alias successfully changed!
When setting a alias.

By the way i am using the latest postfixadmin from SVN revision 202 right now.

regards,
Johan
and thanks for your time and effort.

undefined variables - hopefully fixed.

Hi,

Undefined variable issues _should_ be fixed now (in SVN).

See : this changeset for more info.

thanks
David.

Ok the vacation is all right

Ok the vacation is all right now no more undefined stuff

the forward is giving me the following after hitting the edit alias button!
Notice: Undefined index: logging in /usr/local/www/squirrelmail/plugins/postfixadmin/functions.inc.php on line 277

Alias successfully changed!

the change password looks like this:
Notice: Undefined variable: tMessage in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 137

Notice: Undefined variable: stMessage in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 138

Notice: Undefined variable: pPassword_admin_text in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 138

Notice: Undefined variable: pPassword_password_current_text in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 139

Notice: Undefined variable: pPassword_password_text in /usr/local/www/squirrelmail/plugins/postfixadmin/postfixadmin_changepass.php on line 140

regards,
Johan

Fixed?

Hi,

Thanks for the bug reports - they're all due to variables not being initialised properly. You can change PHP's error reporting level, so it doesn't output the warnings, as they are normally harmless.

However, I don't like seeing such things in code (any more than you do!), so thanks.
I've made some changes in subversion - which should fix the problem(s) above

See :

http://squirrelmail-postfixadmin.palepurple.co.uk/index.cgi/timeline and changeset 14 and 15 for more info.

David.

nl language file

Hello here i am again ;)

I have made a nl language file for postfixadmin-plugin


# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2004-01-29 17:35+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: setup.php
msgid "Forwarding"
msgstr "Doorsturen"

msgid "Here you can create and edit E-Mail forwards."
msgstr "Hier kunt u uw doorstuur adres bewerken"

msgid "Set an OUT OF OFFICE message or auto responder for your mail."
msgstr "Configureer hier uw automatisch beantwoorden"

msgid "Change your mailbox password."
msgstr "Verander uw wachtwoord"

#: postfixadmin_changepass.php
msgid "Alias"
msgstr "Alias"

msgid "Change Password"
msgstr "Verander wachtwoord"

msgid "Change your login password"
msgstr "Verander uw login wachtwoord"

#: postfixadmin_forward.php
msgid "Edit Alias"
msgstr "Bewerk alias"

msgid "Edit an alias* for your domain.One entry per line."
msgstr "Bewerk uw alias voor uw domein.Een alias per regel."

msgid "The email address that you have entered is not valid:"
msgstr "Het ingevoerde adres is geen geldig adres"

msgid "Unable to locate alias!"
msgstr "Niet in staat alias te lokaliseren!"

msgid "Unable to modify the alias!"
msgstr "Niet in staat de alias aan te passen"

msgid "*Additional forward-aliase always recieve messages BBC!"
msgstr "Aliasen ontvangen altijd BCC! "

msgid "Alias successfully changend!"
msgstr "Alias succesvol aangepast"

#: postfixadmin_vacation.php
msgid "Auto Response"
msgstr "Automatisch beantwoorden"

msgid "Going Away"
msgstr "Ik ben weg"

msgid "Coming Back"
msgstr "Ik ben terug"

msgid "Options"
msgstr "Opties"

msgid "Out of Office"
msgstr "Out of office"

msgid "Subject"
msgstr "Onderwerp"

msgid "Body"
msgstr "Tekst"

msgid "Your auto response has been removed!"
msgstr "Uw automatisch beantwoorden is verwijdert!"

msgid "Your auto response has been set!"
msgstr "Uw automatisch beantwoorden is geactiveerd!"

msgid "You already have an auto response configured!"
msgstr "Automatisch beantwoorden is al geconfigureerd!"

#: postfixadmin_changepass.php:81 postfixadmin_changepass.php:87
msgid "The passwords that you supplied don't match!Or are empty!"
msgstr "De wachtwoorden komen niet overeen!Of er is geen wachtwoord opgegeven!"

#: postfixadmin_forward.php:70 postfixadmin_forward.php:152
msgid "To"
msgstr "Aan"

#: postfixadmin_changepass.php:101
msgid "Unable to change your password!"
msgstr "Niet in staat uw wachtwoord te wijzigen!"

#: postfixadmin_changepass.php:75
msgid "You didn't supply your current password!"
msgstr "U moet uw huidige wachtwoord opgeven!"

#: postfixadmin_changepass.php:96
msgid "Your password has been changed!"
msgstr "Uw wachtwoord is gewijzigd!"

msgid "Password current"
msgstr "Huidig wachtwoord"

msgid "Password new"
msgstr "Nieuw wachtwoord"

msgid "Password new again"
msgstr "Nieuw wachtwoord nogmaals"

msgid "Please sign out and log back again with your new password!"
msgstr "Log uit en opnieuw in met het nieuwe wachtwoord"

msgid "I will be away from until . For urgent matters you can contact ."
msgstr "Ik ben niet aanwezig van tot . Voor dringende zaken kunt u contact opnemen met ."

regards,
Johan

MDB2 error.

Hi,

I'm using Centos 4.4, with apache 2.0.59, php 5.1.6 , mysql-5.0.48, squirrelmail 1.4.8 and version 0.4.2 of the plugin. I installed MDB2 as per the instructions in the INSTALL file. I get the following when I use any of the functions in the plugin:

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /usr/share/pear/MDB2.php on line 796
Could not connect to the database: MDB2 Error: not found

The change password form does display properly, but gets the above error when submitting it.

My apologies if I've missed something obvious.

Any help is much appreciated.

Thank you,
Farshid

mdb2 / squirrelmail

Hi,

Right, well... it /should/ work :)

1) Did you install the MDB2 driver (e.g. MDB2_postgres or MDB2_mysql)

2) Did you edit the config file?

3) Do you have a PHP error log file, and if so - could you show me the contents?

If it's easier, you can find me on irc as GingerDog on freenode #postfixadmin.

thanks
David

Upgrade to 2.1.1 please!

Try upgrading; I've released 2.1.1, which has slightly better error handling (in that it may give you something useful!)

See here for a download link etc.

thanks
David.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
We don't take kindly to automated nonsensible adverts around here.