uMySftpClient exits with "Could not get user auth list.", when the ssh server supports authentication method NONE.
According to libssh2_userauth_list, a server accepting NONE as authentication returns nil. Therefore, we need to check libssh2_userauth_authenticated(FSession) after the call to libssh2_userauth_list.
Suggested change in line 1125:
UserAuthList := libssh2_userauth_list(FSession, PAnsiChar(AnsiString(FUserName)), Length(AnsiString(FUserName)));
if (libssh2_userauth_authenticated(FSession) = 0) then
begin
if UserAuthList = nil then
begin
Disconnect;
RaiseSSHError('Could not get user auth list.');
end;
auth:
AuthOK := False;
AuthMode := ParseAuthList(UserAuthList);
if amTryAll in AuthMode then
AuthOK := UserAuthTryAll
else
begin
if amPassword in AuthMode then
AuthOK := UserAuthPassword;
if not AuthOK and (amKeyboardInteractive in AuthMode) then
AuthOK := UserAuthKeyboardInteractive;
if not AuthOK and (amPublicKey in AuthMode) then
AuthOK := UserAuthPKey;
if not AuthOK and (amPublicKeyViaAgent in AuthMode) then
AuthOK := UserAuthPKeyViaAgent;
end;
if not (AuthOK and (libssh2_userauth_authenticated(FSession) > 0)) then
begin
B := True;
if Assigned(FOnAuthFail) then
FOnAuthFail(Self, B);
if not B then
begin
Disconnect;
Exit;
end
else
goto auth;
end;
end;
uMySftpClient exits with "Could not get user auth list.", when the ssh server supports authentication method NONE. According to libssh2_userauth_list, a server accepting NONE as authentication returns nil. Therefore, we need to check libssh2_userauth_authenticated(FSession) after the call to libssh2_userauth_list.
Suggested change in line 1125: