ftp: remove superfluous checking for crlf in user or pwd

... as this is already done much earlier in the URL parser.

Also add test case 894 that verifies that pop3 with an encodedd CR in
the user name is rejected.

Closes #4887
This commit is contained in:
Daniel Stenberg 2020-02-06 11:36:53 +01:00
parent c87730daeb
commit 950b53da0d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 38 additions and 19 deletions

View file

@ -253,18 +253,6 @@ static void freedirs(struct ftp_conn *ftpc)
Curl_safefree(ftpc->newhost);
}
/* Returns non-zero if the given string contains CR (\r) or LF (\n),
which are not allowed within RFC 959 <string>.
Note: The input string is in the client's encoding which might
not be ASCII, so escape sequences \r & \n must be used instead
of hex values 0x0d & 0x0a.
*/
static bool isBadFtpString(const char *string)
{
return ((NULL != strchr(string, '\r')) ||
(NULL != strchr(string, '\n'))) ? TRUE : FALSE;
}
/***********************************************************************
*
* AcceptServerConnect()
@ -4377,11 +4365,6 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
*/
ftp->user = conn->user;
ftp->passwd = conn->passwd;
if(isBadFtpString(ftp->user))
return CURLE_URL_MALFORMAT;
if(isBadFtpString(ftp->passwd))
return CURLE_URL_MALFORMAT;
conn->proto.ftpc.known_filesize = -1; /* unknown size for now */
return CURLE_OK;