LCOV - code coverage report
Current view: top level - source4/torture/rpc - rpc.c (source / functions) Hit Total Coverage
Test: coverage report for master 2b515b7d Lines: 264 320 82.5 %
Date: 2024-02-28 12:06:22 Functions: 23 26 88.5 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    SMB torture tester
       4             :    Copyright (C) Andrew Tridgell 1997-2003
       5             :    Copyright (C) Jelmer Vernooij 2006
       6             : 
       7             :    This program is free software; you can redistribute it and/or modify
       8             :    it under the terms of the GNU General Public License as published by
       9             :    the Free Software Foundation; either version 3 of the License, or
      10             :    (at your option) any later version.
      11             : 
      12             :    This program is distributed in the hope that it will be useful,
      13             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :    GNU General Public License for more details.
      16             : 
      17             :    You should have received a copy of the GNU General Public License
      18             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      19             : */
      20             : 
      21             : #include "includes.h"
      22             : #include "lib/cmdline/cmdline.h"
      23             : #include "torture/rpc/torture_rpc.h"
      24             : #include "torture/smbtorture.h"
      25             : #include "librpc/ndr/ndr_table.h"
      26             : #include "../lib/util/dlinklist.h"
      27             : 
      28         932 : static bool torture_rpc_teardown (struct torture_context *tcase,
      29             :                                           void *data)
      30             : {
      31         932 :         struct torture_rpc_tcase_data *tcase_data =
      32             :                 (struct torture_rpc_tcase_data *)data;
      33         932 :         if (tcase_data->join_ctx != NULL)
      34         166 :             torture_leave_domain(tcase, tcase_data->join_ctx);
      35         932 :         talloc_free(tcase_data);
      36         932 :         return true;
      37             : }
      38             : 
      39             : /**
      40             :  * Obtain the DCE/RPC binding context associated with a torture context.
      41             :  *
      42             :  * @param tctx Torture context
      43             :  * @param binding Pointer to store DCE/RPC binding
      44             :  */
      45        4408 : NTSTATUS torture_rpc_binding(struct torture_context *tctx,
      46             :                              struct dcerpc_binding **binding)
      47             : {
      48          75 :         NTSTATUS status;
      49        4408 :         const char *binding_string = torture_setting_string(tctx, "binding",
      50             :                                                             NULL);
      51             : 
      52        4408 :         if (binding_string == NULL) {
      53           0 :                 torture_comment(tctx,
      54             :                                 "You must specify a DCE/RPC binding string\n");
      55           0 :                 return NT_STATUS_INVALID_PARAMETER;
      56             :         }
      57             : 
      58        4408 :         status = dcerpc_parse_binding(tctx, binding_string, binding);
      59        4408 :         if (NT_STATUS_IS_ERR(status)) {
      60           0 :                 torture_comment(tctx,
      61             :                                 "Failed to parse dcerpc binding '%s'\n",
      62             :                                 binding_string);
      63           0 :                 return status;
      64             :         }
      65             : 
      66        4408 :         return NT_STATUS_OK;
      67             : }
      68             : 
      69             : /**
      70             :  * open a rpc connection to the chosen binding string
      71             :  */
      72        1717 : _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
      73             :                                 struct dcerpc_pipe **p,
      74             :                                 const struct ndr_interface_table *table)
      75             : {
      76          36 :         NTSTATUS status;
      77          36 :         struct dcerpc_binding *binding;
      78             : 
      79        1717 :         status = torture_rpc_binding(tctx, &binding);
      80        1717 :         if (NT_STATUS_IS_ERR(status)) {
      81           0 :                 return status;
      82             :         }
      83             : 
      84        1717 :         return torture_rpc_connection_with_binding(tctx, binding, p, table);
      85             : }
      86             : 
      87             : /**
      88             :  * open a rpc connection to the chosen binding string
      89             :  */
      90        1717 : _PUBLIC_ NTSTATUS torture_rpc_connection_with_binding(struct torture_context *tctx,
      91             :                                                       struct dcerpc_binding *binding,
      92             :                                                       struct dcerpc_pipe **p,
      93             :                                                       const struct ndr_interface_table *table)
      94             : {
      95          36 :         NTSTATUS status;
      96             : 
      97        1717 :         dcerpc_init();
      98             : 
      99        1717 :         status = dcerpc_pipe_connect_b(tctx,
     100             :                                      p, binding, table,
     101             :                                      samba_cmdline_get_creds(),
     102             :                                         tctx->ev, tctx->lp_ctx);
     103             : 
     104        1717 :         if (NT_STATUS_IS_ERR(status)) {
     105         188 :                 torture_warning(tctx, "Failed to connect to remote server: %s %s\n",
     106             :                            dcerpc_binding_string(tctx, binding), nt_errstr(status));
     107             :         }
     108             : 
     109        1717 :         return status;
     110             : }
     111             : 
     112             : /**
     113             :  * open a rpc connection to a specific transport
     114             :  */
     115         153 : NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx,
     116             :                                           struct dcerpc_pipe **p,
     117             :                                           const struct ndr_interface_table *table,
     118             :                                           enum dcerpc_transport_t transport,
     119             :                                           uint32_t assoc_group_id,
     120             :                                           uint32_t extra_flags)
     121             : {
     122          27 :         NTSTATUS status;
     123          27 :         struct dcerpc_binding *binding;
     124             : 
     125         153 :         *p = NULL;
     126             : 
     127         153 :         status = torture_rpc_binding(tctx, &binding);
     128         153 :         if (!NT_STATUS_IS_OK(status)) {
     129           0 :                 return status;
     130             :         }
     131             : 
     132         153 :         status = dcerpc_binding_set_transport(binding, transport);
     133         153 :         if (!NT_STATUS_IS_OK(status)) {
     134           0 :                 return status;
     135             :         }
     136             : 
     137         153 :         status = dcerpc_binding_set_assoc_group_id(binding, assoc_group_id);
     138         153 :         if (!NT_STATUS_IS_OK(status)) {
     139           0 :                 return status;
     140             :         }
     141             : 
     142         153 :         status = dcerpc_binding_set_flags(binding, extra_flags, 0);
     143         153 :         if (!NT_STATUS_IS_OK(status)) {
     144           0 :                 return status;
     145             :         }
     146             : 
     147         153 :         status = dcerpc_pipe_connect_b(tctx, p, binding, table,
     148             :                                        samba_cmdline_get_creds(),
     149             :                                        tctx->ev, tctx->lp_ctx);
     150         153 :         if (!NT_STATUS_IS_OK(status)) {
     151          72 :                 *p = NULL;
     152          72 :                 return status;
     153             :         }
     154             : 
     155          81 :         return NT_STATUS_OK;
     156             : }
     157             : 
     158          69 : static bool torture_rpc_setup_machine_workstation(struct torture_context *tctx,
     159             :                                                   void **data)
     160             : {
     161           4 :         NTSTATUS status;
     162           4 :         struct dcerpc_binding *binding;
     163          69 :         struct torture_rpc_tcase *tcase = talloc_get_type(tctx->active_tcase,
     164             :                                                 struct torture_rpc_tcase);
     165           4 :         struct torture_rpc_tcase_data *tcase_data;
     166             : 
     167          69 :         status = torture_rpc_binding(tctx, &binding);
     168          69 :         if (NT_STATUS_IS_ERR(status))
     169           0 :                 return false;
     170             : 
     171          69 :         *data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
     172          69 :         tcase_data->credentials = samba_cmdline_get_creds();
     173          69 :         tcase_data->join_ctx = torture_join_domain(tctx, tcase->machine_name,
     174             :                                                    ACB_WSTRUST,
     175             :                                                    &tcase_data->credentials);
     176          69 :         if (tcase_data->join_ctx == NULL)
     177           0 :             torture_fail(tctx, "Failed to join as WORKSTATION");
     178             : 
     179          69 :         status = dcerpc_pipe_connect_b(tctx,
     180             :                                 &(tcase_data->pipe),
     181             :                                 binding,
     182             :                                 tcase->table,
     183             :                                 tcase_data->credentials, tctx->ev, tctx->lp_ctx);
     184             : 
     185          69 :         torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
     186             : 
     187          65 :         return NT_STATUS_IS_OK(status);
     188             : }
     189             : 
     190          97 : static bool torture_rpc_setup_machine_bdc(struct torture_context *tctx,
     191             :                                           void **data)
     192             : {
     193           8 :         NTSTATUS status;
     194           8 :         struct dcerpc_binding *binding;
     195          97 :         struct torture_rpc_tcase *tcase = talloc_get_type(tctx->active_tcase,
     196             :                                                 struct torture_rpc_tcase);
     197           8 :         struct torture_rpc_tcase_data *tcase_data;
     198             : 
     199          97 :         status = torture_rpc_binding(tctx, &binding);
     200          97 :         if (NT_STATUS_IS_ERR(status))
     201           0 :                 return false;
     202             : 
     203          97 :         *data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
     204          97 :         tcase_data->credentials = samba_cmdline_get_creds();
     205          97 :         tcase_data->join_ctx = torture_join_domain(tctx, tcase->machine_name,
     206             :                                                    ACB_SVRTRUST,
     207             :                                                    &tcase_data->credentials);
     208          97 :         if (tcase_data->join_ctx == NULL)
     209           0 :             torture_fail(tctx, "Failed to join as BDC");
     210             : 
     211          97 :         status = dcerpc_pipe_connect_b(tctx,
     212             :                                 &(tcase_data->pipe),
     213             :                                 binding,
     214             :                                 tcase->table,
     215             :                                 tcase_data->credentials, tctx->ev, tctx->lp_ctx);
     216             : 
     217          97 :         torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
     218             : 
     219          89 :         return NT_STATUS_IS_OK(status);
     220             : }
     221             : 
     222       22038 : _PUBLIC_ struct torture_rpc_tcase *torture_suite_add_machine_workstation_rpc_iface_tcase(
     223             :                                 struct torture_suite *suite,
     224             :                                 const char *name,
     225             :                                 const struct ndr_interface_table *table,
     226             :                                 const char *machine_name)
     227             : {
     228       22038 :         struct torture_rpc_tcase *tcase = talloc(suite,
     229             :                                                  struct torture_rpc_tcase);
     230             : 
     231       22038 :         torture_suite_init_rpc_tcase(suite, tcase, name, table);
     232             : 
     233       22038 :         tcase->machine_name = talloc_strdup(tcase, machine_name);
     234       22038 :         tcase->tcase.setup = torture_rpc_setup_machine_workstation;
     235       22038 :         tcase->tcase.teardown = torture_rpc_teardown;
     236             : 
     237       22038 :         return tcase;
     238             : }
     239             : 
     240       30051 : _PUBLIC_ struct torture_rpc_tcase *torture_suite_add_machine_bdc_rpc_iface_tcase(
     241             :                                 struct torture_suite *suite,
     242             :                                 const char *name,
     243             :                                 const struct ndr_interface_table *table,
     244             :                                 const char *machine_name)
     245             : {
     246       30051 :         struct torture_rpc_tcase *tcase = talloc(suite,
     247             :                                                  struct torture_rpc_tcase);
     248             : 
     249       30051 :         torture_suite_init_rpc_tcase(suite, tcase, name, table);
     250             : 
     251       30051 :         tcase->machine_name = talloc_strdup(tcase, machine_name);
     252       30051 :         tcase->tcase.setup = torture_rpc_setup_machine_bdc;
     253       30051 :         tcase->tcase.teardown = torture_rpc_teardown;
     254             : 
     255       30051 :         return tcase;
     256             : }
     257             : 
     258      128868 : _PUBLIC_ bool torture_suite_init_rpc_tcase(struct torture_suite *suite,
     259             :                                            struct torture_rpc_tcase *tcase,
     260             :                                            const char *name,
     261             :                                            const struct ndr_interface_table *table)
     262             : {
     263      128868 :         if (!torture_suite_init_tcase(suite, (struct torture_tcase *)tcase, name))
     264           0 :                 return false;
     265             : 
     266      128868 :         tcase->table = table;
     267             : 
     268      128868 :         return true;
     269             : }
     270             : 
     271           7 : static bool torture_rpc_setup_anonymous(struct torture_context *tctx,
     272             :                                         void **data)
     273             : {
     274           0 :         NTSTATUS status;
     275           0 :         struct dcerpc_binding *binding;
     276           0 :         struct torture_rpc_tcase_data *tcase_data;
     277           7 :         struct torture_rpc_tcase *tcase = talloc_get_type(tctx->active_tcase,
     278             :                                                           struct torture_rpc_tcase);
     279             : 
     280           7 :         status = torture_rpc_binding(tctx, &binding);
     281           7 :         if (NT_STATUS_IS_ERR(status))
     282           0 :                 return false;
     283             : 
     284           7 :         *data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
     285           7 :         tcase_data->credentials = cli_credentials_init_anon(tctx);
     286             : 
     287           7 :         status = dcerpc_pipe_connect_b(tctx,
     288             :                                 &(tcase_data->pipe),
     289             :                                 binding,
     290             :                                 tcase->table,
     291             :                                 tcase_data->credentials, tctx->ev, tctx->lp_ctx);
     292             : 
     293           7 :         torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
     294             : 
     295           7 :         return NT_STATUS_IS_OK(status);
     296             : }
     297             : 
     298         759 : static bool torture_rpc_setup (struct torture_context *tctx, void **data)
     299             : {
     300           6 :         NTSTATUS status;
     301         759 :         struct torture_rpc_tcase *tcase = talloc_get_type(
     302             :                                                 tctx->active_tcase, struct torture_rpc_tcase);
     303           6 :         struct torture_rpc_tcase_data *tcase_data;
     304             : 
     305         759 :         *data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
     306         759 :         tcase_data->credentials = samba_cmdline_get_creds();
     307             : 
     308         759 :         status = torture_rpc_connection(tctx,
     309             :                                 &(tcase_data->pipe),
     310             :                                 tcase->table);
     311             : 
     312         759 :         torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
     313             : 
     314         751 :         return NT_STATUS_IS_OK(status);
     315             : }
     316             : 
     317             : 
     318             : 
     319        2379 : _PUBLIC_ struct torture_rpc_tcase *torture_suite_add_anon_rpc_iface_tcase(struct torture_suite *suite,
     320             :                                                                 const char *name,
     321             :                                                                 const struct ndr_interface_table *table)
     322             : {
     323        2379 :         struct torture_rpc_tcase *tcase = talloc(suite, struct torture_rpc_tcase);
     324             : 
     325        2379 :         torture_suite_init_rpc_tcase(suite, tcase, name, table);
     326             : 
     327        2379 :         tcase->tcase.setup = torture_rpc_setup_anonymous;
     328        2379 :         tcase->tcase.teardown = torture_rpc_teardown;
     329             : 
     330        2379 :         return tcase;
     331             : }
     332             : 
     333             : 
     334       74400 : _PUBLIC_ struct torture_rpc_tcase *torture_suite_add_rpc_iface_tcase(struct torture_suite *suite,
     335             :                                                                 const char *name,
     336             :                                                                 const struct ndr_interface_table *table)
     337             : {
     338       74400 :         struct torture_rpc_tcase *tcase = talloc(suite, struct torture_rpc_tcase);
     339             : 
     340       74400 :         torture_suite_init_rpc_tcase(suite, tcase, name, table);
     341             : 
     342       74400 :         tcase->tcase.setup = torture_rpc_setup;
     343       74400 :         tcase->tcase.teardown = torture_rpc_teardown;
     344             : 
     345       74400 :         return tcase;
     346             : }
     347             : 
     348        3875 : static bool torture_rpc_wrap_test(struct torture_context *tctx,
     349             :                                                                   struct torture_tcase *tcase,
     350             :                                                                   struct torture_test *test)
     351             : {
     352          68 :         bool (*fn) (struct torture_context *, struct dcerpc_pipe *);
     353        3875 :         struct torture_rpc_tcase_data *tcase_data =
     354             :                 (struct torture_rpc_tcase_data *)tcase->data;
     355             : 
     356        3875 :         fn = test->fn;
     357             : 
     358        3875 :         return fn(tctx, tcase_data->pipe);
     359             : }
     360             : 
     361         366 : static bool torture_rpc_wrap_test_ex(struct torture_context *tctx,
     362             :                                                                   struct torture_tcase *tcase,
     363             :                                                                   struct torture_test *test)
     364             : {
     365           0 :         bool (*fn) (struct torture_context *, struct dcerpc_pipe *, const void *);
     366         366 :         struct torture_rpc_tcase_data *tcase_data =
     367             :                 (struct torture_rpc_tcase_data *)tcase->data;
     368             : 
     369         366 :         fn = test->fn;
     370             : 
     371         366 :         return fn(tctx, tcase_data->pipe, test->data);
     372             : }
     373             : 
     374             : 
     375         845 : static bool torture_rpc_wrap_test_creds(struct torture_context *tctx,
     376             :                                                                   struct torture_tcase *tcase,
     377             :                                                                   struct torture_test *test)
     378             : {
     379         118 :         bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct cli_credentials *);
     380         845 :         struct torture_rpc_tcase_data *tcase_data =
     381             :                 (struct torture_rpc_tcase_data *)tcase->data;
     382             : 
     383         845 :         fn = test->fn;
     384             : 
     385         845 :         return fn(tctx, tcase_data->pipe, tcase_data->credentials);
     386             : }
     387             : 
     388          10 : static bool torture_rpc_wrap_test_join(struct torture_context *tctx,
     389             :                                        struct torture_tcase *tcase,
     390             :                                        struct torture_test *test)
     391             : {
     392           0 :         bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct cli_credentials *, struct test_join *);
     393          10 :         struct torture_rpc_tcase_data *tcase_data =
     394             :                 (struct torture_rpc_tcase_data *)tcase->data;
     395             : 
     396          10 :         fn = test->fn;
     397             : 
     398          10 :         return fn(tctx, tcase_data->pipe, tcase_data->credentials, tcase_data->join_ctx);
     399             : }
     400             : 
     401      437985 : _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test(
     402             :                                         struct torture_rpc_tcase *tcase,
     403             :                                         const char *name,
     404             :                                         bool (*fn) (struct torture_context *, struct dcerpc_pipe *))
     405             : {
     406       24375 :         struct torture_test *test;
     407             : 
     408      437985 :         test = talloc(tcase, struct torture_test);
     409             : 
     410      437985 :         test->name = talloc_strdup(test, name);
     411      437985 :         test->description = NULL;
     412      437985 :         test->run = torture_rpc_wrap_test;
     413      437985 :         test->dangerous = false;
     414      437985 :         test->data = NULL;
     415      437985 :         test->fn = fn;
     416             : 
     417      437985 :         DLIST_ADD_END(tcase->tcase.tests, test);
     418             : 
     419      437985 :         return test;
     420             : }
     421             : 
     422      157641 : _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_creds(
     423             :                                         struct torture_rpc_tcase *tcase,
     424             :                                         const char *name,
     425             :                                         bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct cli_credentials *))
     426             : {
     427        8375 :         struct torture_test *test;
     428             : 
     429      157641 :         test = talloc(tcase, struct torture_test);
     430             : 
     431      157641 :         test->name = talloc_strdup(test, name);
     432      157641 :         test->description = NULL;
     433      157641 :         test->run = torture_rpc_wrap_test_creds;
     434      157641 :         test->dangerous = false;
     435      157641 :         test->data = NULL;
     436      157641 :         test->fn = fn;
     437             : 
     438      157641 :         DLIST_ADD_END(tcase->tcase.tests, test);
     439             : 
     440      157641 :         return test;
     441             : }
     442             : 
     443        3882 : _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_join(
     444             :                                         struct torture_rpc_tcase *tcase,
     445             :                                         const char *name,
     446             :                                         bool (*fn) (struct torture_context *, struct dcerpc_pipe *,
     447             :                                                     struct cli_credentials *, struct test_join *))
     448             : {
     449         250 :         struct torture_test *test;
     450             : 
     451        3882 :         test = talloc(tcase, struct torture_test);
     452             : 
     453        3882 :         test->name = talloc_strdup(test, name);
     454        3882 :         test->description = NULL;
     455        3882 :         test->run = torture_rpc_wrap_test_join;
     456        3882 :         test->dangerous = false;
     457        3882 :         test->data = NULL;
     458        3882 :         test->fn = fn;
     459             : 
     460        3882 :         DLIST_ADD_END(tcase->tcase.tests, test);
     461             : 
     462        3882 :         return test;
     463             : }
     464             : 
     465       33306 : _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_ex(
     466             :                                         struct torture_rpc_tcase *tcase,
     467             :                                         const char *name,
     468             :                                         bool (*fn) (struct torture_context *, struct dcerpc_pipe *,
     469             :                                                                 void *),
     470             :                                         void *userdata)
     471             : {
     472        1750 :         struct torture_test *test;
     473             : 
     474       33306 :         test = talloc(tcase, struct torture_test);
     475             : 
     476       33306 :         test->name = talloc_strdup(test, name);
     477       33306 :         test->description = NULL;
     478       33306 :         test->run = torture_rpc_wrap_test_ex;
     479       33306 :         test->dangerous = false;
     480       33306 :         test->data = userdata;
     481       33306 :         test->fn = fn;
     482             : 
     483       33306 :         DLIST_ADD_END(tcase->tcase.tests, test);
     484             : 
     485       33306 :         return test;
     486             : }
     487             : 
     488           0 : static bool torture_rpc_wrap_test_setup(struct torture_context *tctx,
     489             :                                         struct torture_tcase *tcase,
     490             :                                         struct torture_test *test)
     491             : {
     492           0 :         bool (*fn)(struct torture_context *, struct dcerpc_pipe *, const void *);
     493           0 :         struct torture_rpc_tcase *rpc_tcase = talloc_get_type_abort(
     494             :                 tctx->active_tcase, struct torture_rpc_tcase);
     495           0 :         struct torture_rpc_tcase_data *tcase_data = talloc_get_type_abort(
     496             :                 tcase->data, struct torture_rpc_tcase_data);
     497           0 :         void *data = discard_const_p(void, test->data);
     498           0 :         bool ok;
     499             : 
     500           0 :         ok = rpc_tcase->setup_fn(tctx, tcase_data->pipe, data);
     501           0 :         if (!ok) {
     502           0 :                 return false;
     503             :         }
     504             : 
     505           0 :         fn = test->fn;
     506             : 
     507           0 :         ok = fn(tctx, tcase_data->pipe, data);
     508           0 :         if (!ok) {
     509           0 :                 return false;
     510             :         }
     511             : 
     512           0 :         ok = rpc_tcase->teardown_fn(tctx, tcase_data->pipe, data);
     513           0 :         if (!ok) {
     514           0 :                 return false;
     515             :         }
     516             : 
     517           0 :         return true;
     518             : }
     519             : 
     520           0 : _PUBLIC_ struct torture_test *torture_rpc_tcase_add_test_setup(
     521             :                                 struct torture_rpc_tcase *tcase,
     522             :                                 const char *name,
     523             :                                 bool (*fn)(struct torture_context *,
     524             :                                            struct dcerpc_pipe *,
     525             :                                            void *),
     526             :                                 void *userdata)
     527             : {
     528           0 :         struct torture_test *test = NULL;
     529             : 
     530           0 :         test = talloc(tcase, struct torture_test);
     531             : 
     532           0 :         test->name = talloc_strdup(test, name);
     533           0 :         test->description = NULL;
     534           0 :         test->run = torture_rpc_wrap_test_setup;
     535           0 :         test->dangerous = false;
     536           0 :         test->data = userdata;
     537           0 :         test->fn = fn;
     538             : 
     539           0 :         DLIST_ADD_END(tcase->tcase.tests, test);
     540             : 
     541           0 :         return test;
     542             : }
     543             : 
     544           0 : _PUBLIC_ struct torture_rpc_tcase *torture_suite_add_rpc_setup_tcase(
     545             :                                 struct torture_suite *suite,
     546             :                                 const char *name,
     547             :                                 const struct ndr_interface_table *table,
     548             :                                 bool (*setup_fn)(struct torture_context *,
     549             :                                                  struct dcerpc_pipe *,
     550             :                                                  void *),
     551             :                                 bool (*teardown_fn)(struct torture_context *,
     552             :                                                     struct dcerpc_pipe *,
     553             :                                                     void *))
     554             : {
     555           0 :         struct torture_rpc_tcase *tcase = talloc(
     556             :                 suite, struct torture_rpc_tcase);
     557             : 
     558           0 :         torture_suite_init_rpc_tcase(suite, tcase, name, table);
     559             : 
     560           0 :         tcase->setup_fn = setup_fn;
     561           0 :         tcase->teardown_fn = teardown_fn;
     562           0 :         tcase->tcase.setup = torture_rpc_setup;
     563           0 :         tcase->tcase.teardown = torture_rpc_teardown;
     564             : 
     565           0 :         return tcase;
     566             : }
     567             : 
     568        2379 : NTSTATUS torture_rpc_init(TALLOC_CTX *ctx)
     569             : {
     570        2379 :         struct torture_suite *suite = torture_suite_create(ctx, "rpc");
     571             : 
     572        2379 :         ndr_table_init();
     573             : 
     574        2379 :         torture_suite_add_simple_test(suite, "lsa", torture_rpc_lsa);
     575        2379 :         torture_suite_add_simple_test(suite, "lsalookup", torture_rpc_lsa_lookup);
     576        2379 :         torture_suite_add_simple_test(suite, "lsa-getuser", torture_rpc_lsa_get_user);
     577        2379 :         torture_suite_add_suite(suite, torture_rpc_lsa_lookup_sids(suite));
     578        2379 :         torture_suite_add_suite(suite, torture_rpc_lsa_lookup_names(suite));
     579        2379 :         torture_suite_add_suite(suite, torture_rpc_lsa_secrets(suite));
     580        2379 :         torture_suite_add_suite(suite, torture_rpc_lsa_trusted_domains(suite));
     581        2379 :         torture_suite_add_suite(suite, torture_rpc_lsa_forest_trust(suite));
     582        2379 :         torture_suite_add_suite(suite, torture_rpc_lsa_privileges(suite));
     583        2379 :         torture_suite_add_suite(suite, torture_rpc_echo(suite));
     584        2379 :         torture_suite_add_suite(suite, torture_rpc_dfs(suite));
     585        2379 :         torture_suite_add_suite(suite, torture_rpc_frsapi(suite));
     586        2379 :         torture_suite_add_suite(suite, torture_rpc_unixinfo(suite));
     587        2379 :         torture_suite_add_suite(suite, torture_rpc_eventlog(suite));
     588        2379 :         torture_suite_add_suite(suite, torture_rpc_atsvc(suite));
     589        2379 :         torture_suite_add_suite(suite, torture_rpc_wkssvc(suite));
     590        2379 :         torture_suite_add_suite(suite, torture_rpc_handles(suite));
     591        2379 :         torture_suite_add_suite(suite, torture_rpc_object_uuid(suite));
     592        2379 :         torture_suite_add_suite(suite, torture_rpc_winreg(suite));
     593        2379 :         torture_suite_add_suite(suite, torture_rpc_spoolss(suite));
     594             : #ifdef WITH_NTVFS_FILESERVER
     595        1515 :         torture_suite_add_suite(suite, torture_rpc_spoolss_notify(suite));
     596             : #endif
     597        2379 :         torture_suite_add_suite(suite, torture_rpc_spoolss_win(suite));
     598        2379 :         torture_suite_add_suite(suite, torture_rpc_spoolss_driver(suite));
     599        2379 :         torture_suite_add_suite(suite, torture_rpc_spoolss_access(suite));
     600        2379 :         torture_suite_add_suite(suite, torture_rpc_iremotewinspool(suite));
     601        2379 :         torture_suite_add_suite(suite, torture_rpc_iremotewinspool_drv(suite));
     602        2379 :         torture_suite_add_simple_test(suite, "samr", torture_rpc_samr);
     603        2379 :         torture_suite_add_simple_test(suite, "samr.users", torture_rpc_samr_users);
     604        2379 :         torture_suite_add_simple_test(suite, "samr.passwords.default", torture_rpc_samr_passwords);
     605        2379 :         torture_suite_add_suite(suite, torture_rpc_netlogon(suite));
     606        2379 :         torture_suite_add_suite(suite, torture_rpc_netlogon_s3(suite));
     607        2379 :         torture_suite_add_suite(suite, torture_rpc_netlogon_admin(suite));
     608        2379 :         torture_suite_add_suite(suite, torture_rpc_netlogon_zerologon(suite));
     609        2379 :         torture_suite_add_suite(suite, torture_rpc_netlogon_crypto_fips(suite));
     610        2379 :         torture_suite_add_suite(suite, torture_rpc_remote_pac(suite));
     611        2379 :         torture_suite_add_simple_test(suite, "samlogon", torture_rpc_samlogon);
     612        2379 :         torture_suite_add_simple_test(suite, "samsync", torture_rpc_samsync);
     613        2379 :         torture_suite_add_simple_test(suite, "schannel", torture_rpc_schannel);
     614        2379 :         torture_suite_add_simple_test(suite, "schannel2", torture_rpc_schannel2);
     615        2379 :         torture_suite_add_simple_test(suite, "bench-schannel1", torture_rpc_schannel_bench1);
     616        2379 :         torture_suite_add_simple_test(suite, "schannel_anon_setpw", torture_rpc_schannel_anon_setpw);
     617        2379 :         torture_suite_add_suite(suite, torture_rpc_srvsvc(suite));
     618        2379 :         torture_suite_add_suite(suite, torture_rpc_svcctl(suite));
     619        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_accessmask(suite));
     620        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_handletype(suite));
     621        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_workstation_auth(suite));
     622        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_passwords_pwdlastset(suite));
     623        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_passwords_badpwdcount(suite));
     624        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_passwords_lockout(suite));
     625        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_passwords_validate(suite));
     626        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_user_privileges(suite));
     627        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_large_dc(suite));
     628        2379 :         torture_suite_add_suite(suite, torture_rpc_samr_priv(suite));
     629        2379 :         torture_suite_add_suite(suite, torture_rpc_epmapper(suite));
     630        2379 :         torture_suite_add_suite(suite, torture_rpc_initshutdown(suite));
     631        2379 :         torture_suite_add_simple_test(suite, "mgmt", torture_rpc_mgmt);
     632        2379 :         torture_suite_add_simple_test(suite, "scanner", torture_rpc_scanner);
     633        2379 :         torture_suite_add_simple_test(suite, "countcalls", torture_rpc_countcalls);
     634        2379 :         torture_suite_add_simple_test(suite, "authcontext", torture_bind_authcontext);
     635        2379 :         torture_suite_add_suite(suite, torture_rpc_samba3(suite));
     636        2379 :         torture_rpc_drsuapi_tcase(suite);
     637        2379 :         torture_rpc_drsuapi_w2k8_tcase(suite);
     638        2379 :         torture_rpc_drsuapi_cracknames_tcase(suite);
     639        2379 :         torture_suite_add_suite(suite, torture_rpc_dssetup(suite));
     640        2379 :         torture_suite_add_suite(suite, torture_rpc_browser(suite));
     641        2379 :         torture_suite_add_simple_test(suite, "altercontext", torture_rpc_alter_context);
     642        2379 :         torture_suite_add_simple_test(suite, "join", torture_rpc_join);
     643        2379 :         torture_drs_rpc_dsgetinfo_tcase(suite);
     644        2379 :         torture_suite_add_simple_test(suite, "bench-rpc", torture_bench_rpc);
     645        2379 :         torture_suite_add_simple_test(suite, "asyncbind", torture_async_bind);
     646        2379 :         torture_suite_add_suite(suite, torture_rpc_ntsvcs(suite));
     647        2379 :         torture_suite_add_suite(suite, torture_rpc_bind(suite));
     648             : #ifdef AD_DC_BUILD_IS_ENABLED
     649        1515 :         torture_suite_add_suite(suite, torture_rpc_backupkey(suite));
     650             : #endif
     651        2379 :         torture_suite_add_suite(suite, torture_rpc_fsrvp(suite));
     652        2379 :         torture_suite_add_suite(suite, torture_rpc_clusapi(suite));
     653        2379 :         torture_suite_add_suite(suite, torture_rpc_witness(suite));
     654        2379 :         torture_suite_add_suite(suite, torture_rpc_mdssvc(suite));
     655             : 
     656        2379 :         suite->description = talloc_strdup(suite, "DCE/RPC protocol and interface tests");
     657             : 
     658        2379 :         torture_register_suite(ctx, suite);
     659             : 
     660        2379 :         return NT_STATUS_OK;
     661             : }

Generated by: LCOV version 1.14