mirror of
https://github.com/curl/curl.git
synced 2025-09-26 14:06:48 +03:00
ftpserver.pl: Moved IMAP LOGIN handler into own function
This commit is contained in:
parent
84ad1569e5
commit
187ac69374
|
@ -169,6 +169,12 @@ my $datasockf_conn = 'no'; # ['no','yes']
|
||||||
my $got_exit_signal = 0; # set if program should finish execution ASAP
|
my $got_exit_signal = 0; # set if program should finish execution ASAP
|
||||||
my $exit_signal; # first signal handled in exit_signal_handler
|
my $exit_signal; # first signal handled in exit_signal_handler
|
||||||
|
|
||||||
|
#**********************************************************************
|
||||||
|
# Mail related definitions
|
||||||
|
#
|
||||||
|
my $TEXT_USERNAME = "user";
|
||||||
|
my $TEXT_PASSWORD = "secret";
|
||||||
|
|
||||||
#**********************************************************************
|
#**********************************************************************
|
||||||
# exit_signal_handler will be triggered to indicate that the program
|
# exit_signal_handler will be triggered to indicate that the program
|
||||||
# should finish its execution in a controlled way as soon as possible.
|
# should finish its execution in a controlled way as soon as possible.
|
||||||
|
@ -594,6 +600,7 @@ sub protocolsetup {
|
||||||
'FETCH' => \&FETCH_imap,
|
'FETCH' => \&FETCH_imap,
|
||||||
'LIST' => \&LIST_imap,
|
'LIST' => \&LIST_imap,
|
||||||
'LSUB' => \&LSUB_imap,
|
'LSUB' => \&LSUB_imap,
|
||||||
|
'LOGIN' => \&LOGIN_imap,
|
||||||
'LOGOUT' => \&LOGOUT_imap,
|
'LOGOUT' => \&LOGOUT_imap,
|
||||||
'NOOP' => \&NOOP_imap,
|
'NOOP' => \&NOOP_imap,
|
||||||
'RENAME' => \&RENAME_imap,
|
'RENAME' => \&RENAME_imap,
|
||||||
|
@ -604,7 +611,6 @@ sub protocolsetup {
|
||||||
'UID' => \&UID_imap,
|
'UID' => \&UID_imap,
|
||||||
);
|
);
|
||||||
%displaytext = (
|
%displaytext = (
|
||||||
'LOGIN' => ' OK LOGIN completed',
|
|
||||||
'welcome' => join("",
|
'welcome' => join("",
|
||||||
' _ _ ____ _ '."\r\n",
|
' _ _ ____ _ '."\r\n",
|
||||||
' ___| | | | _ \| | '."\r\n",
|
' ___| | | | _ \| | '."\r\n",
|
||||||
|
@ -817,6 +823,26 @@ sub CAPABILITY_imap {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub LOGIN_imap {
|
||||||
|
my ($args) = @_;
|
||||||
|
my ($user, $password) = split(/ /, $args, 2);
|
||||||
|
fix_imap_params($user, $password);
|
||||||
|
|
||||||
|
logmsg "LOGIN_imap got $args\n";
|
||||||
|
|
||||||
|
if ($user eq "") {
|
||||||
|
sendcontrol "$cmdid BAD Command Argument\r\n";
|
||||||
|
}
|
||||||
|
elsif (($user ne $TEXT_USERNAME) && ($password ne $TEXT_PASSWORD)) {
|
||||||
|
sendcontrol "$cmdid NO LOGIN failed\r\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendcontrol "$cmdid OK LOGIN completed\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub SELECT_imap {
|
sub SELECT_imap {
|
||||||
my ($testno) = @_;
|
my ($testno) = @_;
|
||||||
fix_imap_params($testno);
|
fix_imap_params($testno);
|
||||||
|
@ -1463,7 +1489,7 @@ sub PASS_pop3 {
|
||||||
|
|
||||||
logmsg "PASS_pop3 got $password\n";
|
logmsg "PASS_pop3 got $password\n";
|
||||||
|
|
||||||
if (($username ne "user") && ($password ne "secret")) {
|
if (($username ne $TEXT_USERNAME) && ($password ne $TEXT_PASSWORD)) {
|
||||||
sendcontrol "-ERR Login failure\r\n";
|
sendcontrol "-ERR Login failure\r\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user