summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h43
-rw-r--r--source3/include/rpc_svcctl.h69
-rw-r--r--source3/rpc_client/cli_svcctl.c74
-rw-r--r--source3/rpc_parse/parse_misc.c37
-rw-r--r--source3/rpc_parse/parse_svc.c194
-rw-r--r--source3/rpcclient/cmd_svcctl.c74
-rw-r--r--source3/rpcclient/rpcclient.c6
7 files changed, 243 insertions, 254 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index df06ac2e9d..d99ba9e27c 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2136,11 +2136,16 @@ BOOL svc_query_svc_cfg(struct cli_state *cli, uint16 fnum,
QUERY_SERVICE_CONFIG *cfg,
uint32 *buf_size);
BOOL svc_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd);
-BOOL svc_query_unknown_1b(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *pol, uint32 switch_value,
- uint32 unknown_1,
- uint32 *num_items,
- uint32 ***items);
+BOOL svc_change_svc_cfg(struct cli_state *cli, uint16 fnum,
+ POLICY_HND *hnd,
+ uint32 service_type, uint32 start_type,
+ uint32 unknown_0,
+ uint32 error_control,
+ char* bin_path_name, char* load_order_grp,
+ uint32 tag_id,
+ char* dependencies, char* service_start_name,
+ char* password,
+ char* disp_name);
/*The following definitions come from rpc_client/cli_wkssvc.c */
@@ -2445,7 +2450,8 @@ BOOL make_buffer2_multi(BUFFER2 *str, char *const* const buf, uint32 num);
BOOL make_buffer2(BUFFER2 *str, const char *buf, int len);
BOOL smb_io_buffer2(char *desc, BUFFER2 *buf2, uint32 buffer, prs_struct *ps, int depth);
BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf);
-BOOL make_string2(STRING2 *str, char *buf, int len);
+BOOL make_string2(STRING2 *str, const char *buf, int len);
+BOOL make_buf_string2(STRING2 *str, uint32 *ptr, const char *buf);
BOOL smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth);
BOOL make_unistr2(UNISTR2 *str, const char *buf, int len);
BOOL smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth);
@@ -3434,16 +3440,19 @@ BOOL svc_io_r_query_disp_name(char *desc, SVC_R_QUERY_DISP_NAME *r_u, prs_struct
BOOL make_svc_q_close(SVC_Q_CLOSE *q_c, POLICY_HND *hnd);
BOOL svc_io_q_close(char *desc, SVC_Q_CLOSE *q_u, prs_struct *ps, int depth);
BOOL svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth);
-BOOL make_svc_q_unknown_1b(SVC_Q_UNKNOWN_1B *q_u,
- const POLICY_HND *pol, uint32 switch_value,
- uint32 unknown_1);
-BOOL svc_io_q_unknown_1b(char *desc, SVC_Q_UNKNOWN_1B *q_u, prs_struct *ps, int depth);
-BOOL make_svc_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u,
- uint32 switch_value, uint32 unknown_1,
- uint32 num_items, uint32 **item,
- uint32 status);
-BOOL svc_io_r_unknown_1b(char *desc, SVC_R_UNKNOWN_1B *r_u, prs_struct *ps, int depth);
-void svc_free_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u);
+BOOL make_svc_q_change_svc_config(SVC_Q_CHANGE_SVC_CONFIG *q_u, POLICY_HND *hnd,
+ uint32 service_type, uint32 start_type,
+ uint32 unknown_0,
+ uint32 error_control,
+ char* bin_path_name, char* load_order_grp,
+ uint32 tag_id,
+ char* dependencies, char* service_start_name,
+ char* password,
+ char* disp_name);
+BOOL svc_io_q_change_svc_config(char *desc, SVC_Q_CHANGE_SVC_CONFIG *q_u, prs_struct *ps, int depth);
+BOOL make_svc_r_change_svc_config(SVC_R_CHANGE_SVC_CONFIG *r_c,
+ uint32 unknown_0, uint32 status);
+BOOL svc_io_r_change_svc_config(char *desc, SVC_R_CHANGE_SVC_CONFIG *r_u, prs_struct *ps, int depth);
/*The following definitions come from rpc_parse/parse_wks.c */
@@ -3681,7 +3690,7 @@ BOOL msrpc_svc_enum(struct client_info *info,
void cmd_svc_enum(struct client_info *info, int argc, char *argv[]);
void cmd_svc_stop(struct client_info *info, int argc, char *argv[]);
void cmd_svc_start(struct client_info *info, int argc, char *argv[]);
-void cmd_svc_test(struct client_info *info, int argc, char *argv[]);
+void cmd_svc_set(struct client_info *info, int argc, char *argv[]);
/*The following definitions come from rpcclient/cmd_wkssvc.c */
diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h
index 1815de8532..ecd1188fe8 100644
--- a/source3/include/rpc_svcctl.h
+++ b/source3/include/rpc_svcctl.h
@@ -26,15 +26,15 @@
/* svcctl pipe */
-#define SVC_OPEN_SC_MAN 0x0f
-#define SVC_ENUM_SVCS_STATUS 0x0e
-#define SVC_QUERY_SVC_CONFIG 0x11
-#define SVC_QUERY_DISP_NAME 0x14
-#define SVC_OPEN_SERVICE 0x10
-#define SVC_START_SERVICE 0x13
-#define SVC_STOP_SERVICE 0x01
-#define SVC_UNKNOWN_1B 0x1b
-#define SVC_CLOSE 0x00
+#define SVC_OPEN_SC_MAN 0x0f
+#define SVC_ENUM_SVCS_STATUS 0x0e
+#define SVC_QUERY_SVC_CONFIG 0x11
+#define SVC_QUERY_DISP_NAME 0x14
+#define SVC_CHANGE_SVC_CONFIG 0x0b
+#define SVC_OPEN_SERVICE 0x10
+#define SVC_START_SERVICE 0x13
+#define SVC_STOP_SERVICE 0x01
+#define SVC_CLOSE 0x00
/* SVC_Q_OPEN_SC_MAN */
@@ -244,30 +244,45 @@ typedef struct r_svc_close_info
} SVC_R_CLOSE;
-/* SVC_Q_UNKNOWN_1B */
-typedef struct q_svc_unk_1b_info
+/* SVC_Q_CHANGE_SVC_CONFIG */
+typedef struct q_svc_change_svc_cfg_info
{
- POLICY_HND pol; /* service policy handle */
- uint32 switch_value; /* 0x01 */
- uint32 unknown_1; /* 0x0000 0228 */
+ POLICY_HND pol;
+ uint32 service_type;
+ uint32 start_type;
+ uint32 unknown_0;
+ uint32 error_control;
+
+ uint32 ptr_bin_path_name;
+ UNISTR2 uni_bin_path_name;
+
+ uint32 ptr_load_order_grp;
+ UNISTR2 uni_load_order_grp;
+
+ uint32 tag_id;
-} SVC_Q_UNKNOWN_1B;
+ uint32 ptr_dependencies;
+ UNISTR2 uni_dependencies;
+
+ uint32 ptr_service_start_name;
+ UNISTR2 uni_service_start_name;
+
+ uint32 ptr_password;
+ STRING2 str_password;
-/* SVC_R_UNKNOWN_1B */
-typedef struct r_svc_unk_1b_info
+ uint32 ptr_display_name;
+ UNISTR2 uni_display_name;
+
+} SVC_Q_CHANGE_SVC_CONFIG;
+
+/* SVC_R_CHANGE_SVC_CONFIG */
+typedef struct r_svc_change_svc_cfg_info
{
- uint32 switch_value1; /* 0x01 */
- uint32 ptr;
- uint32 switch_value2; /* 0x01 */
- uint32 unknown_1; /* 0x0000 0228 */
- uint32 num_items1;
- uint32 *ptr_items;
- uint32 num_items2;
- uint32 **items;
+ uint32 unknown_0; /* */
+ uint32 status; /* return status */
- uint32 status;
+} SVC_R_CHANGE_SVC_CONFIG;
-} SVC_R_UNKNOWN_1B;
#endif /* _RPC_SVCCTL_H */
diff --git a/source3/rpc_client/cli_svcctl.c b/source3/rpc_client/cli_svcctl.c
index bba6342db8..f85e37dcb5 100644
--- a/source3/rpc_client/cli_svcctl.c
+++ b/source3/rpc_client/cli_svcctl.c
@@ -479,61 +479,73 @@ BOOL svc_close(struct cli_state *cli, uint16 fnum, POLICY_HND *hnd)
}
/****************************************************************************
-do a SVC Query Lookup RIDS
+do a SVC Change Service Config
****************************************************************************/
-BOOL svc_query_unknown_1b(struct cli_state *cli, uint16 fnum,
- const POLICY_HND *pol, uint32 switch_value,
- uint32 unknown_1,
- uint32 *num_items,
- uint32 ***items)
+BOOL svc_change_svc_cfg(struct cli_state *cli, uint16 fnum,
+ POLICY_HND *hnd,
+ uint32 service_type, uint32 start_type,
+ uint32 unknown_0,
+ uint32 error_control,
+ char* bin_path_name, char* load_order_grp,
+ uint32 tag_id,
+ char* dependencies, char* service_start_name,
+ char* password,
+ char* disp_name)
{
- prs_struct data;
- prs_struct rdata;
-
- SVC_Q_UNKNOWN_1B q_o;
- BOOL valid_query = False;
+ prs_struct rbuf;
+ prs_struct buf;
+ SVC_Q_CHANGE_SVC_CONFIG q_c;
+ BOOL valid_cfg = False;
- if (pol == NULL || num_items == NULL || items == NULL ) return False;
+ if (hnd == NULL) return False;
- /* create and send a MSRPC command with api SVC_UNKNOWN_1B */
+ /* create and send a MSRPC command with api SVC_CHANGE_SVC_CONFIG */
- prs_init(&data , 1024, 4, SAFETY_MARGIN, False);
- prs_init(&rdata, 0 , 4, SAFETY_MARGIN, True );
+ prs_init(&buf , 1024, 4, SAFETY_MARGIN, False);
+ prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True );
- DEBUG(4,("SVC Query Unknown 1b.\n"));
+ DEBUG(4,("SVC Change Service Config\n"));
/* store the parameters */
- make_svc_q_unknown_1b(&q_o, pol, switch_value, unknown_1);
+ make_svc_q_change_svc_config(&q_c, hnd,
+ service_type, start_type,
+ unknown_0, error_control,
+ bin_path_name, load_order_grp,
+ tag_id,
+ dependencies, service_start_name,
+ password, disp_name);
/* turn parameters into data stream */
- svc_io_q_unknown_1b("", &q_o, &data, 0);
+ svc_io_q_change_svc_config("", &q_c, &buf, 0);
/* send the data on \PIPE\ */
- if (rpc_api_pipe_req(cli, fnum, SVC_UNKNOWN_1B, &data, &rdata))
+ if (rpc_api_pipe_req(cli, fnum, SVC_CHANGE_SVC_CONFIG, &buf, &rbuf))
{
- SVC_R_UNKNOWN_1B r_o;
+ SVC_R_CHANGE_SVC_CONFIG r_c;
BOOL p;
- ZERO_STRUCT(r_o);
- svc_io_r_unknown_1b("", &r_o, &rdata, 0);
- p = rdata.offset != 0;
-
- if (p && r_o.status != 0)
+ ZERO_STRUCT (r_c);
+
+ svc_io_r_change_svc_config("", &r_c, &rbuf, 0);
+ p = rbuf.offset != 0;
+
+ if (p && r_c.status != 0)
{
/* report error code */
- DEBUG(4,("SVC_R_UNKNOWN_1B: %s\n", get_nt_error_msg(r_o.status)));
+ DEBUG(1,("SVC_CHANGE_SVC_CONFIG: %s\n", get_nt_error_msg(r_c.status)));
p = False;
}
if (p)
{
- (*num_items) = r_o.num_items1;
- (*items) = r_o.items;
+ valid_cfg = True;
}
}
- prs_mem_free(&data );
- prs_mem_free(&rdata );
+ prs_mem_free(&rbuf);
+ prs_mem_free(&buf );
- return valid_query;
+ return valid_cfg;
}
+
+
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 2f2c68648a..fe65aaf4d4 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -777,16 +777,37 @@ BOOL make_buf_unistr2(UNISTR2 *str, uint32 *ptr, const char *buf)
/*******************************************************************
creates a STRING2 structure.
********************************************************************/
-BOOL make_string2(STRING2 *str, char *buf, int len)
+BOOL make_string2(STRING2 *str, const char *buf, int len)
{
- /* set up string lengths. */
- str->str_max_len = len;
- str->undoc = 0;
- str->str_str_len = len;
+ /* set up string lengths. */
+ str->str_max_len = len;
+ str->undoc = 0;
+ str->str_str_len = len;
+
+ /* store the string */
+ if(len != 0)
+ {
+ memcpy(str->buffer, buf, len);
+ }
- /* store the string */
- if(len != 0)
- memcpy(str->buffer, buf, len);
+ return True;
+}
+
+/*******************************************************************
+creates a STRING2 structure: sets up the buffer, too
+********************************************************************/
+BOOL make_buf_string2(STRING2 *str, uint32 *ptr, const char *buf)
+{
+ if (buf != NULL)
+ {
+ *ptr = 1;
+ make_string2(str, buf, strlen(buf)+1);
+ }
+ else
+ {
+ *ptr = 0;
+ make_string2(str, "", 0);
+ }
return True;
}
diff --git a/source3/rpc_parse/parse_svc.c b/source3/rpc_parse/parse_svc.c
index b35b98a354..93ad0dcced 100644
--- a/source3/rpc_parse/parse_svc.c
+++ b/source3/rpc_parse/parse_svc.c
@@ -822,20 +822,35 @@ BOOL svc_io_r_close(char *desc, SVC_R_CLOSE *r_u, prs_struct *ps, int depth)
}
/*******************************************************************
-makes a SVC_Q_UNKNOWN_1B structure.
+makes an SVC_Q_CHANGE_SVC_CONFIG structure.
********************************************************************/
-BOOL make_svc_q_unknown_1b(SVC_Q_UNKNOWN_1B *q_u,
- const POLICY_HND *pol, uint32 switch_value,
- uint32 unknown_1)
+BOOL make_svc_q_change_svc_config(SVC_Q_CHANGE_SVC_CONFIG *q_u, POLICY_HND *hnd,
+ uint32 service_type, uint32 start_type,
+ uint32 unknown_0,
+ uint32 error_control,
+ char* bin_path_name, char* load_order_grp,
+ uint32 tag_id,
+ char* dependencies, char* service_start_name,
+ char* password,
+ char* disp_name)
{
- if (q_u == NULL) return False;
+ if (q_u == NULL || hnd == NULL) return False;
- DEBUG(5,("make_svc_r_unknwon_12\n"));
+ DEBUG(5,("make_svc_q_change_svc_config\n"));
- memcpy(&(q_u->pol), pol, sizeof(*pol));
+ memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
- q_u->switch_value = switch_value;
- q_u->unknown_1 = unknown_1;
+ q_u->service_type = service_type;
+ q_u->start_type = start_type;
+ q_u->unknown_0 = unknown_0;
+ q_u->error_control = error_control;
+ make_buf_unistr2(&(q_u->uni_bin_path_name ), &(q_u->ptr_bin_path_name ), bin_path_name );
+ make_buf_unistr2(&(q_u->uni_load_order_grp ), &(q_u->ptr_load_order_grp ), load_order_grp );
+ q_u->tag_id = tag_id;
+ make_buf_unistr2(&(q_u->uni_dependencies ), &(q_u->ptr_dependencies ), dependencies );
+ make_buf_unistr2(&(q_u->uni_service_start_name), &(q_u->ptr_service_start_name), service_start_name);
+ make_buf_string2(&(q_u->str_password ), &(q_u->ptr_password ), password );
+ make_buf_unistr2(&(q_u->uni_display_name ), &(q_u->ptr_display_name ), disp_name );
return True;
}
@@ -843,67 +858,60 @@ BOOL make_svc_q_unknown_1b(SVC_Q_UNKNOWN_1B *q_u,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-BOOL svc_io_q_unknown_1b(char *desc, SVC_Q_UNKNOWN_1B *q_u, prs_struct *ps, int depth)
+BOOL svc_io_q_change_svc_config(char *desc, SVC_Q_CHANGE_SVC_CONFIG *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL) return False;
- prs_debug(ps, depth, desc, "svc_io_q_unknown_1b");
+ prs_debug(ps, depth, desc, "svc_io_q_change_svc_config");
depth++;
prs_align(ps);
- smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
+ smb_io_pol_hnd("", &(q_u->pol), ps, depth);
+ prs_align(ps);
+
+ prs_uint32("service_type ", ps, depth, &(q_u->service_type ));
+ prs_uint32("start_type ", ps, depth, &(q_u->start_type ));
+ prs_uint32("unknown_0 ", ps, depth, &(q_u->unknown_0 ));
+ prs_uint32("error_control ", ps, depth, &(q_u->error_control ));
+ prs_uint32("ptr_bin_path_name ", ps, depth, &(q_u->ptr_bin_path_name ));
+ smb_io_unistr2("uni_bin_path_name ", &(q_u->uni_bin_path_name ), q_u->ptr_bin_path_name , ps, depth);
+ prs_align(ps);
+
+ prs_uint32("ptr_load_order_grp ", ps, depth, &(q_u->ptr_load_order_grp ));
+ smb_io_unistr2("uni_load_order_grp ", &(q_u->uni_load_order_grp ), q_u->ptr_load_order_grp , ps, depth);
+ prs_align(ps);
+ prs_uint32("tag_id ", ps, depth, &(q_u->tag_id ));
+ prs_uint32("ptr_dependencies ", ps, depth, &(q_u->ptr_dependencies ));
+ smb_io_unistr2("uni_dependencies ", &(q_u->uni_dependencies ), q_u->ptr_dependencies , ps, depth);
+ prs_align(ps);
+ prs_uint32("ptr_service_start_name", ps, depth, &(q_u->ptr_service_start_name));
+ smb_io_unistr2("uni_service_start_name", &(q_u->uni_service_start_name), q_u->ptr_service_start_name, ps, depth);
+ prs_align(ps);
+ prs_uint32("ptr_password ", ps, depth, &(q_u->ptr_password ));
+
+ smb_io_string2("str_password ", &(q_u->str_password ), q_u->ptr_display_name , ps, depth);
prs_align(ps);
- prs_uint32("switch_value", ps, depth, &(q_u->switch_value));
- prs_uint32("unknown_1 ", ps, depth, &(q_u->unknown_1 ));
+ prs_uint32("ptr_display_name ", ps, depth, &(q_u->ptr_display_name ));
+ smb_io_unistr2("uni_display_name ", &(q_u->uni_display_name ), q_u->ptr_display_name , ps, depth);
+ prs_align(ps);
return True;
}
/*******************************************************************
-makes a SVC_R_UNKNOWN_1B structure.
+makes an SVC_R_CHANGE_SVC_CONFIG structure.
********************************************************************/
-BOOL make_svc_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u,
- uint32 switch_value, uint32 unknown_1,
- uint32 num_items, uint32 **item,
- uint32 status)
+BOOL make_svc_r_change_svc_config(SVC_R_CHANGE_SVC_CONFIG *r_c,
+ uint32 unknown_0, uint32 status)
{
- uint32 i;
- if (r_u == NULL) return False;
-
- DEBUG(5,("make_svc_r_unknown_1b\n"));
-
- if (status == 0x0)
- {
- r_u->num_items1 = num_items;
- r_u->ptr = 1;
- r_u->num_items2 = num_items;
-
- r_u->items = item;
- if (num_items != 0)
- {
- r_u->ptr_items = (uint32*)malloc(num_items * sizeof(r_u->ptr_items[0]));
- if (r_u->ptr_items == NULL)
- {
- svc_free_r_unknown_1b(r_u);
- return False;
- }
- for (i = 0; i < num_items; i++)
- {
- r_u->ptr_items[i] = item[i] != NULL ? 1 : 0;
- }
- }
+ if (r_c == NULL) return False;
- }
- else
- {
- r_u->num_items1 = num_items;
- r_u->ptr_items = 0;
- r_u->num_items2 = num_items;
- }
+ DEBUG(5,("make_svc_r_change_svc_config\n"));
- r_u->status = status;
+ r_c->unknown_0 = unknown_0;
+ r_c->status = status;
return True;
}
@@ -911,92 +919,18 @@ BOOL make_svc_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-BOOL svc_io_r_unknown_1b(char *desc, SVC_R_UNKNOWN_1B *r_u, prs_struct *ps, int depth)
+BOOL svc_io_r_change_svc_config(char *desc, SVC_R_CHANGE_SVC_CONFIG *r_u, prs_struct *ps, int depth)
{
- uint32 i;
- uint32 count = 0;
- fstring tmp;
if (r_u == NULL) return False;
- prs_debug(ps, depth, desc, "svc_io_r_unknown_1b");
+ prs_debug(ps, depth, desc, "svc_io_r_change_svc_config");
depth++;
prs_align(ps);
- prs_uint32("num_items1", ps, depth, &(r_u->num_items1));
- prs_uint32("ptr ", ps, depth, &(r_u->ptr ));
- prs_uint32("num_items2", ps, depth, &(r_u->num_items2));
-
- if (r_u->ptr_items != 0 && r_u->num_items1 != 0)
- {
- r_u->ptr_items = (uint32*)Realloc(r_u->ptr_items,
- r_u->num_items2 * sizeof(r_u->ptr_items[0]));
- if (r_u->ptr_items == NULL)
- {
- return False;
- }
-
- for (i = 0; i < r_u->num_items2; i++)
- {
- prs_grow(ps);
- slprintf(tmp, sizeof(tmp) - 1, "ptr_item[%02d]", i);
- prs_uint32(tmp, ps, depth, &(r_u->ptr_items[i]));
- }
-
- for (i = 0; i < r_u->num_items2; i++)
- {
- slprintf(tmp, sizeof(tmp) - 1, "item[%02d]", i);
-
- if (ps->io)
- {
- /* reading */
- if (r_u->ptr_items[i] != 0)
- {
- uint32 item;
- prs_uint32(tmp, ps, depth, &item);
- add_uint32s_to_array(&count, &r_u->items, &item);
- }
- else
- {
- add_uint32s_to_array(&count, &r_u->items, NULL);
- }
- }
- else
- {
- /* writing */
- if (r_u->ptr_items[i] != 0)
- {
- prs_uint32(tmp, ps, depth, r_u->items[i]);
- }
- }
- }
- }
-
- prs_uint32("status", ps, depth, &(r_u->status));
-
- if (!ps->io)
- {
- /* storing. don't need memory any more */
- svc_free_r_unknown_1b(r_u);
- }
+ prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0));
+ prs_uint32("status ", ps, depth, &(r_u->status ));
return True;
}
-/*******************************************************************
-frees a structure.
-********************************************************************/
-void svc_free_r_unknown_1b(SVC_R_UNKNOWN_1B *r_u)
-{
- if (r_u->ptr_items != NULL)
- {
- free(r_u->ptr_items);
- r_u->ptr_items = NULL;
- }
- if (r_u->items != NULL)
- {
- free_uint32_array(r_u->num_items1, r_u->items);
- r_u->items = NULL;
- r_u->num_items1 = 0;
- }
-}
diff --git a/source3/rpcclient/cmd_svcctl.c b/source3/rpcclient/cmd_svcctl.c
index 6d2311b962..708dd49de1 100644
--- a/source3/rpcclient/cmd_svcctl.c
+++ b/source3/rpcclient/cmd_svcctl.c
@@ -383,19 +383,21 @@ void cmd_svc_start(struct client_info *info, int argc, char *argv[])
}
/****************************************************************************
-nt test service
+nt service set
****************************************************************************/
-void cmd_svc_test(struct client_info *info, int argc, char *argv[])
+void cmd_svc_set(struct client_info *info, int argc, char *argv[])
{
uint16 fnum;
BOOL res = True;
- BOOL res1 = True;
- char *svc_name;
BOOL res2 = True;
+ BOOL res3;
POLICY_HND pol_svc;
+ QUERY_SERVICE_CONFIG cfg;
+ uint32 svc_buf_size = 0x8000;
+
+ char *svc_name;
+
POLICY_HND pol_scm;
- uint32 num_items = 0;
- uint32 **items = NULL;
fstring srv_name;
@@ -403,63 +405,59 @@ void cmd_svc_test(struct client_info *info, int argc, char *argv[])
fstrcat(srv_name, info->myhostname);
strupper(srv_name);
- DEBUG(4,("cmd_svc_test: server:%s\n", srv_name));
+ DEBUG(4,("cmd_svc_set: server:%s\n", srv_name));
if (argc < 2)
{
- report(out_hnd,"svctest <service name>]\n");
+ report(out_hnd,"svcset <service name>\n");
return;
}
- argv++;
- argc--;
-
- svc_name = argv[0];
-
- argv++;
- argc--;
+ svc_name = argv[1];
/* open SVCCTL session. */
res = res ? cli_nt_session_open(smb_cli, PIPE_SVCCTL, &fnum) : False;
/* open service control manager receive a policy handle */
res = res ? svc_open_sc_man(smb_cli, fnum,
- srv_name, NULL, 0x80000000,
+ srv_name, NULL, 0x80000004,
&pol_scm) : False;
- res1 = res ? svc_open_service(smb_cli, fnum,
+ res2 = res ? svc_open_service(smb_cli, fnum,
&pol_scm,
- svc_name, 0x80000010,
+ svc_name, 0x80000001,
&pol_svc) : False;
- res2 = res1 ? svc_query_unknown_1b(smb_cli, fnum,
- &pol_svc, 1, 0x227,
- &num_items, &items) : False;
+ res3 = res2 ? svc_query_svc_cfg(smb_cli, fnum,
+ &pol_svc, &cfg,
+ &svc_buf_size) : False;
- res1 = res1 ? svc_close(smb_cli, fnum, &pol_svc) : False;
- res = res ? svc_close(smb_cli, fnum, &pol_scm) : False;
+ if (res3)
+ {
+ res3 = svc_change_svc_cfg(smb_cli, fnum, &pol_svc,
+ cfg.service_type,
+ cfg.start_type,
+ 0xffffffff,
+ 0,
+ NULL, NULL,
+ cfg.tag_id,
+ NULL, "administrator", NULL, NULL);
+
+ }
+
+ res2 = res2 ? svc_close(smb_cli, fnum, &pol_svc) : False;
+
+ res = res ? svc_close(smb_cli, fnum, &pol_scm) : False;
/* close the session */
cli_nt_session_close(smb_cli, fnum);
- if (res2)
+ if (res3)
{
- uint32 i;
- report(out_hnd,"Test 0x1b Service %s\n", svc_name);
- for (i = 0; i < num_items; i++)
- {
- if (items[i] != NULL)
- {
- report(out_hnd, "%x\n", *items[i]);
- }
- }
- DEBUG(5,("cmd_svc_test: succeeded\n"));
+ DEBUG(5,("cmd_svc_set: change succeeded\n"));
}
else
- report(out_hnd,"Failed Test 0x1b (%s)\n", svc_name);
{
- DEBUG(5,("cmd_svc_test: failed\n"));
+ DEBUG(5,("cmd_svc_set: change failed\n"));
}
-
- free_uint32_array(num_items, items);
}
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index de0f72c65d..f242f9c4ea 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -158,9 +158,9 @@ commands[] =
},
{
- "svctest",
- cmd_svc_test,
- "<service> Test Service",
+ "svcset",
+ cmd_svc_set,
+ "<service> Test Set Service",
{COMPL_SVCLST, COMPL_NONE}
},