From d99f4f004ca46e4c0f2e60a231a14708a128f0f2 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 31 May 2007 17:24:30 +0000 Subject: r23271: merge service control pidl change for CloseServiceHandle() from SAMBA_3_0_26 (This used to be commit 0b1bc3521fac52f3164b6cc9e053abc3ceabf5e7) --- source3/rpc_server/srv_svcctl.c | 45 ++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'source3/rpc_server/srv_svcctl.c') diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c index 74ae3aaa16..e36df7ac93 100644 --- a/source3/rpc_server/srv_svcctl.c +++ b/source3/rpc_server/srv_svcctl.c @@ -1,7 +1,7 @@ /* * Unix SMB/CIFS implementation. * RPC Pipe client / server routines - * Copyright (C) Gerald Carter 2005. + * Copyright (C) Gerald Carter 2005 - 2007 * * 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 @@ -23,28 +23,30 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV -/******************************************************************* - ********************************************************************/ - -static BOOL api_svcctl_close_service(pipes_struct *p) +static BOOL proxy_svcctl_call(pipes_struct *p, uint8 opnum) { - SVCCTL_Q_CLOSE_SERVICE q_u; - SVCCTL_R_CLOSE_SERVICE r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; + struct api_struct *fns; + int n_fns; - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); + svcctl_get_pipe_fns(&fns, &n_fns); - if(!svcctl_io_q_close_service("", &q_u, data, 0)) + if (opnum >= n_fns) return False; - r_u.status = _svcctl_close_service(p, &q_u, &r_u); + if (fns[opnum].opnum != opnum) { + smb_panic("SVCCTL function table not sorted\n"); + } - if(!svcctl_io_r_close_service("", &r_u, rdata, 0)) - return False; + return fns[opnum].fn(p); +} - return True; + +/******************************************************************* + ********************************************************************/ + +static BOOL api_svcctl_close_service(pipes_struct *p) +{ + return proxy_svcctl_call( p, DCERPC_SVCCTL_CLOSESERVICEHANDLE ); } /******************************************************************* @@ -432,14 +434,15 @@ static struct api_struct api_svcctl_cmds[] = }; -void svcctl_get_pipe_fns( struct api_struct **fns, int *n_fns ) +void svcctl2_get_pipe_fns( struct api_struct **fns, int *n_fns ) { - *fns = api_svcctl_cmds; + *fns = api_svcctl_cmds; *n_fns = sizeof(api_svcctl_cmds) / sizeof(struct api_struct); } -NTSTATUS rpc_svcctl_init(void) +NTSTATUS rpc_svcctl2_init(void) { - return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "svcctl", "ntsvcs", api_svcctl_cmds, - sizeof(api_svcctl_cmds) / sizeof(struct api_struct)); + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, + "svcctl", "ntsvcs", api_svcctl_cmds, + sizeof(api_svcctl_cmds) / sizeof(struct api_struct)); } -- cgit