Skip to content

Commit

Permalink
Issue 2271 – Misplaced stored site use warning in scripting when sess…
Browse files Browse the repository at this point in the history
…ion name is specified

https://winscp.net/tracker/2271
(cherry picked from commit da0fc7a)

Source commit: 323213de6c212e3c788c1f0f820f07f4fb792a52
  • Loading branch information
martinprikryl committed Mar 5, 2024
1 parent 3637bb7 commit 6eed42a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/core/Script.cpp
Expand Up @@ -2758,7 +2758,7 @@ void __fastcall TManagementScript::Connect(const UnicodeString Session,
TScriptCommands::CheckParams(Options, false);
}

if (!Session.IsEmpty() && !Data->Name.IsEmpty() && (Batch != TScript::BatchOff) && !Interactive)
if (!Session.IsEmpty() && (Data->Source != ::ssNone) && (Batch != TScript::BatchOff) && !Interactive)
{
std::unique_ptr<TSessionData> DataWithFingerprint(Data->Clone());
DataWithFingerprint->LookupLastFingerprint();
Expand Down
2 changes: 1 addition & 1 deletion source/core/SessionData.cpp
Expand Up @@ -1944,7 +1944,7 @@ void __fastcall TSessionData::Modify()
}
}
//---------------------------------------------------------------------
UnicodeString __fastcall TSessionData::GetSource()
UnicodeString __fastcall TSessionData::GetSourceName()
{
switch (FSource)
{
Expand Down
5 changes: 3 additions & 2 deletions source/core/SessionData.h
Expand Up @@ -451,7 +451,7 @@ friend class TStoredSessionList;
UnicodeString __fastcall GetLocalName();
UnicodeString __fastcall GetFolderName();
void __fastcall Modify();
UnicodeString __fastcall GetSource();
UnicodeString __fastcall GetSourceName();
void __fastcall DoLoad(THierarchicalStorage * Storage, bool PuttyImport, bool & RewritePassword, bool Unsafe, bool RespectDisablePasswordStoring);
void __fastcall DoSave(THierarchicalStorage * Storage,
bool PuttyExport, const TSessionData * Default, bool DoNotEncryptPasswords);
Expand Down Expand Up @@ -739,7 +739,8 @@ friend class TStoredSessionList;
__property int OrigPortNumber = { read = FOrigPortNumber };
__property UnicodeString LocalName = { read = GetLocalName };
__property UnicodeString FolderName = { read = GetFolderName };
__property UnicodeString Source = { read = GetSource };
__property TSessionSource Source = { read = FSource };
__property UnicodeString SourceName = { read = GetSourceName };
__property bool SaveOnly = { read = FSaveOnly };
};
//---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion source/core/SessionInfo.cpp
Expand Up @@ -1231,7 +1231,7 @@ void __fastcall TSessionLog::DoAddStartupInfo(TSessionData * Data)
}
else
{
ADF(L"Session name: %s (%s)", (Data->SessionName, Data->Source));
ADF(L"Session name: %s (%s)", (Data->SessionName, Data->SourceName));
UnicodeString AddressFamily;
if (Data->AddressFamily != afAuto)
{
Expand Down

0 comments on commit 6eed42a

Please sign in to comment.