diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 2 | ||||
-rw-r--r-- | source3/include/rpc_svcctl.h | 22 | ||||
-rw-r--r-- | source3/rpc_parse/parse_svc.c | 48 | ||||
-rw-r--r-- | source3/rpc_server/srv_svcctl.c | 37 |
4 files changed, 109 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 46dc35b2aa..e64a7a92aa 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2591,6 +2591,8 @@ void svc_io_q_open_service(char *desc, SVC_Q_OPEN_SERVICE *q_u, prs_struct *ps, void make_svc_r_open_service(SVC_R_OPEN_SERVICE *r_u, POLICY_HND *hnd, uint32 status) ; void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, int depth); +void svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth); +void svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth); void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u, uint32 service_type, uint32 start_type, uint32 error_control, diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h index c32ba87ba9..8a2a771d64 100644 --- a/source3/include/rpc_svcctl.h +++ b/source3/include/rpc_svcctl.h @@ -31,6 +31,7 @@ #define SVC_QUERY_SVC_CONFIG 0x11 #define SVC_QUERY_DISP_NAME 0x14 #define SVC_OPEN_SERVICE 0x10 +#define SVC_START_SERVICE 0x13 #define SVC_CLOSE 0x00 @@ -72,6 +73,27 @@ typedef struct r_svc_open_service_info } SVC_R_OPEN_SERVICE; +#define MAX_SVC_ARGS 4 + +/* SVC_Q_START_SERVICE */ +typedef struct q_svc_start_service_info +{ + POLICY_HND pol; + + uint32 argc; + uint32 ptr_argv; + uint32 argc2; + UNISTR2 argv[MAX_SVC_ARGS]; + +} SVC_Q_START_SERVICE; + +/* SVC_R_START_SERVICE */ +typedef struct r_svc_start_service_info +{ + uint32 status; + +} SVC_R_START_SERVICE; + /* QUERY_SERVICE_CONFIG */ typedef struct query_service_config_info diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c index e8cdd35a2c..f936df24b9 100644 --- a/source3/rpc_parse/parse_svc.c +++ b/source3/rpc_parse/parse_svc.c @@ -163,6 +163,54 @@ void svc_io_r_open_service(char *desc, SVC_R_OPEN_SERVICE *r_u, prs_struct *ps, } /******************************************************************* +reads or writes a SVC_Q_START_SERVICE structure. +********************************************************************/ +void svc_io_q_start_service(char *desc, SVC_Q_START_SERVICE *q_s, prs_struct *ps, int depth) +{ + if (q_s == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_q_start_service"); + depth++; + + prs_align(ps); + smb_io_pol_hnd("", &(q_s->pol), ps, depth); + + prs_align(ps); + prs_uint32("argc ", ps, depth, &(q_s->argc )); + prs_uint32("ptr_argv", ps, depth, &(q_s->ptr_argv)); + + if (q_s->ptr_argv != 0) + { + int i; + + prs_uint32("argc2 ", ps, depth, &(q_s->argc2)); + + if (q_s->argc2 > MAX_SVC_ARGS) + { + q_s->argc = q_s->argc2 = MAX_SVC_ARGS; + } + + for (i = 0; i < q_s->argc2; i++) + { + smb_io_unistr2("", &(q_s->argv[i]), 1, ps, depth); + } + } +} + +/******************************************************************* +reads or writes a structure. +********************************************************************/ +void svc_io_r_start_service(char *desc, SVC_R_START_SERVICE *r_s, prs_struct *ps, int depth) +{ + if (r_s == NULL) return; + + prs_debug(ps, depth, desc, "svc_io_r_start_service"); + depth++; + + prs_uint32("status", ps, depth, &(r_s->status)); +} + +/******************************************************************* make_svc_query_svc_cfg ********************************************************************/ void make_svc_query_svc_cfg(QUERY_SERVICE_CONFIG *q_u, diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c index d52816df80..6a420c1493 100644 --- a/source3/rpc_server/srv_svcctl.c +++ b/source3/rpc_server/srv_svcctl.c @@ -126,6 +126,42 @@ static void api_svc_open_service( uint16 vuid, prs_struct *data, } /******************************************************************* + svc_reply_start_service + ********************************************************************/ +static void svc_reply_start_service(SVC_Q_START_SERVICE *q_s, + prs_struct *rdata) +{ + SVC_R_START_SERVICE r_s; + + DEBUG(5,("svc_start_service: %d\n", __LINE__)); + + r_s.status = 0x0; + + if (find_lsa_policy_by_hnd(&q_s->pol) == -1) + { + r_s.status = 0xC000000 | NT_STATUS_INVALID_HANDLE; + } + + /* start the service here */ + + /* store the response in the SMB stream */ + svc_io_r_start_service("", &r_s, rdata, 0); + + DEBUG(5,("svc_start_service: %d\n", __LINE__)); +} + +/******************************************************************* + api_svc_start_service + ********************************************************************/ +static void api_svc_start_service( uint16 vuid, prs_struct *data, + prs_struct *rdata ) +{ + SVC_Q_START_SERVICE q_u; + svc_io_q_start_service("", &q_u, data, 0); + svc_reply_start_service(&q_u, rdata); +} + +/******************************************************************* svc_reply_open_sc_man ********************************************************************/ static void svc_reply_open_sc_man(SVC_Q_OPEN_SC_MAN *q_u, @@ -338,6 +374,7 @@ static struct api_struct api_svc_cmds[] = { "SVC_OPEN_SERVICE" , SVC_OPEN_SERVICE , api_svc_open_service }, { "SVC_ENUM_SVCS_STATUS", SVC_ENUM_SVCS_STATUS, api_svc_enum_svcs_status }, { "SVC_QUERY_DISP_NAME" , SVC_QUERY_DISP_NAME , api_svc_query_disp_name }, + { "SVC_START_SERVICE" , SVC_START_SERVICE , api_svc_start_service }, { NULL , 0 , NULL } }; |