From ccb136db48c42f1c1ddd5a51513aafdb8f28c4e3 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 14 Sep 2005 16:38:33 +0000 Subject: [PATCH] r10226: here we go again. have to implement another pipe to get the MMC service control plugin to stop whining. Looks like I have about 1/2 dozen RPCs to match Win2k --- source/Makefile.in | 13 +++++-- source/configure.in | 3 +- source/include/includes.h | 1 + source/include/rpc_ntsvcs.h | 40 ++++++++++++++++++++++ source/include/smb.h | 3 +- source/rpc_parse/parse_ntsvcs.c | 68 +++++++++++++++++++++++++++++++++++++ source/rpc_parse/parse_rpc.c | 13 ++++++- source/rpc_server/srv_ntsvcs.c | 71 +++++++++++++++++++++++++++++++++++++++ source/rpc_server/srv_ntsvcs_nt.c | 35 +++++++++++++++++++ source/rpc_server/srv_pipe.c | 3 ++ 10 files changed, 245 insertions(+), 5 deletions(-) create mode 100644 source/include/rpc_ntsvcs.h create mode 100644 source/rpc_parse/parse_ntsvcs.c create mode 100644 source/rpc_server/srv_ntsvcs.c create mode 100644 source/rpc_server/srv_ntsvcs_nt.c diff --git a/source/Makefile.in b/source/Makefile.in index abeb1353372..6f5267fdd1e 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -288,6 +288,8 @@ RPC_SVCCTL_OBJ = rpc_server/srv_svcctl.o rpc_server/srv_svcctl_nt.o \ services/svc_spoolss.o services/svc_rcinit.o services/services_db.o \ services/svc_netlogon.o services/svc_winreg.o +RPC_NTSVCS_OBJ = rpc_server/srv_ntsvcs.o rpc_server/srv_ntsvcs_nt.o + RPC_DFS_OBJ = rpc_server/srv_dfs.o rpc_server/srv_dfs_nt.o RPC_SPOOLSS_OBJ = rpc_server/srv_spoolss.o rpc_server/srv_spoolss_nt.o @@ -312,7 +314,8 @@ RPC_PARSE_OBJ = rpc_parse/parse_lsa.o rpc_parse/parse_net.o \ rpc_parse/parse_spoolss.o rpc_parse/parse_dfs.o \ rpc_parse/parse_echo.o rpc_parse/parse_shutdown.o \ rpc_parse/parse_svcctl.o rpc_parse/parse_unixinfo.o \ - rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o $(REGOBJS_OBJ) + rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o \ + rpc_parse/parse_ntsvcs.o $(REGOBJS_OBJ) RPC_CLIENT_OBJ = rpc_client/cli_pipe.o @@ -643,7 +646,8 @@ PROTO_OBJ = $(SMBD_OBJ_MAIN) \ $(RPC_LSA_OBJ) $(RPC_NETLOG_OBJ) $(RPC_SAMR_OBJ) $(RPC_REG_OBJ) $(RPC_LSA_DS_OBJ) \ $(RPC_SVC_OBJ) $(RPC_WKS_OBJ) $(RPC_DFS_OBJ) $(RPC_SPOOLSS_OBJ) \ $(RPC_ECHO_OBJ) $(RPC_SVCCTL_OBJ) $(RPC_EVENTLOG_OBJ) $(SMBLDAP_OBJ) \ - $(IDMAP_OBJ) libsmb/spnego.o $(PASSCHANGE_OBJ) $(RPC_UNIXINFO_OBJ) + $(IDMAP_OBJ) libsmb/spnego.o $(PASSCHANGE_OBJ) $(RPC_UNIXINFO_OBJ) \ + $(RPC_NTSVCS_OBJ) WINBIND_WINS_NSS_OBJ = nsswitch/wins.o $(PARAM_OBJ) \ $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) $(NSSWINS_OBJ) $(KRBCLIENT_OBJ) @@ -1083,6 +1087,11 @@ bin/librpc_svcctl.@SHLIBEXT@: $(RPC_SVCCTL_OBJ) @$(SHLD) $(LDSHFLAGS) -o $@ $(RPC_SVCCTL_OBJ) -lc \ @SONAMEFLAG@`basename $@` +bin/librpc_ntsvcs.@SHLIBEXT@: $(RPC_NTSVCS_OBJ) + @echo "Linking $@" + @$(SHLD) $(LDSHFLAGS) -o $@ $(RPC_NTSVCS_OBJ) -lc \ + @SONAMEFLAG@`basename $@` + bin/librpc_wkssvc.@SHLIBEXT@: $(RPC_WKS_OBJ) @echo "Linking $@" @$(SHLD) $(LDSHFLAGS) -o $@ $(RPC_WKS_OBJ) -lc \ diff --git a/source/configure.in b/source/configure.in index 6800cffec37..d7f6f2e565d 100644 --- a/source/configure.in +++ b/source/configure.in @@ -458,7 +458,7 @@ DYNEXP= dnl Add modules that have to be built by default here dnl These have to be built static: -default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_reg rpc_lsa_ds rpc_wks rpc_svcctl rpc_net rpc_dfs rpc_srv rpc_spoolss rpc_eventlog rpc_unixinfo auth_rhosts auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin" +default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_reg rpc_lsa_ds rpc_wks rpc_svcctl rpc_ntsvcs rpc_net rpc_dfs rpc_srv rpc_spoolss rpc_eventlog rpc_unixinfo auth_rhosts auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin" dnl These are preferably build shared, and static if dlopen() is not available default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy charset_CP850 charset_CP437" @@ -4946,6 +4946,7 @@ SMB_MODULE(rpc_reg, \$(RPC_REG_OBJ), "bin/librpc_winreg.$SHLIBEXT", RPC) SMB_MODULE(rpc_lsa_ds, \$(RPC_LSA_DS_OBJ), "bin/librpc_lsa_ds.$SHLIBEXT", RPC) SMB_MODULE(rpc_wks, \$(RPC_WKS_OBJ), "bin/librpc_wkssvc.$SHLIBEXT", RPC) SMB_MODULE(rpc_svcctl, \$(RPC_SVCCTL_OBJ), "bin/librpc_svcctl.$SHLIBEXT", RPC) +SMB_MODULE(rpc_ntsvcs, \$(RPC_NTSVCS_OBJ), "bin/librpc_ntsvcs.$SHLIBEXT", RPC) SMB_MODULE(rpc_net, \$(RPC_NETLOG_OBJ), "bin/librpc_NETLOGON.$SHLIBEXT", RPC) SMB_MODULE(rpc_dfs, \$(RPC_DFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC) SMB_MODULE(rpc_srv, \$(RPC_SVC_OBJ), "bin/librpc_srvsvc.$SHLIBEXT", RPC) diff --git a/source/include/includes.h b/source/include/includes.h index d6f031182e7..0368c03aadd 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -927,6 +927,7 @@ extern int errno; #include "ntdomain.h" #include "rpc_svcctl.h" +#include "rpc_ntsvcs.h" #include "rpc_lsa.h" #include "rpc_netlogon.h" #include "reg_objects.h" diff --git a/source/include/rpc_ntsvcs.h b/source/include/rpc_ntsvcs.h new file mode 100644 index 00000000000..2cc8eb1d7fd --- /dev/null +++ b/source/include/rpc_ntsvcs.h @@ -0,0 +1,40 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup + Copyright (C) Gerald (Jerry) Carter 2005 + + 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. +*/ + +#ifndef _RPC_NTSVCS_H /* _RPC_NTSVCS_H */ +#define _RPC_NTSVCS_H + +/* ntsvcs pipe */ + +#define NTSVCS_GET_VERSION 0x02 + +/**************************/ + +typedef struct { + /* nothing in the request */ + uint32 dummy; +} NTSVCS_Q_GET_VERSION; + +typedef struct { + uint32 version; + NTSTATUS status; +} NTSVCS_R_GET_VERSION; + +#endif /* _RPC_NTSVCS_H */ diff --git a/source/include/smb.h b/source/include/smb.h index fdc550ef2ac..739dd92a428 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -208,7 +208,8 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN]; #define PI_SVCCTL 11 #define PI_EVENTLOG 12 #define PI_UNIXINFO 13 -#define PI_MAX_PIPES 14 +#define PI_NTSVCS 14 +#define PI_MAX_PIPES 15 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ typedef struct nttime_info { diff --git a/source/rpc_parse/parse_ntsvcs.c b/source/rpc_parse/parse_ntsvcs.c new file mode 100644 index 00000000000..6e2bdf08699 --- /dev/null +++ b/source/rpc_parse/parse_ntsvcs.c @@ -0,0 +1,68 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Gerald (Jerry) Carter 2005. + * + * 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" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +/******************************************************************* +********************************************************************/ + +BOOL ntsvcs_io_q_get_version(const char *desc, NTSVCS_Q_GET_VERSION *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "ntsvcs_io_q_get_version"); + depth++; + + /* there is nothing to parse in this PDU */ + + return True; + +} + +/******************************************************************* +********************************************************************/ + +BOOL ntsvcs_io_r_get_version(const char *desc, NTSVCS_R_GET_VERSION *r_u, prs_struct *ps, int depth) +{ + if ( !r_u ) + return False; + + prs_debug(ps, depth, desc, "ntsvcs_io_r_get_version"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("version", ps, depth, &r_u->version)) + return False; + + if(!prs_ntstatus("status", ps, depth, &r_u->status)) + return False; + + return True; +} + + + + diff --git a/source/rpc_parse/parse_rpc.c b/source/rpc_parse/parse_rpc.c index 47436e75351..282e815eb5d 100644 --- a/source/rpc_parse/parse_rpc.c +++ b/source/rpc_parse/parse_rpc.c @@ -191,7 +191,7 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_UNIXINFO_V0 \ +#define SYNT_UNIXINFO_V0 \ { \ { \ 0x9c54e310, 0xa955, 0x4885, \ @@ -201,6 +201,16 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_NTSVCS_V1 \ +{ \ + { \ + 0x8d9f4e40, 0xa03d, 0x11ce, \ + { 0x8f, 0x69}, \ + { 0x08, 0x00, \ + 0x3e, 0x30, 0x05, 0x1b } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -223,6 +233,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, + { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; diff --git a/source/rpc_server/srv_ntsvcs.c b/source/rpc_server/srv_ntsvcs.c new file mode 100644 index 00000000000..ebc6695c251 --- /dev/null +++ b/source/rpc_server/srv_ntsvcs.c @@ -0,0 +1,71 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Copyright (C) Gerald Carter 2005. + * + * 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" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_SRV + +/******************************************************************* + ********************************************************************/ + +static BOOL api_ntsvcs_get_version(pipes_struct *p) +{ + NTSVCS_Q_GET_VERSION q_u; + NTSVCS_R_GET_VERSION r_u; + prs_struct *data = &p->in_data.data; + prs_struct *rdata = &p->out_data.rdata; + + ZERO_STRUCT(q_u); + ZERO_STRUCT(r_u); + + if(!ntsvcs_io_q_get_version("", &q_u, data, 0)) + return False; + + r_u.status = _ntsvcs_get_version(p, &q_u, &r_u); + + if(!ntsvcs_io_r_get_version("", &r_u, rdata, 0)) + return False; + + return True; +} + + +/******************************************************************* + \PIPE\svcctl commands + ********************************************************************/ + +static struct api_struct api_ntsvcs_cmds[] = +{ + { "NTSVCS_GET_VERSION" , NTSVCS_GET_VERSION , api_ntsvcs_get_version }, +}; + + +void ntsvcs_get_pipe_fns( struct api_struct **fns, int *n_fns ) +{ + *fns = api_ntsvcs_cmds; + *n_fns = sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct); +} + +NTSTATUS rpc_ntsvcs_init(void) +{ + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "ntsvcs", "ntsvcs", api_ntsvcs_cmds, + sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct)); +} diff --git a/source/rpc_server/srv_ntsvcs_nt.c b/source/rpc_server/srv_ntsvcs_nt.c new file mode 100644 index 00000000000..fc56873bbb2 --- /dev/null +++ b/source/rpc_server/srv_ntsvcs_nt.c @@ -0,0 +1,35 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * + * Copyright (C) Gerald (Jerry) Carter 2005. + * + * 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" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_SRV + +/******************************************************************** +********************************************************************/ + +NTSTATUS _ntsvcs_get_version( pipes_struct *p, NTSVCS_Q_GET_VERSION *q_u, NTSVCS_R_GET_VERSION *r_u ) +{ + r_u->version = 0x00000400; /* no idea what this means */ + + return NT_STATUS_OK; +} diff --git a/source/rpc_server/srv_pipe.c b/source/rpc_server/srv_pipe.c index 5c5d73434db..93846eb45b0 100644 --- a/source/rpc_server/srv_pipe.c +++ b/source/rpc_server/srv_pipe.c @@ -2268,6 +2268,9 @@ void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns ) case PI_UNIXINFO: unixinfo_get_pipe_fns( &cmds, &n_cmds ); break; + case PI_NTSVCS: + ntsvcs_get_pipe_fns( &cmds, &n_cmds ); + break; #ifdef DEVELOPER case PI_ECHO: echo_get_pipe_fns( &cmds, &n_cmds ); -- 2.11.4.GIT