Internal
Public Access
Fix mRemoteNG import failing on entries without a username
The previous username relaxation only touched ProfileDialog's own save-time validation. ProfileRepository::isProfileValid() had the identical "username required for SSH/RDP" check independently, called directly by insertProfile()/updateProfile() -- exactly the path mRemoteNG import uses, since it builds Profile objects and inserts them directly rather than going through the dialog. Every imported SSH/RDP entry without a recorded username was rejected outright. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -175,6 +175,15 @@ Delivered:
|
|||||||
cleanly rather than sending Apple auth a blank username. The value is
|
cleanly rather than sending Apple auth a blank username. The value is
|
||||||
kept on the tab's in-memory profile copy for its lifetime, not written
|
kept on the tab's in-memory profile copy for its lifetime, not written
|
||||||
back to the saved profile
|
back to the saved profile
|
||||||
|
- The blank-username relaxation above initially only covered
|
||||||
|
`ProfileDialog`'s own save-time validation; `ProfileRepository::
|
||||||
|
isProfileValid()` had the identical "username required for SSH/RDP"
|
||||||
|
check independently, called directly by `insertProfile()`/
|
||||||
|
`updateProfile()` -- which is exactly the path mRemoteNG import uses
|
||||||
|
(it builds `Profile` objects and inserts them directly, never going
|
||||||
|
through the dialog), so importing any SSH/RDP entry without a
|
||||||
|
username still failed outright until this second check was found and
|
||||||
|
removed too
|
||||||
- Robustness fix: an unrecognized `FramebufferUpdate` rectangle encoding
|
- Robustness fix: an unrecognized `FramebufferUpdate` rectangle encoding
|
||||||
used to abort the connection generically; `kAnnouncedEncodings` is now
|
used to abort the connection generically; `kAnnouncedEncodings` is now
|
||||||
the single source of truth for what `SetEncodings` announces and what
|
the single source of truth for what `SetEncodings` announces and what
|
||||||
|
|||||||
@@ -235,13 +235,6 @@ bool isProfileValid(const Profile& profile, QString* error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QString protocol = normalizedProtocol(profile.protocol);
|
const QString protocol = normalizedProtocol(profile.protocol);
|
||||||
if ((protocol == QStringLiteral("SSH") || protocol == QStringLiteral("RDP"))
|
|
||||||
&& profile.username.trimmed().isEmpty()) {
|
|
||||||
if (error != nullptr) {
|
|
||||||
*error = QStringLiteral("Username is required for %1 profiles.").arg(protocol);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString authMode = normalizedAuthMode(protocol, profile.authMode);
|
const QString authMode = normalizedAuthMode(protocol, profile.authMode);
|
||||||
if (protocol == QStringLiteral("SSH") && authMode == QStringLiteral("Private Key")
|
if (protocol == QStringLiteral("SSH") && authMode == QStringLiteral("Private Key")
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ private slots:
|
|||||||
void createProfileRejectsMissingName();
|
void createProfileRejectsMissingName();
|
||||||
void createProfileRejectsMissingHost();
|
void createProfileRejectsMissingHost();
|
||||||
void createProfileRejectsInvalidPort();
|
void createProfileRejectsInvalidPort();
|
||||||
void createProfileRejectsMissingUsernameForSsh();
|
void createProfileAllowsMissingUsernameForSsh();
|
||||||
void createProfileRejectsMissingPrivateKeyForKeyAuth();
|
void createProfileRejectsMissingPrivateKeyForKeyAuth();
|
||||||
void createProfileRejectsDuplicateName();
|
void createProfileRejectsDuplicateName();
|
||||||
void updateProfilePersistsChanges();
|
void updateProfilePersistsChanges();
|
||||||
@@ -156,11 +156,17 @@ void TestProfileRepository::createProfileRejectsInvalidPort()
|
|||||||
QVERIFY(!m_repo->createProfile(profile).has_value());
|
QVERIFY(!m_repo->createProfile(profile).has_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestProfileRepository::createProfileRejectsMissingUsernameForSsh()
|
void TestProfileRepository::createProfileAllowsMissingUsernameForSsh()
|
||||||
{
|
{
|
||||||
|
// SSH/RDP no longer require a username at save time (issue #21) --
|
||||||
|
// among other things, this unblocks importing mRemoteNG entries that
|
||||||
|
// don't have one recorded, which used to fail outright. The user is
|
||||||
|
// asked for it at connect time instead (see SessionTab).
|
||||||
Profile profile = makeSshProfile();
|
Profile profile = makeSshProfile();
|
||||||
profile.username.clear();
|
profile.username.clear();
|
||||||
QVERIFY(!m_repo->createProfile(profile).has_value());
|
const auto created = m_repo->createProfile(profile);
|
||||||
|
QVERIFY(created.has_value());
|
||||||
|
QVERIFY(created->username.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestProfileRepository::createProfileRejectsMissingPrivateKeyForKeyAuth()
|
void TestProfileRepository::createProfileRejectsMissingPrivateKeyForKeyAuth()
|
||||||
|
|||||||
Reference in New Issue
Block a user