Why does GetErrorMessage return “wrong password”, when the user name is wrong?

跟風遠走 提交于 2019-12-04 03:46:36

问题


GetErrorMessage (from CInternetException) gives me the following:

With the incorrect ftp server name:
"ERROR! The server name or address could not be resolved"

With the incorrect password:
ERROR! The password was not allowed

With the incorrect user name:
ERROR! The password was not allowed <-----? NO separate message for incorrect username? Is this intended?

try
{
   pConnect = sess->GetFtpConnection(host, userName, password, port, FALSE );
}

catch (CInternetException* pEx) //incorrect user name displays incorrect password?
{
      TCHAR sz[1024];
      pEx->GetErrorMessage(sz, 1024);
      printf("ERROR!  %s\n", sz);
      pEx->Delete();
}

回答1:


Yes that is intended. A typical FTP server will not distinguish between an invalid password and an invalid username. This is for security reasons, so e.g. attackers can't brute force their way to discover valid usernames.



来源:https://stackoverflow.com/questions/2166098/why-does-geterrormessage-return-wrong-password-when-the-user-name-is-wrong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!