diff options
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/include/rpc_srvsvc.h | 17 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 47 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc.c | 33 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc_nt.c | 29 |
5 files changed, 124 insertions, 5 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 19495f126c..abb1d58b6e 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -3492,6 +3492,8 @@ BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth); BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth); BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth); +BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth); +BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth); void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, char *name); void init_srv_sess_info0(SESS_INFO_0 *ss0, char *name); void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, char *name, char *user); @@ -3767,6 +3769,7 @@ uint32 _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET uint32 _srv_net_share_get_info(pipes_struct *p, SRV_Q_NET_SHARE_GET_INFO *q_u, SRV_R_NET_SHARE_GET_INFO *r_u); uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, SRV_R_NET_SHARE_SET_INFO *r_u); uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_SHARE_ADD *r_u); +uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_SHARE_DEL *r_u); uint32 _srv_net_remote_tod(pipes_struct *p, SRV_Q_NET_REMOTE_TOD *q_u, SRV_R_NET_REMOTE_TOD *r_u); /*The following definitions come from rpc_server/srv_util.c */ diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h index 09b88ff456..3fb76e82e0 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -33,6 +33,7 @@ #define SRV_NETSHAREENUM_ALL 0x0f #define SRV_NET_SHARE_GET_INFO 0x10 #define SRV_NET_SHARE_SET_INFO 0x11 +#define SRV_NET_SHARE_DEL 0x12 #define SRV_NET_SRV_GET_INFO 0x15 #define SRV_NET_SRV_SET_INFO 0x16 #define SRV_NET_REMOTE_TOD 0x1c @@ -478,6 +479,22 @@ typedef struct r_net_share_add } SRV_R_NET_SHARE_ADD; +/* SRV_Q_NET_SHARE_DEL */ +typedef struct q_net_share_del +{ + uint32 ptr_srv_name; + UNISTR2 uni_srv_name; + UNISTR2 uni_share_name; + +} SRV_Q_NET_SHARE_DEL; + +/* SRV_R_NET_SHARE_DEL */ +typedef struct r_net_share_del +{ + uint32 status; /* return status */ + +} SRV_R_NET_SHARE_DEL; + /* FILE_INFO_3 (level 3 file info strings) */ typedef struct file_info3_info { diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index fd38594b0d..b9479a7105 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -815,6 +815,53 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps } /******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_del(char *desc, SRV_Q_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + return False; + if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + return False; + + if(!smb_io_unistr2("", &q_n->uni_share_name, True, ps, depth)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_del"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("status ", ps, depth, &q_n->status)) + return False; + + return True; +} + +/******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index d588298c88..d4d5e1bfe8 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -258,7 +258,7 @@ static BOOL api_srv_net_share_set_info(pipes_struct *p) } /******************************************************************* - RPC to add share information. Use the SET wire format. + RPC to add share information. ********************************************************************/ static BOOL api_srv_net_share_add(pipes_struct *p) @@ -288,6 +288,36 @@ static BOOL api_srv_net_share_add(pipes_struct *p) } /******************************************************************* + RPC to delete share information. +********************************************************************/ + +static BOOL api_srv_net_share_del(pipes_struct *p) +{ + SRV_Q_NET_SHARE_DEL q_u; + SRV_R_NET_SHARE_DEL r_u; + prs_struct *data = &p->in_data.data; + prs_struct *rdata = &p->out_data.rdata; + + ZERO_STRUCT(q_u); + ZERO_STRUCT(r_u); + + /* Unmarshall the net server del info. */ + if(!srv_io_q_net_share_del("", &q_u, data, 0)) { + DEBUG(0,("api_srv_net_share_del: Failed to unmarshall SRV_Q_NET_SHARE_DEL.\n")); + return False; + } + + r_u.status = _srv_net_share_del(p, &q_u, &r_u); + + if(!srv_io_r_net_share_del("", &r_u, rdata, 0)) { + DEBUG(0,("api_srv_net_share_del: Failed to marshall SRV_R_NET_SHARE_DEL.\n")); + return False; + } + + return True; +} + +/******************************************************************* api_srv_net_remote_tod ********************************************************************/ @@ -325,6 +355,7 @@ struct api_struct api_srv_cmds[] = { "SRV_NETSHAREENUM_ALL" , SRV_NETSHAREENUM_ALL , api_srv_net_share_enum_all }, { "SRV_NETSHAREENUM" , SRV_NETSHAREENUM , api_srv_net_share_enum }, { "SRV_NET_SHARE_ADD" , SRV_NET_SHARE_ADD , api_srv_net_share_add }, + { "SRV_NET_SHARE_DEL" , SRV_NET_SHARE_DEL , api_srv_net_share_del }, { "SRV_NET_SHARE_GET_INFO", SRV_NET_SHARE_GET_INFO, api_srv_net_share_get_info }, { "SRV_NET_SHARE_SET_INFO", SRV_NET_SHARE_SET_INFO, api_srv_net_share_set_info }, { "SRV_NETFILEENUM" , SRV_NETFILEENUM , api_srv_net_file_enum }, diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index acb8846db6..0e03918bfb 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -955,7 +955,7 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S share_name = dos_unistr2_to_str(&q_u->uni_share_name); - r_u->switch_value = q_u->info_level; + r_u->switch_value = 0; snum = find_service(share_name); @@ -985,7 +985,6 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S status = NT_STATUS_BAD_NETWORK_NAME; } - r_u->switch_value = 0; r_u->status = status; DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__)); @@ -1003,7 +1002,7 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S DEBUG(5,("_srv_net_share_add: %d\n", __LINE__)); - r_u->switch_value = q_u->info_level; + r_u->switch_value = 0; switch (q_u->info_level) { case 1: @@ -1025,7 +1024,6 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S break; } - r_u->switch_value = 0; r_u->status = status; DEBUG(5,("_srv_net_share_add: %d\n", __LINE__)); @@ -1034,6 +1032,29 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S } /******************************************************************* + Net share delete. Stub for now. JRA. +********************************************************************/ + +uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_SHARE_DEL *r_u) +{ + char *share_name; + uint32 status = NT_STATUS_NOPROBLEMO; + int snum; + + DEBUG(5,("_srv_net_share_del: %d\n", __LINE__)); + + share_name = dos_unistr2_to_str(&q_u->uni_share_name); + + snum = find_service(share_name); + + if (snum < 0) + return NT_STATUS_BAD_NETWORK_NAME; + + /* Stub... */ + return ERROR_ACCESS_DENIED; +} + +/******************************************************************* time of day ********************************************************************/ |