diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/Makefile.in | 6 | ||||
-rw-r--r-- | source4/librpc/idl/wkssvc.idl | 30 | ||||
-rw-r--r-- | source4/librpc/ndr/libndr.h | 1 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_wkssvc.c | 162 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_wkssvc.h | 28 | ||||
-rw-r--r-- | source4/librpc/rpc/rpc_wkssvc.c | 18 | ||||
-rw-r--r-- | source4/torture/rpc/wkssvc.c | 69 | ||||
-rw-r--r-- | source4/torture/torture.c | 1 |
8 files changed, 312 insertions, 3 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in index f8d36d656d..293ce5d77e 100644 --- a/source4/Makefile.in +++ b/source4/Makefile.in @@ -196,11 +196,11 @@ LIBCLIUTIL_OBJ = libcli/util/asn1.o \ LIBRAW_NDR_OBJ = librpc/ndr/ndr.o librpc/ndr/ndr_basic.o librpc/ndr/ndr_sec.o \ librpc/ndr/ndr_echo.o librpc/ndr/ndr_misc.o librpc/ndr/ndr_lsa.o \ librpc/ndr/ndr_dfs.o librpc/ndr/ndr_samr.o \ - librpc/ndr/ndr_spoolss.o librpc/ndr/ndr_spoolss_buf.o + librpc/ndr/ndr_spoolss.o librpc/ndr/ndr_spoolss_buf.o librpc/ndr/ndr_wkssvc.o LIBRAW_RPC_OBJ = librpc/rpc/dcerpc.o librpc/rpc/rpc_echo.o librpc/rpc/rpc_lsa.o \ librpc/rpc/dcerpc_smb.o librpc/rpc/rpc_dfs.o librpc/rpc/rpc_spoolss.o \ - librpc/rpc/rpc_samr.o + librpc/rpc/rpc_samr.o librpc/rpc/rpc_wkssvc.o LIBRAW_OBJ = libcli/raw/rawfile.o libcli/raw/smb_signing.o \ libcli/raw/clisocket.o libcli/raw/clitransport.o \ @@ -509,7 +509,7 @@ SMBTORTURE_RAW_OBJ = torture/raw/qfsinfo.o torture/raw/qfileinfo.o torture/raw/s torture/raw/write.o torture/raw/lock.o torture/raw/rename.o torture/raw/seek.o SMBTORTURE_RPC_OBJ = torture/rpc/lsa.o torture/rpc/echo.o torture/rpc/dfs.o \ - torture/rpc/spoolss.o torture/rpc/samr.o + torture/rpc/spoolss.o torture/rpc/samr.o torture/rpc/wkssvc.o SMBTORTURE_OBJ1 = torture/torture.o torture/torture_util.o torture/nbio.o torture/scanner.o \ torture/utable.o torture/denytest.o torture/mangle_test.o \ diff --git a/source4/librpc/idl/wkssvc.idl b/source4/librpc/idl/wkssvc.idl new file mode 100644 index 0000000000..8f76a862f3 --- /dev/null +++ b/source4/librpc/idl/wkssvc.idl @@ -0,0 +1,30 @@ +/* + wkssvc interface definitions +*/ + +[ uuid(6bffd098-a112-3610-9833-46c3f87e345a), + version(1.0), + pointer_default(unique) +] interface wkssvc +{ + /******************/ + /* Function: 0x00 */ + typedef struct { + uint32 platform_id; /* 0x0000 01f4 - unknown */ + unistr *uni_compname; /* unicode server name */ + unistr *uni_lan_grp; /* unicode domain name */ + uint32 ver_major; /* 4 - unknown */ + uint32 ver_minor; /* 0 - unknown */ + } wks_Info100; + + typedef union { + case (100) wks_Info100 *info100; + } wks_Info; + + NTSTATUS wks_QueryInfo( + [in] unistr *server_name, + [in] uint32 level, + [out,switch_is(level)] wks_Info info + ); + +} diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index f0a906e5fa..8186aa0a13 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -195,3 +195,4 @@ typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint16, v #include "librpc/ndr/ndr_spoolss.h" #include "librpc/ndr/ndr_spoolss_buf.h" #include "librpc/ndr/ndr_samr.h" +#include "librpc/ndr/ndr_wkssvc.h" diff --git a/source4/librpc/ndr/ndr_wkssvc.c b/source4/librpc/ndr/ndr_wkssvc.c new file mode 100644 index 0000000000..ff694de5d6 --- /dev/null +++ b/source4/librpc/ndr/ndr_wkssvc.c @@ -0,0 +1,162 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" + +NTSTATUS ndr_push_wks_QueryInfo(struct ndr_push *ndr, struct wks_QueryInfo *r) +{ + NDR_CHECK(ndr_push_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_unistr(ndr, r->in.server_name)); + } + NDR_CHECK(ndr_push_uint32(ndr, r->in.level)); + + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_wks_Info100(struct ndr_pull *ndr, int ndr_flags, struct wks_Info100 *r) +{ + uint32 _ptr_uni_compname; + uint32 _ptr_uni_lan_grp; + NDR_CHECK(ndr_pull_struct_start(ndr)); + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->platform_id)); + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_uni_compname)); + if (_ptr_uni_compname) { + NDR_ALLOC(ndr, r->uni_compname); + } else { + r->uni_compname = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_uni_lan_grp)); + if (_ptr_uni_lan_grp) { + NDR_ALLOC(ndr, r->uni_lan_grp); + } else { + r->uni_lan_grp = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, &r->ver_major)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->ver_minor)); + ndr_pull_struct_end(ndr); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + if (r->uni_compname) { + NDR_CHECK(ndr_pull_unistr(ndr, &r->uni_compname)); + } + if (r->uni_lan_grp) { + NDR_CHECK(ndr_pull_unistr(ndr, &r->uni_lan_grp)); + } +done: + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_wks_Info(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union wks_Info *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_struct_start(ndr)); + NDR_CHECK(ndr_pull_uint16(ndr, level)); + switch (*level) { + case 100: { + uint32 _ptr_info100; + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info100)); + if (_ptr_info100) { + NDR_ALLOC(ndr, r->info100); + } else { + r->info100 = NULL; + } + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level); + } + ndr_pull_struct_end(ndr); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + switch (*level) { + case 100: + if (r->info100) { + NDR_CHECK(ndr_pull_wks_Info100(ndr, NDR_SCALARS|NDR_BUFFERS, r->info100)); + } + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level); + } +done: + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_wks_QueryInfo(struct ndr_pull *ndr, struct wks_QueryInfo *r) +{ + { uint16 _level = r->in.level; + NDR_CHECK(ndr_pull_wks_Info(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, &r->out.info)); + if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info"); + } + NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); + + return NT_STATUS_OK; +} + +void ndr_print_wks_Info100(struct ndr_print *ndr, const char *name, struct wks_Info100 *r) +{ + ndr_print_struct(ndr, name, "wks_Info100"); + ndr->depth++; + ndr_print_uint32(ndr, "platform_id", r->platform_id); + ndr_print_ptr(ndr, "uni_compname", r->uni_compname); + ndr->depth++; + if (r->uni_compname) { + ndr_print_unistr(ndr, "uni_compname", r->uni_compname); + } + ndr->depth--; + ndr_print_ptr(ndr, "uni_lan_grp", r->uni_lan_grp); + ndr->depth++; + if (r->uni_lan_grp) { + ndr_print_unistr(ndr, "uni_lan_grp", r->uni_lan_grp); + } + ndr->depth--; + ndr_print_uint32(ndr, "ver_major", r->ver_major); + ndr_print_uint32(ndr, "ver_minor", r->ver_minor); + ndr->depth--; +} + +void ndr_print_wks_Info(struct ndr_print *ndr, const char *name, uint16 level, union wks_Info *r) +{ + ndr_print_union(ndr, name, level, "wks_Info"); + switch (level) { + case 100: + ndr_print_ptr(ndr, "info100", r->info100); + ndr->depth++; + if (r->info100) { + ndr_print_wks_Info100(ndr, "info100", r->info100); + } + ndr->depth--; + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +void ndr_print_wks_QueryInfo(struct ndr_print *ndr, const char *name, int flags, struct wks_QueryInfo *r) +{ + ndr_print_struct(ndr, name, "wks_QueryInfo"); + ndr->depth++; + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "wks_QueryInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_unistr(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_uint32(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "wks_QueryInfo"); + ndr->depth++; + ndr_print_wks_Info(ndr, "info", r->in.level, &r->out.info); + ndr->depth--; + } + ndr->depth--; +} + diff --git a/source4/librpc/ndr/ndr_wkssvc.h b/source4/librpc/ndr/ndr_wkssvc.h new file mode 100644 index 0000000000..c8ad3fb7bc --- /dev/null +++ b/source4/librpc/ndr/ndr_wkssvc.h @@ -0,0 +1,28 @@ +/* header auto-generated by pidl */ + +struct wks_Info100 { + uint32 platform_id; + const char *uni_compname; + const char *uni_lan_grp; + uint32 ver_major; + uint32 ver_minor; +}; + +union wks_Info { +/* [case(100)] */ struct wks_Info100 *info100; +}; + +struct wks_QueryInfo { + struct { + const char *server_name; + uint32 level; + } in; + + struct { + union wks_Info info; + NTSTATUS result; + } out; + +}; + +#define DCERPC_WKS_QUERYINFO 0 diff --git a/source4/librpc/rpc/rpc_wkssvc.c b/source4/librpc/rpc/rpc_wkssvc.c new file mode 100644 index 0000000000..0549a35128 --- /dev/null +++ b/source4/librpc/rpc/rpc_wkssvc.c @@ -0,0 +1,18 @@ +/* dcerpc client calls auto-generated by pidl */ + +#include "includes.h" + + +NTSTATUS dcerpc_wks_QueryInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct wks_QueryInfo *r) +{ + NTSTATUS status; + status = dcerpc_ndr_request(p, DCERPC_WKS_QUERYINFO, mem_ctx, + (ndr_push_fn_t) ndr_push_wks_QueryInfo, + (ndr_pull_fn_t) ndr_pull_wks_QueryInfo, + r); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return r->out.result; +} diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c new file mode 100644 index 0000000000..eb85a4c428 --- /dev/null +++ b/source4/torture/rpc/wkssvc.c @@ -0,0 +1,69 @@ +/* + Unix SMB/CIFS implementation. + test suite for wkssvc rpc operations + + Copyright (C) Andrew Tridgell 2003 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + + +static BOOL test_QueryInfo(struct dcerpc_pipe *p, + TALLOC_CTX *mem_ctx) +{ + NTSTATUS status; + struct wks_QueryInfo r; + + printf("testing QueryInfo\n"); + + r.in.server_name = dcerpc_server_name(p); + r.in.level = 100; + + status = dcerpc_wks_QueryInfo(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("QueryInfo failed - %s\n", nt_errstr(status)); + return False; + } + + NDR_PRINT_BOTH_DEBUG(wks_QueryInfo, &r); + + return True; +} + +BOOL torture_rpc_wkssvc(int dummy) +{ + NTSTATUS status; + struct dcerpc_pipe *p; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + struct policy_handle handle; + + mem_ctx = talloc_init("torture_rpc_wkssvc"); + + status = torture_rpc_connection(&p, "wkssvc"); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + if (!test_QueryInfo(p, mem_ctx)) { + ret = False; + } + + torture_rpc_close(p); + + return ret; +} diff --git a/source4/torture/torture.c b/source4/torture/torture.c index facfb832ec..225f1321f5 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -3989,6 +3989,7 @@ static struct { {"RPC-DFS", torture_rpc_dfs, 0}, {"RPC-SPOOLSS", torture_rpc_spoolss, 0}, {"RPC-SAMR", torture_rpc_samr, 0}, + {"RPC-WKSSVC", torture_rpc_wkssvc, 0}, {NULL, NULL, 0}}; |