diff options
-rw-r--r-- | source3/lib/netapi/tests/netuser.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/source3/lib/netapi/tests/netuser.c b/source3/lib/netapi/tests/netuser.c index ca2dc1a2f4..c50e384951 100644 --- a/source3/lib/netapi/tests/netuser.c +++ b/source3/lib/netapi/tests/netuser.c @@ -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"); |