wbemprox: Accept the root\default namespace.

This commit is contained in:
Hans Leidekker 2013-08-21 14:09:28 +02:00 committed by Alexandre Julliard
parent 00bbc62010
commit d799a664f4
2 changed files with 11 additions and 2 deletions

View File

@ -108,6 +108,9 @@ static void test_IWbemLocator(void)
static const WCHAR path19W[] = {'R','O','O','T','\\','\\','C','I','M','V','2',0}; static const WCHAR path19W[] = {'R','O','O','T','\\','\\','C','I','M','V','2',0};
static const WCHAR path20W[] = {'R','O','O','T','\\','C','I','M','V','2','\\',0}; static const WCHAR path20W[] = {'R','O','O','T','\\','C','I','M','V','2','\\',0};
static const WCHAR path21W[] = {'R','O','O','T','/','C','I','M','V','2',0}; static const WCHAR path21W[] = {'R','O','O','T','/','C','I','M','V','2',0};
static const WCHAR path22W[] = {'r','o','o','t','\\','d','e','f','a','u','l','t',0};
static const WCHAR path23W[] = {'r','o','o','t','\\','c','i','m','v','0',0};
static const WCHAR path24W[] = {'r','o','o','t','\\','c','i','m','v','1',0};
static const struct static const struct
{ {
const WCHAR *path; const WCHAR *path;
@ -138,7 +141,10 @@ static void test_IWbemLocator(void)
{ path18W, S_OK }, { path18W, S_OK },
{ path19W, WBEM_E_INVALID_NAMESPACE }, { path19W, WBEM_E_INVALID_NAMESPACE },
{ path20W, WBEM_E_INVALID_NAMESPACE }, { path20W, WBEM_E_INVALID_NAMESPACE },
{ path21W, S_OK } { path21W, S_OK },
{ path22W, S_OK },
{ path23W, WBEM_E_INVALID_NAMESPACE },
{ path24W, WBEM_E_INVALID_NAMESPACE }
}; };
IWbemLocator *locator; IWbemLocator *locator;
IWbemServices *services; IWbemServices *services;

View File

@ -101,6 +101,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
{ {
static const WCHAR rootW[] = {'R','O','O','T'}; static const WCHAR rootW[] = {'R','O','O','T'};
static const WCHAR cimv2W[] = {'C','I','M','V','2'}; static const WCHAR cimv2W[] = {'C','I','M','V','2'};
static const WCHAR defaultW[] = {'D','E','F','A','U','L','T'};
HRESULT hr = WBEM_E_INVALID_NAMESPACE; HRESULT hr = WBEM_E_INVALID_NAMESPACE;
const WCHAR *p, *q; const WCHAR *p, *q;
unsigned int len; unsigned int len;
@ -138,7 +139,9 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
goto done; goto done;
} }
q++; q++;
if ((len = strlenW( q )) != sizeof(cimv2W) / sizeof(cimv2W[0]) || memicmpW( q, cimv2W, len )) len = strlenW( q );
if ((len != sizeof(cimv2W) / sizeof(cimv2W[0]) || memicmpW( q, cimv2W, len )) &&
(len != sizeof(defaultW) / sizeof(defaultW[0]) || memicmpW( q, defaultW, len )))
goto done; goto done;
if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY; if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
else else