mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
netapi: add NetUserModalsGet and NetUserModalsSet tests.
Guenther
(This used to be commit a9c444a342
)
This commit is contained in:
parent
cd1a1e3490
commit
fabd6551b3
@ -152,6 +152,56 @@ NET_API_STATUS test_netuseradd(const char *hostname,
|
||||
return NetUserAdd(hostname, 1, (uint8_t *)&u1, &parm_err);
|
||||
}
|
||||
|
||||
static NET_API_STATUS test_netusermodals(struct libnetapi_ctx *ctx,
|
||||
const char *hostname)
|
||||
{
|
||||
NET_API_STATUS status;
|
||||
struct USER_MODALS_INFO_0 *u0 = NULL;
|
||||
struct USER_MODALS_INFO_0 *_u0 = NULL;
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t parm_err = 0;
|
||||
uint32_t levels[] = { 0, 1, 2, 3 };
|
||||
int i = 0;
|
||||
|
||||
for (i=0; i<ARRAY_SIZE(levels); i++) {
|
||||
|
||||
printf("testing NetUserModalsGet level %d\n", levels[i]);
|
||||
|
||||
status = NetUserModalsGet(hostname, levels[i], &buffer);
|
||||
if (status) {
|
||||
NETAPI_STATUS(ctx, status, "NetUserModalsGet");
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
status = NetUserModalsGet(hostname, 0, (uint8_t **)&u0);
|
||||
if (status) {
|
||||
NETAPI_STATUS(ctx, status, "NetUserModalsGet");
|
||||
return status;
|
||||
}
|
||||
|
||||
printf("testing NetUserModalsSet\n");
|
||||
|
||||
status = NetUserModalsSet(hostname, 0, (uint8_t *)u0, &parm_err);
|
||||
if (status) {
|
||||
NETAPI_STATUS(ctx, status, "NetUserModalsSet");
|
||||
return status;
|
||||
}
|
||||
|
||||
status = NetUserModalsGet(hostname, 0, (uint8_t **)&_u0);
|
||||
if (status) {
|
||||
NETAPI_STATUS(ctx, status, "NetUserModalsGet");
|
||||
return status;
|
||||
}
|
||||
|
||||
if (memcmp(u0, _u0, sizeof(u0) != 0)) {
|
||||
printf("USER_MODALS_INFO_0 struct has changed!!!!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
NET_API_STATUS netapitest_user(struct libnetapi_ctx *ctx,
|
||||
const char *hostname)
|
||||
{
|
||||
@ -246,6 +296,11 @@ NET_API_STATUS netapitest_user(struct libnetapi_ctx *ctx,
|
||||
goto out;
|
||||
}
|
||||
|
||||
status = test_netusermodals(ctx, hostname);
|
||||
if (status) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
status = 0;
|
||||
|
||||
printf("NetUser tests succeeded\n");
|
||||
|
Loading…
Reference in New Issue
Block a user