r26212: Make test_NetrJoinDomain2() a little more robust against missing parameters.
authorGünther Deschner <gd@samba.org>
Thu, 29 Nov 2007 22:22:49 +0000 (23:22 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:46:54 +0000 (05:46 +0100)
Guenther
(This used to be commit 08aad347e8fd25f480ecf9b1283575012792cf71)

source4/torture/rpc/wkssvc.c

index 5e0be1f5b522e1186263a40be2a1bc1c703e12a7..f82238da61b2cef7e322ce4c630fb71a0e4f4ccc 100644 (file)
@@ -1198,10 +1198,11 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
        struct wkssvc_NetrJoinDomain2 r;
        const char *domain_admin_account = NULL;
        const char *domain_admin_password = NULL;
+       const char *domain_name = NULL;
        struct wkssvc_PasswordBuffer pwd_buf;
        enum wkssvc_NetJoinStatus join_status;
        const char *join_name = NULL;
-       WERROR expected_err = WERR_OK;
+       WERROR expected_err;
 
        /* FIXME: this test assumes to join workstations / servers and does not
         * handle DCs (WERR_SETUP_DOMAIN_CONTROLLER) */
@@ -1218,6 +1219,8 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
                case NetSetupUnknownStatus:
                case NetSetupUnjoined:
                case NetSetupWorkgroupName:
+               default:
+                       expected_err = WERR_OK;
                        break;
        }
 
@@ -1229,6 +1232,17 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
                                               "torture",
                                               "domain_admin_password");
 
+       domain_name = lp_parm_string(global_loadparm, NULL,
+                                    "torture",
+                                    "domain_name");
+
+       if ((domain_admin_account == NULL) ||
+           (domain_admin_password == NULL) ||
+           (domain_name == NULL)) {
+               torture_comment(tctx, "not enough input parameter\n");
+               return false;
+       }
+
        if (!encode_wkssvc_join_password_buffer(tctx, p,
                                                domain_admin_password,
                                                &pwd_buf))
@@ -1237,7 +1251,7 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
        }
 
        r.in.server_name = dcerpc_server_name(p);
-       r.in.domain_name = lp_realm(global_loadparm);
+       r.in.domain_name = domain_name;
        r.in.account_ou = NULL;
        r.in.admin_account = domain_admin_account;
        r.in.encrypted_password = &pwd_buf;