Line data Source code
1 : /* 2 : Unix SMB/CIFS implementation. 3 : 4 : test suite for behaviour of object uuids in rpc requests 5 : 6 : Copyright (C) Stefan Metzmacher 2008 7 : 8 : This program is free software; you can redistribute it and/or modify 9 : it under the terms of the GNU General Public License as published by 10 : the Free Software Foundation; either version 3 of the License, or 11 : (at your option) any later version. 12 : 13 : This program is distributed in the hope that it will be useful, 14 : but WITHOUT ANY WARRANTY; without even the implied warranty of 15 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 : GNU General Public License for more details. 17 : 18 : You should have received a copy of the GNU General Public License 19 : along with this program. If not, see <http://www.gnu.org/licenses/>. 20 : */ 21 : 22 : #include "includes.h" 23 : #include "librpc/gen_ndr/ndr_dssetup.h" 24 : #include "librpc/gen_ndr/ndr_lsa.h" 25 : #include "torture/rpc/torture_rpc.h" 26 : 27 : /* 28 : this tests the send object uuids in the dcerpc request 29 : */ 30 : 31 3 : static bool test_random_uuid(struct torture_context *torture) 32 : { 33 0 : NTSTATUS status; 34 0 : struct dcerpc_pipe *p1, *p2; 35 0 : struct GUID uuid; 36 0 : struct dssetup_DsRoleGetPrimaryDomainInformation r1; 37 0 : struct lsa_GetUserName r2; 38 3 : struct lsa_String *authority_name_p = NULL; 39 3 : struct lsa_String *account_name_p = NULL; 40 : 41 3 : torture_comment(torture, "RPC-OBJECTUUID-RANDOM\n"); 42 : 43 3 : status = torture_rpc_connection(torture, &p1, &ndr_table_dssetup); 44 3 : torture_assert_ntstatus_ok(torture, status, "opening dsetup pipe1"); 45 : 46 3 : status = torture_rpc_connection(torture, &p2, &ndr_table_lsarpc); 47 3 : torture_assert_ntstatus_ok(torture, status, "opening lsa pipe1"); 48 : 49 3 : uuid = GUID_random(); 50 : 51 3 : r1.in.level = DS_ROLE_BASIC_INFORMATION; 52 3 : status = dcerpc_binding_handle_call(p1->binding_handle, 53 : &uuid, 54 : &ndr_table_dssetup, 55 : NDR_DSSETUP_DSROLEGETPRIMARYDOMAININFORMATION, 56 : torture, &r1); 57 3 : torture_assert_ntstatus_ok(torture, status, "DsRoleGetPrimaryDomainInformation failed"); 58 3 : torture_assert_werr_ok(torture, r1.out.result, "DsRoleGetPrimaryDomainInformation failed"); 59 : 60 3 : uuid = GUID_random(); 61 : 62 3 : r2.in.system_name = "\\"; 63 3 : r2.in.account_name = &account_name_p; 64 3 : r2.in.authority_name = &authority_name_p; 65 3 : r2.out.account_name = &account_name_p; 66 3 : r2.out.authority_name = &authority_name_p; 67 : 68 3 : status = dcerpc_binding_handle_call(p2->binding_handle, 69 : &uuid, 70 : &ndr_table_lsarpc, 71 : NDR_LSA_GETUSERNAME, 72 : torture, &r2); 73 3 : torture_assert_ntstatus_ok(torture, status, "lsaClose failed"); 74 3 : torture_assert_ntstatus_ok(torture, r2.out.result, "lsaClose failed"); 75 : 76 3 : return true; 77 : } 78 : 79 2354 : struct torture_suite *torture_rpc_object_uuid(TALLOC_CTX *mem_ctx) 80 : { 81 125 : struct torture_suite *suite; 82 2354 : suite = torture_suite_create(mem_ctx, "objectuuid"); 83 2354 : torture_suite_add_simple_test(suite, "random-uuid", test_random_uuid); 84 2354 : return suite; 85 : }