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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libcharon/plugins/windows_dns/windows_dns_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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?

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]')


// Get the current DNS servers list for our adapter
hres = pSvc->lpVtbl->ExecQuery( pSvc, language, query, WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator );
Expand Down
Loading