summaryrefslogtreecommitdiff
path: root/source4/torture/libnet
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-05-29 21:59:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:42 -0500
commit2a87a112f7f5cfd2019b5781dac04b87770bd37e (patch)
treec449365d0573248cdaf4165626a70d952e4d90c4 /source4/torture/libnet
parent95399b1e66bf3e5d8e01f8b35973556d4d840191 (diff)
downloadsamba-2a87a112f7f5cfd2019b5781dac04b87770bd37e.tar.gz
samba-2a87a112f7f5cfd2019b5781dac04b87770bd37e.tar.bz2
samba-2a87a112f7f5cfd2019b5781dac04b87770bd37e.zip
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)
Diffstat (limited to 'source4/torture/libnet')
-rw-r--r--source4/torture/libnet/userinfo.c45
1 files changed, 41 insertions, 4 deletions
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) {