Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jan : POP3 server authentication problem - D7 indy10.0.52
| Subject: | POP3 server authentication problem - D7 indy10.0.52 |
| Posted by: | "Jacques" (jacques.no..@btinternet.com) |
| Date: | Mon, 30 Jan 2006 01:18:20 |
I've been reading through the RFC for POP3 server and have also been playing
around with pop3server demo that came with
indy10. I'm basically working down the list of commands and have hit a snag
with the authentication method. here's the code i use to log in a client:
procedure Tform1.IdPOP3Server1CheckUser(AThread: TIdContext;
LThread: TIdPOP3ServerContext);
var
ok:boolean;
begin
//read username
lthread.Username:=athread.Connection.IOHandler.ReadLn;
if lthread.Username='myusername' then begin
//send back a msg to server
athread.Connection.IOHandler.WriteLn('+OK '+'Bring on the password-:)');
end
else begin
athread.Connection.IOHandler.WriteLn('-ERR '+'Wrong uname');
end ;
//read the password
lthread.password:=athread.Connection.IOHandler.ReadLn;
if lthread.Username='mypass' then begin
athread.Connection.IOHandler.WriteLn('+OK '+'Ask away-:)');
ok:=true;
end
else begin
athread.Connection.IOHandler.WriteLn('-ERR '+'Wrong password');
end;
//if uname and paswword is ok, set server in 'trans' state
LThread.State := Trans;
end;
I tested this code with telnet and it is completely ignored by the server.
It does not check if the username or the password is right. Is this the
right way to authenticate a client? Or am i missing the point entirely?
Thanks