summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_srv.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse/parse_srv.c')
-rw-r--r--source3/rpc_parse/parse_srv.c1493
1 files changed, 0 insertions, 1493 deletions
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
********************************************************************/