From 7718ef4c6649bfed415b4034e960f1f3dcc07bdb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 22 Jul 2006 18:20:07 +0000 Subject: r17187: Beginnings of a little lsa walker for Samba3, if only to prevent the regression we had in 3.0.23... Volker (This used to be commit 0236f3b41a4f9015f8551ffb67db59fa48212bf5) --- source4/torture/rpc/rpc.c | 1 + source4/torture/rpc/samba3rpc.c | 77 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) (limited to 'source4') diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 752659c48a..67ad1f1ae5 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -134,6 +134,7 @@ NTSTATUS torture_rpc_init(void) torture_samba3_rpc_sharesec); register_torture_op("RPC-SAMBA3-GETUSERNAME", torture_samba3_rpc_getusername); + register_torture_op("RPC-SAMBA3-LSA", torture_samba3_rpc_lsa); register_torture_op("RPC-DRSUAPI", torture_rpc_drsuapi); register_torture_op("RPC-CRACKNAMES", torture_rpc_drsuapi_cracknames); register_torture_op("RPC-ROT", torture_rpc_rot); diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index aa5089b724..cd7eb7c581 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -2071,3 +2071,80 @@ BOOL torture_samba3_rpc_sharesec(struct torture_context *torture) talloc_free(mem_ctx); return ret; } + +BOOL torture_samba3_rpc_lsa(struct torture_context *torture) +{ + TALLOC_CTX *mem_ctx; + BOOL ret = True; + struct smbcli_state *cli; + struct dcerpc_pipe *p; + struct policy_handle lsa_handle; + NTSTATUS status; + struct dom_sid *domain_sid; + + if (!(mem_ctx = talloc_new(torture))) { + return False; + } + + if (!(torture_open_connection_share( + mem_ctx, &cli, lp_parm_string(-1, "torture", "host"), + "IPC$", NULL))) { + d_printf("IPC$ connection failed\n"); + talloc_free(mem_ctx); + return False; + } + + p = pipe_bind_smb(mem_ctx, cli->tree, "\\lsarpc", + &dcerpc_table_lsarpc); + if (p == NULL) { + d_printf("(%s) pipe_bind_smb failed\n", __location__); + talloc_free(mem_ctx); + return False; + } + + { + struct lsa_ObjectAttribute attr; + struct lsa_OpenPolicy2 o; + o.in.system_name = talloc_asprintf( + mem_ctx, "\\\\%s", dcerpc_server_name(p)); + ZERO_STRUCT(attr); + o.in.attr = &attr; + o.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; + o.out.handle = &lsa_handle; + status = dcerpc_lsa_OpenPolicy2(p, mem_ctx, &o); + if (!NT_STATUS_IS_OK(status)) { + d_printf("(%s) dcerpc_lsa_OpenPolicy2 failed: %s\n", + __location__, nt_errstr(status)); + talloc_free(mem_ctx); + return False; + } + } + +#if 0 + p->conn->flags |= DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT; +#endif + + { + int i; + int levels[] = { 2,3,5,6 }; + + for (i=0; iaccount_domain.sid; + } + } + } + + return ret; +} -- cgit