diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-07-22 18:20:07 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:10:17 -0500 |
commit | 7718ef4c6649bfed415b4034e960f1f3dcc07bdb (patch) | |
tree | 5e2ed3b33c9747b4b3bc5721247e607b6afdf705 /source4/torture | |
parent | 49f68caed20d2a7d1850e493005bdf85929d6365 (diff) | |
download | samba-7718ef4c6649bfed415b4034e960f1f3dcc07bdb.tar.gz samba-7718ef4c6649bfed415b4034e960f1f3dcc07bdb.tar.bz2 samba-7718ef4c6649bfed415b4034e960f1f3dcc07bdb.zip |
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)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/rpc.c | 1 | ||||
-rw-r--r-- | source4/torture/rpc/samba3rpc.c | 77 |
2 files changed, 78 insertions, 0 deletions
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; i<ARRAY_SIZE(levels); i++) { + struct lsa_QueryInfoPolicy r; + r.in.handle = &lsa_handle; + r.in.level = levels[i]; + status = dcerpc_lsa_QueryInfoPolicy(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + d_printf("(%s) dcerpc_lsa_QueryInfoPolicy %d " + "failed: %s\n", __location__, + levels[i], nt_errstr(status)); + talloc_free(mem_ctx); + return False; + } + if (levels[i] == 5) { + domain_sid = r.out.info->account_domain.sid; + } + } + } + + return ret; +} |