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

Wiktor Zgodziński Wiktor Zgodziński
Wed, 08 Jan 2003 19:41:53 +0100


CL> On Wed, Jan 08, 2003 at 07:07:49PM +0100, Wiktor Zgodziński wrote:
>> 
>> CL> On Wed, Jan 08, 2003 at 06:42:31PM +0100, Wiktor Zgodziński =
wrote:
>> >> I'm using tpop3d 1.4.2  with auth_mysql and with my own db. All=
 is fine,
>> >> but today I notice following problem.
>> >> 
>> >> 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 =
saying
>> >> that there is no message for user. Of course there are few mess=
age and
>> >> if user logs as john.smith@domain.com he gets his messages.
>> >> 
>> >> What should I fix to resolve this problem. May be I didn't  rea=
d
>> >> documentation carefully. ? Just tell me that.
>> 
>> CL> Your database is doing a case-insensitive compare. Cf.
>> 
>> CL>     http://www.mysql.com/doc/en/Case_Sensitivity_Operators.htm=
l
>> 
>> 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.
>> 
>> I don't have problem with authorization. I have problem after auth=
.
>> When tpop3d checking user mailbox it's looking into mailbox:/var/s=
pool/mail/$(domain)/$(local_part)

CL> your select query is:

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

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

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

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

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


My fault. You're right. Now is working. I don't know why I thought
that this line :   /var/spool/mail/$(domain)/$(local_part) is
responsible for this error. Now is working well thx.

Of course that was my wrong SQL query.


Regards,
Wiktor                            mailto:viki@isp.telenergo.pl