ntdsapi: Implement DsClientMakeSpnForTargetServerW.
This commit is contained in:
parent
a8baf4d3ef
commit
2655ca2538
|
@ -203,3 +203,29 @@ DWORD WINAPI DsServerRegisterSpnW(DS_SPN_WRITE_OP operation, LPCWSTR ServiceClas
|
|||
debugstr_w(ServiceClass), debugstr_w(UserObjectDN));
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
DWORD WINAPI DsClientMakeSpnForTargetServerW(LPCWSTR class, LPCWSTR name, DWORD *buflen, LPWSTR buf)
|
||||
{
|
||||
DWORD len;
|
||||
WCHAR *p;
|
||||
|
||||
TRACE("(%s,%s,%p,%p)\n", debugstr_w(class), debugstr_w(name), buflen, buf);
|
||||
|
||||
if (!class || !name || !buflen) return ERROR_INVALID_PARAMETER;
|
||||
|
||||
len = strlenW(class) + 1 + strlenW(name) + 1;
|
||||
if (*buflen < len)
|
||||
{
|
||||
*buflen = len;
|
||||
return ERROR_BUFFER_OVERFLOW;
|
||||
}
|
||||
*buflen = len;
|
||||
|
||||
memcpy(buf, class, strlenW(class) * sizeof(WCHAR));
|
||||
p = buf + strlenW(class);
|
||||
*p++ = '/';
|
||||
memcpy(p, name, strlenW(name) * sizeof(WCHAR));
|
||||
buf[len] = 0;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
@ stub DsBindWithSpnA
|
||||
@ stub DsBindWithSpnW
|
||||
@ stub DsClientMakeSpnForTargetServerA
|
||||
@ stub DsClientMakeSpnForTargetServerW
|
||||
@ stdcall DsClientMakeSpnForTargetServerW(wstr wstr ptr ptr)
|
||||
@ stub DsCrackNamesA
|
||||
@ stub DsCrackNamesW
|
||||
@ stub DsCrackSpn2A
|
||||
|
|
|
@ -84,7 +84,38 @@ static void test_DsMakeSpn(void)
|
|||
ok(spn_length == lstrlenW(wszSpn5) + 1, "DsMakeSpnW should have returned spn_length of %d instead of %d\n", lstrlenW(wszSpn5) + 1, spn_length);
|
||||
}
|
||||
|
||||
static void test_DsClientMakeSpnForTargetServer(void)
|
||||
{
|
||||
static const WCHAR classW[] = {'c','l','a','s','s',0};
|
||||
static const WCHAR hostW[] = {'h','o','s','t','.','d','o','m','a','i','n',0};
|
||||
static const WCHAR resultW[] = {'c','l','a','s','s','/','h','o','s','t','.','d','o','m','a','i','n',0};
|
||||
DWORD ret, len;
|
||||
WCHAR buf[256];
|
||||
|
||||
ret = DsClientMakeSpnForTargetServerW( NULL, NULL, NULL, NULL );
|
||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||
|
||||
ret = DsClientMakeSpnForTargetServerW( classW, NULL, NULL, NULL );
|
||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||
|
||||
ret = DsClientMakeSpnForTargetServerW( classW, hostW, NULL, NULL );
|
||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||
|
||||
len = 0;
|
||||
ret = DsClientMakeSpnForTargetServerW( classW, hostW, &len, NULL );
|
||||
ok( ret == ERROR_BUFFER_OVERFLOW, "got %u\n", ret );
|
||||
ok( len == lstrlenW(resultW) + 1, "got %u\n", len );
|
||||
|
||||
len = sizeof(buf)/sizeof(buf[0]);
|
||||
buf[0] = 0;
|
||||
ret = DsClientMakeSpnForTargetServerW( classW, hostW, &len, buf );
|
||||
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
||||
ok( len == lstrlenW(resultW) + 1, "got %u\n", len );
|
||||
ok( !lstrcmpW( buf, resultW ), "wrong data\n" );
|
||||
}
|
||||
|
||||
START_TEST( ntdsapi )
|
||||
{
|
||||
test_DsMakeSpn();
|
||||
test_DsClientMakeSpnForTargetServer();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
DWORD WINAPI DsClientMakeSpnForTargetServerA(LPCSTR, LPCSTR, DWORD*, LPSTR);
|
||||
DWORD WINAPI DsClientMakeSpnForTargetServerW(LPCWSTR, LPCWSTR, DWORD*, LPWSTR);
|
||||
#define DsClientMakeSpnForTargetServer WINELIB_NAME_AW(DsClientMakeSpnForTargetServer)
|
||||
|
||||
DWORD WINAPI DsMakeSpnA(LPCSTR, LPCSTR, LPCSTR, USHORT, LPCSTR, DWORD*, LPSTR);
|
||||
DWORD WINAPI DsMakeSpnW(LPCWSTR, LPCWSTR, LPCWSTR, USHORT, LPCWSTR, DWORD*, LPWSTR);
|
||||
#define DsMakeSpn WINELIB_NAME_AW(DsMakeSpn)
|
||||
|
|
Loading…
Reference in New Issue