diff options
author | Günther Deschner <gd@samba.org> | 2008-07-31 21:09:00 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-08-11 19:14:19 +0200 |
commit | fabd6551b3e601c3c3cf921632a4a9f4c79ee847 (patch) | |
tree | e35b4c9b0e6f061ae792b4f251148dc95b894dcf /source3 | |
parent | cd1a1e3490ab7ba441f3f5caaad86dce88c2f57d (diff) | |
download | samba-fabd6551b3e601c3c3cf921632a4a9f4c79ee847.tar.gz samba-fabd6551b3e601c3c3cf921632a4a9f4c79ee847.tar.bz2 samba-fabd6551b3e601c3c3cf921632a4a9f4c79ee847.zip |
netapi: add NetUserModalsGet and NetUserModalsSet tests.
Guenther
(This used to be commit a9c444a342968b539918c082b78af8640f8c87cd)
Diffstat (limited to 'source3')
-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"); |