diff options
author | Jeremy Allison <jra@samba.org> | 2001-04-06 17:41:47 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-04-06 17:41:47 +0000 |
commit | 3874261774ef9b56461602b4aea3cf4e7b9cc5a0 (patch) | |
tree | 48fd16e3932124e1c62a63a418c1f32520ca7213 | |
parent | fd4c525d5832d80fc7684255f94c606bb83c0e28 (diff) | |
download | samba-3874261774ef9b56461602b4aea3cf4e7b9cc5a0.tar.gz samba-3874261774ef9b56461602b4aea3cf4e7b9cc5a0.tar.bz2 samba-3874261774ef9b56461602b4aea3cf4e7b9cc5a0.zip |
Added stub function for NET_SHARE_ADD. Once this is implemented to call a hook
function (same for NET_SHARE_DELETE and NET_SHARE_SET) we will be able to manage
the shares section in smb.conf via NT server manager........
This should enhance the friendliness of Samba in NT-only shops by an order of
magnitude.
Jeremy.
(This used to be commit a2cd5f2ba11164a17622b96374ab43070f9ed691)
-rw-r--r-- | source3/include/proto.h | 3 | ||||
-rw-r--r-- | source3/include/rpc_srvsvc.h | 22 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 58 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc.c | 31 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc_nt.c | 40 |
5 files changed, 154 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 084030b783..19495f126c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -3490,6 +3490,8 @@ BOOL srv_io_q_net_share_get_info(char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth); BOOL srv_io_q_net_share_set_info(char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth); 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); 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); @@ -3764,6 +3766,7 @@ uint32 _srv_net_share_enum_all(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R uint32 _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u); 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_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 810ccc3c35..09b88ff456 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -29,6 +29,7 @@ #define SRV_NETCONNENUM 0x08 #define SRV_NETFILEENUM 0x09 #define SRV_NETSESSENUM 0x0c +#define SRV_NET_SHARE_ADD 0x0e #define SRV_NETSHAREENUM_ALL 0x0f #define SRV_NET_SHARE_GET_INFO 0x10 #define SRV_NET_SHARE_SET_INFO 0x11 @@ -456,6 +457,27 @@ typedef struct r_net_share_set_info } SRV_R_NET_SHARE_SET_INFO; +/* SRV_Q_NET_SHARE_ADD */ +typedef struct q_net_share_add +{ + uint32 ptr_srv_name; + UNISTR2 uni_srv_name; + + uint32 info_level; + + SRV_SHARE_INFO info; + +} SRV_Q_NET_SHARE_ADD; + +/* SRV_R_NET_SHARE_ADD */ +typedef struct r_net_share_add +{ + uint32 switch_value; /* switch value */ + + uint32 status; /* return status */ + +} SRV_R_NET_SHARE_ADD; + /* 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 dd70c5521c..fd38594b0d 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -757,6 +757,64 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_ } /******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_share_add(char *desc, SRV_Q_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_share_add"); + 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(!prs_align(ps)) + return False; + + if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) + return False; + + if(!prs_align(ps)) + return False; + + if(!srv_io_srv_share_info("info ", ps, depth, &q_n->info)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_share_add"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value)) + 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 95896f36c8..d588298c88 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -258,6 +258,36 @@ static BOOL api_srv_net_share_set_info(pipes_struct *p) } /******************************************************************* + RPC to add share information. Use the SET wire format. +********************************************************************/ + +static BOOL api_srv_net_share_add(pipes_struct *p) +{ + SRV_Q_NET_SHARE_ADD q_u; + SRV_R_NET_SHARE_ADD 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 add info. */ + if(!srv_io_q_net_share_add("", &q_u, data, 0)) { + DEBUG(0,("api_srv_net_share_add: Failed to unmarshall SRV_Q_NET_SHARE_ADD.\n")); + return False; + } + + r_u.status = _srv_net_share_add(p, &q_u, &r_u); + + if(!srv_io_r_net_share_add("", &r_u, rdata, 0)) { + DEBUG(0,("api_srv_net_share_add: Failed to marshall SRV_R_NET_SHARE_ADD.\n")); + return False; + } + + return True; +} + +/******************************************************************* api_srv_net_remote_tod ********************************************************************/ @@ -294,6 +324,7 @@ struct api_struct api_srv_cmds[] = { "SRV_NETSESSENUM" , SRV_NETSESSENUM , api_srv_net_sess_enum }, { "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_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 82a299d18e..acb8846db6 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -994,6 +994,46 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S } /******************************************************************* + Net share add. Stub for now. JRA. +********************************************************************/ + +uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_SHARE_ADD *r_u) +{ + uint32 status = NT_STATUS_NOPROBLEMO; + + DEBUG(5,("_srv_net_share_add: %d\n", __LINE__)); + + r_u->switch_value = q_u->info_level; + + switch (q_u->info_level) { + case 1: + status = ERROR_ACCESS_DENIED; + break; + case 2: + status = ERROR_ACCESS_DENIED; + break; + case 502: + /* we set sd's here. FIXME. JRA */ + status = ERROR_ACCESS_DENIED; + break; + case 1005: + status = ERROR_ACCESS_DENIED; + break; + default: + DEBUG(5,("_srv_net_share_add: unsupported switch value %d\n", q_u->info_level)); + status = NT_STATUS_INVALID_INFO_CLASS; + break; + } + + r_u->switch_value = 0; + r_u->status = status; + + DEBUG(5,("_srv_net_share_add: %d\n", __LINE__)); + + return r_u->status; +} + +/******************************************************************* time of day ********************************************************************/ |