summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-15 14:24:31 +0100
committerGünther Deschner <gd@samba.org>2008-02-15 14:24:31 +0100
commit34df32446df1167cddea2dd9a3fb3240e817f731 (patch)
tree47a7d9f94b5a0248d2a4b1735ef1217f93f5462d
parentb7f483e6bda197d62a1432629b62bd9f834df42b (diff)
downloadsamba-34df32446df1167cddea2dd9a3fb3240e817f731.tar.gz
samba-34df32446df1167cddea2dd9a3fb3240e817f731.tar.bz2
samba-34df32446df1167cddea2dd9a3fb3240e817f731.zip
Remove unused marshalling for NET_SAM_SYNC.
Guenther (This used to be commit a94d93725a649c7a0ac1fcd61ea07579f65596da)
-rw-r--r--source3/include/rpc_netlogon.h345
-rw-r--r--source3/rpc_client/cli_netlogon.c53
-rw-r--r--source3/rpc_parse/parse_net.c1165
3 files changed, 0 insertions, 1563 deletions
diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h
index 93b50c9c00..4105b34e10 100644
--- a/source3/include/rpc_netlogon.h
+++ b/source3/include/rpc_netlogon.h
@@ -467,30 +467,6 @@ typedef struct net_r_sam_logoff_info {
NTSTATUS status; /* return code */
} NET_R_SAM_LOGOFF;
-/* NET_Q_SAM_SYNC */
-typedef struct net_q_sam_sync_info {
- UNISTR2 uni_srv_name; /* \\PDC */
- UNISTR2 uni_cli_name; /* BDC */
- DOM_CRED cli_creds;
- DOM_CRED ret_creds;
-
- uint32 database_id;
- uint32 restart_state;
- uint32 sync_context;
-
- uint32 max_size; /* preferred maximum length */
-} NET_Q_SAM_SYNC;
-
-/* SAM_DELTA_HDR */
-typedef struct sam_delta_hdr_info {
- uint16 type; /* type of structure attached */
- uint16 type2;
- uint32 target_rid;
-
- uint32 type3;
- uint32 ptr_delta;
-} SAM_DELTA_HDR;
-
/* LOCKOUT_STRING */
typedef struct account_lockout_string {
uint32 array_size;
@@ -510,327 +486,6 @@ typedef struct hdr_account_lockout_string {
uint32 buffer;
} HDR_LOCKOUT_STRING;
-/* SAM_DOMAIN_INFO (0x1) */
-typedef struct sam_domain_info_info {
- UNIHDR hdr_dom_name;
- UNIHDR hdr_oem_info;
-
- uint64 force_logoff;
- uint16 min_pwd_len;
- uint16 pwd_history_len;
- uint64 max_pwd_age;
- uint64 min_pwd_age;
- uint64 dom_mod_count;
- NTTIME creation_time;
- uint32 security_information;
-
- BUFHDR4 hdr_sec_desc; /* security descriptor */
-
- HDR_LOCKOUT_STRING hdr_account_lockout;
-
- UNIHDR hdr_unknown2;
- UNIHDR hdr_unknown3;
- UNIHDR hdr_unknown4;
-
- UNISTR2 uni_dom_name;
- UNISTR2 buf_oem_info;
-
- RPC_DATA_BLOB buf_sec_desc;
-
- LOCKOUT_STRING account_lockout;
-
- UNISTR2 buf_unknown2;
- UNISTR2 buf_unknown3;
- UNISTR2 buf_unknown4;
-
- uint32 logon_chgpass;
- uint32 unknown6;
- uint32 unknown7;
- uint32 unknown8;
-} SAM_DOMAIN_INFO;
-
-/* SAM_GROUP_INFO (0x2) */
-typedef struct sam_group_info_info {
- UNIHDR hdr_grp_name;
- DOM_GID gid;
- UNIHDR hdr_grp_desc;
- BUFHDR2 hdr_sec_desc; /* security descriptor */
- uint8 reserved[48];
-
- UNISTR2 uni_grp_name;
- UNISTR2 uni_grp_desc;
- RPC_DATA_BLOB buf_sec_desc;
-} SAM_GROUP_INFO;
-
-/* SAM_PWD */
-typedef struct sam_passwd_info {
- /* this structure probably contains password history */
- /* this is probably a count of lm/nt pairs */
- uint32 unk_0; /* 0x0000 0002 */
-
- UNIHDR hdr_lm_pwd;
- uint8 buf_lm_pwd[16];
-
- UNIHDR hdr_nt_pwd;
- uint8 buf_nt_pwd[16];
-
- UNIHDR hdr_empty_lm;
- UNIHDR hdr_empty_nt;
-} SAM_PWD;
-
-/* SAM_ACCOUNT_INFO (0x5) */
-typedef struct sam_account_info_info {
- UNIHDR hdr_acct_name;
- UNIHDR hdr_full_name;
-
- uint32 user_rid;
- uint32 group_rid;
-
- UNIHDR hdr_home_dir;
- UNIHDR hdr_dir_drive;
- UNIHDR hdr_logon_script;
- UNIHDR hdr_acct_desc;
- UNIHDR hdr_workstations;
-
- NTTIME logon_time;
- NTTIME logoff_time;
-
- uint32 logon_divs; /* 0xA8 */
- uint32 ptr_logon_hrs;
-
- uint16 bad_pwd_count;
- uint16 logon_count;
- NTTIME pwd_last_set_time;
- NTTIME acct_expiry_time;
-
- uint32 acb_info;
- uint8 nt_pwd[16];
- uint8 lm_pwd[16];
- uint8 nt_pwd_present;
- uint8 lm_pwd_present;
- uint8 pwd_expired;
-
- UNIHDR hdr_comment;
- UNIHDR hdr_parameters;
- uint16 country;
- uint16 codepage;
-
- BUFHDR2 hdr_sec_desc; /* security descriptor */
-
- UNIHDR hdr_profile;
- UNIHDR hdr_reserved[3]; /* space for more strings */
- uint32 dw_reserved[4]; /* space for more data - first two seem to
- be an NTTIME */
-
- UNISTR2 uni_acct_name;
- UNISTR2 uni_full_name;
- UNISTR2 uni_home_dir;
- UNISTR2 uni_dir_drive;
- UNISTR2 uni_logon_script;
- UNISTR2 uni_acct_desc;
- UNISTR2 uni_workstations;
-
- uint32 unknown1; /* 0x4EC */
- uint32 unknown2; /* 0 */
-
- RPC_DATA_BLOB buf_logon_hrs;
- UNISTR2 uni_comment;
- UNISTR2 uni_parameters;
- SAM_PWD pass;
- RPC_DATA_BLOB buf_sec_desc;
- UNISTR2 uni_profile;
-} SAM_ACCOUNT_INFO;
-
-/* SAM_GROUP_MEM_INFO (0x8) */
-typedef struct sam_group_mem_info_info {
- uint32 ptr_rids;
- uint32 ptr_attribs;
- uint32 num_members;
- uint8 unknown[16];
-
- uint32 num_members2;
- uint32 *rids;
-
- uint32 num_members3;
- uint32 *attribs;
-
-} SAM_GROUP_MEM_INFO;
-
-/* SAM_ALIAS_INFO (0x9) */
-typedef struct sam_alias_info_info {
- UNIHDR hdr_als_name;
- uint32 als_rid;
- BUFHDR2 hdr_sec_desc; /* security descriptor */
- UNIHDR hdr_als_desc;
- uint8 reserved[40];
-
- UNISTR2 uni_als_name;
- RPC_DATA_BLOB buf_sec_desc;
- UNISTR2 uni_als_desc;
-} SAM_ALIAS_INFO;
-
-/* SAM_ALIAS_MEM_INFO (0xC) */
-typedef struct sam_alias_mem_info_info {
- uint32 num_members;
- uint32 ptr_members;
- uint8 unknown[16];
-
- uint32 num_sids;
- uint32 *ptr_sids;
- DOM_SID2 *sids;
-} SAM_ALIAS_MEM_INFO;
-
-
-/* SAM_DELTA_POLICY (0x0D) */
-typedef struct {
- uint32 max_log_size; /* 0x5000 */
- uint64 audit_retention_period; /* 0 */
- uint32 auditing_mode; /* 0 */
- uint32 num_events;
- uint32 ptr_events;
- UNIHDR hdr_dom_name;
- uint32 sid_ptr;
-
- uint32 paged_pool_limit; /* 0x02000000 */
- uint32 non_paged_pool_limit; /* 0x00100000 */
- uint32 min_workset_size; /* 0x00010000 */
- uint32 max_workset_size; /* 0x0f000000 */
- uint32 page_file_limit; /* 0 */
- uint64 time_limit; /* 0 */
- NTTIME modify_time; /* 0x3c*/
- NTTIME create_time; /* a7080110 */
- BUFHDR2 hdr_sec_desc;
-
- uint32 num_event_audit_options;
- uint32 event_audit_option;
-
- UNISTR2 domain_name;
- DOM_SID2 domain_sid;
-
- RPC_DATA_BLOB buf_sec_desc;
-} SAM_DELTA_POLICY;
-
-/* SAM_DELTA_TRUST_DOMS */
-typedef struct {
- uint32 buf_size;
- SEC_DESC *sec_desc;
- DOM_SID2 sid;
- UNIHDR hdr_domain;
-
- uint32 unknown0;
- uint32 unknown1;
- uint32 unknown2;
-
- uint32 buf_size2;
- uint32 ptr;
-
- uint32 unknown3;
- UNISTR2 domain;
-} SAM_DELTA_TRUSTDOMS;
-
-/* SAM_DELTA_PRIVS (0x10) */
-typedef struct {
- DOM_SID2 sid;
-
- uint32 priv_count;
- uint32 priv_control;
-
- uint32 priv_attr_ptr;
- uint32 priv_name_ptr;
-
- uint32 paged_pool_limit; /* 0x02000000 */
- uint32 non_paged_pool_limit; /* 0x00100000 */
- uint32 min_workset_size; /* 0x00010000 */
- uint32 max_workset_size; /* 0x0f000000 */
- uint32 page_file_limit; /* 0 */
- uint64 time_limit; /* 0 */
- uint32 system_flags; /* 1 */
- BUFHDR2 hdr_sec_desc;
-
- uint32 buf_size2;
-
- uint32 attribute_count;
- uint32 *attributes;
-
- uint32 privlist_count;
- UNIHDR *hdr_privslist;
- UNISTR2 *uni_privslist;
-
- RPC_DATA_BLOB buf_sec_desc;
-} SAM_DELTA_PRIVS;
-
-/* SAM_DELTA_SECRET */
-typedef struct {
- uint32 buf_size;
- SEC_DESC *sec_desc;
- UNISTR2 secret;
-
- uint32 count1;
- uint32 count2;
- uint32 ptr;
- NTTIME time1;
- uint32 count3;
- uint32 count4;
- uint32 ptr2;
- NTTIME time2;
- uint32 unknow1;
-
- uint32 buf_size2;
- uint32 ptr3;
- uint32 unknow2; /* 0x0 12 times */
-
- uint32 chal_len;
- uint32 reserved1; /* 0 */
- uint32 chal_len2;
- uint8 chal[16];
-
- uint32 key_len;
- uint32 reserved2; /* 0 */
- uint32 key_len2;
- uint8 key[8];
-
- uint32 buf_size3;
- SEC_DESC *sec_desc2;
-} SAM_DELTA_SECRET;
-
-/* SAM_DELTA_MOD_COUNT (0x16) */
-typedef struct {
- uint32 seqnum;
- uint32 dom_mod_count_ptr;
- uint64 dom_mod_count; /* domain mod count at last sync */
-} SAM_DELTA_MOD_COUNT;
-
-typedef union sam_delta_ctr_info {
- SAM_DOMAIN_INFO domain_info ;
- SAM_GROUP_INFO group_info ;
- SAM_ACCOUNT_INFO account_info;
- SAM_GROUP_MEM_INFO grp_mem_info;
- SAM_ALIAS_INFO alias_info ;
- SAM_ALIAS_MEM_INFO als_mem_info;
- SAM_DELTA_POLICY policy_info;
- SAM_DELTA_PRIVS privs_info;
- SAM_DELTA_MOD_COUNT mod_count;
- SAM_DELTA_TRUSTDOMS trustdoms_info;
- SAM_DELTA_SECRET secret_info;
-} SAM_DELTA_CTR;
-
-/* NET_R_SAM_SYNC */
-typedef struct net_r_sam_sync_info {
- DOM_CRED srv_creds;
-
- uint32 sync_context;
-
- uint32 ptr_deltas;
- uint32 num_deltas;
- uint32 ptr_deltas2;
- uint32 num_deltas2;
-
- SAM_DELTA_HDR *hdr_deltas;
- SAM_DELTA_CTR *deltas;
-
- NTSTATUS status;
-} NET_R_SAM_SYNC;
-
#define DSGETDC_VALID_FLAGS ( \
DS_FORCE_REDISCOVERY | \
DS_DIRECTORY_SERVICE_REQUIRED | \
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index 0da482c9ef..f15340ffec 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -347,59 +347,6 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
return NT_STATUS_OK;
}
-/* Sam synchronisation */
-
-NTSTATUS rpccli_netlogon_sam_sync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- uint32 database_id, uint32 next_rid, uint32 *num_deltas,
- SAM_DELTA_HDR **hdr_deltas,
- SAM_DELTA_CTR **deltas)
-{
- prs_struct qbuf, rbuf;
- NET_Q_SAM_SYNC q;
- NET_R_SAM_SYNC r;
- NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- DOM_CRED clnt_creds;
- DOM_CRED ret_creds;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- ZERO_STRUCT(ret_creds);
-
- /* Initialise input parameters */
-
- creds_client_step(cli->dc, &clnt_creds);
-
- init_net_q_sam_sync(&q, cli->dc->remote_machine, global_myname(),
- &clnt_creds, &ret_creds, database_id, next_rid);
-
- /* Marshall data and send request */
-
- CLI_DO_RPC_COPY_SESS_KEY(cli, mem_ctx, PI_NETLOGON, NET_SAM_SYNC,
- q, r,
- qbuf, rbuf,
- net_io_q_sam_sync,
- net_io_r_sam_sync,
- NT_STATUS_UNSUCCESSFUL);
-
- /* Return results */
-
- result = r.status;
- *num_deltas = r.num_deltas2;
- *hdr_deltas = r.hdr_deltas;
- *deltas = r.deltas;
-
- if (!NT_STATUS_IS_ERR(result)) {
- /* Check returned credentials. */
- if (!creds_client_check(cli->dc, &r.srv_creds.challenge)) {
- DEBUG(0,("cli_netlogon_sam_sync: credentials chain check failed\n"));
- return NT_STATUS_ACCESS_DENIED;
- }
- }
-
- return result;
-}
-
/* Logon domain user */
NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
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; i<info->num_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; i<info->attribute_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; i<info->privlist_count; i++)
- if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth))
- return False;
-
- for (i=0; i<info->privlist_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;
-}