summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2003-10-21 17:59:08 +0000
committerJim McDonough <jmcd@samba.org>2003-10-21 17:59:08 +0000
commit989b57f783adada15db645f60e9aafc3e83cc6ce (patch)
treeb8367396dc4355f4d902dab282ee5a447bedc15e /source3
parent630a77e50f0d12e7f91f10ec68bbb836edf62791 (diff)
downloadsamba-989b57f783adada15db645f60e9aafc3e83cc6ce.tar.gz
samba-989b57f783adada15db645f60e9aafc3e83cc6ce.tar.bz2
samba-989b57f783adada15db645f60e9aafc3e83cc6ce.zip
Add server side support for epmapper pipe. Currently only does a fixed
mapping, but this is the base for changes to come. (This used to be commit 73882e970a3aea1c3c9f34779b4220bbf28f6dad)
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in14
-rw-r--r--source3/configure.in4
-rw-r--r--source3/rpc_server/srv_epmapper.c88
-rw-r--r--source3/rpc_server/srv_epmapper_nt.c70
-rw-r--r--source3/rpc_server/srv_pipe.c3
-rw-r--r--source3/smbd/nttrans.c1
6 files changed, 176 insertions, 4 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index a02bd751c8..10c07d05eb 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -264,6 +264,8 @@ RPC_PIPE_OBJ = rpc_server/srv_pipe_hnd.o rpc_server/srv_util.o \
RPC_ECHO_OBJ = rpc_server/srv_echo.o rpc_server/srv_echo_nt.o
+RPC_EPMAPPER_OBJ = rpc_server/srv_epmapper.o rpc_server/srv_epmapper_nt.o
+
RPC_SERVER_OBJ = @RPC_STATIC@ $(RPC_PIPE_OBJ)
# this includes only the low level parse code, not stuff
@@ -580,9 +582,10 @@ PROTO_OBJ = $(SMBD_OBJ_MAIN) \
$(PASSDB_OBJ) $(GROUPDB_OBJ) $(MSDFS_OBJ) \
$(READLINE_OBJ) $(PROFILE_OBJ) $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) \
$(LIB_SMBD_OBJ) $(SAM_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) \
- $(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) $(SMBLDAP_OBJ) $(IDMAP_OBJ) libsmb/spnego.o
+ $(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_EPMAPPER_OBJ) \
+ $(SMBLDAP_OBJ) $(IDMAP_OBJ) libsmb/spnego.o
WINBIND_WINS_NSS_OBJ = nsswitch/wins.o $(PARAM_OBJ) $(UBIQX_OBJ) \
$(LIBSMB_OBJ) $(LIB_OBJ) $(NSSWINS_OBJ) $(KRBCLIENT_OBJ)
@@ -1005,6 +1008,11 @@ bin/librpc_echo.@SHLIBEXT@: $(RPC_ECHO_OBJ)
@$(SHLD) $(LDSHFLAGS) -o $@ $(RPC_ECHO_OBJ) -lc \
@SONAMEFLAG@`basename $@`
+bin/librpc_epmapper.@SHLIBEXT@: $(RPC_EPMAPPER_OBJ)
+ @echo "Linking $@"
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(RPC_EPMAPPER_OBJ) -lc \
+ @SONAMEFLAG@`basename $@`
+
bin/winbindd@EXEEXT@: $(WINBINDD_OBJ) @BUILD_POPT@ bin/.dummy
@echo "Linking $@"
@$(LINK) -o $@ $(WINBINDD_OBJ) $(DYNEXP) $(LIBS) @POPTLIBS@ $(KRB5LIBS) $(LDAP_LIBS)
diff --git a/source3/configure.in b/source3/configure.in
index 16b0760802..01c71b3149 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -296,7 +296,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_net rpc_dfs rpc_srv rpc_spoolss auth_rhosts auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin pdb_gums gums_tdbsam2"
+default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_reg rpc_lsa_ds rpc_wks rpc_net rpc_dfs rpc_srv rpc_spoolss rpc_epmapper auth_rhosts auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin pdb_gums gums_tdbsam2"
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 charset_CP850 charset_CP437"
@@ -4128,6 +4128,8 @@ SMB_MODULE(rpc_srv, \$(RPC_SVC_OBJ), "bin/librpc_srvsvc.$SHLIBEXT", RPC)
SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC)
SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC)
SMB_MODULE(rpc_echo, \$(RPC_ECHO_OBJ), "bin/librpc_echo.$SHLIBEXT", RPC)
+SMB_MODULE(rpc_epmapper, \$(RPC_EPMAPPER_OBJ), "bin/librpc_epmapper.$SHLIBEXT",
+ RPC)
SMB_SUBSYSTEM(RPC,smbd/server.o)
SMB_MODULE(idmap_ldap, sam/idmap_ldap.o, "bin/idmap_ldap.$SHLIBEXT", IDMAP)
diff --git a/source3/rpc_server/srv_epmapper.c b/source3/rpc_server/srv_epmapper.c
new file mode 100644
index 0000000000..70de092850
--- /dev/null
+++ b/source3/rpc_server/srv_epmapper.c
@@ -0,0 +1,88 @@
+
+/*
+ Unix SMB/CIFS implementation.
+ Samba end point mapper utility and mapping functions
+ Copyright (C) Jim McDonough (jmcd@us.ibm.com) 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"
+
+/*****************************************************************
+ api_handle_map_req - handles standard epm mapping request
+******************************************************************/
+static BOOL api_handle_map_req(pipes_struct * p)
+{
+
+ EPM_Q_MAP q_in;
+ EPM_R_MAP q_out;
+
+ prs_struct *in_data = &p->in_data.data;
+ prs_struct *ret_data = &p->out_data.rdata;
+
+ ZERO_STRUCT(q_in);
+ ZERO_STRUCT(q_out);
+
+ /* process input request and parse packet */
+
+ if (!epm_io_q_map("", &q_in, in_data, 0)) {
+ DEBUG(0,
+ ("api_handle_map_request: unable to unmarshall EPMD_MAP\n"));
+ return False;
+ }
+
+ _epm_map(p, &q_in, &q_out);
+
+ if (!epm_io_r_map("", &q_out, ret_data, 0)) {
+ DEBUG(0,
+ ("api_handle_map_req: unable to marshall EPMD_MAP\n"));
+ return False;
+ }
+
+ return True;
+}
+
+/*******************************************************************/
+/* \pipe\epmapper commands */
+/*******************************************************************/
+/* opnum is 3 on map request */
+
+struct api_struct api_epmapper_cmds[] = {
+ {"MAP_PIPE_NAME", EPM_MAP_PIPE_NAME, api_handle_map_req},
+};
+
+/*******************************************************************/
+/* */
+/*******************************************************************/
+
+void epm_get_pipe_fns(struct api_struct **funcs, int *n_funcs)
+{
+ *funcs = api_epmapper_cmds;
+ *n_funcs = sizeof(api_epmapper_cmds) / sizeof(struct api_struct);
+}
+
+/*******************************************************************/
+/* */
+/*******************************************************************/
+
+NTSTATUS rpc_epmapper_init(void)
+{
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+ EPM_PIPE_NM, EPM_PIPE_NM,
+ api_epmapper_cmds,
+ sizeof(api_epmapper_cmds) /
+ sizeof(struct api_struct));
+}
diff --git a/source3/rpc_server/srv_epmapper_nt.c b/source3/rpc_server/srv_epmapper_nt.c
new file mode 100644
index 0000000000..1b72a5ed41
--- /dev/null
+++ b/source3/rpc_server/srv_epmapper_nt.c
@@ -0,0 +1,70 @@
+
+/*
+ Unix SMB/CIFS implementation.
+ Samba end point mapper utility and mapping functions
+ Copyright (C) Jim McDonough (jmcd@us.ibm.com) 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"
+
+/*******************************************************************/
+/* _epm_map - fill out mapping on input and output structs */
+/*******************************************************************/
+void _epm_map(pipes_struct *ps, const EPM_Q_MAP *q_u, EPM_R_MAP *r_u)
+{
+ int i;
+ uint8 target_address[] = { 9, 53, 95, 27 };
+ EPM_FLOOR *floors = talloc(ps->mem_ctx, sizeof(EPM_FLOOR) *
+ q_u->tower->num_floors);
+ EPM_TOWER *towers = talloc(ps->mem_ctx,
+ sizeof(EPM_TOWER) * MAX_TOWERS);
+ EPM_TOWER_ARRAY array;
+
+ if (!floors || !towers) {
+ DEBUG(0, ("_epm_map: talloc failed!\n"));
+ return;
+ }
+
+ for (i = 0; i < q_u->tower->num_floors; i++) {
+ switch (q_u->tower->floors[i].lhs.protocol) {
+ case EPM_FLOOR_UUID:
+ init_epm_floor_uuid(&floors[i],
+ &q_u->tower->floors[i].
+ lhs.uuid.uuid,
+ q_u->tower->floors[i].
+ lhs.uuid.version);
+ break;
+ case EPM_FLOOR_RPC:
+ init_epm_floor_rpc(&floors[i]);
+ break;
+ case EPM_FLOOR_TCP:
+ /* for now map all requests to port 135 */
+ init_epm_floor_tcp(&floors[i], 135);
+ break;
+ case EPM_FLOOR_IP:
+ init_epm_floor_ip(&floors[i], target_address);
+ break;
+ }
+ }
+
+ init_epm_tower(ps->mem_ctx, &towers[0], floors, 5);
+ init_epm_tower_array(ps->mem_ctx, &array, towers, 1);
+ init_epm_r_map(ps->mem_ctx, r_u, &q_u->term_handle, &array, 1, 0);
+
+ return;
+
+}
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index 96261c665f..444c35987a 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -1603,6 +1603,9 @@ void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns )
echo_get_pipe_fns( &cmds, &n_cmds );
break;
#endif
+ case PI_EPM:
+ epm_get_pipe_fns( &cmds, &n_cmds );
+ break;
default:
DEBUG(0,("get_pipe_fns: Unknown pipe index! [%d]\n", idx));
}
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 19af61f190..e7d7c20f6b 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -43,6 +43,7 @@ static const char *known_nt_pipes[] = {
"\\spoolss",
"\\netdfs",
"\\rpcecho",
+ "\\epmapper",
NULL
};