r5651: A bit more code in userinfo test and hook up test function to
authorRafal Szczesniak <mimir@samba.org>
Fri, 4 Mar 2005 00:24:21 +0000 (00:24 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:10:56 +0000 (13:10 -0500)
main torture binary.

rafal
(This used to be commit 94955e5325ceddd35673da74afb19d1676b5b23c)

source4/torture/libnet/userinfo.c
source4/torture/torture.c

index 4a28079251a1b7779190a62392f1c5680ae5bef5..ca5d5ab428318d7a6c056dfebdfac8ad0ffcd05e 100644 (file)
@@ -47,6 +47,8 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        r2.in.connect_handle = &h;
        r2.in.domain_name = domname;
 
+       printf("domain lookup\n");
+
        status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2);
        if (!NT_STATUS_IS_OK(status)) {
                printf("LookupDomain failed - %s\n", nt_errstr(status));
@@ -58,6 +60,8 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        r3.in.sid = r2.out.sid;
        r3.out.domain_handle = &domain_handle;
 
+       printf("opening domain\n");
+
        status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3);
        if (!NT_STATUS_IS_OK(status)) {
                printf("OpenDomain failed - %s\n", nt_errstr(status));
@@ -71,14 +75,17 @@ static BOOL test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 BOOL torture_userinfo(void)
 {
        NTSTATUS status;
+       const char *binding;
        struct dcerpc_pipe *p;
+       struct dcerpc_binding b;
        TALLOC_CTX *mem_ctx;
        BOOL ret = True;
        struct policy_handle h;
-       struct samr_String name = { 4, 4, "TEST" };
+       struct samr_String name;
 
        mem_ctx = talloc_init("test_userinfo");
-       
+       binding = lp_parm_string(-1, "torture", "binding");
+
        status = torture_rpc_connection(&p,
                                        DCERPC_SAMR_NAME,
                                        DCERPC_SAMR_UUID,
@@ -88,12 +95,21 @@ BOOL torture_userinfo(void)
                return False;
        }
 
+       status = dcerpc_parse_binding(mem_ctx, binding, &b);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("failed to parse dcerpc binding '%s'\n", binding);
+               talloc_free(mem_ctx);
+               ret = False;
+               goto done;
+       }
+       name.string = b.host;
+
        if (!test_opendomain(p, mem_ctx, &h, &name)) {
                ret = False;
        }
 
+done:
        talloc_free(mem_ctx);
-       
        torture_rpc_close(p);
 
        return ret;
index b589902b66cb2952ca0f779e5f4c7c01d4d1f477..09be1e1fe3d03a9fae3890034a6a6b288b8fbbc0 100644 (file)
@@ -2426,6 +2426,9 @@ static struct {
        {"NBT-REGISTER", torture_nbt_register, 0},
        {"NBT-WINS", torture_nbt_wins, 0},
        {"NBT-WINSREPLICATION", torture_nbt_winsreplication, 0},
+       
+       /* libnet tests */
+       {"NET-USERINFO", torture_userinfo, 0},
 
        {NULL, NULL, 0}};