After more detail analysis, we discovered that I was wrong.
It is rather misunderstanding instead of bug.
Anonymous authentication works correctly according RFC959.
I would like to split it into two points according two option how to understand to anonymous connection:
1. If you set macro FTPSRVCFG_IS_ANONYMOUS as 1, FTP server will accepts all FTP commands without any successful authentication process – you don’t need authentication process for FTP commands.
2. If your client forces you to execute authentication with user name “anonymous” for anonymous connection, you can set ftpsrv_users[] to {"anonymous", "", NULL}. In that case any password will be accepted however password string must contain at least one character (could be any).
This behavior fits to RFC959. Note: In that case, rules for macro FTPSRVCFG_IS_ANONYMOUS is not applied because authentication process was executed as successful.
Problem is only in case when we want use “anonymous” as user name and empty string as password (just click on enter when client asks for password).
This combination is not accepted by FTP server by default.
If you would like apply also this option, please edit ftpsrv_cmd.c file and made modification from:
if (input->pass != NULL)
{
/* Validate username and password */
if (ftpsrv_check_authtbl(session))
{
session->auth_state = FTPSRV_LOGGED_IN;
session->message = (char*) ftpsrvmsg_pass;
}
else
{
session->auth_state = FTPSRV_LOGGED_OUT;
session->message = (char*) ftpsrvmsg_authfail;
}
retval = FTPSRV_OK;
}
else
{
session->message = (char*) ftpsrvmsg_badsyntax;
retval = FTPSRV_ERROR;
}
to:
/* Validate username and password */
if (ftpsrv_check_authtbl(session))
{
session->auth_state = FTPSRV_LOGGED_IN;
session->message = (char*) ftpsrvmsg_pass;
}
else
{
session->auth_state = FTPSRV_LOGGED_OUT;
session->message = (char*) ftpsrvmsg_authfail;
}
retval = FTPSRV_OK;
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------