From 615895332a73ad372bcb5918190cbfff6ba83e05 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 16 Jan 2007 14:44:23 +0000 Subject: r20830: merge mgmt work (This used to be commit 3cc299dbbe278936281f8e7071e6de8ec1bb219c) --- source4/rpc_server/config.mk | 12 +--- source4/rpc_server/dcerpc_server.c | 13 +++++ source4/rpc_server/dcesrv_mgmt.c | 103 ++++++++++++++++++++++++++++++++++ source4/rpc_server/mgmt/dcesrv_mgmt.c | 80 -------------------------- 4 files changed, 117 insertions(+), 91 deletions(-) create mode 100644 source4/rpc_server/dcesrv_mgmt.c delete mode 100644 source4/rpc_server/mgmt/dcesrv_mgmt.c (limited to 'source4/rpc_server') diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk index cc676f9fd5..2f1428d10c 100644 --- a/source4/rpc_server/config.mk +++ b/source4/rpc_server/config.mk @@ -34,17 +34,6 @@ PUBLIC_DEPENDENCIES = NDR_EPMAPPER # End MODULE dcerpc_epmapper ################################################ -################################################ -# Start MODULE dcerpc_mgmt -[MODULE::dcerpc_mgmt] -INIT_FUNCTION = dcerpc_server_mgmt_init -SUBSYSTEM = dcerpc_server -OBJ_FILES = \ - mgmt/dcesrv_mgmt.o -PUBLIC_DEPENDENCIES = NDR_MGMT -# End MODULE dcerpc_mgmt -################################################ - ################################################ # Start MODULE dcerpc_remote [MODULE::dcerpc_remote] @@ -197,6 +186,7 @@ OBJ_FILES = \ dcerpc_server.o \ dcerpc_sock.o \ dcesrv_auth.o \ + dcesrv_mgmt.o \ handles.o PUBLIC_DEPENDENCIES = \ LIBCLI_AUTH \ diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 6233a2e088..6af4be9cc1 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -35,6 +35,8 @@ #include "libcli/security/security.h" #include "build.h" +extern const struct dcesrv_interface dcesrv_mgmt_interface; + /* see if two endpoints match */ @@ -178,6 +180,17 @@ _PUBLIC_ NTSTATUS dcesrv_interface_register(struct dcesrv_context *dce_ctx, ZERO_STRUCTP(ep); ep->ep_description = talloc_reference(ep, binding); add_ep = True; + + /* add mgmt interface */ + ifl = talloc(dce_ctx, struct dcesrv_if_list); + if (!ifl) { + return NT_STATUS_NO_MEMORY; + } + + memcpy(&(ifl->iface), &dcesrv_mgmt_interface, + sizeof(struct dcesrv_interface)); + + DLIST_ADD(ep->interface_list, ifl); } /* see if the interface is already registered on te endpoint */ diff --git a/source4/rpc_server/dcesrv_mgmt.c b/source4/rpc_server/dcesrv_mgmt.c new file mode 100644 index 0000000000..1656050b59 --- /dev/null +++ b/source4/rpc_server/dcesrv_mgmt.c @@ -0,0 +1,103 @@ +/* + Unix SMB/CIFS implementation. + + endpoint server for the mgmt pipe + + Copyright (C) Jelmer Vernooij 2006 + + 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" +#include "rpc_server/dcerpc_server.h" +#include "librpc/gen_ndr/ndr_mgmt.h" +#include "rpc_server/common/common.h" + +/* + mgmt_inq_if_ids +*/ +static WERROR mgmt_inq_if_ids(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct mgmt_inq_if_ids *r) +{ + const struct dcesrv_endpoint *ep = dce_call->conn->endpoint; + struct dcesrv_if_list *l; + struct rpc_if_id_vector_t *vector; + + vector = *r->out.if_id_vector = talloc(mem_ctx, struct rpc_if_id_vector_t); + vector->count = 0; + vector->if_id = NULL; + for (l = ep->interface_list; l; l = l->next) { + vector->count++; + vector->if_id = talloc_realloc(mem_ctx, vector->if_id, struct dcerpc_syntax_id_p, vector->count); + vector->if_id[vector->count-1].id = &l->iface.syntax_id; + } + return WERR_OK; +} + + +/* + mgmt_inq_stats +*/ +static WERROR mgmt_inq_stats(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct mgmt_inq_stats *r) +{ + if (r->in.max_count != MGMT_STATS_ARRAY_MAX_SIZE) + return WERR_NOT_SUPPORTED; + + r->out.statistics->count = r->in.max_count; + r->out.statistics->statistics = talloc_array(mem_ctx, uint32_t, r->in.max_count); + /* FIXME */ + r->out.statistics->statistics[MGMT_STATS_CALLS_IN] = 0; + r->out.statistics->statistics[MGMT_STATS_CALLS_OUT] = 0; + r->out.statistics->statistics[MGMT_STATS_PKTS_IN] = 0; + r->out.statistics->statistics[MGMT_STATS_PKTS_OUT] = 0; + + return WERR_OK; +} + + +/* + mgmt_is_server_listening +*/ +static uint32_t mgmt_is_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct mgmt_is_server_listening *r) +{ + *r->out.status = 0; + return 1; +} + + +/* + mgmt_stop_server_listening +*/ +static WERROR mgmt_stop_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct mgmt_stop_server_listening *r) +{ + return WERR_ACCESS_DENIED; +} + + +/* + mgmt_inq_princ_name +*/ +static WERROR mgmt_inq_princ_name(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct mgmt_inq_princ_name *r) +{ + DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); +} + + +/* include the generated boilerplate */ +#include "librpc/gen_ndr/ndr_mgmt_s.c" diff --git a/source4/rpc_server/mgmt/dcesrv_mgmt.c b/source4/rpc_server/mgmt/dcesrv_mgmt.c deleted file mode 100644 index 2996b7675e..0000000000 --- a/source4/rpc_server/mgmt/dcesrv_mgmt.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - endpoint server for the mgmt pipe - - Copyright (C) Jelmer Vernooij 2006 - - 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" -#include "rpc_server/dcerpc_server.h" -#include "librpc/gen_ndr/ndr_mgmt.h" -#include "rpc_server/common/common.h" - -/* - mgmt_inq_if_ids -*/ -static WERROR mgmt_inq_if_ids(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct mgmt_inq_if_ids *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - -/* - mgmt_inq_stats -*/ -static WERROR mgmt_inq_stats(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct mgmt_inq_stats *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - -/* - mgmt_is_server_listening -*/ -static uint32_t mgmt_is_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct mgmt_is_server_listening *r) -{ - *r->out.status = 1; - return 0; -} - - -/* - mgmt_stop_server_listening -*/ -static WERROR mgmt_stop_server_listening(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct mgmt_stop_server_listening *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - -/* - mgmt_inq_princ_name -*/ -static WERROR mgmt_inq_princ_name(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct mgmt_inq_princ_name *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - -/* include the generated boilerplate */ -#include "librpc/gen_ndr/ndr_mgmt_s.c" -- cgit