I am working on a simple pop3 client in C, and I had the following problem: In AUTHORIZATION state, the server will never know my password:
Connection successful: + OK GMX POP3 StreamProxy ready
user hopatropa@gmx.com
+ OK May I have your password, please?
pass ******
-ERR Username or password incorrect
but the same sequence of commands works well in telnet
+ OK GMX POP3 StreamProxy ready
user hopatropa@gmx.com
+ OK May I have your password, please?
pass ******
+ OK Mailbox locked and ready
I am sure that the password that I am sending is ok. This is how I send the pass command and get a response:
sprintf (command, "pass% s \ r \ n", pass); // pass is the string containing the password
printf ("% s", command);
if (write (sock, command, sizeof (command)) == -1)
{
fprintf(stderr, "write() error: %d\n", errno);
return errno;
}
if (read(sock, msgbuff, sizeof(msgbuff)) == -1)
{
fprintf(stderr, "read() error: %d\n", errno);
return errno;
}
.
John Pope