summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/rpc/join.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/source4/torture/rpc/join.c b/source4/torture/rpc/join.c
new file mode 100644
index 0000000000..beb313c3d2
--- /dev/null
+++ b/source4/torture/rpc/join.c
@@ -0,0 +1,43 @@
+#include "includes.h"
+#include "lib/cmdline/popt_common.h"
+#include "libnet/libnet.h"
+#include "lib/ldb/include/ldb.h"
+
+#define TORTURE_NETBIOS_NAME "smbtorturejoin"
+
+
+BOOL torture_rpc_join(void)
+{
+ struct test_join *tj;
+ const char *machine_password;
+
+ /* Join domain as a member server. */
+ tj = torture_join_domain(TORTURE_NETBIOS_NAME,
+ ACB_WSTRUST,
+ &machine_password);
+
+ if (!tj) {
+ DEBUG(0, ("%s failed to join domain\n",
+ TORTURE_NETBIOS_NAME));
+ return False;
+ }
+
+ /* Leave domain. */
+ torture_leave_domain(tj);
+
+ /* Join domain as a domain controller. */
+ tj = torture_join_domain(TORTURE_NETBIOS_NAME,
+ ACB_SVRTRUST,
+ &machine_password);
+ if (!tj) {
+ DEBUG(0, ("%s failed to join domain %s.\n",
+ TORTURE_NETBIOS_NAME, lp_workgroup()));
+ return False;
+ }
+
+ /* Leave domain. */
+ torture_leave_domain(tj);
+
+ return True;
+}
+