From 34df32446df1167cddea2dd9a3fb3240e817f731 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 15 Feb 2008 14:24:31 +0100 Subject: Remove unused marshalling for NET_SAM_SYNC. Guenther (This used to be commit a94d93725a649c7a0ac1fcd61ea07579f65596da) --- source3/rpc_parse/parse_net.c | 1165 ----------------------------------------- 1 file changed, 1165 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index b4ed470cce..8677924d6a 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1406,1168 +1406,3 @@ bool net_io_r_sam_logoff(const char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps return True; } - -/******************************************************************* -makes a NET_Q_SAM_SYNC structure. -********************************************************************/ -bool init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, - const char *cli_name, DOM_CRED *cli_creds, - DOM_CRED *ret_creds, uint32 database_id, - uint32 next_rid) -{ - DEBUG(5, ("init_q_sam_sync\n")); - - init_unistr2(&q_s->uni_srv_name, srv_name, UNI_STR_TERMINATE); - init_unistr2(&q_s->uni_cli_name, cli_name, UNI_STR_TERMINATE); - - if (cli_creds) - memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds)); - - if (cli_creds) - memcpy(&q_s->ret_creds, ret_creds, sizeof(q_s->ret_creds)); - else - memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds)); - - q_s->database_id = database_id; - q_s->restart_state = 0; - q_s->sync_context = next_rid; - q_s->max_size = 0xffff; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -bool net_io_q_sam_sync(const char *desc, NET_Q_SAM_SYNC * q_s, prs_struct *ps, - int depth) -{ - prs_debug(ps, depth, desc, "net_io_q_sam_sync"); - depth++; - - if (!smb_io_unistr2("", &q_s->uni_srv_name, True, ps, depth)) - return False; - if (!smb_io_unistr2("", &q_s->uni_cli_name, True, ps, depth)) - return False; - - if (!smb_io_cred("", &q_s->cli_creds, ps, depth)) - return False; - if (!smb_io_cred("", &q_s->ret_creds, ps, depth)) - return False; - - if (!prs_uint32("database_id ", ps, depth, &q_s->database_id)) - return False; - if (!prs_uint32("restart_state", ps, depth, &q_s->restart_state)) - return False; - if (!prs_uint32("sync_context ", ps, depth, &q_s->sync_context)) - return False; - - if (!prs_uint32("max_size", ps, depth, &q_s->max_size)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_delta_hdr(const char *desc, SAM_DELTA_HDR * delta, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "net_io_sam_delta_hdr"); - depth++; - - if (!prs_uint16("type", ps, depth, &delta->type)) - return False; - if (!prs_uint16("type2", ps, depth, &delta->type2)) - return False; - if (!prs_uint32("target_rid", ps, depth, &delta->target_rid)) - return False; - - if (!prs_uint32("type3", ps, depth, &delta->type3)) - return False; - - /* Not sure why we need this but it seems to be necessary to get - sam deltas working. */ - - if (delta->type != 0x16) { - if (!prs_uint32("ptr_delta", ps, depth, &delta->ptr_delta)) - return False; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_delta_mod_count(const char *desc, SAM_DELTA_MOD_COUNT *info, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "net_io_sam_delta_stamp"); - depth++; - - if (!prs_uint32("seqnum", ps, depth, &info->seqnum)) - return False; - if (!prs_uint32("dom_mod_count_ptr", ps, depth, - &info->dom_mod_count_ptr)) - return False; - - if (info->dom_mod_count_ptr) { - if (!prs_uint64("dom_mod_count", ps, depth, - &info->dom_mod_count)) - return False; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_domain_info(const char *desc, SAM_DOMAIN_INFO * info, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "net_io_sam_domain_info"); - depth++; - - if (!smb_io_unihdr("hdr_dom_name", &info->hdr_dom_name, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_oem_info", &info->hdr_oem_info, ps, depth)) - return False; - - if (!prs_uint64("force_logoff", ps, depth, &info->force_logoff)) - return False; - if (!prs_uint16("min_pwd_len", ps, depth, &info->min_pwd_len)) - return False; - if (!prs_uint16("pwd_history_len", ps, depth, &info->pwd_history_len)) - return False; - if (!prs_uint64("max_pwd_age", ps, depth, &info->max_pwd_age)) - return False; - if (!prs_uint64("min_pwd_age", ps, depth, &info->min_pwd_age)) - return False; - if (!prs_uint64("dom_mod_count", ps, depth, &info->dom_mod_count)) - return False; - if (!smb_io_time("creation_time", &info->creation_time, ps, depth)) - return False; - if (!prs_uint32("security_information", ps, depth, &info->security_information)) - return False; - if (!smb_io_bufhdr4("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) - return False; - if (!smb_io_lockout_string_hdr("hdr_account_lockout_string", &info->hdr_account_lockout, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_unknown2", &info->hdr_unknown2, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_unknown3", &info->hdr_unknown3, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_unknown4", &info->hdr_unknown4, ps, depth)) - return False; - if (!prs_uint32("logon_chgpass", ps, depth, &info->logon_chgpass)) - return False; - if (!prs_uint32("unknown6", ps, depth, &info->unknown6)) - return False; - if (!prs_uint32("unknown7", ps, depth, &info->unknown7)) - return False; - if (!prs_uint32("unknown8", ps, depth, &info->unknown8)) - return False; - - if (!smb_io_unistr2("uni_dom_name", &info->uni_dom_name, - info->hdr_dom_name.buffer, ps, depth)) - return False; - if (!smb_io_unistr2("buf_oem_info", &info->buf_oem_info, - info->hdr_oem_info.buffer, ps, depth)) - return False; - - if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) - return False; - - if (!smb_io_account_lockout_str("account_lockout", &info->account_lockout, - info->hdr_account_lockout.buffer, ps, depth)) - return False; - - if (!smb_io_unistr2("buf_unknown2", &info->buf_unknown2, - info->hdr_unknown2.buffer, ps, depth)) - return False; - if (!smb_io_unistr2("buf_unknown3", &info->buf_unknown3, - info->hdr_unknown3.buffer, ps, depth)) - return False; - if (!smb_io_unistr2("buf_unknown4", &info->buf_unknown4, - info->hdr_unknown4.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_group_info(const char *desc, SAM_GROUP_INFO * info, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "net_io_sam_group_info"); - depth++; - - if (!smb_io_unihdr("hdr_grp_name", &info->hdr_grp_name, ps, depth)) - return False; - if (!smb_io_gid("gid", &info->gid, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_grp_desc", &info->hdr_grp_desc, ps, depth)) - return False; - if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) - return False; - - if (ps->data_offset + 48 > ps->buffer_size) - return False; - ps->data_offset += 48; - - if (!smb_io_unistr2("uni_grp_name", &info->uni_grp_name, - info->hdr_grp_name.buffer, ps, depth)) - return False; - if (!smb_io_unistr2("uni_grp_desc", &info->uni_grp_desc, - info->hdr_grp_desc.buffer, ps, depth)) - return False; - if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_passwd_info(const char *desc, SAM_PWD * pwd, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "net_io_sam_passwd_info"); - depth++; - - if (!prs_uint32("unk_0 ", ps, depth, &pwd->unk_0)) - return False; - - if (!smb_io_unihdr("hdr_lm_pwd", &pwd->hdr_lm_pwd, ps, depth)) - return False; - if (!prs_uint8s(False, "buf_lm_pwd", ps, depth, pwd->buf_lm_pwd, 16)) - return False; - - if (!smb_io_unihdr("hdr_nt_pwd", &pwd->hdr_nt_pwd, ps, depth)) - return False; - if (!prs_uint8s(False, "buf_nt_pwd", ps, depth, pwd->buf_nt_pwd, 16)) - return False; - - if (!smb_io_unihdr("", &pwd->hdr_empty_lm, ps, depth)) - return False; - if (!smb_io_unihdr("", &pwd->hdr_empty_nt, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_account_info(const char *desc, SAM_ACCOUNT_INFO *info, - prs_struct *ps, int depth) -{ - BUFHDR2 hdr_priv_data; - uint32 i; - - prs_debug(ps, depth, desc, "net_io_sam_account_info"); - depth++; - - if (!smb_io_unihdr("hdr_acct_name", &info->hdr_acct_name, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_full_name", &info->hdr_full_name, ps, depth)) - return False; - - if (!prs_uint32("user_rid ", ps, depth, &info->user_rid)) - return False; - if (!prs_uint32("group_rid", ps, depth, &info->group_rid)) - return False; - - if (!smb_io_unihdr("hdr_home_dir ", &info->hdr_home_dir, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_dir_drive", &info->hdr_dir_drive, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_logon_script", &info->hdr_logon_script, ps, - depth)) - return False; - - if (!smb_io_unihdr("hdr_acct_desc", &info->hdr_acct_desc, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_workstations", &info->hdr_workstations, ps, - depth)) - return False; - - if (!smb_io_time("logon_time", &info->logon_time, ps, depth)) - return False; - if (!smb_io_time("logoff_time", &info->logoff_time, ps, depth)) - return False; - - if (!prs_uint32("logon_divs ", ps, depth, &info->logon_divs)) - return False; - if (!prs_uint32("ptr_logon_hrs", ps, depth, &info->ptr_logon_hrs)) - return False; - - if (!prs_uint16("bad_pwd_count", ps, depth, &info->bad_pwd_count)) - return False; - if (!prs_uint16("logon_count", ps, depth, &info->logon_count)) - return False; - if (!smb_io_time("pwd_last_set_time", &info->pwd_last_set_time, ps, - depth)) - return False; - if (!smb_io_time("acct_expiry_time", &info->acct_expiry_time, ps, - depth)) - return False; - - if (!prs_uint32("acb_info", ps, depth, &info->acb_info)) - return False; - if (!prs_uint8s(False, "nt_pwd", ps, depth, info->nt_pwd, 16)) - return False; - if (!prs_uint8s(False, "lm_pwd", ps, depth, info->lm_pwd, 16)) - return False; - if (!prs_uint8("lm_pwd_present", ps, depth, &info->lm_pwd_present)) - return False; - if (!prs_uint8("nt_pwd_present", ps, depth, &info->nt_pwd_present)) - return False; - if (!prs_uint8("pwd_expired", ps, depth, &info->pwd_expired)) - return False; - - if (!smb_io_unihdr("hdr_comment", &info->hdr_comment, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_parameters", &info->hdr_parameters, ps, - depth)) - return False; - if (!prs_uint16("country", ps, depth, &info->country)) - return False; - if (!prs_uint16("codepage", ps, depth, &info->codepage)) - return False; - - if (!smb_io_bufhdr2("hdr_priv_data", &hdr_priv_data, ps, depth)) - return False; - if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_profile", &info->hdr_profile, ps, depth)) - return False; - - for (i = 0; i < 3; i++) - { - if (!smb_io_unihdr("hdr_reserved", &info->hdr_reserved[i], - ps, depth)) - return False; - } - - for (i = 0; i < 4; i++) - { - if (!prs_uint32("dw_reserved", ps, depth, - &info->dw_reserved[i])) - return False; - } - - if (!smb_io_unistr2("uni_acct_name", &info->uni_acct_name, - info->hdr_acct_name.buffer, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_full_name", &info->uni_full_name, - info->hdr_full_name.buffer, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_home_dir ", &info->uni_home_dir, - info->hdr_home_dir.buffer, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_dir_drive", &info->uni_dir_drive, - info->hdr_dir_drive.buffer, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_logon_script", &info->uni_logon_script, - info->hdr_logon_script.buffer, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_acct_desc", &info->uni_acct_desc, - info->hdr_acct_desc.buffer, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_workstations", &info->uni_workstations, - info->hdr_workstations.buffer, ps, depth)) - return False; - prs_align(ps); - - if (!prs_uint32("unknown1", ps, depth, &info->unknown1)) - return False; - if (!prs_uint32("unknown2", ps, depth, &info->unknown2)) - return False; - - if (!smb_io_rpc_blob("buf_logon_hrs", &info->buf_logon_hrs, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_comment", &info->uni_comment, - info->hdr_comment.buffer, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_parameters", &info->uni_parameters, - info->hdr_parameters.buffer, ps, depth)) - return False; - prs_align(ps); - if (hdr_priv_data.buffer != 0) - { - int old_offset = 0; - uint32 len = 0x44; - if (!prs_uint32("pwd_len", ps, depth, &len)) - return False; - old_offset = ps->data_offset; - if (len > 0) - { - if (ps->io) - { - /* reading */ - if (!prs_hash1(ps, ps->data_offset, len)) - return False; - } - if (!net_io_sam_passwd_info("pass", &info->pass, - ps, depth)) - return False; - - if (!ps->io) - { - /* writing */ - if (!prs_hash1(ps, old_offset, len)) - return False; - } - } - if (old_offset + len > ps->buffer_size) - return False; - ps->data_offset = old_offset + len; - } - if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) - return False; - prs_align(ps); - if (!smb_io_unistr2("uni_profile", &info->uni_profile, - info->hdr_profile.buffer, ps, depth)) - return False; - - prs_align(ps); - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_group_mem_info(const char *desc, SAM_GROUP_MEM_INFO * info, - prs_struct *ps, int depth) -{ - uint32 i; - fstring tmp; - - prs_debug(ps, depth, desc, "net_io_sam_group_mem_info"); - depth++; - - prs_align(ps); - if (!prs_uint32("ptr_rids ", ps, depth, &info->ptr_rids)) - return False; - if (!prs_uint32("ptr_attribs", ps, depth, &info->ptr_attribs)) - return False; - if (!prs_uint32("num_members", ps, depth, &info->num_members)) - return False; - - if (ps->data_offset + 16 > ps->buffer_size) - return False; - ps->data_offset += 16; - - if (info->ptr_rids != 0) - { - if (!prs_uint32("num_members2", ps, depth, - &info->num_members2)) - return False; - - if (info->num_members2 != info->num_members) - { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps)) { - if (info->num_members2) { - info->rids = TALLOC_ARRAY(ps->mem_ctx, uint32, info->num_members2); - - if (info->rids == NULL) { - DEBUG(0, ("out of memory allocating %d rids\n", - info->num_members2)); - return False; - } - } else { - info->rids = NULL; - } - } - - for (i = 0; i < info->num_members2; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "rids[%02d]", i); - if (!prs_uint32(tmp, ps, depth, &info->rids[i])) - return False; - } - } - - if (info->ptr_attribs != 0) - { - if (!prs_uint32("num_members3", ps, depth, - &info->num_members3)) - return False; - if (info->num_members3 != info->num_members) - { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps)) { - if (info->num_members3) { - info->attribs = TALLOC_ARRAY(ps->mem_ctx, uint32, info->num_members3); - - if (info->attribs == NULL) { - DEBUG(0, ("out of memory allocating %d attribs\n", - info->num_members3)); - return False; - } - } else { - info->attribs = NULL; - } - } - - for (i = 0; i < info->num_members3; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "attribs[%02d]", i); - if (!prs_uint32(tmp, ps, depth, &info->attribs[i])) - return False; - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_alias_info(const char *desc, SAM_ALIAS_INFO * info, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "net_io_sam_alias_info"); - depth++; - - if (!smb_io_unihdr("hdr_als_name", &info->hdr_als_name, ps, depth)) - return False; - if (!prs_uint32("als_rid", ps, depth, &info->als_rid)) - return False; - if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_als_desc", &info->hdr_als_desc, ps, depth)) - return False; - - if (ps->data_offset + 40 > ps->buffer_size) - return False; - ps->data_offset += 40; - - if (!smb_io_unistr2("uni_als_name", &info->uni_als_name, - info->hdr_als_name.buffer, ps, depth)) - return False; - if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) - return False; - - if (!smb_io_unistr2("uni_als_desc", &info->uni_als_desc, - info->hdr_als_desc.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * info, - prs_struct *ps, int depth) -{ - uint32 i; - fstring tmp; - - prs_debug(ps, depth, desc, "net_io_sam_alias_mem_info"); - depth++; - - prs_align(ps); - if (!prs_uint32("num_members", ps, depth, &info->num_members)) - return False; - if (!prs_uint32("ptr_members", ps, depth, &info->ptr_members)) - return False; - - if (ps->data_offset + 16 > ps->buffer_size) - return False; - ps->data_offset += 16; - - if (info->ptr_members != 0) - { - if (!prs_uint32("num_sids", ps, depth, &info->num_sids)) - return False; - if (info->num_sids != info->num_members) - { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps)) { - if (info->num_sids) { - info->ptr_sids = TALLOC_ARRAY(ps->mem_ctx, uint32, info->num_sids); - - if (info->ptr_sids == NULL) { - DEBUG(0, ("out of memory allocating %d ptr_sids\n", - info->num_sids)); - return False; - } - } else { - info->ptr_sids = NULL; - } - } - - for (i = 0; i < info->num_sids; i++) - { - slprintf(tmp, sizeof(tmp) - 1, "ptr_sids[%02d]", i); - if (!prs_uint32(tmp, ps, depth, &info->ptr_sids[i])) - return False; - } - - if (UNMARSHALLING(ps)) { - if (info->num_sids) { - info->sids = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, info->num_sids); - - if (info->sids == NULL) { - DEBUG(0, ("error allocating %d sids\n", - info->num_sids)); - return False; - } - } else { - info->sids = NULL; - } - } - - for (i = 0; i < info->num_sids; i++) - { - if (info->ptr_sids[i] != 0) - { - slprintf(tmp, sizeof(tmp) - 1, "sids[%02d]", - i); - if (!smb_io_dom_sid2(tmp, &info->sids[i], - ps, depth)) - return False; - } - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_policy_info(const char *desc, SAM_DELTA_POLICY *info, - prs_struct *ps, int depth) -{ - unsigned int i; - prs_debug(ps, depth, desc, "net_io_sam_policy_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if (!prs_uint32("max_log_size", ps, depth, &info->max_log_size)) - return False; - if (!prs_uint64("audit_retention_period", ps, depth, - &info->audit_retention_period)) - return False; - if (!prs_uint32("auditing_mode", ps, depth, &info->auditing_mode)) - return False; - if (!prs_uint32("num_events", ps, depth, &info->num_events)) - return False; - if (!prs_uint32("ptr_events", ps, depth, &info->ptr_events)) - return False; - - if (!smb_io_unihdr("hdr_dom_name", &info->hdr_dom_name, ps, depth)) - return False; - - if (!prs_uint32("sid_ptr", ps, depth, &info->sid_ptr)) - return False; - - if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit)) - return False; - if (!prs_uint32("non_paged_pool_limit", ps, depth, - &info->non_paged_pool_limit)) - return False; - if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size)) - return False; - if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size)) - return False; - if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit)) - return False; - if (!prs_uint64("time_limit", ps, depth, &info->time_limit)) - return False; - if (!smb_io_time("modify_time", &info->modify_time, ps, depth)) - return False; - if (!smb_io_time("create_time", &info->create_time, ps, depth)) - return False; - if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) - return False; - - for (i=0; i<4; i++) { - UNIHDR dummy; - if (!smb_io_unihdr("dummy", &dummy, ps, depth)) - return False; - } - - for (i=0; i<4; i++) { - uint32 reserved; - if (!prs_uint32("reserved", ps, depth, &reserved)) - return False; - } - - if (!prs_uint32("num_event_audit_options", ps, depth, - &info->num_event_audit_options)) - return False; - - for (i=0; inum_event_audit_options; i++) - if (!prs_uint32("event_audit_option", ps, depth, - &info->event_audit_option)) - return False; - - if (!smb_io_unistr2("domain_name", &info->domain_name, True, ps, depth)) - return False; - - if(!smb_io_dom_sid2("domain_sid", &info->domain_sid, ps, depth)) - return False; - - if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) - - return False; - - return True; -} - -#if 0 - -/* This function is pretty broken - see bug #334 */ - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_trustdoms_info(const char *desc, SAM_DELTA_TRUSTDOMS *info, - prs_struct *ps, int depth) -{ - int i; - - prs_debug(ps, depth, desc, "net_io_sam_trustdoms_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("buf_size", ps, depth, &info->buf_size)) - return False; - - if(!sec_io_desc("sec_desc", &info->sec_desc, ps, depth)) - return False; - - if(!smb_io_dom_sid2("sid", &info->sid, ps, depth)) - return False; - - if(!smb_io_unihdr("hdr_domain", &info->hdr_domain, ps, depth)) - return False; - - if(!prs_uint32("unknown0", ps, depth, &info->unknown0)) - return False; - if(!prs_uint32("unknown1", ps, depth, &info->unknown1)) - return False; - if(!prs_uint32("unknown2", ps, depth, &info->unknown2)) - return False; - - if(!prs_uint32("buf_size2", ps, depth, &info->buf_size2)) - return False; - if(!prs_uint32("ptr", ps, depth, &info->ptr)) - return False; - - for (i=0; i<12; i++) - if(!prs_uint32("unknown3", ps, depth, &info->unknown3)) - return False; - - if (!smb_io_unistr2("domain", &info->domain, True, ps, depth)) - return False; - - return True; -} - -#endif - -#if 0 - -/* This function doesn't work - see bug #334 */ - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_secret_info(const char *desc, SAM_DELTA_SECRET *info, - prs_struct *ps, int depth) -{ - int i; - - prs_debug(ps, depth, desc, "net_io_sam_secret_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("buf_size", ps, depth, &info->buf_size)) - return False; - - if(!sec_io_desc("sec_desc", &info->sec_desc, ps, depth)) - return False; - - if (!smb_io_unistr2("secret", &info->secret, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("count1", ps, depth, &info->count1)) - return False; - if(!prs_uint32("count2", ps, depth, &info->count2)) - return False; - if(!prs_uint32("ptr", ps, depth, &info->ptr)) - return False; - - - if(!smb_io_time("time1", &info->time1, ps, depth)) /* logon time */ - return False; - if(!prs_uint32("count3", ps, depth, &info->count3)) - return False; - if(!prs_uint32("count4", ps, depth, &info->count4)) - return False; - if(!prs_uint32("ptr2", ps, depth, &info->ptr2)) - return False; - if(!smb_io_time("time2", &info->time2, ps, depth)) /* logon time */ - return False; - if(!prs_uint32("unknow1", ps, depth, &info->unknow1)) - return False; - - - if(!prs_uint32("buf_size2", ps, depth, &info->buf_size2)) - return False; - if(!prs_uint32("ptr3", ps, depth, &info->ptr3)) - return False; - for(i=0; i<12; i++) - if(!prs_uint32("unknow2", ps, depth, &info->unknow2)) - return False; - - if(!prs_uint32("chal_len", ps, depth, &info->chal_len)) - return False; - if(!prs_uint32("reserved1", ps, depth, &info->reserved1)) - return False; - if(!prs_uint32("chal_len2", ps, depth, &info->chal_len2)) - return False; - - if(!prs_uint8s (False, "chal", ps, depth, info->chal, info->chal_len2)) - return False; - - if(!prs_uint32("key_len", ps, depth, &info->key_len)) - return False; - if(!prs_uint32("reserved2", ps, depth, &info->reserved2)) - return False; - if(!prs_uint32("key_len2", ps, depth, &info->key_len2)) - return False; - - if(!prs_uint8s (False, "key", ps, depth, info->key, info->key_len2)) - return False; - - - if(!prs_uint32("buf_size3", ps, depth, &info->buf_size3)) - return False; - - if(!sec_io_desc("sec_desc2", &info->sec_desc2, ps, depth)) - return False; - - - return True; -} - -#endif - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, - prs_struct *ps, int depth) -{ - unsigned int i; - - prs_debug(ps, depth, desc, "net_io_sam_privs_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_dom_sid2("sid", &info->sid, ps, depth)) - return False; - - if(!prs_uint32("priv_count", ps, depth, &info->priv_count)) - return False; - if(!prs_uint32("priv_control", ps, depth, &info->priv_control)) - return False; - - if(!prs_uint32("priv_attr_ptr", ps, depth, &info->priv_attr_ptr)) - return False; - if(!prs_uint32("priv_name_ptr", ps, depth, &info->priv_name_ptr)) - return False; - - if (!prs_uint32("paged_pool_limit", ps, depth, &info->paged_pool_limit)) - return False; - if (!prs_uint32("non_paged_pool_limit", ps, depth, - &info->non_paged_pool_limit)) - return False; - if (!prs_uint32("min_workset_size", ps, depth, &info->min_workset_size)) - return False; - if (!prs_uint32("max_workset_size", ps, depth, &info->max_workset_size)) - return False; - if (!prs_uint32("page_file_limit", ps, depth, &info->page_file_limit)) - return False; - if (!prs_uint64("time_limit", ps, depth, &info->time_limit)) - return False; - if (!prs_uint32("system_flags", ps, depth, &info->system_flags)) - return False; - if (!smb_io_bufhdr2("hdr_sec_desc", &info->hdr_sec_desc, ps, depth)) - return False; - - for (i=0; i<4; i++) { - UNIHDR dummy; - if (!smb_io_unihdr("dummy", &dummy, ps, depth)) - return False; - } - - for (i=0; i<4; i++) { - uint32 reserved; - if (!prs_uint32("reserved", ps, depth, &reserved)) - return False; - } - - if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count)) - return False; - - if (UNMARSHALLING(ps)) { - if (info->attribute_count) { - info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count); - if (!info->attributes) { - return False; - } - } else { - info->attributes = NULL; - } - } - - for (i=0; iattribute_count; i++) - if(!prs_uint32("attributes", ps, depth, &info->attributes[i])) - return False; - - if(!prs_uint32("privlist_count", ps, depth, &info->privlist_count)) - return False; - - if (UNMARSHALLING(ps)) { - if (info->privlist_count) { - info->hdr_privslist = TALLOC_ARRAY(ps->mem_ctx, UNIHDR, info->privlist_count); - info->uni_privslist = TALLOC_ARRAY(ps->mem_ctx, UNISTR2, info->privlist_count); - if (!info->hdr_privslist) { - return False; - } - if (!info->uni_privslist) { - return False; - } - } else { - info->hdr_privslist = NULL; - info->uni_privslist = NULL; - } - } - - for (i=0; iprivlist_count; i++) - if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth)) - return False; - - for (i=0; iprivlist_count; i++) - if (!smb_io_unistr2("uni_privslist", &info->uni_privslist[i], True, ps, depth)) - return False; - - if (!smb_io_rpc_blob("buf_sec_desc", &info->buf_sec_desc, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool net_io_sam_delta_ctr(const char *desc, - SAM_DELTA_CTR * delta, uint16 type, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "net_io_sam_delta_ctr"); - depth++; - - switch (type) { - /* Seen in sam deltas */ - case SAM_DELTA_MODIFIED_COUNT: - if (!net_io_sam_delta_mod_count("", &delta->mod_count, ps, depth)) - return False; - break; - - case SAM_DELTA_DOMAIN_INFO: - if (!net_io_sam_domain_info("", &delta->domain_info, ps, depth)) - return False; - break; - - case SAM_DELTA_GROUP_INFO: - if (!net_io_sam_group_info("", &delta->group_info, ps, depth)) - return False; - break; - - case SAM_DELTA_ACCOUNT_INFO: - if (!net_io_sam_account_info("", &delta->account_info, ps, depth)) - return False; - break; - - case SAM_DELTA_GROUP_MEM: - if (!net_io_sam_group_mem_info("", &delta->grp_mem_info, ps, depth)) - return False; - break; - - case SAM_DELTA_ALIAS_INFO: - if (!net_io_sam_alias_info("", &delta->alias_info, ps, depth)) - return False; - break; - - case SAM_DELTA_POLICY_INFO: - if (!net_io_sam_policy_info("", &delta->policy_info, ps, depth)) - return False; - break; - - case SAM_DELTA_ALIAS_MEM: - if (!net_io_sam_alias_mem_info("", &delta->als_mem_info, ps, depth)) - return False; - break; - - case SAM_DELTA_PRIVS_INFO: - if (!net_io_sam_privs_info("", &delta->privs_info, ps, depth)) - return False; - break; - - /* These guys are implemented but broken */ - - case SAM_DELTA_TRUST_DOMS: - case SAM_DELTA_SECRET_INFO: - break; - - /* These guys are not implemented yet */ - - case SAM_DELTA_RENAME_GROUP: - case SAM_DELTA_RENAME_USER: - case SAM_DELTA_RENAME_ALIAS: - case SAM_DELTA_DELETE_GROUP: - case SAM_DELTA_DELETE_USER: - default: - DEBUG(0, ("Replication error: Unknown delta type 0x%x\n", type)); - break; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -bool net_io_r_sam_sync(const char *desc, - NET_R_SAM_SYNC * r_s, prs_struct *ps, int depth) -{ - uint32 i; - - prs_debug(ps, depth, desc, "net_io_r_sam_sync"); - depth++; - - if (!smb_io_cred("srv_creds", &r_s->srv_creds, ps, depth)) - return False; - if (!prs_uint32("sync_context", ps, depth, &r_s->sync_context)) - return False; - - if (!prs_uint32("ptr_deltas", ps, depth, &r_s->ptr_deltas)) - return False; - if (r_s->ptr_deltas != 0) - { - if (!prs_uint32("num_deltas ", ps, depth, &r_s->num_deltas)) - return False; - if (!prs_uint32("ptr_deltas2", ps, depth, &r_s->ptr_deltas2)) - return False; - if (r_s->ptr_deltas2 != 0) - { - if (!prs_uint32("num_deltas2", ps, depth, - &r_s->num_deltas2)) - return False; - - if (r_s->num_deltas2 != r_s->num_deltas) - { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps)) { - if (r_s->num_deltas2) { - r_s->hdr_deltas = TALLOC_ARRAY(ps->mem_ctx, SAM_DELTA_HDR, r_s->num_deltas2); - if (r_s->hdr_deltas == NULL) { - DEBUG(0, ("error tallocating memory " - "for %d delta headers\n", - r_s->num_deltas2)); - return False; - } - } else { - r_s->hdr_deltas = NULL; - } - } - - for (i = 0; i < r_s->num_deltas2; i++) - { - if (!net_io_sam_delta_hdr("", - &r_s->hdr_deltas[i], - ps, depth)) - return False; - } - - if (UNMARSHALLING(ps)) { - if (r_s->num_deltas2) { - r_s->deltas = TALLOC_ARRAY(ps->mem_ctx, SAM_DELTA_CTR, r_s->num_deltas2); - if (r_s->deltas == NULL) { - DEBUG(0, ("error tallocating memory " - "for %d deltas\n", - r_s->num_deltas2)); - return False; - } - } else { - r_s->deltas = NULL; - } - } - - for (i = 0; i < r_s->num_deltas2; i++) - { - if (!net_io_sam_delta_ctr( - "", &r_s->deltas[i], - r_s->hdr_deltas[i].type3, - ps, depth)) { - DEBUG(0, ("hmm, failed on i=%d\n", i)); - return False; - } - } - } - } - - prs_align(ps); - if (!prs_ntstatus("status", ps, depth, &(r_s->status))) - return False; - - return True; -} -- cgit