LCOV - code coverage report
Current view: top level - source4/torture/rpc - samr_priv.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 175 213 82.2 %
Date: 2021-09-23 10:06:22 Functions: 13 16 81.2 %

          Line data    Source code
       1             : /*
       2             :  * Unix SMB/CIFS implementation.
       3             :  * test suite for samr rpc operations
       4             :  *
       5             :  * Copyright (c) 2011      Andreas Schneider
       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 "param/param.h"
      23             : #include "torture/torture.h"
      24             : #include "librpc/gen_ndr/ndr_samr_c.h"
      25             : #include "librpc/rpc/dcerpc_proto.h"
      26             : #include "libcli/security/security.h"
      27             : #include "torture/rpc/torture_rpc.h"
      28             : 
      29             : #define TEST_ACCOUNT_NAME "guru"
      30             : 
      31             : struct torture_user {
      32             :         const char *username;
      33             :         const char *password;
      34             :         const char *domain;
      35             :         uint32_t *builtin_memberships;
      36             :         uint32_t num_builtin_memberships;
      37             :         bool admin_rights;
      38             : };
      39             : 
      40             : struct torture_access_context {
      41             :         struct dcerpc_pipe *pipe;
      42             :         struct torture_user user;
      43             :         struct test_join *join;
      44             : };
      45             : 
      46         574 : static void init_lsa_String(struct lsa_String *name, const char *s)
      47             : {
      48         574 :         name->string = s;
      49         574 : }
      50             : 
      51         140 : static bool test_samr_queryUserInfo(struct torture_context *tctx,
      52             :                                     struct dcerpc_binding_handle *b,
      53             :                                     struct policy_handle *user_handle)
      54             : {
      55             :         struct samr_QueryUserInfo r;
      56             :         union samr_UserInfo *info;
      57             :         NTSTATUS status;
      58             : 
      59         140 :         r.in.level = UserGeneralInformation;
      60         140 :         r.in.user_handle = user_handle;
      61         140 :         r.out.info = &info;
      62             : 
      63         140 :         status = dcerpc_samr_QueryUserInfo_r(b,
      64             :                                              tctx,
      65             :                                              &r);
      66         140 :         torture_assert_ntstatus_ok(tctx, status, "queryUserInfo failed");
      67         140 :         torture_assert_ntstatus_ok(tctx, r.out.result, "queryUserInfo failed");
      68             : 
      69         140 :         return true;
      70             : }
      71             : 
      72         280 : static bool test_LookupName(struct dcerpc_binding_handle *b,
      73             :                             struct torture_context *tctx,
      74             :                             struct policy_handle *domain_handle,
      75             :                             const char *name,
      76             :                             uint32_t *rid)
      77             : {
      78             :         NTSTATUS status;
      79             :         struct samr_LookupNames n;
      80             :         struct lsa_String sname[1];
      81             :         struct samr_Ids rids, types;
      82             : 
      83         280 :         init_lsa_String(&sname[0], name);
      84             : 
      85         280 :         n.in.domain_handle = domain_handle;
      86         280 :         n.in.num_names = 1;
      87         280 :         n.in.names = sname;
      88         280 :         n.out.rids = &rids;
      89         280 :         n.out.types = &types;
      90             : 
      91         280 :         status = dcerpc_samr_LookupNames_r(b, tctx, &n);
      92         280 :         if (!NT_STATUS_IS_OK(status)) {
      93           0 :                 return false;
      94             :         }
      95         280 :         if (!NT_STATUS_IS_OK(n.out.result)) {
      96         140 :                 return false;
      97             :         }
      98             : 
      99         140 :         *rid = n.out.rids->ids[0];
     100         140 :         return true;
     101             : }
     102             : 
     103           7 : static bool test_samr_CreateUser(struct torture_context *tctx,
     104             :                                  struct dcerpc_binding_handle *b,
     105             :                                  struct policy_handle *domain_handle,
     106             :                                  const char *name,
     107             :                                  struct policy_handle *user_handle)
     108             : {
     109             :         struct lsa_String username;
     110             :         struct samr_CreateUser r;
     111           7 :         uint32_t rid = 0;
     112             :         NTSTATUS status;
     113             : 
     114           7 :         init_lsa_String(&username, name);
     115             : 
     116           7 :         r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
     117           7 :         r.in.domain_handle = domain_handle;
     118           7 :         r.in.account_name = &username;
     119           7 :         r.out.user_handle = user_handle;
     120           7 :         r.out.rid = &rid;
     121             : 
     122           7 :         status = dcerpc_samr_CreateUser_r(b, tctx, &r);
     123           7 :         torture_assert_ntstatus_ok(tctx, status, "CreateUser failed");
     124             : 
     125           7 :         return NT_STATUS_IS_OK(r.out.result);
     126             : }
     127             : 
     128         280 : static bool test_samr_OpenUser(struct torture_context *tctx,
     129             :                                struct dcerpc_binding_handle *b,
     130             :                                struct policy_handle *domain_handle,
     131             :                                const char *name,
     132             :                                struct policy_handle *user_handle,
     133             :                                bool expected)
     134             : {
     135             :         struct samr_OpenUser r;
     136         280 :         uint32_t rid = 0;
     137             :         NTSTATUS status;
     138             :         bool ok;
     139             : 
     140         280 :         ok = test_LookupName(b, tctx, domain_handle, name, &rid);
     141         280 :         if (!ok && expected) {
     142         140 :                 torture_comment(tctx, " - lookup name for %s failed\n", name);
     143         140 :                 return true;
     144         140 :         } else if (!ok) {
     145           0 :                 return false;
     146             :         }
     147             : 
     148         140 :         r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
     149         140 :         r.in.domain_handle = domain_handle;
     150         140 :         r.in.rid = rid;
     151         140 :         r.out.user_handle = user_handle;
     152             : 
     153         140 :         status = dcerpc_samr_OpenUser_r(b, tctx, &r);
     154         140 :         torture_assert_ntstatus_ok(tctx, status, "OpenUser failed");
     155         140 :         torture_assert_ntstatus_ok(tctx, r.out.result, "OpenUser failed");
     156             : 
     157         140 :         return true;
     158             : }
     159             : 
     160         287 : static bool test_samr_openDomain(struct torture_context *tctx,
     161             :                                  struct dcerpc_binding_handle *b,
     162             :                                  struct policy_handle *connect_handle,
     163             :                                  const char *domain,
     164             :                                  struct policy_handle *domain_handle)
     165             : {
     166             :         struct samr_LookupDomain r;
     167             :         struct samr_OpenDomain r2;
     168             :         struct lsa_String n;
     169             :         struct dom_sid *sid;
     170             :         NTSTATUS status;
     171             : 
     172         287 :         r.in.connect_handle = connect_handle;
     173         287 :         init_lsa_String(&n, domain);
     174         287 :         r.in.domain_name = &n;
     175         287 :         r.out.sid = &sid;
     176             : 
     177         287 :         status = dcerpc_samr_LookupDomain_r(b, tctx, &r);
     178         287 :         torture_assert_ntstatus_ok(tctx, status, "LookupDomain failed");
     179         287 :         torture_assert_ntstatus_ok(tctx, r.out.result, "LookupDomain failed");
     180             : 
     181         287 :         r2.in.connect_handle = connect_handle;
     182         287 :         r2.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
     183         287 :         r2.in.sid = sid;
     184         287 :         r2.out.domain_handle = domain_handle;
     185             : 
     186         287 :         status = dcerpc_samr_OpenDomain_r(b, tctx, &r2);
     187         287 :         torture_assert_ntstatus_ok(tctx, status, "OpenDomain failed");
     188         287 :         torture_assert_ntstatus_ok(tctx, r2.out.result, "OpenDomain failed");
     189             : 
     190         287 :         return true;
     191             : }
     192             : 
     193         287 : static bool test_samr_Connect(struct torture_context *tctx,
     194             :                               struct dcerpc_binding_handle *b,
     195             :                               struct policy_handle *connect_handle)
     196             : {
     197             :         struct samr_Connect r;
     198             :         NTSTATUS status;
     199             : 
     200         287 :         r.in.system_name = 0;
     201         287 :         r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
     202         287 :         r.out.connect_handle = connect_handle;
     203             : 
     204         287 :         status = dcerpc_samr_Connect_r(b, tctx, &r);
     205         287 :         torture_assert_ntstatus_ok(tctx, status, "SAMR connect failed");
     206         287 :         torture_assert_ntstatus_ok(tctx, r.out.result, "SAMR connect failed");
     207             : 
     208         287 :         return true;
     209             : }
     210             : 
     211           7 : static bool test_samr_create_user(struct torture_context *tctx,
     212             :                                   struct torture_access_context *t,
     213             :                                   const char *name)
     214             : {
     215           7 :         struct dcerpc_binding_handle *b = t->pipe->binding_handle;
     216             :         struct policy_handle connect_handle;
     217             :         struct policy_handle domain_handle;
     218             :         struct policy_handle user_handle;
     219           7 :         bool ok = false;
     220             : 
     221           7 :         torture_comment(tctx, "Connecting to SAMR\n");
     222           7 :         ZERO_STRUCT(connect_handle);
     223           7 :         ok = test_samr_Connect(tctx, b, &connect_handle);
     224           7 :         torture_assert(tctx, ok, "Unable to connect to domain");
     225             : 
     226           7 :         torture_comment(tctx, "Opening domain %s\n", t->user.domain);
     227           7 :         ZERO_STRUCT(domain_handle);
     228           7 :         ok = test_samr_openDomain(tctx,
     229             :                                   b,
     230             :                                   &connect_handle,
     231             :                                   t->user.domain,
     232             :                                   &domain_handle);
     233           7 :         torture_assert(tctx, ok, "Unable to open to domain");
     234             : 
     235           7 :         torture_comment(tctx, "Creating account %s\n", name);
     236           7 :         ZERO_STRUCT(user_handle);
     237           7 :         ok = test_samr_CreateUser(tctx,
     238             :                                   b,
     239             :                                   &domain_handle,
     240             :                                   name,
     241             :                                   &user_handle);
     242             : 
     243             :         /* We don't check ok with torture macros here because the
     244             :          * caller might be looking for failure */
     245           7 :         test_samr_handle_Close(b, tctx, &domain_handle);
     246           7 :         test_samr_handle_Close(b, tctx, &connect_handle);
     247             : 
     248           7 :         return ok;
     249             : }
     250             : 
     251         280 : static bool test_samr_userinfo_getinfo(struct torture_context *tctx,
     252             :                                        struct dcerpc_pipe *p,
     253             :                                        bool expected)
     254             : {
     255             :         const char *name;
     256         280 :         struct dcerpc_pipe *p2 = NULL;
     257             :         struct dcerpc_binding_handle *b;
     258             :         struct policy_handle connect_handle;
     259             :         struct policy_handle domain_handle;
     260             :         struct policy_handle user_handle;
     261             :         NTSTATUS status;
     262         280 :         uint32_t i = 0;
     263             :         bool ok;
     264             : 
     265         280 :         status = torture_rpc_connection(tctx, &p2, &ndr_table_samr);
     266         280 :         torture_assert_ntstatus_ok(tctx, status,
     267             :                         "Creating secondary connection failed");
     268         280 :         b = p2->binding_handle;
     269             : 
     270         280 :         torture_comment(tctx, " - 2nd connect\n");
     271             :         /* connect */
     272         280 :         ZERO_STRUCT(connect_handle);
     273         280 :         ok = test_samr_Connect(tctx, b, &connect_handle);
     274         280 :         torture_assert(tctx, ok, "Unable to connect to domain");
     275             : 
     276         280 :         torture_comment(tctx, " - 2nd open domain\n");
     277             :         /* open domain */
     278         280 :         ZERO_STRUCT(domain_handle);
     279         280 :         ok = test_samr_openDomain(tctx,
     280             :                                   b,
     281             :                                   &connect_handle,
     282             :                                   torture_setting_string(tctx, "workgroup",
     283             :                                                          lpcfg_workgroup(tctx->lp_ctx)),
     284             :                                   &domain_handle);
     285         280 :         torture_assert(tctx, ok, "Unable to open to domain");
     286             : 
     287             :         /* create user */
     288         280 :         name = talloc_asprintf(tctx,
     289             :                                "%s%04d",
     290             :                                TEST_ACCOUNT_NAME,
     291             :                                i);
     292             : 
     293         280 :         torture_comment(tctx, " - 2nd open user\n");
     294         280 :         ZERO_STRUCT(user_handle);
     295         280 :         ok = test_samr_OpenUser(tctx,
     296             :                                 b,
     297             :                                 &domain_handle,
     298             :                                 name,
     299             :                                 &user_handle,
     300             :                                 expected);
     301         280 :         torture_assert(tctx, ok, "Unable to open user");
     302             : 
     303         280 :         if (!expected) {
     304         140 :                 torture_comment(tctx, " - 2nd query user\n");
     305         140 :                 ok = test_samr_queryUserInfo(tctx, b, &user_handle);
     306         140 :                 torture_assert(tctx, ok, "Unable to query user");
     307             : 
     308         140 :                 test_samr_handle_Close(b, tctx, &user_handle);
     309             :         }
     310             : 
     311         280 :         test_samr_handle_Close(b, tctx, &domain_handle);
     312         280 :         test_samr_handle_Close(b, tctx, &connect_handle);
     313             : 
     314         280 :         talloc_free(p2);
     315             : 
     316         280 :         return true;
     317             : }
     318             : 
     319             : #define NUM_RUNS 20
     320           7 : static bool torture_rpc_samr_caching(struct torture_context *tctx,
     321             :                                      struct dcerpc_pipe *p)
     322             : {
     323             :         struct test_join *join;
     324           7 :         const char *password = NULL;
     325             :         const char *name;
     326             :         NTSTATUS status;
     327           7 :         uint32_t i = 0;
     328             :         bool ok;
     329             : 
     330           7 :         torture_comment(tctx, ">>> Testing User Info Caching\n");
     331             : 
     332             :         /* create user */
     333           7 :         name = talloc_asprintf(tctx,
     334             :                                "%s%04d",
     335             :                                TEST_ACCOUNT_NAME,
     336             :                                i);
     337             : 
     338           7 :         torture_comment(tctx, "- Creating user %s\n", name);
     339             : 
     340           7 :         join = torture_create_testuser(tctx,
     341             :                                        name,
     342             :                                        torture_setting_string(tctx, "workgroup",
     343             :                                                               lpcfg_workgroup(tctx->lp_ctx)),
     344             :                                        ACB_NORMAL,
     345             :                                        &password);
     346           7 :         torture_assert(tctx, join, "failed to join domain");
     347             : 
     348           7 :         torture_comment(tctx, "- Query user information\n");
     349         147 :         for (i = 0; i < NUM_RUNS; i++) {
     350         140 :                 ok = test_samr_userinfo_getinfo(tctx, p, false);
     351         140 :                 torture_assert(tctx, ok, "test_samr_userinfo_getinfo failed");
     352             :         }
     353             : 
     354           7 :         torture_comment(tctx, "- Delete user\n");
     355           7 :         status = torture_delete_testuser(tctx,
     356             :                                          join,
     357             :                                          name);
     358           7 :         torture_assert_ntstatus_ok(tctx, status, "DeleteUser failed");
     359             : 
     360           7 :         torture_comment(tctx, "- Try to query user information again (should fail)\n");
     361         147 :         for (i = 0; i < NUM_RUNS; i++) {
     362         140 :                 ok = test_samr_userinfo_getinfo(tctx,
     363             :                                                 p,
     364             :                                                 true);
     365         140 :                 torture_assert(tctx, ok, "test_samr_userinfo_getinfo failed");
     366             :         }
     367             : 
     368           7 :         return true;
     369             : }
     370             : #undef NUM_RUNS
     371             : 
     372           0 : static bool torture_rpc_samr_access_setup_membership(struct torture_context *tctx,
     373             :                                                      struct dcerpc_pipe *p,
     374             :                                                      uint32_t num_members,
     375             :                                                      uint32_t *members,
     376             :                                                      struct dom_sid *user_sid)
     377             : {
     378           0 :         struct dcerpc_binding_handle *b = p->binding_handle;
     379             :         struct policy_handle connect_handle, domain_handle;
     380             :         int i;
     381             : 
     382           0 :         torture_comment(tctx,
     383             :                 "Setting up BUILTIN membership for %s\n",
     384             :                 dom_sid_string(tctx, user_sid));
     385             : 
     386           0 :         for (i=0; i < num_members; i++) {
     387           0 :                 torture_comment(tctx, "adding user to S-1-5-32-%d\n", members[i]);
     388             :         }
     389             : 
     390             :         /* connect */
     391             :         {
     392             :                 struct samr_Connect2 r;
     393           0 :                 r.in.system_name = "";
     394           0 :                 r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
     395           0 :                 ZERO_STRUCT(connect_handle);
     396           0 :                 r.out.connect_handle = &connect_handle;
     397             : 
     398           0 :                 torture_assert_ntstatus_ok(tctx,
     399             :                         dcerpc_samr_Connect2_r(b, tctx, &r),
     400             :                         "samr_Connect2 failed");
     401           0 :                 torture_assert_ntstatus_ok(tctx, r.out.result,
     402             :                         "samr_Connect2 failed");
     403             :         }
     404             : 
     405             :         /* open domain */
     406             :         {
     407             :                 struct samr_OpenDomain r;
     408           0 :                 r.in.connect_handle = &connect_handle;
     409           0 :                 r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
     410           0 :                 r.in.sid = dom_sid_parse_talloc(tctx, "S-1-5-32");
     411           0 :                 ZERO_STRUCT(domain_handle);
     412           0 :                 r.out.domain_handle = &domain_handle;
     413             : 
     414           0 :                 torture_assert_ntstatus_ok(tctx,
     415             :                         dcerpc_samr_OpenDomain_r(b, tctx, &r),
     416             :                         "samr_OpenDomain failed");
     417           0 :                 torture_assert_ntstatus_ok(tctx, r.out.result,
     418             :                         "samr_OpenDomain failed");
     419             :         }
     420             : 
     421           0 :         for (i = 0; i < num_members; i++) {
     422             : 
     423             :                 struct policy_handle alias_handle;
     424             : 
     425             :                 /* open alias */
     426             :                 {
     427             :                         struct samr_OpenAlias r;
     428           0 :                         r.in.domain_handle = &domain_handle;
     429           0 :                         r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
     430           0 :                         r.in.rid = members[i];
     431           0 :                         ZERO_STRUCT(alias_handle);
     432           0 :                         r.out.alias_handle = &alias_handle;
     433             : 
     434           0 :                         torture_assert_ntstatus_ok(tctx,
     435             :                                         dcerpc_samr_OpenAlias_r(b, tctx, &r),
     436             :                                         "samr_OpenAlias failed");
     437           0 :                         torture_assert_ntstatus_ok(tctx, r.out.result,
     438             :                                         "samr_OpenAlias failed");
     439             :                 }
     440             : 
     441             :                 /* add alias member */
     442             :                 {
     443             :                         struct samr_AddAliasMember r;
     444           0 :                         ZERO_STRUCT(alias_handle);
     445           0 :                         r.in.alias_handle = &alias_handle;
     446           0 :                         r.in.sid = user_sid;
     447             : 
     448           0 :                         torture_assert_ntstatus_ok(tctx,
     449             :                                         dcerpc_samr_AddAliasMember_r(b, tctx, &r),
     450             :                                         "samr_AddAliasMember failed");
     451           0 :                         torture_assert_ntstatus_ok(tctx, r.out.result,
     452             :                                         "samr_AddAliasMember failed");
     453             :                 }
     454             : 
     455           0 :                 test_samr_handle_Close(b, tctx, &alias_handle);
     456             :         }
     457             : 
     458           0 :         test_samr_handle_Close(b, tctx, &domain_handle);
     459           0 :         test_samr_handle_Close(b, tctx, &connect_handle);
     460             : 
     461           0 :         return true;
     462             : }
     463             : 
     464           7 : static bool torture_rpc_samr_access_setup(struct torture_context *tctx,
     465             :                                           struct dcerpc_pipe *p,
     466             :                                           struct torture_access_context *t)
     467             : {
     468           7 :         const char *binding = torture_setting_string(tctx, "binding", NULL);
     469             :         struct cli_credentials *test_credentials;
     470             :         struct test_join *join;
     471             :         struct dom_sid *test_sid;
     472             :         struct dcerpc_pipe *samr_pipe;
     473             : 
     474           7 :         t->user.domain = torture_setting_string(tctx, "workgroup",
     475             :                                                 lpcfg_workgroup(tctx->lp_ctx)),
     476             : 
     477           7 :         join = torture_create_testuser(tctx,
     478             :                                        t->user.username,
     479             :                                        t->user.domain,
     480             :                                        ACB_NORMAL,
     481             :                                        &t->user.password);
     482           7 :         torture_assert(tctx, join, "failed to join domain");
     483           7 :         t->join = join;
     484             : 
     485           7 :         test_credentials = cli_credentials_init(tctx);
     486             : 
     487           7 :         cli_credentials_set_workstation(test_credentials,
     488             :                                         "localhost",
     489             :                                         CRED_SPECIFIED);
     490           7 :         cli_credentials_set_domain(test_credentials,
     491             :                                    torture_setting_string(tctx, "workgroup",
     492             :                                                           lpcfg_workgroup(tctx->lp_ctx)),
     493             :                                    CRED_SPECIFIED);
     494           7 :         cli_credentials_set_username(test_credentials,
     495             :                                      t->user.username,
     496             :                                      CRED_SPECIFIED);
     497           7 :         cli_credentials_set_password(test_credentials,
     498             :                                      t->user.password,
     499             :                                      CRED_SPECIFIED);
     500           7 :         test_sid = discard_const_p(struct dom_sid,
     501             :                                    torture_join_user_sid(t->join));
     502             : 
     503           7 :         if (t->user.num_builtin_memberships) {
     504           0 :                 torture_assert(tctx,
     505             :                         torture_rpc_samr_access_setup_membership(tctx,
     506             :                                                                  p,
     507             :                                                                  t->user.num_builtin_memberships,
     508             :                                                                  t->user.builtin_memberships,
     509             :                                                                  test_sid),
     510             :                         "failed to setup membership");
     511             :         }
     512             : 
     513           7 :         torture_assert_ntstatus_ok(tctx,
     514             :                 dcerpc_pipe_connect(tctx,
     515             :                                     &samr_pipe,
     516             :                                     binding,
     517             :                                     &ndr_table_samr,
     518             :                                     test_credentials,
     519             :                                     tctx->ev,
     520             :                                     tctx->lp_ctx),
     521             :                 "Error connecting to server");
     522             : 
     523           7 :         t->pipe = samr_pipe;
     524             : 
     525           7 :         return true;
     526             : }
     527             : 
     528           7 : static bool torture_rpc_samr_access(struct torture_context *tctx,
     529             :                                     struct dcerpc_pipe *p)
     530             : {
     531             :         struct torture_access_context *t;
     532             :         const char *testuser;
     533             :         bool ok;
     534             : 
     535           7 :         torture_comment(tctx, "Testing non-privileged user access\n");
     536             : 
     537           7 :         t = talloc_zero(tctx, struct torture_access_context);
     538           7 :         torture_assert(tctx, t, "talloc failed");
     539             : 
     540           7 :         t->user.username = talloc_asprintf(t, "%s%04d", TEST_ACCOUNT_NAME, 100);
     541             : 
     542           7 :         torture_comment(tctx, "*** Setting up non-privleged user\n"
     543             :                               "***\n");
     544             : 
     545           7 :         ok = torture_rpc_samr_access_setup(tctx, p, t);
     546           7 :         torture_assert(tctx, ok, "torture_rpc_samr_access_setup failed");
     547             : 
     548           7 :         testuser = talloc_asprintf(t, "%s%04d", TEST_ACCOUNT_NAME, 200);
     549             : 
     550           7 :         torture_comment(tctx, "*** Try to create user (%s) as non-privileged "
     551             :                               "user - should fail\n"
     552             :                               "***\n", testuser);
     553             : 
     554           7 :         ok = test_samr_create_user(tctx, t, testuser);
     555             : 
     556           7 :         torture_assert(tctx, ok == false, "*** Creating user was successful but it should fail");
     557             : 
     558           7 :         return true;
     559             : }
     560             : 
     561        2355 : struct torture_suite *torture_rpc_samr_priv(TALLOC_CTX *mem_ctx)
     562             : {
     563        1897 :         struct torture_suite *suite =
     564         458 :                 torture_suite_create(mem_ctx, "samr.priv");
     565             :         struct torture_rpc_tcase *tcase;
     566             : 
     567        2355 :         tcase = torture_suite_add_rpc_iface_tcase(suite,
     568             :                                                   "samr",
     569             :                                                   &ndr_table_samr);
     570             : 
     571        2355 :         torture_rpc_tcase_add_test(tcase,
     572             :                                    "caching",
     573             :                                    torture_rpc_samr_caching);
     574             : 
     575        2355 :         torture_rpc_tcase_add_test(tcase,
     576             :                                    "access",
     577             :                                    torture_rpc_samr_access);
     578             : 
     579        2355 :         return suite;
     580             : }

Generated by: LCOV version 1.13