diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/test856 | 4 | ||||
-rwxr-xr-x | tests/ftpserver.pl | 39 |
2 files changed, 38 insertions, 5 deletions
diff --git a/tests/data/test856 b/tests/data/test856 index 7076cf6a9..55991c7b6 100644 --- a/tests/data/test856 +++ b/tests/data/test856 @@ -2,6 +2,7 @@ <info> <keywords> POP3 +LOGIN
FAILURE </keywords> </info> @@ -9,9 +10,6 @@ FAILURE # # Server-side <reply> -<servercmd> -REPLY PASS -ERR invalid login -</servercmd> </reply> # diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 78e50c6a5..4f67207cd 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -561,16 +561,16 @@ sub protocolsetup { 'DELE' => \&DELE_pop3, 'LIST' => \&LIST_pop3, 'NOOP' => \&NOOP_pop3, + 'PASS' => \&PASS_pop3, 'QUIT' => \&QUIT_pop3, 'RETR' => \&RETR_pop3, 'RSET' => \&RSET_pop3, 'STAT' => \&STAT_pop3, 'TOP' => \&TOP_pop3, 'UIDL' => \&UIDL_pop3, + 'USER' => \&USER_pop3, ); %displaytext = ( - 'USER' => '+OK We are happy you popped in!', - 'PASS' => '+OK Access granted', 'welcome' => join("", ' _ _ ____ _ '."\r\n", ' ___| | | | _ \| | '."\r\n", @@ -1366,6 +1366,9 @@ sub LOGOUT_imap { ################ POP3 commands ################ +# Who is attempting to log in +my $username; + sub CAPA_pop3 { my ($testno) = @_; @@ -1438,6 +1441,38 @@ sub AUTH_pop3 { return 0; } +sub USER_pop3 { + my ($user) = @_; + + logmsg "USER_pop3 got $user\n"; + + if (!$user) { + sendcontrol "-ERR Protocol error\r\n"; + } + else { + $username = $user; + + sendcontrol "+OK\r\n"; + } + + return 0; +} + +sub PASS_pop3 { + my ($password) = @_; + + logmsg "PASS_pop3 got $password\n"; + + if (($username ne "user") && ($password ne "secret")) { + sendcontrol "-ERR Login failure\r\n"; + } + else { + sendcontrol "+OK Login successful\r\n"; + } + + return 0; +} + sub RETR_pop3 { my ($testno) = @_; my @data; |