diff options
Diffstat (limited to 'source4/torture/libnet/libnet_rpc.c')
-rw-r--r-- | source4/torture/libnet/libnet_rpc.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c index 723a2fd40b..b7d94813a6 100644 --- a/source4/torture/libnet/libnet_rpc.c +++ b/source4/torture/libnet/libnet_rpc.c @@ -22,6 +22,8 @@ #include "includes.h" #include "lib/cmdline/popt_common.h" #include "libnet/libnet.h" +#include "libcli/security/security.h" +#include "librpc/ndr/libndr.h" #include "librpc/gen_ndr/ndr_lsa.h" #include "librpc/gen_ndr/ndr_samr.h" #include "librpc/rpc/dcerpc.h" @@ -50,6 +52,34 @@ static BOOL test_lsa_connect(struct libnet_context *ctx) } +static BOOL test_lsa_dcinfo_connect(struct libnet_context *ctx) +{ + NTSTATUS status; + struct libnet_RpcConnect connect; + connect.level = LIBNET_RPC_CONNECT_DC_INFO; + connect.in.binding = lp_parm_string(-1, "torture", "binding"); + connect.in.dcerpc_iface = &dcerpc_table_lsarpc; + + status = libnet_RpcConnect(ctx, ctx, &connect); + + if (!NT_STATUS_IS_OK(status)) { + printf("Couldn't connect to rpc service %s on %s: %s\n", + connect.in.dcerpc_iface->name, connect.in.binding, + nt_errstr(status)); + + return False; + } + + printf("Domain Controller Info:\n"); + printf("\tDomain Name:\t %s\n", connect.out.domain_name); + printf("\tDomain SID:\t %s\n", dom_sid_string(ctx, connect.out.domain_sid)); + printf("\tRealm:\t\t %s\n", connect.out.realm); + printf("\tGUID:\t\t %s\n", GUID_string(ctx, connect.out.guid)); + + return True; +} + + static BOOL test_samr_connect(struct libnet_context *ctx) { NTSTATUS status; @@ -84,6 +114,12 @@ BOOL torture_rpc_connect(struct torture_context *torture) return False; } + printf("Testing connection with domain info to lsarpc interface\n"); + if (!test_lsa_dcinfo_connect(ctx)) { + printf("failed to connect lsarpc interface\n"); + return False; + } + printf("Testing connection to SAMR service\n"); if (!test_samr_connect(ctx)) { printf("failed to connect samr interface\n"); |