Ticket #335 (closed defect: fixed)
don't attempt to auth on empty username
| Reported by: | dmorton | Owned by: | dmorton |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0.2 |
| Component: | PHP scripts | Version: | 1.0.1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
After a lengthy debugging session on IRC, Adam Kosmin uncovered the following error with dbmail. When he logged in with just a username, (rewriting type 0, imap) it let him in; On all other systems it doesn't.
The result of get_user_from_email() is an empty string if there is no '@' in the input. So Maia happily tries to authenticate an empty user. The resulting IMAP session looked sort of like: (.'s are spaces)
OK.dbmail.imap.(protocol.version.4r1).server.2.1.ready.to.run.. 0001.LOGIN.""."your password".. *.BYE.internal.db.error.validating.user.. A0001.OK.completed..
In this case, dbmail gave an invalid line, followed by 'OK' which NET_IMAP takes as success.
While this isn't really Maia's fault, maybe we shouldn't even try to auth an empty username. So the question is, do we return an error, or do we ammend get_user_from_email to return the supplied $email if $email is just a username? Do we add a check in auth() for an empty username?

