Commit 2655ca25 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

ntdsapi: Implement DsClientMakeSpnForTargetServerW.

parent a8baf4d3
...@@ -203,3 +203,29 @@ DWORD WINAPI DsServerRegisterSpnW(DS_SPN_WRITE_OP operation, LPCWSTR ServiceClas ...@@ -203,3 +203,29 @@ DWORD WINAPI DsServerRegisterSpnW(DS_SPN_WRITE_OP operation, LPCWSTR ServiceClas
debugstr_w(ServiceClass), debugstr_w(UserObjectDN)); debugstr_w(ServiceClass), debugstr_w(UserObjectDN));
return ERROR_CALL_NOT_IMPLEMENTED; 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 @@ ...@@ -7,7 +7,7 @@
@ stub DsBindWithSpnA @ stub DsBindWithSpnA
@ stub DsBindWithSpnW @ stub DsBindWithSpnW
@ stub DsClientMakeSpnForTargetServerA @ stub DsClientMakeSpnForTargetServerA
@ stub DsClientMakeSpnForTargetServerW @ stdcall DsClientMakeSpnForTargetServerW(wstr wstr ptr ptr)
@ stub DsCrackNamesA @ stub DsCrackNamesA
@ stub DsCrackNamesW @ stub DsCrackNamesW
@ stub DsCrackSpn2A @ stub DsCrackSpn2A
......
...@@ -84,7 +84,38 @@ static void test_DsMakeSpn(void) ...@@ -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); 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 ) START_TEST( ntdsapi )
{ {
test_DsMakeSpn(); test_DsMakeSpn();
test_DsClientMakeSpnForTargetServer();
} }
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
extern "C" { extern "C" {
#endif #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 DsMakeSpnA(LPCSTR, LPCSTR, LPCSTR, USHORT, LPCSTR, DWORD*, LPSTR);
DWORD WINAPI DsMakeSpnW(LPCWSTR, LPCWSTR, LPCWSTR, USHORT, LPCWSTR, DWORD*, LPWSTR); DWORD WINAPI DsMakeSpnW(LPCWSTR, LPCWSTR, LPCWSTR, USHORT, LPCWSTR, DWORD*, LPWSTR);
#define DsMakeSpn WINELIB_NAME_AW(DsMakeSpn) #define DsMakeSpn WINELIB_NAME_AW(DsMakeSpn)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment