The branch, master has been updated via 2c31b7975daba0e7b12a2eaf8dfe6501dde9b937 (commit) via d595844891026b9adeb3fd44157a9bae2b3ec645 (commit) via b7a1dd9a94771c781efee0f0f4180024b2efe18b (commit) via f8bbdb100ba9293e45f345d12e92d693e079e6e1 (commit) via 6627080e0015acff5cfaf283f342c18fcba59117 (commit) via 3e1cd3dda7a6de9a46ecac9cf1518470203e4e12 (commit) from ba0facd688d2b0d864364031a373abea73e9154f (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 2c31b7975daba0e7b12a2eaf8dfe6501dde9b937 Author: Stefan Metzmacher <[EMAIL PROTECTED]> Date: Sat Dec 6 12:39:58 2008 +0100 s4:torture: add simple RPC-BROWSER test metze commit d595844891026b9adeb3fd44157a9bae2b3ec645 Author: Stefan Metzmacher <[EMAIL PROTECTED]> Date: Sat Dec 6 14:18:13 2008 +0100 s4:librpc: add SUBSYSTEM::RPC_NDR_BROWSER metze commit b7a1dd9a94771c781efee0f0f4180024b2efe18b Author: Stefan Metzmacher <[EMAIL PROTECTED]> Date: Sat Dec 6 14:20:45 2008 +0100 s4:loadparm: start 'browser' rpc_server metze commit f8bbdb100ba9293e45f345d12e92d693e079e6e1 Author: Stefan Metzmacher <[EMAIL PROTECTED]> Date: Sat Dec 6 14:19:58 2008 +0100 s4:dcesrv_browser: implement dcesrv_BrowserrQueryOtherDomains() metze commit 6627080e0015acff5cfaf283f342c18fcba59117 Author: Stefan Metzmacher <[EMAIL PROTECTED]> Date: Sat Dec 6 10:21:11 2008 +0100 s4:rpc_server: add dcesrv_browser template metze commit 3e1cd3dda7a6de9a46ecac9cf1518470203e4e12 Author: Stefan Metzmacher <[EMAIL PROTECTED]> Date: Sat Dec 6 10:11:30 2008 +0100 s4:brwoser.idl: add idl for BrowserrQueryOtherDomains() metze ----------------------------------------------------------------------- Summary of changes: librpc/idl/browser.idl | 54 +++++++-- librpc/idl/srvsvc.idl | 4 +- source4/librpc/config.mk | 5 + source4/param/loadparm.c | 2 +- source4/rpc_server/browser/dcesrv_browser.c | 172 +++++++++++++++++++++++++++ source4/rpc_server/config.mk | 13 ++ source4/rpc_server/service_rpc.c | 1 + source4/torture/config.mk | 4 +- source4/torture/rpc/browser.c | 122 +++++++++++++++++++ source4/torture/rpc/rpc.c | 1 + 10 files changed, 360 insertions(+), 18 deletions(-) create mode 100644 source4/rpc_server/browser/dcesrv_browser.c create mode 100644 source4/torture/rpc/browser.c Changeset truncated at 500 lines: diff --git a/librpc/idl/browser.idl b/librpc/idl/browser.idl index 5b05be9..94d4ce6 100644 --- a/librpc/idl/browser.idl +++ b/librpc/idl/browser.idl @@ -1,4 +1,6 @@ -[ +import "srvsvc.idl"; + +[ uuid("6bffd098-a112-3610-9833-012892020162"), version(0.0), helpstring("Browsing"), @@ -9,50 +11,76 @@ interface browser { /******************/ /* Function 0x00 */ - [todo] NTSTATUS BrowserrServerEnum(); + [todo] void BrowserrServerEnum(); /******************/ /* Function 0x01 */ - [todo] NTSTATUS BrowserrDebugCall(); + [todo] void BrowserrDebugCall(); /******************/ /* Function 0x02 */ - [todo] NTSTATUS BrowserrQueryOtherDomains(); + + typedef struct { + uint32 entries_read; + [size_is(entries_read)] srvsvc_NetSrvInfo100 *entries; + } BrowserrSrvInfo100Ctr; + + typedef struct { + uint32 entries_read; + [size_is(entries_read)] srvsvc_NetSrvInfo101 *entries; + } BrowserrSrvInfo101Ctr; + + typedef [switch_type(uint32)] union { + [case(100)] BrowserrSrvInfo100Ctr *info100; + [case(101)] BrowserrSrvInfo101Ctr *info101; + [default] ; + } BrowserrSrvInfoUnion; + + typedef struct { + uint32 level; + [switch_is(level)] BrowserrSrvInfoUnion info; + } BrowserrSrvInfo; + + WERROR BrowserrQueryOtherDomains( + [in,unique] [string,charset(UTF16)] uint16 *server_unc, + [in,out,ref] BrowserrSrvInfo *info, + [out,ref] uint32 *total_entries + ); /******************/ /* Function 0x03 */ - [todo] NTSTATUS BrowserrResetNetlogonState(); + [todo] void BrowserrResetNetlogonState(); /******************/ /* Function 0x04 */ - [todo] NTSTATUS BrowserrDebugTrace(); + [todo] void BrowserrDebugTrace(); /******************/ /* Function 0x05 */ - [todo] NTSTATUS BrowserrQueryStatistics(); + [todo] void BrowserrQueryStatistics(); /******************/ /* Function 0x06 */ - [todo] NTSTATUS BrowserResetStatistics(); + [todo] void BrowserResetStatistics(); /******************/ /* Function 0x07 */ - [todo] NTSTATUS NetrBrowserStatisticsClear(); + [todo] void NetrBrowserStatisticsClear(); /******************/ /* Function 0x08 */ - [todo] NTSTATUS NetrBrowserStatisticsGet(); + [todo] void NetrBrowserStatisticsGet(); /******************/ /* Function 0x09 */ - [todo] NTSTATUS BrowserrSetNetlogonState(); + [todo] void BrowserrSetNetlogonState(); /******************/ /* Function 0x0a */ - [todo] NTSTATUS BrowserrQueryEmulatedDomains(); + [todo] void BrowserrQueryEmulatedDomains(); /******************/ /* Function 0x0b */ - [todo] NTSTATUS BrowserrServerEnumEx(); + [todo] void BrowserrServerEnumEx(); } diff --git a/librpc/idl/srvsvc.idl b/librpc/idl/srvsvc.idl index 3f24402..153d8cf 100644 --- a/librpc/idl/srvsvc.idl +++ b/librpc/idl/srvsvc.idl @@ -638,12 +638,12 @@ import "security.idl", "svcctl.idl"; PLATFORM_ID_VMS = 700 } srvsvc_PlatformId; - typedef struct { + typedef [public] struct { srvsvc_PlatformId platform_id; [string,charset(UTF16)] uint16 *server_name; } srvsvc_NetSrvInfo100; - typedef struct { + typedef [public] struct { srvsvc_PlatformId platform_id; [string,charset(UTF16)] uint16 *server_name; uint32 version_major; diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 97da760..adea071 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -448,6 +448,11 @@ PUBLIC_DEPENDENCIES = dcerpc NDR_UNIXINFO RPC_NDR_UNIXINFO_OBJ_FILES = $(gen_ndrsrcdir)/ndr_unixinfo_c.o +[SUBSYSTEM::RPC_NDR_BROWSER] +PUBLIC_DEPENDENCIES = dcerpc NDR_BROWSER + +RPC_NDR_BROWSER_OBJ_FILES = $(gen_ndrsrcdir)/ndr_browser_c.o + [SUBSYSTEM::RPC_NDR_IRPC] PUBLIC_DEPENDENCIES = dcerpc NDR_IRPC diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index d660141..ab7d209 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -2296,7 +2296,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lp_do_global_parameter(lp_ctx, "ntvfs handler", "unixuid default"); lp_do_global_parameter(lp_ctx, "max connections", "-1"); - lp_do_global_parameter(lp_ctx, "dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup unixinfo"); + lp_do_global_parameter(lp_ctx, "dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup unixinfo browser"); lp_do_global_parameter(lp_ctx, "server services", "smb rpc nbt wrepl ldap cldap kdc drepl winbind ntp_signd"); lp_do_global_parameter(lp_ctx, "ntptr providor", "simple_ldb"); lp_do_global_parameter(lp_ctx, "auth methods:domain controller", "anonymous sam_ignoredomain"); diff --git a/source4/rpc_server/browser/dcesrv_browser.c b/source4/rpc_server/browser/dcesrv_browser.c new file mode 100644 index 0000000..33fed50 --- /dev/null +++ b/source4/rpc_server/browser/dcesrv_browser.c @@ -0,0 +1,172 @@ +/* + Unix SMB/CIFS implementation. + + endpoint server for the browser pipe + + Copyright (C) Stefan Metzmacher 2008 + + 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 3 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, see <http://www.gnu.org/licenses/>. +*/ + +#include "includes.h" +#include "rpc_server/dcerpc_server.h" +#include "librpc/gen_ndr/ndr_browser.h" +#include "rpc_server/common/common.h" + + +/* + BrowserrServerEnum +*/ +static void dcesrv_BrowserrServerEnum(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrServerEnum *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserrDebugCall +*/ +static void dcesrv_BrowserrDebugCall(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrDebugCall *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserrQueryOtherDomains +*/ +static WERROR dcesrv_BrowserrQueryOtherDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrQueryOtherDomains *r) +{ + struct BrowserrSrvInfo100Ctr *ctr100; + + switch (r->in.info->level) { + case 100: + if (!r->in.info->info.info100) { + return WERR_INVALID_PARAM; + } + + ctr100 = talloc(mem_ctx, struct BrowserrSrvInfo100Ctr); + W_ERROR_HAVE_NO_MEMORY(ctr100); + + ctr100->entries_read = 0; + ctr100->entries = talloc_zero_array(ctr100, struct srvsvc_NetSrvInfo100, + ctr100->entries_read); + W_ERROR_HAVE_NO_MEMORY(ctr100->entries); + + r->out.info->info.info100 = ctr100; + *r->out.total_entries = ctr100->entries_read; + return WERR_OK; + default: + return WERR_UNKNOWN_LEVEL; + } + + return WERR_INVALID_PARAM; +} + + +/* + BrowserrResetNetlogonState +*/ +static void dcesrv_BrowserrResetNetlogonState(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrResetNetlogonState *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserrDebugTrace +*/ +static void dcesrv_BrowserrDebugTrace(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrDebugTrace *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserrQueryStatistics +*/ +static void dcesrv_BrowserrQueryStatistics(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrQueryStatistics *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserResetStatistics +*/ +static void dcesrv_BrowserResetStatistics(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserResetStatistics *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + NetrBrowserStatisticsClear +*/ +static void dcesrv_NetrBrowserStatisticsClear(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct NetrBrowserStatisticsClear *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + NetrBrowserStatisticsGet +*/ +static void dcesrv_NetrBrowserStatisticsGet(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct NetrBrowserStatisticsGet *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserrSetNetlogonState +*/ +static void dcesrv_BrowserrSetNetlogonState(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrSetNetlogonState *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserrQueryEmulatedDomains +*/ +static void dcesrv_BrowserrQueryEmulatedDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrQueryEmulatedDomains *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* + BrowserrServerEnumEx +*/ +static void dcesrv_BrowserrServerEnumEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct BrowserrServerEnumEx *r) +{ + DCESRV_FAULT_VOID(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* include the generated boilerplate */ +#include "librpc/gen_ndr/ndr_browser_s.c" diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk index fb697d0..2149d68 100644 --- a/source4/rpc_server/config.mk +++ b/source4/rpc_server/config.mk @@ -184,6 +184,19 @@ PRIVATE_DEPENDENCIES = \ dcerpc_drsuapi_OBJ_FILES = $(rpc_serversrcdir)/drsuapi/dcesrv_drsuapi.o ################################################ +# Start MODULE dcerpc_browser +[MODULE::dcerpc_browser] +INIT_FUNCTION = dcerpc_server_browser_init +SUBSYSTEM = DCESRV +PRIVATE_DEPENDENCIES = \ + DCERPC_COMMON \ + NDR_BROWSER +# End MODULE dcerpc_browser +################################################ + +dcerpc_browser_OBJ_FILES = $(rpc_serversrcdir)/browser/dcesrv_browser.o + +################################################ # Start SUBSYSTEM dcerpc_server [SUBSYSTEM::dcerpc_server] PRIVATE_DEPENDENCIES = \ diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c index bb4d6bd..8b9020d 100644 --- a/source4/rpc_server/service_rpc.c +++ b/source4/rpc_server/service_rpc.c @@ -437,6 +437,7 @@ static void dcesrv_task_init(struct task_server *task) extern NTSTATUS dcerpc_server_samr_init(void); extern NTSTATUS dcerpc_server_remote_init(void); extern NTSTATUS dcerpc_server_lsa_init(void); + extern NTSTATUS dcerpc_server_browser_init(void); init_module_fn static_init[] = { STATIC_DCESRV_MODULES }; init_module_fn *shared_init = load_samba_modules(NULL, task->lp_ctx, "dcerpc_server"); diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 4b4664f..eaff5d5 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -108,7 +108,7 @@ PRIVATE_DEPENDENCIES = \ RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_ROT RPC_NDR_DSSETUP \ RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER RPC_NDR_NTSVCS WB_HELPER LIBSAMBA-NET \ LIBCLI_AUTH POPT_CREDENTIALS TORTURE_LDAP TORTURE_UTIL TORTURE_RAP \ - dcerpc_server service process_model ntvfs SERVICE_SMB + dcerpc_server service process_model ntvfs SERVICE_SMB RPC_NDR_BROWSER torture_rpc_OBJ_FILES = $(addprefix $(torturesrcdir)/rpc/, \ join.o lsa.o lsa_lookup.o session_key.o echo.o dfs.o drsuapi.o \ @@ -117,7 +117,7 @@ torture_rpc_OBJ_FILES = $(addprefix $(torturesrcdir)/rpc/, \ eventlog.o epmapper.o winreg.o initshutdown.o oxidresolve.o remact.o mgmt.o \ scanner.o autoidl.o countcalls.o testjoin.o schannel.o netlogon.o remote_pac.o samlogon.o \ samsync.o bind.o dssetup.o alter_context.o bench.o samba3rpc.o rpc.o async_bind.o \ - handles.o frsapi.o object_uuid.o ntsvcs.o) + handles.o frsapi.o object_uuid.o ntsvcs.o browser.o) $(eval $(call proto_header_template,$(torturesrcdir)/rpc/proto.h,$(torture_rpc_OBJ_FILES:.o=.c))) diff --git a/source4/torture/rpc/browser.c b/source4/torture/rpc/browser.c new file mode 100644 index 0000000..7c5479a --- /dev/null +++ b/source4/torture/rpc/browser.c @@ -0,0 +1,122 @@ +/* + Unix SMB/CIFS implementation. + + test suite for browser rpc operations + + Copyright (C) Stefan Metzmacher 2008 + + 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 3 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, see <http://www.gnu.org/licenses/>. +*/ + +#include "includes.h" +#include "torture/torture.h" +#include "librpc/gen_ndr/ndr_browser_c.h" +#include "torture/rpc/rpc.h" + +bool test_BrowserrQueryOtherDomains(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + struct BrowserrQueryOtherDomains r; + struct BrowserrSrvInfo info; + struct BrowserrSrvInfo100Ctr ctr100; + struct srvsvc_NetSrvInfo100 entries100[1]; + struct BrowserrSrvInfo101Ctr ctr101; + struct srvsvc_NetSrvInfo101 entries101[1]; + uint32_t total_entries; + NTSTATUS status; + + torture_comment(tctx, "dcerpc_BrowserrQueryOtherDomains\n"); + + ZERO_STRUCT(r); + ZERO_STRUCT(info); + ZERO_STRUCT(ctr100); + ZERO_STRUCT(entries100); + ZERO_STRUCT(ctr101); + ZERO_STRUCT(entries101); + total_entries = 0; + + r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); + r.in.info = &info; + r.out.info = &info; + r.out.total_entries = &total_entries; + + info.level = 100; + info.info.info100 = &ctr100; + + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_ok(tctx, r.out.result, "BrowserrQueryOtherDomains failed"); + torture_assert_int_equal(tctx, *r.out.total_entries, 0, "BrowserrQueryOtherDomains"); + + ctr100.entries_read = ARRAY_SIZE(entries100); + ctr100.entries = entries100; + + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_ok(tctx, r.out.result, "BrowserrQueryOtherDomains failed"); + torture_assert_int_equal(tctx, *r.out.total_entries, 0, "BrowserrQueryOtherDomains"); + + info.info.info100 = NULL; + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_equal(tctx, WERR_INVALID_PARAM, r.out.result, + "BrowserrQueryOtherDomains failed"); + + info.level = 101; + info.info.info101 = &ctr101; + + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result, + "BrowserrQueryOtherDomains"); + + ctr101.entries_read = ARRAY_SIZE(entries101); + ctr101.entries = entries101; + + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result, + "BrowserrQueryOtherDomains"); + + info.info.info101 = NULL; + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result, + "BrowserrQueryOtherDomains"); + + info.level = 102; + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result, + "BrowserrQueryOtherDomains"); + + info.level = 0; + status = dcerpc_BrowserrQueryOtherDomains(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "BrowserrQueryOtherDomains failed"); + torture_assert_werr_equal(tctx, WERR_UNKNOWN_LEVEL, r.out.result, + "BrowserrQueryOtherDomains"); + -- Samba Shared Repository