werror: replace WERR_UNKNOWN_LEVEL with WERR_INVALID_LEVEL in source4/torture/rpc/
[amitay/samba.git] / source4 / torture / rpc / wkssvc.c
index a8556c58cf721c11aa44a741c56839d13cd55381..e19523f172e78551ecd2f89611235e1dbfd32dd2 100644 (file)
@@ -129,7 +129,7 @@ static bool test_NetrWkstaTransportAdd(struct torture_context *tctx,
        torture_assert_ntstatus_ok(tctx, status,
                                   "NetrWkstaTransportAdd failed");
        torture_assert_werr_equal(tctx, r.out.result,
-                                 WERR_INVALID_PARAM,
+                                 WERR_INVALID_PARAMETER,
                                  "NetrWkstaTransportAdd level 0 failed");
 
        return true;
@@ -217,7 +217,7 @@ static bool test_NetrWkstaUserGetInfo(struct torture_context *tctx,
        NTSTATUS status;
        struct wkssvc_NetrWkstaUserGetInfo r;
        union wkssvc_NetrWkstaUserInfo info;
-       const char *dom = lp_workgroup(tctx->lp_ctx);
+       const char *dom = lpcfg_workgroup(tctx->lp_ctx);
        struct cli_credentials *creds = cmdline_credentials;
        const char *user = cli_credentials_get_username(creds);
        int i;
@@ -231,12 +231,12 @@ static bool test_NetrWkstaUserGetInfo(struct torture_context *tctx,
                { NULL, 0, WERR_NO_SUCH_LOGON_SESSION },
                { NULL, 1, WERR_NO_SUCH_LOGON_SESSION },
                { NULL, 1101, WERR_OK },
-               { dom, 0, WERR_INVALID_PARAM },
-               { dom, 1, WERR_INVALID_PARAM },
-               { dom, 1101, WERR_INVALID_PARAM },
-               { user, 0, WERR_INVALID_PARAM },
-               { user, 1, WERR_INVALID_PARAM },
-               { user, 1101, WERR_INVALID_PARAM },
+               { dom, 0, WERR_INVALID_PARAMETER },
+               { dom, 1, WERR_INVALID_PARAMETER },
+               { dom, 1101, WERR_INVALID_PARAMETER },
+               { user, 0, WERR_INVALID_PARAMETER },
+               { user, 1, WERR_INVALID_PARAMETER },
+               { user, 1101, WERR_INVALID_PARAMETER },
        };
 
        for (i=0; i<ARRAY_SIZE(tests); i++) {
@@ -346,7 +346,7 @@ static bool test_NetrUseAdd(struct torture_context *tctx,
        status = dcerpc_wkssvc_NetrUseAdd_r(b, tctx, &r);
        torture_assert_ntstatus_ok(tctx, status,
                                   "NetrUseAdd failed");
-       torture_assert_werr_equal(tctx, r.out.result, WERR_UNKNOWN_LEVEL,
+       torture_assert_werr_equal(tctx, r.out.result, WERR_INVALID_LEVEL,
                               "NetrUseAdd failed");
 
        ZERO_STRUCT(r);
@@ -476,7 +476,7 @@ static bool test_NetrUseGetInfo(struct torture_context *tctx,
 
                        if (!test_NetrUseGetInfo_level(tctx, p, use_name,
                                                       levels[i],
-                                                      WERR_NOT_CONNECTED))
+                                                      WERR_NERR_USENOTFOUND))
                        {
                                if (levels[i] != 0) {
                                        return false;
@@ -495,7 +495,7 @@ static bool test_NetrLogonDomainNameAdd(struct torture_context *tctx,
        struct wkssvc_NetrLogonDomainNameAdd r;
        struct dcerpc_binding_handle *b = p->binding_handle;
 
-       r.in.domain_name = lp_workgroup(tctx->lp_ctx);
+       r.in.domain_name = lpcfg_workgroup(tctx->lp_ctx);
 
        torture_comment(tctx, "Testing NetrLogonDomainNameAdd\n");
 
@@ -514,7 +514,7 @@ static bool test_NetrLogonDomainNameDel(struct torture_context *tctx,
        struct wkssvc_NetrLogonDomainNameDel r;
        struct dcerpc_binding_handle *b = p->binding_handle;
 
-       r.in.domain_name = lp_workgroup(tctx->lp_ctx);
+       r.in.domain_name = lpcfg_workgroup(tctx->lp_ctx);
 
        torture_comment(tctx, "Testing NetrLogonDomainNameDel\n");
 
@@ -530,7 +530,7 @@ static bool test_NetrEnumerateComputerNames_level(struct torture_context *tctx,
                                                  struct dcerpc_pipe *p,
                                                  uint16_t level,
                                                  const char ***names,
-                                                 int *num_names)
+                                                 size_t *num_names)
 {
        NTSTATUS status;
        struct wkssvc_NetrEnumerateComputerNames r;
@@ -610,7 +610,7 @@ static bool test_NetrValidateName(struct torture_context *tctx,
        for (i=0; i<ARRAY_SIZE(levels); i++) {
 
                r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
-               r.in.name = lp_workgroup(tctx->lp_ctx);
+               r.in.name = lpcfg_workgroup(tctx->lp_ctx);
                r.in.Account = NULL;
                r.in.Password = NULL;
                r.in.name_type = levels[i];
@@ -641,7 +641,7 @@ static bool test_NetrValidateName2(struct torture_context *tctx,
        for (i=0; i<ARRAY_SIZE(levels); i++) {
 
                r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
-               r.in.name = lp_workgroup(tctx->lp_ctx);
+               r.in.name = lpcfg_workgroup(tctx->lp_ctx);
                r.in.Account = NULL;
                r.in.EncryptedPassword = NULL;
                r.in.name_type = levels[i];
@@ -666,7 +666,7 @@ static bool test_NetrAddAlternateComputerName(struct torture_context *tctx,
        NTSTATUS status;
        struct wkssvc_NetrAddAlternateComputerName r;
        const char **names = NULL;
-       int num_names = 0;
+       size_t num_names = 0;
        int i;
        struct dcerpc_binding_handle *b = p->binding_handle;
 
@@ -708,7 +708,7 @@ static bool test_NetrRemoveAlternateComputerName(struct torture_context *tctx,
        NTSTATUS status;
        struct wkssvc_NetrRemoveAlternateComputerName r;
        const char **names = NULL;
-       int num_names = 0;
+       size_t num_names = 0;
        int i;
        struct dcerpc_binding_handle *b = p->binding_handle;
 
@@ -781,7 +781,7 @@ static bool test_NetrSetPrimaryComputername(struct torture_context *tctx,
        */
 
        const char **names_o = NULL, **names = NULL;
-       int num_names_o = 0, num_names = 0;
+       size_t num_names_o = 0, num_names = 0;
 
        torture_comment(tctx, "Testing NetrSetPrimaryComputername\n");
 
@@ -887,7 +887,7 @@ static bool test_NetrRenameMachineInDomain2(struct torture_context *tctx,
                                            struct dcerpc_pipe *p)
 {
        const char **names_o = NULL, **names = NULL;
-       int num_names_o = 0, num_names = 0;
+       size_t num_names_o = 0, num_names = 0;
 
        torture_comment(tctx, "Testing NetrRenameMachineInDomain2\n");
 
@@ -1075,7 +1075,7 @@ static bool test_NetrGetJoinableOus(struct torture_context *tctx,
        struct dcerpc_binding_handle *b = p->binding_handle;
 
        r.in.server_name = dcerpc_server_name(p);
-       r.in.domain_name = lp_workgroup(tctx->lp_ctx);
+       r.in.domain_name = lpcfg_workgroup(tctx->lp_ctx);
        r.in.Account = NULL;
        r.in.unknown = NULL;
        r.in.num_ous = r.out.num_ous = &num_ous;
@@ -1102,7 +1102,7 @@ static bool test_NetrGetJoinableOus2(struct torture_context *tctx,
        struct dcerpc_binding_handle *b = p->binding_handle;
 
        r.in.server_name = dcerpc_server_name(p);
-       r.in.domain_name = lp_workgroup(tctx->lp_ctx);
+       r.in.domain_name = lpcfg_workgroup(tctx->lp_ctx);
        r.in.Account = NULL;
        r.in.EncryptedPassword = NULL;
        r.in.num_ous = r.out.num_ous = &num_ous;
@@ -1130,7 +1130,7 @@ static bool test_NetrUnjoinDomain(struct torture_context *tctx,
        struct dcerpc_binding_handle *b = p->binding_handle;
 
        admin_account = talloc_asprintf(tctx, "%s\\%s",
-                                       lp_workgroup(tctx->lp_ctx),
+                                       lpcfg_workgroup(tctx->lp_ctx),
                                        user);
 
        r.in.server_name = dcerpc_server_name(p);
@@ -1159,11 +1159,11 @@ static bool test_NetrJoinDomain(struct torture_context *tctx,
        struct dcerpc_binding_handle *b = p->binding_handle;
 
        admin_account = talloc_asprintf(tctx, "%s\\%s",
-                                       lp_workgroup(tctx->lp_ctx),
+                                       lpcfg_workgroup(tctx->lp_ctx),
                                        user);
 
        r.in.server_name = dcerpc_server_name(p);
-       r.in.domain_name = lp_dnsdomain(tctx->lp_ctx);
+       r.in.domain_name = lpcfg_dnsdomain(tctx->lp_ctx);
        r.in.account_ou = NULL;
        r.in.Account = admin_account;
        r.in.password = NULL;
@@ -1204,7 +1204,7 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
        struct dcerpc_binding_handle *b = p->binding_handle;
 
        /* FIXME: this test assumes to join workstations / servers and does not
-        * handle DCs (WERR_SETUP_DOMAIN_CONTROLLER) */
+        * handle DCs (WERR_NERR_SETUPDOMAINCONTROLLER) */
 
        if (!test_GetJoinInformation(tctx, p, &join_status, &join_name))
        {
@@ -1213,7 +1213,7 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
 
        switch (join_status) {
                case NET_SETUP_DOMAIN_NAME:
-                       expected_err = WERR_SETUP_ALREADY_JOINED;
+                       expected_err = WERR_NERR_SETUPALREADYJOINED;
                        break;
                case NET_SETUP_UNKNOWN_STATUS:
                case NET_SETUP_UNJOINED:
@@ -1289,7 +1289,7 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
        struct dcerpc_binding_handle *b = p->binding_handle;
 
        /* FIXME: this test assumes to join workstations / servers and does not
-        * handle DCs (WERR_SETUP_DOMAIN_CONTROLLER) */
+        * handle DCs (WERR_NERR_SETUPDOMAINCONTROLLER) */
 
        if (!test_GetJoinInformation(tctx, p, &join_status, &join_name))
        {
@@ -1298,7 +1298,7 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
 
        switch (join_status) {
                case NET_SETUP_UNJOINED:
-                       expected_err = WERR_SETUP_NOT_JOINED;
+                       expected_err = WERR_NERR_SETUPNOTJOINED;
                        break;
                case NET_SETUP_DOMAIN_NAME:
                case NET_SETUP_UNKNOWN_STATUS:
@@ -1366,7 +1366,7 @@ struct torture_suite *torture_rpc_wkssvc(TALLOC_CTX *mem_ctx)
        struct torture_rpc_tcase *tcase;
        struct torture_test *test;
 
-       suite = torture_suite_create(mem_ctx, "WKSSVC");
+       suite = torture_suite_create(mem_ctx, "wkssvc");
        tcase = torture_suite_add_rpc_iface_tcase(suite, "wkssvc",
                                                  &ndr_table_wkssvc);