Re[2]: [tpop3d-discuss] Case problems during checikng mailbox

Chris Lightfoot chris at ex-parrot.com
Wed, 8 Jan 2003 18:22:44 +0000


On Wed, Jan 08, 2003 at 07:07:49PM +0100, Wiktor Zgodzi=F1ski wrote:
>=20
> CL> On Wed, Jan 08, 2003 at 06:42:31PM +0100, Wiktor Zgodzi=F1ski wrote=
:
> >> I'm using tpop3d 1.4.2  with auth_mysql and with my own db. All is f=
ine,
> >> but today I notice following problem.
> >>=20
> >> If user give his account name in different case ex:
> >> John.Smith@domain.com (spool dir for him is called
> >> /var/spool/mail/domain.com/john.simith) tpop3d log him in, but sayin=
g
> >> that there is no message for user. Of course there are few message a=
nd
> >> if user logs as john.smith@domain.com he gets his messages.
> >>=20
> >> What should I fix to resolve this problem. May be I didn't  read
> >> documentation carefully. ? Just tell me that.
>=20
> CL> Your database is doing a case-insensitive compare. Cf.
>=20
> CL>     http://www.mysql.com/doc/en/Case_Sensitivity_Operators.html
>=20
> CL> Two obvious fixes: either do a case-sensitive compare on
> CL> username, or cast the results through lcase(). See the
> CL> MySQL manual for more on this.
>=20
> I don't have problem with authorization. I have problem after auth.
> When tpop3d checking user mailbox it's looking into mailbox:/var/spool/=
mail/$(domain)/$(local_part)

your select query is:

SELECT CONCAT('/var/spool/mail/','$(domain)','/','$(local_part)'),
       CONCAT('{plaintext}',password),
       'exim',
       'bsd'
    from users WHERE
        username LIKE '$(local_part)'
        and domain LIKE '$(domain)'
        and is_alias LIKE 'no' and valid LIKE 'yes';

LIKE does a case-insensitive compare. So John.Smith is
LIKE john.smith. One way around this would be to do

    SELECT CONCAT(..., LOWER('$(local_part)')), ...

or alternatively, you could re-write the SELECT statement
not to match case-insensitively.

This is really OT for tpop3d-discuss. I suggest you try
the MySQL list if you're still stuck.

--=20
``... Traverse the curve, carrying a spear, in a time less
  than that it takes for a lion to walk its own length.''
  (How To Hunt A Lion: the Peano method)