diff options
author | Jim McDonough <jmcd@samba.org> | 2002-06-01 01:02:04 +0000 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2002-06-01 01:02:04 +0000 |
commit | 4caf48a7005407e16fca7ea4414c4a00bddb7c85 (patch) | |
tree | bd781f973f9180e003c43d5b102b2551694b98b8 | |
parent | 654273856863d861c8be7b46c39e68a81ea3807a (diff) | |
download | samba-4caf48a7005407e16fca7ea4414c4a00bddb7c85.tar.gz samba-4caf48a7005407e16fca7ea4414c4a00bddb7c85.tar.xz samba-4caf48a7005407e16fca7ea4414c4a00bddb7c85.zip |
Add rpc for file close, expand file enum to take username
(This used to be commit 4b18a94590a25882f06f88c3c7dd1a08bf990044)
-rw-r--r-- | source3/include/rpc_srvsvc.h | 16 | ||||
-rw-r--r-- | source3/libsmb/cli_srvsvc.c | 48 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 71 |
3 files changed, 127 insertions, 8 deletions
diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h index 8dded729735..a41f9a686d0 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -26,6 +26,7 @@ /* srvsvc pipe */ #define SRV_NET_CONN_ENUM 0x08 #define SRV_NET_FILE_ENUM 0x09 +#define SRV_NET_FILE_CLOSE 0x0b #define SRV_NET_SESS_ENUM 0x0c #define SRV_NET_SHARE_ADD 0x0e #define SRV_NET_SHARE_ENUM_ALL 0x0f @@ -648,6 +649,21 @@ typedef struct r_net_file_enum_info } SRV_R_NET_FILE_ENUM; +/* SRV_Q_NET_FILE_CLOSE */ +typedef struct q_net_file_close +{ + uint32 ptr_srv_name; /* pointer to server name */ + UNISTR2 uni_srv_name; /* server name */ + + uint32 file_id; +} SRV_Q_NET_FILE_CLOSE; + +/* SRV_R_NET_FILE_CLOSE */ +typedef struct r_net_file_close +{ + WERROR status; /* return status */ +} SRV_R_NET_FILE_CLOSE; + /* SRV_INFO_100 */ typedef struct srv_info_100_info { diff --git a/source3/libsmb/cli_srvsvc.c b/source3/libsmb/cli_srvsvc.c index 6910ba0c5b5..91fd1e00c76 100644 --- a/source3/libsmb/cli_srvsvc.c +++ b/source3/libsmb/cli_srvsvc.c @@ -317,8 +317,9 @@ WERROR cli_srvsvc_net_remote_tod(struct cli_state *cli, TALLOC_CTX *mem_ctx, } WERROR cli_srvsvc_net_file_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - int preferred_len, ENUM_HND *hnd) + uint32 file_level, char *user_name, + SRV_FILE_INFO_CTR *ctr, int preferred_len, + ENUM_HND *hnd) { prs_struct qbuf, rbuf; SRV_Q_NET_FILE_ENUM q; @@ -336,8 +337,8 @@ WERROR cli_srvsvc_net_file_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, /* Initialise input parameters */ - init_srv_q_net_file_enum(&q, cli->srv_name_slash, NULL, file_level, - ctr, preferred_len, hnd); + init_srv_q_net_file_enum(&q, cli->srv_name_slash, NULL, user_name, + file_level, ctr, preferred_len, hnd); /* Marshall data and send request */ @@ -401,3 +402,42 @@ WERROR cli_srvsvc_net_file_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, return result; } + +WERROR cli_srvsvc_net_file_close(struct cli_state *cli, TALLOC_CTX *mem_ctx, + uint32 file_id) +{ + prs_struct qbuf, rbuf; + SRV_Q_NET_FILE_CLOSE q; + SRV_R_NET_FILE_CLOSE r; + WERROR result = W_ERROR(ERRgeneral); + int i; + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Initialise parse structures */ + + prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL); + prs_init(&rbuf, 0, mem_ctx, UNMARSHALL); + + /* Initialise input parameters */ + + init_srv_q_net_file_close(&q, cli->srv_name_slash, file_id); + + /* Marshall data and send request */ + + if (!srv_io_q_net_file_close("", &q, &qbuf, 0) || + !rpc_api_pipe_req(cli, SRV_NET_FILE_CLOSE, &qbuf, &rbuf)) + goto done; + + /* Unmarshall response */ + + if (!srv_io_r_net_file_close("", &r, &rbuf, 0)) + goto done; + + result = r.status; + done: + prs_mem_free(&qbuf); + prs_mem_free(&rbuf); + return result; +} diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 3ccf937d2a6..36afc7c9621 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -1993,15 +1993,16 @@ static BOOL srv_io_srv_file_ctr(char *desc, SRV_FILE_INFO_CTR *ctr, prs_struct * ********************************************************************/ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, - char *srv_name, char *qual_name, - uint32 file_level, SRV_FILE_INFO_CTR *ctr, - uint32 preferred_len, - ENUM_HND *hnd) + char *srv_name, char *qual_name, char *user_name, + uint32 file_level, SRV_FILE_INFO_CTR *ctr, + uint32 preferred_len, + ENUM_HND *hnd) { DEBUG(5,("init_q_net_file_enum\n")); init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); + init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); q_n->file_level = q_n->ctr.switch_value = file_level; q_n->preferred_len = preferred_len; @@ -2101,6 +2102,68 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps } /******************************************************************* + Initialize a net file close request +********************************************************************/ +void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, char *server, + uint32 file_id) +{ + q_n->ptr_srv_name = 1; + init_unistr2(&q_n->uni_srv_name, server, strlen(server) + 1); + q_n->file_id = file_id; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ +BOOL srv_io_q_net_file_close(char *desc, SRV_Q_NET_FILE_CLOSE *q_n, + prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); + 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("file_id", ps, depth, &q_n->file_id)) + return False; + + return True; +} + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_r_net_file_close(char *desc, SRV_R_NET_FILE_CLOSE *q_n, + prs_struct *ps, int depth) +{ + if (q_n == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &q_n->status)) + return False; + + return True; +} + +/******************************************************************* Inits a SRV_INFO_100 structure. ********************************************************************/ |