Bugs item #1783149, was opened at 2007-08-28 09:17
Message generated for change (Comment added) made by michaelbeiter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=937964&aid=1783149&group_id=191583
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core
Group: None
>Status: Open
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Michael Beiter (michaelbeiter)
Assigned to: Nobody/Anonymous (nobody)
Summary: Username in maildir path is not converted to lowercase
Initial Comment:
The entered username is not converted to lowercase in the maildir when adding a new mailbox.
If the username is entered as i.e. Te...@do...valid, the resulting username (for login) will be te...@do...valid, what is correct. When the maildir is chosen to be made up of domain and username, it will result as domain.invalid/TeST - what is incorrect, as at least maildrop in my setup won't be able to deliver mails: it expects domain.invalid/test as maildir (what is only consequent).
The fix is easy, it is sufficient to add a "strtolower" function call at the appropriate lines:
admin/create-mailbox.php
143c143
< $maildir = $fDomain . "/" . escape_string ($_POST['fUsername']) . "/";
---
> $maildir = $fDomain . "/" . strtolower(escape_string ($_POST['fUsername'])) . "/";
create-mailbox.php
154c154
< $maildir = $fDomain . "/" . escape_string ($_POST['fUsername']) . "/";
---
> $maildir = $fDomain . "/" . strtolower(escape_string ($_POST['fUsername'])) . "/";
----------------------------------------------------------------------
>Comment By: Michael Beiter (michaelbeiter)
Date: 2007-10-08 12:37
Message:
Logged In: YES
user_id=76720
Originator: YES
>> Probably you didn't expect these difficulties because you use the
>> alternative maildir structure (domain_in_mailbox==YES [...]
>
> I use the same setting as you do
sorry, then I got that wrong.
> [...] because maildrop reads the maildir from the database itsself
> ("WHERE username=...") instead of using the value it got from postfix.
ok, that's the point: We use the values from the database in maildrop only
once for creating the maildir. For delivery, the path is created from the
values provided by postfix (which are lowercase, as explained).
Your tests surely work as you always use the database... In fact, delivery
is the only place where we do not use the credentials from the db.
Actually, courier worked fine for us with uppercase maildir names as you
described. We decided once in a dark past that due to performance issues it
would be better to build the maildir path using the provided credentials
and not fire a db query.
Anyway: The question of defaulting credentials to lowercase is not
affected by this concern.
Thanks, Michael
----------------------------------------------------------------------
Comment By: Christian Boltz (christian_boltz)
Date: 2007-10-08 11:53
Message:
Logged In: YES
user_id=593261
Originator: NO
> Probably you didn't expect these difficulties because you use the
> alternative maildir structure (domain_in_mailbox==YES [...]
I use the same setting as you do and even tested it: the maildir is
created with uppercase letters. However this didn't matter on my system
because maildrop reads the maildir from the database itsself ("WHERE
username=...") instead of using the value it got from postfix. I tested:
- delivery with postfix / maildrop
- fetching mails with courier
and everything worked with the uppercase maildir name.
----------------------------------------------------------------------
Comment By: Michael Beiter (michaelbeiter)
Date: 2007-10-08 06:46
Message:
Logged In: YES
user_id=76720
Originator: YES
Regarding my maildroprc: I used the username and domainname as provided by
the database to create the maildirs. However, postfix always provides
lowercase credentials when it delivers a mail to maildrop.
Probably you didn't expect these difficulties because you use the
alternative maildir structure (domain_in_mailbox==YES, what actually is the
default IIRC). This results in using $fUsername on which a strtolower is
applied in an earlier step somewhere around line 80. Unfortunately, at that
place $fUsername ist tainted with the domain name, what requires using the
POST-variable as described to restore $fUsername to its original value.
In other words: I could use a strtolower when creating the maildir in my
maildroprc. However, this could lead to inconsistencies in other
applications. As imlemented by postfixadmin in the alternative maildir
structure, user- and domainnames should be lowercase - and that's why I
reported :-)
HTH, Michael
----------------------------------------------------------------------
Comment By: Christian Boltz (christian_boltz)
Date: 2007-10-07 19:52
Message:
Logged In: YES
user_id=593261
Originator: NO
Just curious: How does your maildroprc look like? (I'm also using maildrop
and using uppercase mailbox names works without problems.)
Anyway: Your change won't do any harm or backwards compatibility issues
(because it only affects creation of new mailboxes). I just applied your
patch to create-mailbox.php in the SVN.
Thanks for reporting this!
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=937964&aid=1783149&group_id=191583
|