Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NCL-1920: Add wild card on sophos adapter query #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Likith-Gowdahs
Copy link

Issue : In some systems where the Sophos connect tap adapter has a count suffixed to it name. Then the adapter query from strongswan would fail because of the count added at the end.

Fix: make the query more robust (wild card) so that it can query the adapter even if then name has a count suffixed

@Likith-Gowdahs Likith-Gowdahs requested a review from akodithy July 18, 2024 08:14
@@ -212,7 +212,7 @@ static int GetTapAdapterInfo( IWbemServices *pSvc, int *iface_idx, wchar_t *dns1
{
// Allocate our strings
language = SysAllocString( L"WQL" );
query = SysAllocString( L"SELECT * FROM Win32_NetworkAdapterConfiguration where Description LIKE 'Sophos TAP Adapter'" );
query = SysAllocString( L"SELECT * FROM Win32_NetworkAdapterConfiguration where Description LIKE 'Sophos TAP Adapter%'" );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be any issue because of this expectation in line 226 that we assume only 1 matching result but this query returns more than 1?

@@ -212,7 +212,7 @@ static int GetTapAdapterInfo( IWbemServices *pSvc, int *iface_idx, wchar_t *dns1
{
// Allocate our strings
language = SysAllocString( L"WQL" );
query = SysAllocString( L"SELECT * FROM Win32_NetworkAdapterConfiguration where Description LIKE 'Sophos TAP Adapter'" );
query = SysAllocString( L"SELECT * FROM Win32_NetworkAdapterConfiguration where Description LIKE 'Sophos TAP Adapter%'" );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming that we expect either "Sophos TAP Adapter" or "Sophos TAP Adapter1", "Sophos TAP Adapter2"? If this is correct, can we tighten the query like below? Basically checking for prefix string "Sophos TAP Adapter" and then checking either empty or single digit number?

where Description LIKE 'Sophos TAP Adapter%' AND (Description LIKE '%[0-9]' OR Description NOT LIKE '%[^0-9]')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants