summaryrefslogtreecommitdiffstats
path: root/source4/torture/rpc/dfs.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-11-06 01:24:07 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:44:25 +0100
commitbffef39e71e543cfa7520884e4484680e5e260ce (patch)
tree29cca762e66242b961ffce2ce95e0cd8d6b092b5 /source4/torture/rpc/dfs.c
parentba4a5bb2ea2cf81869585bc518b2da2108cd0c28 (diff)
downloadsamba-bffef39e71e543cfa7520884e4484680e5e260ce.tar.gz
samba-bffef39e71e543cfa7520884e4484680e5e260ce.tar.xz
samba-bffef39e71e543cfa7520884e4484680e5e260ce.zip
r25848: Add IDL and torture test for dfs_SetDcAddress and dfs_GetDcAddress.
Guenther (This used to be commit 8fb5d36734cb19dcbcf5e22c43e80db7646e82fa)
Diffstat (limited to 'source4/torture/rpc/dfs.c')
-rw-r--r--source4/torture/rpc/dfs.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c
index 56b0febb4dc..5596a5cadf2 100644
--- a/source4/torture/rpc/dfs.c
+++ b/source4/torture/rpc/dfs.c
@@ -522,6 +522,80 @@ static bool test_StdRoot(struct dcerpc_pipe *p,
return ret;
}
+static bool test_GetDcAddress(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx,
+ const char *host)
+{
+ NTSTATUS status;
+ struct dfs_GetDcAddress r;
+ uint8_t is_root = 0;
+ uint32_t ttl = 0;
+ const char *ptr;
+
+ printf("Testing GetDcAddress\n");
+
+ ptr = host;
+
+ r.in.servername = host;
+ r.in.server_fullname = r.out.server_fullname = &ptr;
+ r.in.is_root = r.out.is_root = &is_root;
+ r.in.ttl = r.out.ttl = &ttl;
+
+ status = dcerpc_dfs_GetDcAddress(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("GetDcAddress failed - %s\n", nt_errstr(status));
+ return false;
+ } else if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("dfs_GetDcAddress failed - %s\n",
+ win_errstr(r.out.result));
+ return false;
+ }
+
+ return true;
+}
+
+static bool test_SetDcAddress(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx,
+ const char *host)
+{
+ NTSTATUS status;
+ struct dfs_SetDcAddress r;
+
+ printf("Testing SetDcAddress\n");
+
+ r.in.servername = host;
+ r.in.server_fullname = host;
+ r.in.flags = 0;
+ r.in.ttl = 1000;
+
+ status = dcerpc_dfs_SetDcAddress(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetDcAddress failed - %s\n", nt_errstr(status));
+ return false;
+ } else if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("dfs_SetDcAddress failed - %s\n",
+ win_errstr(r.out.result));
+ return false;
+ }
+
+ return true;
+}
+
+static bool test_DcAddress(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx,
+ const char *host)
+{
+ if (!test_GetDcAddress(p, mem_ctx, host)) {
+ return false;
+ }
+
+ if (!test_SetDcAddress(p, mem_ctx, host)) {
+ return false;
+ }
+
+ return true;
+}
+
bool torture_rpc_dfs(struct torture_context *torture)
{
NTSTATUS status;
@@ -538,6 +612,7 @@ bool torture_rpc_dfs(struct torture_context *torture)
ret &= test_Enum(p, torture);
ret &= test_EnumEx(p, torture, host);
ret &= test_StdRoot(p, torture, host);
+ ret &= test_DcAddress(p, torture, host);
return ret;
}