| 1 | /*
|
|---|
| 2 | Unix SMB/CIFS implementation.
|
|---|
| 3 |
|
|---|
| 4 | dcerpc torture tests
|
|---|
| 5 |
|
|---|
| 6 | Copyright (C) Andrew Tridgell 2003
|
|---|
| 7 | Copyright (C) Andrew Bartlett <abartlet@samba.org 2004
|
|---|
| 8 |
|
|---|
| 9 | This program is free software; you can redistribute it and/or modify
|
|---|
| 10 | it under the terms of the GNU General Public License as published by
|
|---|
| 11 | the Free Software Foundation; either version 3 of the License, or
|
|---|
| 12 | (at your option) any later version.
|
|---|
| 13 |
|
|---|
| 14 | This program is distributed in the hope that it will be useful,
|
|---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | GNU General Public License for more details.
|
|---|
| 18 |
|
|---|
| 19 | You should have received a copy of the GNU General Public License
|
|---|
| 20 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|---|
| 21 | */
|
|---|
| 22 |
|
|---|
| 23 | #include "includes.h"
|
|---|
| 24 | #include "torture/torture.h"
|
|---|
| 25 | #include "librpc/gen_ndr/ndr_lsa.h"
|
|---|
| 26 | #include "librpc/gen_ndr/ndr_lsa_c.h"
|
|---|
| 27 | #include "lib/cmdline/popt_common.h"
|
|---|
| 28 | #include "librpc/rpc/dcerpc.h"
|
|---|
| 29 | #include "torture/rpc/rpc.h"
|
|---|
| 30 | #include "libcli/libcli.h"
|
|---|
| 31 | #include "libcli/composite/composite.h"
|
|---|
| 32 | #include "libcli/smb_composite/smb_composite.h"
|
|---|
| 33 |
|
|---|
| 34 | /*
|
|---|
| 35 | This test is 'bogus' in that it doesn't actually perform to the
|
|---|
| 36 | spec. We need to deal with other things inside the DCERPC layer,
|
|---|
| 37 | before we could have multiple binds.
|
|---|
| 38 |
|
|---|
| 39 | We should never pass this test, until such details are fixed in our
|
|---|
| 40 | client, and it looks like multible binds are never used anyway.
|
|---|
| 41 |
|
|---|
| 42 | */
|
|---|
| 43 |
|
|---|
| 44 | bool torture_multi_bind(struct torture_context *torture)
|
|---|
| 45 | {
|
|---|
| 46 | struct dcerpc_pipe *p;
|
|---|
| 47 | struct dcerpc_binding *binding;
|
|---|
| 48 | TALLOC_CTX *mem_ctx;
|
|---|
| 49 | NTSTATUS status;
|
|---|
| 50 | bool ret;
|
|---|
| 51 |
|
|---|
| 52 | mem_ctx = talloc_init("torture_multi_bind");
|
|---|
| 53 |
|
|---|
| 54 | status = torture_rpc_binding(torture, &binding);
|
|---|
| 55 | if (!NT_STATUS_IS_OK(status)) {
|
|---|
| 56 | talloc_free(mem_ctx);
|
|---|
| 57 | return false;
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
|
|---|
| 61 |
|
|---|
| 62 | if (!NT_STATUS_IS_OK(status)) {
|
|---|
| 63 | talloc_free(mem_ctx);
|
|---|
| 64 | return false;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | status = dcerpc_pipe_auth(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials,
|
|---|
| 68 | torture->lp_ctx);
|
|---|
| 69 |
|
|---|
| 70 | if (NT_STATUS_IS_OK(status)) {
|
|---|
| 71 | printf("(incorrectly) allowed re-bind to uuid %s - %s\n",
|
|---|
| 72 | GUID_string(mem_ctx, &ndr_table_lsarpc.syntax_id.uuid), nt_errstr(status));
|
|---|
| 73 | ret = false;
|
|---|
| 74 | } else {
|
|---|
| 75 | printf("\n");
|
|---|
| 76 | ret = true;
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | talloc_free(mem_ctx);
|
|---|
| 80 |
|
|---|
| 81 | return ret;
|
|---|
| 82 | }
|
|---|