From 2a87a112f7f5cfd2019b5781dac04b87770bd37e Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Mon, 29 May 2006 21:59:55 +0000 Subject: r15939: Add tests for userinfo call with username argument provided which enables optional stage resolving username to a rid. rafal (This used to be commit f57a8ace6f55174a30f42a7c2cb01d6917c07be7) --- source4/torture/libnet/userinfo.c | 45 +++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'source4/torture/libnet/userinfo.c') diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index 1def112809..4a92f9689f 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -184,6 +184,7 @@ static BOOL test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) { + const uint16_t level = 5; NTSTATUS status; struct libnet_rpc_userinfo user; struct dom_sid *user_sid; @@ -192,9 +193,23 @@ static BOOL test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, user.in.domain_handle = *domain_handle; user.in.sid = dom_sid_string(mem_ctx, user_sid); - user.in.level = 5; /* this should be extended */ + user.in.level = level; /* this should be extended */ - printf("Testing sync libnet_rpc_userinfo\n"); + printf("Testing sync libnet_rpc_userinfo (SID argument)\n"); + status = libnet_rpc_userinfo(p, mem_ctx, &user); + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); + return False; + } + + ZERO_STRUCT(user); + + user.in.domain_handle = *domain_handle; + user.in.sid = NULL; + user.in.username = TEST_USERNAME; + user.in.level = level; + + printf("Testing sync libnet_rpc_userinfo (username argument)\n"); status = libnet_rpc_userinfo(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); @@ -234,6 +249,7 @@ static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct dom_sid2 *domain_sid, const char* user_name, uint32_t *rid) { + const uint16_t level = 10; NTSTATUS status; struct composite_context *c; struct libnet_rpc_userinfo user; @@ -243,9 +259,30 @@ static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, user.in.domain_handle = *domain_handle; user.in.sid = dom_sid_string(mem_ctx, user_sid); - user.in.level = 10; /* this should be extended */ + user.in.level = level; /* this should be extended */ + + printf("Testing async libnet_rpc_userinfo (SID argument)\n"); + + c = libnet_rpc_userinfo_send(p, &user, msg_handler); + if (!c) { + printf("Failed to call sync libnet_rpc_userinfo_send\n"); + return False; + } + + status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); + if (!NT_STATUS_IS_OK(status)) { + printf("Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); + return False; + } + + ZERO_STRUCT(user); + + user.in.domain_handle = *domain_handle; + user.in.sid = NULL; + user.in.username = TEST_USERNAME; + user.in.level = level; - printf("Testing async libnet_rpc_userinfo\n"); + printf("Testing async libnet_rpc_userinfo (username argument)\n"); c = libnet_rpc_userinfo_send(p, &user, msg_handler); if (!c) { -- cgit