r23801: The FSF has moved around a lot. This fixes their Mass Ave address.
[jra/samba/.git] / source3 / rpc_server / srv_svcctl.c
index 74ae3aaa16fde92f237270f3b1bb1419fb837079..cc8de13562bea5f5d49d35a90b54b1f13b083c66 100644 (file)
@@ -1,11 +1,11 @@
 /* 
  *  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
- *  the Free Software Foundation; either version 2 of the License, or
+ *  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,
@@ -14,8 +14,7 @@
  *  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.
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "includes.h"
 #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 +433,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));
 }