diff options
author | Günther Deschner <gd@samba.org> | 2008-03-10 16:26:56 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-03-10 16:26:56 +0100 |
commit | 11e4e58f17aa94c088b09310421fe02ab7375730 (patch) | |
tree | 3b20f8ae2a0692aa714d18d1e920589b53abcccf | |
parent | b7b89bf8086d1fa8d52b0968c09d0063954b51c3 (diff) | |
download | samba-11e4e58f17aa94c088b09310421fe02ab7375730.tar.gz samba-11e4e58f17aa94c088b09310421fe02ab7375730.tar.bz2 samba-11e4e58f17aa94c088b09310421fe02ab7375730.zip |
Remove unused marshalling for SRV_NET_SHARE_{ENUM,ADD,SETINFO,GETINFO}
Guenther
(This used to be commit e13b9325d251777cd9030f34fa98e22766c0bcfe)
-rw-r--r-- | source3/include/rpc_srvsvc.h | 350 | ||||
-rw-r--r-- | source3/rpc_client/cli_srvsvc.c | 374 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 1493 |
3 files changed, 0 insertions, 2217 deletions
diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h index 60ad23eb48..a8e145a155 100644 --- a/source3/include/rpc_srvsvc.h +++ b/source3/include/rpc_srvsvc.h @@ -261,356 +261,6 @@ typedef struct r_net_conn_enum_info } SRV_R_NET_CONN_ENUM; -/* SH_INFO_0 */ -typedef struct ptr_share_info0 -{ - uint32 ptr_netname; /* pointer to net name. */ -} SH_INFO_0; - -/* SH_INFO_0_STR (level 0 share info strings) */ -typedef struct str_share_info0 -{ - SH_INFO_0 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name */ - -} SH_INFO_0_STR; - -/* SRV_SHARE_INFO_0 */ -typedef struct share_info_0_info -{ - SH_INFO_0 info_0; - SH_INFO_0_STR info_0_str; - -} SRV_SHARE_INFO_0; - -/* SH_INFO_1 (pointers to level 1 share info strings) */ -typedef struct ptr_share_info1 -{ - uint32 ptr_netname; /* pointer to net name. */ - uint32 type; /* ipc, print, disk ... */ - uint32 ptr_remark; /* pointer to comment. */ - -} SH_INFO_1; - -/* SH_INFO_1_STR (level 1 share info strings) */ -typedef struct str_share_info1 -{ - SH_INFO_1 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name */ - UNISTR2 uni_remark; /* unicode string of comment */ - -} SH_INFO_1_STR; - -/* SRV_SHARE_INFO_1 */ -typedef struct share_info_1_info -{ - SH_INFO_1 info_1; - SH_INFO_1_STR info_1_str; - -} SRV_SHARE_INFO_1; - -/* SH_INFO_2 (pointers to level 2 share info strings) */ -typedef struct ptr_share_info2 -{ - uint32 ptr_netname; /* pointer to net name. */ - uint32 type; /* ipc, print, disk ... */ - uint32 ptr_remark; /* pointer to comment. */ - uint32 perms; /* permissions */ - uint32 max_uses; /* maximum uses */ - uint32 num_uses; /* current uses */ - uint32 ptr_path; /* pointer to path name */ - uint32 ptr_passwd; /* pointer to password */ - -} SH_INFO_2; - -/* SH_INFO_2_STR (level 2 share info strings) */ -typedef struct str_share_info2 -{ - SH_INFO_2 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name (e.g NETLOGON) */ - UNISTR2 uni_remark; /* unicode string of comment (e.g "Logon server share") */ - UNISTR2 uni_path; /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */ - UNISTR2 uni_passwd; /* unicode string of password - presumably for share level security (e.g NULL) */ - -} SH_INFO_2_STR; - -/* SRV_SHARE_INFO_2 */ -typedef struct share_info_2_info -{ - SH_INFO_2 info_2; - SH_INFO_2_STR info_2_str; - -} SRV_SHARE_INFO_2; - -typedef struct ptr_share_info501 -{ - uint32 ptr_netname; /* pointer to net name */ - uint32 type; /* ipc, print, disk */ - uint32 ptr_remark; /* pointer to comment */ - uint32 csc_policy; /* client-side offline caching policy << 4 */ -} SH_INFO_501; - -typedef struct str_share_info501 -{ - UNISTR2 uni_netname; /* unicode string of net name */ - UNISTR2 uni_remark; /* unicode string of comment */ -} SH_INFO_501_STR; - -/* SRV_SHARE_INFO_501 */ -typedef struct share_info_501_info -{ - SH_INFO_501 info_501; - SH_INFO_501_STR info_501_str; -} SRV_SHARE_INFO_501; - -/* SH_INFO_502 (pointers to level 502 share info strings) */ -typedef struct ptr_share_info502 -{ - uint32 ptr_netname; /* pointer to net name. */ - uint32 type; /* ipc, print, disk ... */ - uint32 ptr_remark; /* pointer to comment. */ - uint32 perms; /* permissions */ - uint32 max_uses; /* maximum uses */ - uint32 num_uses; /* current uses */ - uint32 ptr_path; /* pointer to path name */ - uint32 ptr_passwd; /* pointer to password */ - uint32 reserved; /* this holds the space taken by the sd in the rpc packet */ - uint32 reserved_offset; /* required for _post operation when marshalling */ - uint32 sd_size; /* size of security descriptor */ - uint32 ptr_sd; /* pointer to security descriptor */ - -} SH_INFO_502; - -/* SH_INFO_502_STR (level 502 share info strings) */ -typedef struct str_share_info502 -{ - SH_INFO_502 *ptrs; - - UNISTR2 uni_netname; /* unicode string of net name (e.g NETLOGON) */ - UNISTR2 uni_remark; /* unicode string of comment (e.g "Logon server share") */ - UNISTR2 uni_path; /* unicode string of local path (e.g c:\winnt\system32\repl\import\scripts) */ - UNISTR2 uni_passwd; /* unicode string of password - presumably for share level security (e.g NULL) */ - - uint32 reserved; - uint32 sd_size; - SEC_DESC *sd; - -} SH_INFO_502_STR; - -/* SRV_SHARE_INFO_502 */ -typedef struct share_info_502_info -{ - SH_INFO_502 info_502; - SH_INFO_502_STR info_502_str; - -} SRV_SHARE_INFO_502; - -typedef struct ptr_share_info1004 -{ - uint32 ptr_remark; - -} SH_INFO_1004; - -typedef struct str_share_info1004 -{ - SH_INFO_1004 *ptrs; - - UNISTR2 uni_remark; - -} SH_INFO_1004_STR; - -typedef struct ptr_info_1004_info -{ - SH_INFO_1004 info_1004; - SH_INFO_1004_STR info_1004_str; -} SRV_SHARE_INFO_1004; - -typedef struct share_info_1005_info -{ - uint32 share_info_flags; -} SRV_SHARE_INFO_1005; - -typedef struct share_info_1006_info -{ - uint32 max_uses; -} SRV_SHARE_INFO_1006; - -typedef struct ptr_share_info1007 -{ - uint32 flags; - uint32 ptr_AlternateDirectoryName; - -} SH_INFO_1007; - -typedef struct str_share_info1007 -{ - SH_INFO_1007 *ptrs; - - UNISTR2 uni_AlternateDirectoryName; - -} SH_INFO_1007_STR; - -typedef struct ptr_info_1007_info -{ - SH_INFO_1007 info_1007; - SH_INFO_1007_STR info_1007_str; -} SRV_SHARE_INFO_1007; - -/* SRV_SHARE_INFO_1501 */ -typedef struct share_info_1501_info -{ - SEC_DESC_BUF *sdb; -} SRV_SHARE_INFO_1501; - -/* SRV_SHARE_INFO_CTR */ -typedef struct srv_share_info_ctr_info -{ - uint32 info_level; - uint32 switch_value; - uint32 ptr_share_info; - - uint32 num_entries; - uint32 ptr_entries; - uint32 num_entries2; - - union { - SRV_SHARE_INFO_0 *info0; - SRV_SHARE_INFO_1 *info1; /* share info level 1 */ - SRV_SHARE_INFO_2 *info2; /* share info level 2 */ - SRV_SHARE_INFO_501 *info501; /* share info level 501 */ - SRV_SHARE_INFO_502 *info502; /* share info level 502 */ - SRV_SHARE_INFO_1004 *info1004; - SRV_SHARE_INFO_1005 *info1005; - SRV_SHARE_INFO_1006 *info1006; - SRV_SHARE_INFO_1007 *info1007; - SRV_SHARE_INFO_1501 *info1501; - void *info; - - } share; - -} SRV_SHARE_INFO_CTR; - -/* SRV_Q_NET_SHARE_ENUM */ -typedef struct q_net_share_enum_info -{ - uint32 ptr_srv_name; /* pointer (to server name?) */ - UNISTR2 uni_srv_name; /* server name */ - - SRV_SHARE_INFO_CTR ctr; /* share info container */ - - uint32 preferred_len; /* preferred maximum length (0xffff ffff) */ - - ENUM_HND enum_hnd; - -} SRV_Q_NET_SHARE_ENUM; - - -/* SRV_R_NET_SHARE_ENUM */ -typedef struct r_net_share_enum_info -{ - SRV_SHARE_INFO_CTR ctr; /* share info container */ - - uint32 total_entries; /* total number of entries */ - ENUM_HND enum_hnd; - - WERROR status; /* return status */ - -} SRV_R_NET_SHARE_ENUM; - - -/* SRV_Q_NET_SHARE_GET_INFO */ -typedef struct q_net_share_get_info_info -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - - UNISTR2 uni_share_name; - uint32 info_level; - -} SRV_Q_NET_SHARE_GET_INFO; - -/* SRV_SHARE_INFO */ -typedef struct srv_share_info { - uint32 switch_value; - uint32 ptr_share_ctr; - - union { - SRV_SHARE_INFO_0 info0; - SRV_SHARE_INFO_1 info1; - SRV_SHARE_INFO_2 info2; - SRV_SHARE_INFO_501 info501; - SRV_SHARE_INFO_502 info502; - SRV_SHARE_INFO_1004 info1004; - SRV_SHARE_INFO_1005 info1005; - SRV_SHARE_INFO_1006 info1006; - SRV_SHARE_INFO_1007 info1007; - SRV_SHARE_INFO_1501 info1501; - } share; -} SRV_SHARE_INFO; - -/* SRV_R_NET_SHARE_GET_INFO */ -typedef struct r_net_share_get_info_info -{ - SRV_SHARE_INFO info; - WERROR status; - -} SRV_R_NET_SHARE_GET_INFO; - -/* SRV_Q_NET_SHARE_SET_INFO */ -typedef struct q_net_share_set_info_info -{ - uint32 ptr_srv_name; - UNISTR2 uni_srv_name; - - UNISTR2 uni_share_name; - uint32 info_level; - - SRV_SHARE_INFO info; - - uint32 ptr_parm_error; - uint32 parm_error; - -} SRV_Q_NET_SHARE_SET_INFO; - -/* SRV_R_NET_SHARE_SET_INFO */ -typedef struct r_net_share_set_info -{ - uint32 ptr_parm_error; - uint32 parm_error; - - WERROR status; /* return status */ - -} 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; - - uint32 ptr_err_index; /* pointer to error index */ - uint32 err_index; /* index in info to field in error */ - -} SRV_Q_NET_SHARE_ADD; - -/* SRV_R_NET_SHARE_ADD */ -typedef struct r_net_share_add -{ - - uint32 ptr_parm_error; - uint32 parm_error; - - WERROR status; /* return status */ - -} SRV_R_NET_SHARE_ADD; - /***************************/ typedef struct { diff --git a/source3/rpc_client/cli_srvsvc.c b/source3/rpc_client/cli_srvsvc.c index c043120030..068108c130 100644 --- a/source3/rpc_client/cli_srvsvc.c +++ b/source3/rpc_client/cli_srvsvc.c @@ -24,380 +24,6 @@ #include "includes.h" -WERROR rpccli_srvsvc_net_share_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - uint32 info_level, SRV_SHARE_INFO_CTR *ctr, - int preferred_len, ENUM_HND *hnd) -{ - prs_struct qbuf, rbuf; - SRV_Q_NET_SHARE_ENUM q; - SRV_R_NET_SHARE_ENUM r; - WERROR result = W_ERROR(ERRgeneral); - fstring server; - int i; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost); - strupper_m(server); - - init_srv_q_net_share_enum(&q, server, info_level, preferred_len, hnd); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_SRVSVC, SRV_NET_SHARE_ENUM_ALL, - q, r, - qbuf, rbuf, - srv_io_q_net_share_enum, - srv_io_r_net_share_enum, - WERR_GENERAL_FAILURE); - - result = r.status; - - if (!W_ERROR_IS_OK(result)) - goto done; - - /* Oh yuck yuck yuck - we have to copy all the info out of the - SRV_SHARE_INFO_CTR in the SRV_R_NET_SHARE_ENUM as when we do a - prs_mem_free() it will all be invalidated. The various share - info structures suck badly too. This really is gross. */ - - ZERO_STRUCTP(ctr); - - if (!r.ctr.num_entries) - goto done; - - ctr->info_level = info_level; - ctr->num_entries = r.ctr.num_entries; - - switch(info_level) { - case 1: - ctr->share.info1 = TALLOC_ARRAY(mem_ctx, SRV_SHARE_INFO_1, ctr->num_entries); - if (ctr->share.info1 == NULL) { - return WERR_NOMEM; - } - - memset(ctr->share.info1, 0, sizeof(SRV_SHARE_INFO_1)); - - for (i = 0; i < ctr->num_entries; i++) { - SRV_SHARE_INFO_1 *info1 = &ctr->share.info1[i]; - char *s; - - /* Copy pointer crap */ - - memcpy(&info1->info_1, &r.ctr.share.info1[i].info_1, - sizeof(SH_INFO_1)); - - /* Duplicate strings */ - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info1[i].info_1_str.uni_netname); - if (s) - init_unistr2(&info1->info_1_str.uni_netname, s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info1[i].info_1_str.uni_remark); - if (s) - init_unistr2(&info1->info_1_str.uni_remark, s, UNI_STR_TERMINATE); - - } - - break; - case 2: - ctr->share.info2 = TALLOC_ARRAY(mem_ctx, SRV_SHARE_INFO_2, ctr->num_entries); - if (ctr->share.info2 == NULL) { - return WERR_NOMEM; - } - - memset(ctr->share.info2, 0, sizeof(SRV_SHARE_INFO_2)); - - for (i = 0; i < ctr->num_entries; i++) { - SRV_SHARE_INFO_2 *info2 = &ctr->share.info2[i]; - char *s; - - /* Copy pointer crap */ - - memcpy(&info2->info_2, &r.ctr.share.info2[i].info_2, - sizeof(SH_INFO_2)); - - /* Duplicate strings */ - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_netname); - if (s) - init_unistr2(&info2->info_2_str.uni_netname, s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_remark); - if (s) - init_unistr2(&info2->info_2_str.uni_remark, s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_path); - if (s) - init_unistr2(&info2->info_2_str.uni_path, s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info2[i].info_2_str.uni_passwd); - if (s) - init_unistr2(&info2->info_2_str.uni_passwd, s, UNI_STR_TERMINATE); - } - break; - /* adding info-level 502 here */ - case 502: - ctr->share.info502 = TALLOC_ARRAY(mem_ctx, SRV_SHARE_INFO_502, ctr->num_entries); - - if (ctr->share.info502 == NULL) { - return WERR_NOMEM; - } - - memset(ctr->share.info502, 0, sizeof(SRV_SHARE_INFO_502)); - - for (i = 0; i < ctr->num_entries; i++) { - SRV_SHARE_INFO_502 *info502 = &ctr->share.info502[i]; - char *s; - - /* Copy pointer crap */ - memcpy(&info502->info_502, &r.ctr.share.info502[i].info_502, - sizeof(SH_INFO_502)); - - /* Duplicate strings */ - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_netname); - if (s) - init_unistr2(&info502->info_502_str.uni_netname, s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_remark); - if (s) - init_unistr2(&info502->info_502_str.uni_remark, s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_path); - if (s) - init_unistr2(&info502->info_502_str.uni_path, s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_passwd); - if (s) - init_unistr2(&info502->info_502_str.uni_passwd, s, UNI_STR_TERMINATE); - - info502->info_502_str.sd = dup_sec_desc(mem_ctx, r.ctr.share.info502[i].info_502_str.sd); - } - break; - } - - done: - - return result; -} - -WERROR rpccli_srvsvc_net_share_get_info(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - const char *sharename, - uint32 info_level, - SRV_SHARE_INFO *info) -{ - prs_struct qbuf, rbuf; - SRV_Q_NET_SHARE_GET_INFO q; - SRV_R_NET_SHARE_GET_INFO r; - WERROR result = W_ERROR(ERRgeneral); - fstring server; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost); - strupper_m(server); - - init_srv_q_net_share_get_info(&q, server, sharename, info_level); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_SRVSVC, SRV_NET_SHARE_GET_INFO, - q, r, - qbuf, rbuf, - srv_io_q_net_share_get_info, - srv_io_r_net_share_get_info, - WERR_GENERAL_FAILURE); - - result = r.status; - - if (!W_ERROR_IS_OK(result)) - goto done; - - ZERO_STRUCTP(info); - - info->switch_value = info_level; - - switch(info_level) { - case 1: - { - SRV_SHARE_INFO_1 *info1 = &info->share.info1; - SH_INFO_1_STR *info1_str = &info1->info_1_str; - - char *s; - - info->share.info1 = r.info.share.info1; - - /* Duplicate strings */ - - s = unistr2_to_ascii_talloc(mem_ctx, &info1_str->uni_netname); - if (s) - init_unistr2(&info1_str->uni_netname, - s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &info1_str->uni_remark); - if (s) - init_unistr2(&info1_str->uni_remark, - s, UNI_STR_TERMINATE); - - break; - } - case 2: - { - SRV_SHARE_INFO_2 *info2 = &info->share.info2; - SH_INFO_2_STR *info2_str = &info2->info_2_str; - - char *s; - - info->share.info2 = r.info.share.info2; - - /* Duplicate strings */ - - s = unistr2_to_ascii_talloc(mem_ctx, &info2_str->uni_netname); - if (s) - init_unistr2(&info2_str->uni_netname, - s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &info2_str->uni_remark); - if (s) - init_unistr2(&info2_str->uni_remark, - s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &info2_str->uni_path); - if (s) - init_unistr2(&info2_str->uni_path, - s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &info2_str->uni_passwd); - if (s) - init_unistr2(&info2_str->uni_passwd, - s, UNI_STR_TERMINATE); - - - break; - } - case 502: - { - SRV_SHARE_INFO_502 *info502 = &info->share.info502; - SH_INFO_502_STR *info502_str = &info502->info_502_str; - - char *s; - - info->share.info502 = r.info.share.info502; - - /* Duplicate strings */ - - s = unistr2_to_ascii_talloc(mem_ctx, &info502_str->uni_netname); - if (s) - init_unistr2(&info502_str->uni_netname, - s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &info502_str->uni_remark); - if (s) - init_unistr2(&info502_str->uni_remark, - s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &info502_str->uni_path); - if (s) - init_unistr2(&info502_str->uni_path, - s, UNI_STR_TERMINATE); - - s = unistr2_to_ascii_talloc(mem_ctx, &info502_str->uni_passwd); - if (s) - init_unistr2(&info502_str->uni_passwd, - s, UNI_STR_TERMINATE); - - info502_str->sd = dup_sec_desc(mem_ctx, info502_str->sd); - break; - } - default: - DEBUG(0,("unimplemented info-level: %d\n", info_level)); - break; - } - - done: - - return result; -} - -WERROR rpccli_srvsvc_net_share_set_info(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - const char *sharename, - uint32 info_level, - SRV_SHARE_INFO *info) -{ - prs_struct qbuf, rbuf; - SRV_Q_NET_SHARE_SET_INFO q; - SRV_R_NET_SHARE_SET_INFO r; - WERROR result = W_ERROR(ERRgeneral); - fstring server; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Initialise input parameters */ - - slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost); - strupper_m(server); - - init_srv_q_net_share_set_info(&q, server, sharename, info_level, info); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_SRVSVC, SRV_NET_SHARE_SET_INFO, - q, r, - qbuf, rbuf, - srv_io_q_net_share_set_info, - srv_io_r_net_share_set_info, - WERR_GENERAL_FAILURE); - - result = r.status; - return result; -} - -WERROR rpccli_srvsvc_net_share_add(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - const char *netname, uint32 type, - const char *remark, uint32 perms, - uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd, - int level, SEC_DESC *sd) -{ - prs_struct qbuf, rbuf; - SRV_Q_NET_SHARE_ADD q; - SRV_R_NET_SHARE_ADD r; - WERROR result = W_ERROR(ERRgeneral); - fstring server; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->cli->desthost); - strupper_m(server); - - init_srv_q_net_share_add(&q,server, netname, type, remark, - perms, max_uses, num_uses, path, passwd, - level, sd); - - /* Marshall data and send request */ - - CLI_DO_RPC_WERR(cli, mem_ctx, PI_SRVSVC, SRV_NET_SHARE_ADD, - q, r, - qbuf, rbuf, - srv_io_q_net_share_add, - srv_io_r_net_share_add, - WERR_GENERAL_FAILURE); - - result = r.status; - return result; -} - WERROR rpccli_srvsvc_net_file_enum(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32 file_level, const char *user_name, SRV_FILE_INFO_CTR *ctr, int preferred_len, diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 9e42ef6158..30b3539395 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -29,1499 +29,6 @@ #define DBGC_CLASS DBGC_RPC_PARSE /******************************************************************* - Inits a SH_INFO_0_STR structure -********************************************************************/ - -void init_srv_share_info0_str(SH_INFO_0_STR *sh0, const char *net_name) -{ - DEBUG(5,("init_srv_share_info0_str\n")); - - init_unistr2(&sh0->uni_netname, net_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info0_str(const char *desc, SH_INFO_0_STR *sh0, prs_struct *ps, int depth) -{ - if (sh0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info0_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh0->ptrs->ptr_netname) - if(!smb_io_unistr2("", &sh0->uni_netname, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_0 structure -********************************************************************/ - -void init_srv_share_info0(SH_INFO_0 *sh0, const char *net_name) -{ - DEBUG(5,("init_srv_share_info0: %s\n", net_name)); - - sh0->ptr_netname = (net_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info0(const char *desc, SH_INFO_0 *sh0, prs_struct *ps, int depth) -{ - if (sh0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh0->ptr_netname)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1_STR structure -********************************************************************/ - -void init_srv_share_info1_str(SH_INFO_1_STR *sh1, const char *net_name, const char *remark) -{ - DEBUG(5,("init_srv_share_info1_str\n")); - - init_unistr2(&sh1->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh1->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1_str(const char *desc, SH_INFO_1_STR *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(sh1->ptrs->ptr_netname) - if(!smb_io_unistr2("", &sh1->uni_netname, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(sh1->ptrs->ptr_remark) - if(!smb_io_unistr2("", &sh1->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1 structure -********************************************************************/ - -void init_srv_share_info1(SH_INFO_1 *sh1, const char *net_name, uint32 type, const char *remark) -{ - DEBUG(5,("init_srv_share_info1: %s %8x %s\n", net_name, type, remark)); - - sh1->ptr_netname = (net_name != NULL) ? 1 : 0; - sh1->type = type; - sh1->ptr_remark = (remark != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1(const char *desc, SH_INFO_1 *sh1, prs_struct *ps, int depth) -{ - if (sh1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh1->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh1->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh1->ptr_remark)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_2_STR structure -********************************************************************/ - -void init_srv_share_info2_str(SH_INFO_2_STR *sh2, - const char *net_name, const char *remark, - const char *path, const char *passwd) -{ - DEBUG(5,("init_srv_share_info2_str\n")); - - init_unistr2(&sh2->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_remark, remark, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_path, path, UNI_STR_TERMINATE); - init_unistr2(&sh2->uni_passwd, passwd, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info2_str(const char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth) -{ - if (sh2 == NULL) - return False; - - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(sh2); - - prs_debug(ps, depth, desc, "srv_io_share_info2_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if (sh->ptr_netname) - if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth)) - return False; - - if (sh->ptr_remark) - if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth)) - return False; - - if (sh->ptr_netname) - if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth)) - return False; - - if (sh->ptr_passwd) - if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_2 structure -********************************************************************/ - -void init_srv_share_info2(SH_INFO_2 *sh2, - const char *net_name, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd) -{ - DEBUG(5,("init_srv_share_info2: %s %8x %s\n", net_name, type, remark)); - - sh2->ptr_netname = (net_name != NULL) ? 1 : 0; - sh2->type = type; - sh2->ptr_remark = (remark != NULL) ? 1 : 0; - sh2->perms = perms; - sh2->max_uses = max_uses; - sh2->num_uses = num_uses; - sh2->ptr_path = (path != NULL) ? 1 : 0; - sh2->ptr_passwd = (passwd != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info2(const char *desc, SH_INFO_2 *sh2, prs_struct *ps, int depth) -{ - if (sh2 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh2->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh2->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh2->ptr_remark)) - return False; - if(!prs_uint32("perms ", ps, depth, &sh2->perms)) - return False; - if(!prs_uint32("max_uses ", ps, depth, &sh2->max_uses)) - return False; - if(!prs_uint32("num_uses ", ps, depth, &sh2->num_uses)) - return False; - if(!prs_uint32("ptr_path ", ps, depth, &sh2->ptr_path)) - return False; - if(!prs_uint32("ptr_passwd ", ps, depth, &sh2->ptr_passwd)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_501_STR structure -********************************************************************/ - -void init_srv_share_info501_str(SH_INFO_501_STR *sh501, - const char *net_name, const char *remark) -{ - DEBUG(5,("init_srv_share_info501_str\n")); - - init_unistr2(&sh501->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh501->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Inits a SH_INFO_2 structure -*******************************************************************/ - -void init_srv_share_info501(SH_INFO_501 *sh501, const char *net_name, uint32 type, const char *remark, uint32 csc_policy) -{ - DEBUG(5,("init_srv_share_info501: %s %8x %s %08x\n", net_name, type, - remark, csc_policy)); - - ZERO_STRUCTP(sh501); - - sh501->ptr_netname = (net_name != NULL) ? 1 : 0; - sh501->type = type; - sh501->ptr_remark = (remark != NULL) ? 1 : 0; - sh501->csc_policy = csc_policy; -} - -/******************************************************************* - Reads of writes a structure. -*******************************************************************/ - -static bool srv_io_share_info501(const char *desc, SH_INFO_501 *sh501, prs_struct *ps, int depth) -{ - if (sh501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info501"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr_netname", ps, depth, &sh501->ptr_netname)) - return False; - if (!prs_uint32("type ", ps, depth, &sh501->type)) - return False; - if (!prs_uint32("ptr_remark ", ps, depth, &sh501->ptr_remark)) - return False; - if (!prs_uint32("csc_policy ", ps, depth, &sh501->csc_policy)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info501_str(const char *desc, SH_INFO_501_STR *sh501, prs_struct *ps, int depth) -{ - if (sh501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info501_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh501->uni_netname, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!smb_io_unistr2("", &sh501->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_502 structure -********************************************************************/ - -void init_srv_share_info502(SH_INFO_502 *sh502, - const char *net_name, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) -{ - DEBUG(5,("init_srv_share_info502: %s %8x %s\n", net_name, type, remark)); - - ZERO_STRUCTP(sh502); - - sh502->ptr_netname = (net_name != NULL) ? 1 : 0; - sh502->type = type; - sh502->ptr_remark = (remark != NULL) ? 1 : 0; - sh502->perms = perms; - sh502->max_uses = max_uses; - sh502->num_uses = num_uses; - sh502->ptr_path = (path != NULL) ? 1 : 0; - sh502->ptr_passwd = (passwd != NULL) ? 1 : 0; - sh502->reserved = 0; /* actual size within rpc */ - sh502->sd_size = (uint32)sd_size; - sh502->ptr_sd = (psd != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info502(const char *desc, SH_INFO_502 *sh502, prs_struct *ps, int depth) -{ - if (sh502 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info502"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_netname", ps, depth, &sh502->ptr_netname)) - return False; - if(!prs_uint32("type ", ps, depth, &sh502->type)) - return False; - if(!prs_uint32("ptr_remark ", ps, depth, &sh502->ptr_remark)) - return False; - if(!prs_uint32("perms ", ps, depth, &sh502->perms)) - return False; - if(!prs_uint32("max_uses ", ps, depth, &sh502->max_uses)) - return False; - if(!prs_uint32("num_uses ", ps, depth, &sh502->num_uses)) - return False; - if(!prs_uint32("ptr_path ", ps, depth, &sh502->ptr_path)) - return False; - if(!prs_uint32("ptr_passwd ", ps, depth, &sh502->ptr_passwd)) - return False; - if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &sh502->reserved_offset)) - return False; - if(!prs_uint32("ptr_sd ", ps, depth, &sh502->ptr_sd)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_502_STR structure -********************************************************************/ - -void init_srv_share_info502_str(SH_INFO_502_STR *sh502str, - const char *net_name, const char *remark, - const char *path, const char *passwd, SEC_DESC *psd, size_t sd_size) -{ - DEBUG(5,("init_srv_share_info502_str\n")); - - init_unistr2(&sh502str->uni_netname, net_name, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_remark, remark, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_path, path, UNI_STR_TERMINATE); - init_unistr2(&sh502str->uni_passwd, passwd, UNI_STR_TERMINATE); - sh502str->sd = psd; - sh502str->reserved = 0; - sh502str->sd_size = sd_size; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info502_str(const char *desc, SH_INFO_502_STR *sh502, prs_struct *ps, int depth) -{ - if (sh502 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info502_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_netname) { - if(!smb_io_unistr2("", &sh502->uni_netname, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_remark) { - if(!smb_io_unistr2("", &sh502->uni_remark, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_path) { - if(!smb_io_unistr2("", &sh502->uni_path, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_passwd) { - if(!smb_io_unistr2("", &sh502->uni_passwd, True, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(sh502->ptrs->ptr_sd) { - uint32 old_offset; - uint32 reserved_offset; - - if(!prs_uint32_pre("reserved ", ps, depth, &sh502->reserved, &reserved_offset)) - return False; - - old_offset = prs_offset(ps); - - if (!sec_io_desc(desc, &sh502->sd, ps, depth)) - return False; - - if(UNMARSHALLING(ps)) { - - sh502->ptrs->sd_size = sh502->sd_size = - ndr_size_security_descriptor(sh502->sd, 0); - - prs_set_offset(ps, old_offset + sh502->reserved); - } - - prs_align(ps); - - if(MARSHALLING(ps)) { - - sh502->ptrs->reserved = sh502->reserved = prs_offset(ps) - old_offset; - } - - if(!prs_uint32_post("reserved ", ps, depth, - &sh502->reserved, reserved_offset, sh502->reserved)) - return False; - if(!prs_uint32_post("reserved ", ps, depth, - &sh502->ptrs->reserved, sh502->ptrs->reserved_offset, sh502->ptrs->reserved)) - return False; - } - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1004_STR structure -********************************************************************/ - -void init_srv_share_info1004_str(SH_INFO_1004_STR *sh1004, const char *remark) -{ - DEBUG(5,("init_srv_share_info1004_str\n")); - - init_unistr2(&sh1004->uni_remark, remark, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1004_str(const char *desc, SH_INFO_1004_STR *sh1004, prs_struct *ps, int depth) -{ - if (sh1004 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1004_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh1004->ptrs->ptr_remark) - if(!smb_io_unistr2("", &sh1004->uni_remark, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1004 structure -********************************************************************/ - -void init_srv_share_info1004(SH_INFO_1004 *sh1004, const char *remark) -{ - DEBUG(5,("init_srv_share_info1004: %s\n", remark)); - - sh1004->ptr_remark = (remark != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1004(const char *desc, SH_INFO_1004 *sh1004, prs_struct *ps, int depth) -{ - if (sh1004 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1004"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_remark", ps, depth, &sh1004->ptr_remark)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1005(const char* desc, SRV_SHARE_INFO_1005* sh1005, prs_struct* ps, int depth) -{ - if(sh1005 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1005"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("share_info_flags", ps, depth, - &sh1005->share_info_flags)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1006(const char* desc, SRV_SHARE_INFO_1006* sh1006, prs_struct* ps, int depth) -{ - if(sh1006 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1006"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("max uses ", ps, depth, &sh1006->max_uses)) - return False; - - return True; -} - -/******************************************************************* - Inits a SH_INFO_1007_STR structure -********************************************************************/ - -void init_srv_share_info1007_str(SH_INFO_1007_STR *sh1007, const char *alternate_directory_name) -{ - DEBUG(5,("init_srv_share_info1007_str\n")); - - init_unistr2(&sh1007->uni_AlternateDirectoryName, alternate_directory_name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1007_str(const char *desc, SH_INFO_1007_STR *sh1007, prs_struct *ps, int depth) -{ - if (sh1007 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1007_str"); - depth++; - - if(!prs_align(ps)) - return False; - if(sh1007->ptrs->ptr_AlternateDirectoryName) - if(!smb_io_unistr2("", &sh1007->uni_AlternateDirectoryName, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - makes a SH_INFO_1007 structure -********************************************************************/ - -void init_srv_share_info1007(SH_INFO_1007 *sh1007, uint32 flags, const char *alternate_directory_name) -{ - DEBUG(5,("init_srv_share_info1007: %s\n", alternate_directory_name)); - - sh1007->flags = flags; - sh1007->ptr_AlternateDirectoryName = (alternate_directory_name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1007(const char *desc, SH_INFO_1007 *sh1007, prs_struct *ps, int depth) -{ - if (sh1007 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1007"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("flags ", ps, depth, &sh1007->flags)) - return False; - if(!prs_uint32("ptr_Alter..", ps, depth, &sh1007->ptr_AlternateDirectoryName)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_share_info1501(const char* desc, SRV_SHARE_INFO_1501* sh1501, - prs_struct* ps, int depth) -{ - if(sh1501 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_share_info1501"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!sec_io_desc_buf(desc, &sh1501->sdb, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_share_ctr(const char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct *ps, int depth) -{ - if (ctr == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_share_ctr"); - depth++; - - if (UNMARSHALLING(ps)) { - memset(ctr, '\0', sizeof(SRV_SHARE_INFO_CTR)); - } - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &ctr->info_level)) - return False; - - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) - return False; - if(!prs_uint32("ptr_share_info", ps, depth, &ctr->ptr_share_info)) - return False; - - if (ctr->ptr_share_info == 0) - return True; - - if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) - return False; - if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) - return False; - - if (ctr->ptr_entries == 0) { - if (ctr->num_entries == 0) - return True; - else - return False; - } - - if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) - return False; - - if (ctr->num_entries2 != ctr->num_entries) - return False; - - switch (ctr->switch_value) { - - case 0: - { - SRV_SHARE_INFO_0 *info0 = ctr->share.info0; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info0 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_0, num_entries))) - return False; - ctr->share.info0 = info0; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info0("", &info0[i].info_0, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info0[i].info_0_str.ptrs = &info0[i].info_0; - if(!srv_io_share_info0_str("", &info0[i].info_0_str, ps, depth)) - return False; - } - - break; - } - - case 1: - { - SRV_SHARE_INFO_1 *info1 = ctr->share.info1; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_1, num_entries))) - return False; - ctr->share.info1 = info1; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1("", &info1[i].info_1, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1[i].info_1_str.ptrs = &info1[i].info_1; - if(!srv_io_share_info1_str("", &info1[i].info_1_str, ps, depth)) - return False; - } - - break; - } - - case 2: - { - SRV_SHARE_INFO_2 *info2 = ctr->share.info2; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info2 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_2,num_entries))) - return False; - ctr->share.info2 = info2; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info2("", &info2[i].info_2, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth)) - return False; - } - - break; - } - - case 501: - { - SRV_SHARE_INFO_501 *info501 = ctr->share.info501; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info501 = PRS_ALLOC_MEM(ps, SRV_SHARE_INFO_501, num_entries))) - return False; - ctr->share.info501 = info501; - } - - for (i = 0; i < num_entries; i++) { - if (!srv_io_share_info501("", &info501[i].info_501, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if (!srv_io_share_info501_str("", &info501[i].info_501_str, ps, depth)) - return False; - } - - break; - } - - case 502: - { - SRV_SHARE_INFO_502 *info502 = ctr->share.info502; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info502 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_502,num_entries))) - return False; - ctr->share.info502 = info502; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info502("", &info502[i].info_502, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info502[i].info_502_str.ptrs = &info502[i].info_502; - if(!srv_io_share_info502_str("", &info502[i].info_502_str, ps, depth)) - return False; - } - - break; - } - - case 1004: - { - SRV_SHARE_INFO_1004 *info1004 = ctr->share.info1004; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1004 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1004,num_entries))) - return False; - ctr->share.info1004 = info1004; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1004("", &info1004[i].info_1004, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1004[i].info_1004_str.ptrs = &info1004[i].info_1004; - if(!srv_io_share_info1004_str("", &info1004[i].info_1004_str, ps, depth)) - return False; - } - - break; - } - - case 1005: - { - SRV_SHARE_INFO_1005 *info1005 = ctr->share.info1005; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1005 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1005,num_entries))) - return False; - ctr->share.info1005 = info1005; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1005("", &info1005[i], ps, depth)) - return False; - } - - break; - } - - case 1006: - { - SRV_SHARE_INFO_1006 *info1006 = ctr->share.info1006; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1006 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1006,num_entries))) - return False; - ctr->share.info1006 = info1006; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1006("", &info1006[i], ps, depth)) - return False; - } - - break; - } - - case 1007: - { - SRV_SHARE_INFO_1007 *info1007 = ctr->share.info1007; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1007 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1007,num_entries))) - return False; - ctr->share.info1007 = info1007; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1007("", &info1007[i].info_1007, ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - info1007[i].info_1007_str.ptrs = &info1007[i].info_1007; - if(!srv_io_share_info1007_str("", &info1007[i].info_1007_str, ps, depth)) - return False; - } - - break; - } - - case 1501: - { - SRV_SHARE_INFO_1501 *info1501 = ctr->share.info1501; - int num_entries = ctr->num_entries; - int i; - - if (UNMARSHALLING(ps) && num_entries) { - if (!(info1501 = PRS_ALLOC_MEM(ps,SRV_SHARE_INFO_1501,num_entries))) - return False; - ctr->share.info1501 = info1501; - } - - for (i = 0; i < num_entries; i++) { - if(!srv_io_share_info1501("", &info1501[i], ps, depth)) - return False; - } - - break; - } - - default: - DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(5,depth), ctr->switch_value)); - break; - } - - return True; -} - -/******************************************************************* - Inits a SRV_Q_NET_SHARE_ENUM structure. -********************************************************************/ - -void init_srv_q_net_share_enum(SRV_Q_NET_SHARE_ENUM *q_n, - const char *srv_name, uint32 info_level, - uint32 preferred_len, ENUM_HND *hnd) -{ - - DEBUG(5,("init_q_net_share_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - - q_n->ctr.info_level = q_n->ctr.switch_value = info_level; - q_n->ctr.ptr_share_info = 1; - q_n->ctr.num_entries = 0; - q_n->ctr.ptr_entries = 0; - q_n->ctr.num_entries2 = 0; - q_n->preferred_len = preferred_len; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_enum(const char *desc, SRV_Q_NET_SHARE_ENUM *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_enum"); - 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(!srv_io_srv_share_ctr("share_ctr", &q_n->ctr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_enum(const char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_enum"); - depth++; - - if(!srv_io_srv_share_ctr("share_ctr", &r_n->ctr, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("total_entries", ps, depth, &r_n->total_entries)) - return False; - - if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - initialises a structure. -********************************************************************/ - -bool init_srv_q_net_share_get_info(SRV_Q_NET_SHARE_GET_INFO *q_n, const char *srv_name, const char *share_name, uint32 info_level) -{ - - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_share_get_info\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); - - q_n->info_level = info_level; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_get_info(const char *desc, SRV_Q_NET_SHARE_GET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_get_info"); - 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; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("info_level", ps, depth, &q_n->info_level)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static bool srv_io_srv_share_info(const char *desc, prs_struct *ps, int depth, SRV_SHARE_INFO *r_n) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_srv_share_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value )) - return False; - - if(!prs_uint32("ptr_share_ctr", ps, depth, &r_n->ptr_share_ctr)) - return False; - - if (r_n->ptr_share_ctr != 0) { - switch (r_n->switch_value) { - case 0: - if(!srv_io_share_info0("", &r_n->share.info0.info_0, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info0.info_0_str.ptrs = &r_n->share.info0.info_0; - - if(!srv_io_share_info0_str("", &r_n->share.info0.info_0_str, ps, depth)) - return False; - - break; - case 1: - if(!srv_io_share_info1("", &r_n->share.info1.info_1, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1.info_1_str.ptrs = &r_n->share.info1.info_1; - - if(!srv_io_share_info1_str("", &r_n->share.info1.info_1_str, ps, depth)) - return False; - - break; - case 2: - if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth)) - return False; - - if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth)) - return False; - - break; - case 501: - if (!srv_io_share_info501("", &r_n->share.info501.info_501, ps, depth)) - return False; - if (!srv_io_share_info501_str("", &r_n->share.info501.info_501_str, ps, depth)) - return False; - break; - - case 502: - if(!srv_io_share_info502("", &r_n->share.info502.info_502, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info502.info_502_str.ptrs = &r_n->share.info502.info_502; - - if(!srv_io_share_info502_str("", &r_n->share.info502.info_502_str, ps, depth)) - return False; - break; - case 1004: - if(!srv_io_share_info1004("", &r_n->share.info1004.info_1004, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1004.info_1004_str.ptrs = &r_n->share.info1004.info_1004; - - if(!srv_io_share_info1004_str("", &r_n->share.info1004.info_1004_str, ps, depth)) - return False; - break; - case 1005: - if(!srv_io_share_info1005("", &r_n->share.info1005, ps, depth)) - return False; - break; - case 1006: - if(!srv_io_share_info1006("", &r_n->share.info1006, ps, depth)) - return False; - break; - case 1007: - if(!srv_io_share_info1007("", &r_n->share.info1007.info_1007, ps, depth)) - return False; - - /* allow access to pointers in the str part. */ - r_n->share.info1007.info_1007_str.ptrs = &r_n->share.info1007.info_1007; - - if(!srv_io_share_info1007_str("", &r_n->share.info1007.info_1007_str, ps, depth)) - return False; - break; - case 1501: - if (!srv_io_share_info1501("", &r_n->share.info1501, ps, depth)) - return False; - default: - DEBUG(5,("%s no share info at switch_value %d\n", - tab_depth(5,depth), r_n->switch_value)); - break; - } - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_get_info(const char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_get_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!srv_io_srv_share_info("info ", ps, depth, &r_n->info)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* - intialises a structure. -********************************************************************/ - -bool init_srv_q_net_share_set_info(SRV_Q_NET_SHARE_SET_INFO *q_n, - const char *srv_name, - const char *share_name, - uint32 info_level, - const SRV_SHARE_INFO *info) -{ - - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_share_set_info\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_share_name, &ptr_share_name, share_name); - - q_n->info_level = info_level; - - q_n->info = *info; - - q_n->ptr_parm_error = 1; - q_n->parm_error = 0; - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_set_info(const char *desc, SRV_Q_NET_SHARE_SET_INFO *q_n, prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_share_set_info"); - 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; - - 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; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("ptr_parm_error", ps, depth, &q_n->ptr_parm_error)) - return False; - if(q_n->ptr_parm_error!=0) { - if(!prs_uint32("parm_error", ps, depth, &q_n->parm_error)) - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_set_info(const char *desc, SRV_R_NET_SHARE_SET_INFO *r_n, prs_struct *ps, int depth) -{ - if (r_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_share_set_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_parm_error ", ps, depth, &r_n->ptr_parm_error)) - return False; - - if(r_n->ptr_parm_error) { - - if(!prs_uint32("parm_error ", ps, depth, &r_n->parm_error)) - return False; - } - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_q_net_share_add(const 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; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_err_index", ps, depth, &q_n->ptr_err_index)) - return False; - if (q_n->ptr_err_index) - if (!prs_uint32("err_index", ps, depth, &q_n->err_index)) - return False; - - return True; -} - -void init_srv_q_net_share_add(SRV_Q_NET_SHARE_ADD *q, const char *srvname, - const char *netname, uint32 type, const char *remark, - uint32 perms, uint32 max_uses, uint32 num_uses, - const char *path, const char *passwd, - int level, SEC_DESC *sd) -{ - switch(level) { - case 502: { - size_t sd_size = ndr_size_security_descriptor(sd, 0); - q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); - q->info.switch_value = q->info_level = level; - q->info.ptr_share_ctr = 1; - init_srv_share_info502(&q->info.share.info502.info_502, netname, type, - remark, perms, max_uses, num_uses, path, passwd, sd, sd_size); - init_srv_share_info502_str(&q->info.share.info502.info_502_str, netname, - remark, path, passwd, sd, sd_size); - q->ptr_err_index = 1; - q->err_index = 0; - } - break; - case 2: - default: - q->ptr_srv_name = 1; - init_unistr2(&q->uni_srv_name, srvname, UNI_STR_TERMINATE); - q->info.switch_value = q->info_level = level; - q->info.ptr_share_ctr = 1; - init_srv_share_info2(&q->info.share.info2.info_2, netname, type, - remark, perms, max_uses, num_uses, path, passwd); - init_srv_share_info2_str(&q->info.share.info2.info_2_str, netname, - remark, path, passwd); - q->ptr_err_index = 1; - q->err_index = 0; - break; - } -} - - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -bool srv_io_r_net_share_add(const char *desc, SRV_R_NET_SHARE_ADD *r_n, prs_struct *ps, int depth) -{ - if (r_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("ptr_parm_error", ps, depth, &r_n->ptr_parm_error)) - return False; - - if(r_n->ptr_parm_error) { - - if(!prs_uint32("parm_error", ps, depth, &r_n->parm_error)) - return False; - } - - if(!prs_werror("status", ps, depth, &r_n->status)) - return False; - - return True; -} - -/******************************************************************* Inits a SESS_INFO_0_STR structure ********************************************************************/ |