Removed version number from file header.
[samba.git] / source3 / rpc_parse / parse_net.c
index 1b0e498f772edda6d8364ab62898dbea6f8a17a3..5865bd9f9b3b398aef85ec8c72867fe0f1df0133 100644 (file)
@@ -1,6 +1,5 @@
 /* 
- *  Unix SMB/Netbios implementation.
- *  Version 1.9.
+ *  Unix SMB/CIFS implementation.
  *  RPC Pipe client / server routines
  *  Copyright (C) Andrew Tridgell              1992-1997,
  *  Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
@@ -743,10 +742,15 @@ BOOL net_io_r_auth_2(char *desc, NET_R_AUTH_2 *r_a, prs_struct *ps, int depth)
  Inits a NET_Q_SRV_PWSET.
 ********************************************************************/
 
-void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *acct_name, 
-                uint16 sec_chan, char *comp_name, DOM_CRED *cred, char nt_cypher[16])
+void init_q_srv_pwset(NET_Q_SRV_PWSET *q_s, char *logon_srv, char *sess_key, char *acct_name, 
+                uint16 sec_chan, char *comp_name, DOM_CRED *cred, uchar hashed_mach_pwd[16])
 {
+       unsigned char nt_cypher[16];
+       
        DEBUG(5,("init_q_srv_pwset\n"));
+       
+       /* Process the new password. */
+       cred_hash3( nt_cypher, hashed_mach_pwd, sess_key, 1);
 
        init_clnt_info(&q_s->clnt_id, logon_srv, acct_name, sec_chan, comp_name, cred);
 
@@ -1012,15 +1016,15 @@ void init_id_info2(NET_ID_INFO_2 * id, const char *domain_name,
        }
 
        memcpy(id->lm_chal, lm_challenge, sizeof(id->lm_chal));
-       init_str_hdr(&id->hdr_nt_chal_resp, sizeof(nt_owf), nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0);
-       init_str_hdr(&id->hdr_lm_chal_resp, sizeof(lm_owf), lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0);
+       init_str_hdr(&id->hdr_nt_chal_resp, nt_chal_resp_len, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0);
+       init_str_hdr(&id->hdr_lm_chal_resp, lm_chal_resp_len, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0);
 
        init_unistr2(&id->uni_domain_name, domain_name, len_domain_name);
        init_unistr2(&id->uni_user_name, user_name, len_user_name);
        init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name);
 
-       init_string2(&id->nt_chal_resp, (const char *)nt_chal_resp, nt_chal_resp_len);
-       init_string2(&id->lm_chal_resp, (const char *)lm_chal_resp, lm_chal_resp_len);
+       init_string2(&id->nt_chal_resp, (const char *)nt_chal_resp, nt_chal_resp_len, nt_chal_resp_len);
+       init_string2(&id->lm_chal_resp, (const char *)lm_chal_resp, lm_chal_resp_len, lm_chal_resp_len);
 
 }
 
@@ -1187,10 +1191,32 @@ static BOOL smb_io_sam_info(char *desc, DOM_SAM_INFO *sam, prs_struct *ps, int d
 }
 
 /*************************************************************************
- Init
+ Inits a NET_USER_INFO_3 structure.
+
+ This is a network logon reply packet, and contains much information about
+ the user.  This information is passed as a (very long) paramater list
+ to avoid having to link in the PASSDB code to every program that deals 
+ with this file.
  *************************************************************************/
 
-void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sampw,
+void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, 
+                        uint32                user_rid,
+                        uint32                group_rid,
+
+                        const char*            user_name,
+                        const char*            full_name,
+                        const char*            home_dir,
+                        const char*            dir_drive,
+                        const char*            logon_script,
+                        const char*            profile_path,
+
+                        time_t unix_logon_time,
+                        time_t unix_logoff_time,
+                        time_t unix_kickoff_time,
+                        time_t unix_pass_last_set_time,
+                        time_t unix_pass_can_change_time,
+                        time_t unix_pass_must_change_time,
+                        
                         uint16 logon_count, uint16 bad_pw_count,
                         uint32 num_groups, DOM_GID *gids,
                         uint32 user_flgs, uchar *sess_key,
@@ -1209,13 +1235,6 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
        int             len_user_name, len_full_name, len_home_dir,
                        len_dir_drive, len_logon_script, len_profile_path;
                        
-       const char*             user_name = pdb_get_username(sampw);
-       const char*             full_name = pdb_get_fullname(sampw);
-       const char*             home_dir  = pdb_get_homedir(sampw);
-       const char*             dir_drive = pdb_get_dirdrive(sampw);
-       const char*             logon_script = pdb_get_logon_script(sampw);
-       const char*             profile_path = pdb_get_profile_path(sampw);
-
        int len_logon_srv    = strlen(logon_srv);
        int len_logon_dom    = strlen(logon_dom);
 
@@ -1233,12 +1252,12 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
 
 
        /* Create NTTIME structs */
-       unix_to_nt_time (&logon_time,           pdb_get_logon_time(sampw));
-       unix_to_nt_time (&logoff_time,          pdb_get_logoff_time(sampw));
-       unix_to_nt_time (&kickoff_time,         pdb_get_kickoff_time(sampw));
-       unix_to_nt_time (&pass_last_set_time,   pdb_get_pass_last_set_time(sampw));
-       unix_to_nt_time (&pass_can_change_time, pdb_get_pass_can_change_time(sampw));
-       unix_to_nt_time (&pass_must_change_time,pdb_get_pass_must_change_time(sampw));
+       unix_to_nt_time (&logon_time,            unix_logon_time);
+       unix_to_nt_time (&logoff_time,           unix_logoff_time);
+       unix_to_nt_time (&kickoff_time,          unix_kickoff_time);
+       unix_to_nt_time (&pass_last_set_time,    unix_pass_last_set_time);
+       unix_to_nt_time (&pass_can_change_time,  unix_pass_can_change_time);
+       unix_to_nt_time (&pass_must_change_time, unix_pass_must_change_time);
 
        usr->logon_time            = logon_time;
        usr->logoff_time           = logoff_time;
@@ -1257,9 +1276,9 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
        usr->logon_count = logon_count;
        usr->bad_pw_count = bad_pw_count;
 
-       usr->user_rid = pdb_get_user_rid(sampw);
-       usr->group_rid = pdb_get_group_rid(sampw);
-       usr->num_groups = num_groups+1;
+       usr->user_rid = user_rid;
+       usr->group_rid = group_rid;
+       usr->num_groups = num_groups;
 
        usr->buffer_groups = 1; /* indicates fill in groups, below, even if there are none */
        usr->user_flgs = user_flgs;
@@ -1288,20 +1307,14 @@ void init_net_user_info3(TALLOC_CTX *ctx, NET_USER_INFO_3 *usr, SAM_ACCOUNT *sam
        init_unistr2(&usr->uni_home_dir, home_dir, len_home_dir);
        init_unistr2(&usr->uni_dir_drive, dir_drive, len_dir_drive);
 
-       /* always have at least one group == the user's primary group */
-       usr->num_groups2 = num_groups+1;
+       usr->num_groups2 = num_groups;
 
-       usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * (num_groups+1));
-       if (usr->gids == NULL)
+       usr->gids = (DOM_GID *)talloc_zero(ctx,sizeof(DOM_GID) * (num_groups));
+       if (usr->gids == NULL && num_groups>0)
                return;
 
-       /* primary group **MUST** go first.  NT4's winmsd.exe will give
-          "The Network statistics are currently not available.  9-5"
-          What the heck is this?     -- jerry  */
-       usr->gids[0].g_rid = usr->group_rid;
-       usr->gids[0].attr  = 0x07;
        for (i = 0; i < num_groups; i++) 
-               usr->gids[i+1] = gids[i];       
+               usr->gids[i] = gids[i]; 
                
        init_unistr2(&usr->uni_logon_srv, logon_srv, len_logon_srv);
        init_unistr2(&usr->uni_logon_dom, logon_dom, len_logon_dom);
@@ -1353,17 +1366,17 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps,
        if(!smb_io_time("must change time", &usr->pass_must_change_time, ps, depth)) /* password must change time */
                return False;
 
-       if(!smb_io_unihdr("unihdr", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
+       if(!smb_io_unihdr("hdr_user_name", &usr->hdr_user_name, ps, depth)) /* username unicode string header */
                return False;
-       if(!smb_io_unihdr("unihdr", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
+       if(!smb_io_unihdr("hdr_full_name", &usr->hdr_full_name, ps, depth)) /* user's full name unicode string header */
                return False;
-       if(!smb_io_unihdr("unihdr", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
+       if(!smb_io_unihdr("hdr_logon_script", &usr->hdr_logon_script, ps, depth)) /* logon script unicode string header */
                return False;
-       if(!smb_io_unihdr("unihdr", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
+       if(!smb_io_unihdr("hdr_profile_path", &usr->hdr_profile_path, ps, depth)) /* profile path unicode string header */
                return False;
-       if(!smb_io_unihdr("unihdr", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
+       if(!smb_io_unihdr("hdr_home_dir", &usr->hdr_home_dir, ps, depth)) /* home directory unicode string header */
                return False;
-       if(!smb_io_unihdr("unihdr", &usr->hdr_dir_drive, ps, depth)) /* home directory drive unicode string header */
+       if(!smb_io_unihdr("hdr_dir_drive", &usr->hdr_dir_drive, ps, depth)) /* home directory drive unicode string header */
                return False;
 
        if(!prs_uint16("logon_count   ", ps, depth, &usr->logon_count))  /* logon count */
@@ -1385,9 +1398,9 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps,
        if(!prs_uint8s(False, "user_sess_key", ps, depth, usr->user_sess_key, 16)) /* unused user session key */
                return False;
 
-       if(!smb_io_unihdr("unihdr", &usr->hdr_logon_srv, ps, depth)) /* logon server unicode string header */
+       if(!smb_io_unihdr("hdr_logon_srv", &usr->hdr_logon_srv, ps, depth)) /* logon server unicode string header */
                return False;
-       if(!smb_io_unihdr("unihdr", &usr->hdr_logon_dom, ps, depth)) /* logon domain unicode string header */
+       if(!smb_io_unihdr("hdr_logon_dom", &usr->hdr_logon_dom, ps, depth)) /* logon domain unicode string header */
                return False;
 
        if(!prs_uint32("buffer_dom_id ", ps, depth, &usr->buffer_dom_id)) /* undocumented logon domain id pointer */
@@ -1407,17 +1420,17 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps,
                }
        }
                
-       if(!smb_io_unistr2("unistr2", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
+       if(!smb_io_unistr2("uni_user_name", &usr->uni_user_name, usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */
                return False;
-       if(!smb_io_unistr2("unistr2", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
+       if(!smb_io_unistr2("uni_full_name", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */
                return False;
-       if(!smb_io_unistr2("unistr2", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
+       if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */
                return False;
-       if(!smb_io_unistr2("unistr2", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
+       if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */
                return False;
-       if(!smb_io_unistr2("unistr2", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
+       if(!smb_io_unistr2("uni_home_dir", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */
                return False;
-       if(!smb_io_unistr2("unistr2", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
+       if(!smb_io_unistr2("uni_dir_drive", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */
                return False;
 
        if(!prs_align(ps))
@@ -1436,9 +1449,9 @@ static BOOL net_io_user_info3(char *desc, NET_USER_INFO_3 *usr, prs_struct *ps,
                        return False;
        }
 
-       if(!smb_io_unistr2("unistr2", &usr->uni_logon_srv, usr->hdr_logon_srv.buffer, ps, depth)) /* logon server unicode string */
+       if(!smb_io_unistr2("uni_logon_srv", &usr->uni_logon_srv, usr->hdr_logon_srv.buffer, ps, depth)) /* logon server unicode string */
                return False;
-       if(!smb_io_unistr2("unistr2", &usr->uni_logon_dom, usr->hdr_logon_srv.buffer, ps, depth)) /* logon domain unicode string */
+       if(!smb_io_unistr2("uni_logon_dom", &usr->uni_logon_dom, usr->hdr_logon_srv.buffer, ps, depth)) /* logon domain unicode string */
                return False;
 
        if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth))           /* domain SID */
@@ -1593,18 +1606,21 @@ BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int
 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, 
-                         uint32 database_id)
+                         const char *cli_name, DOM_CRED *cli_creds, 
+                         DOM_CRED *ret_creds, uint32 database_id)
 {
        DEBUG(5, ("init_q_sam_sync\n"));
 
        init_unistr2(&q_s->uni_srv_name, srv_name, strlen(srv_name) + 1);
        init_unistr2(&q_s->uni_cli_name, cli_name, strlen(cli_name) + 1);
 
-        if (cli_creds) {
+        if (cli_creds)
                 memcpy(&q_s->cli_creds, cli_creds, sizeof(q_s->cli_creds));
-                memset(&q_s->ret_creds, 0, sizeof(q_s->ret_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;
@@ -2283,6 +2299,318 @@ static BOOL net_io_sam_alias_mem_info(char *desc, SAM_ALIAS_MEM_INFO * info,
        return True;
 }
 
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+static BOOL net_io_sam_dom_info(char *desc, SAM_DELTA_DOM *info,
+                                     prs_struct *ps, int depth)
+{
+       int i;
+
+       prs_debug(ps, depth, desc, "net_io_sam_dom_info");
+       depth++;
+
+       if(!prs_align(ps))
+               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("unknown3", ps, depth, &info->unknown3))
+                return False;
+       if (!prs_uint32("unknown4", ps, depth, &info->unknown4))
+                return False;
+       if (!prs_uint32("count1", ps, depth, &info->count1))
+                return False;
+       if (!prs_uint32("ptr1", ps, depth, &info->ptr1))
+                return False;
+
+       if (!prs_uint16("count2", ps, depth, &info->count2))
+                return False;
+       if (!prs_uint16("count3", ps, depth, &info->count3))
+                return False;
+
+       if (!prs_uint32("ptr2", ps, depth, &info->ptr2))
+                return False;
+       if (!prs_uint32("ptr3", ps, depth, &info->ptr3))
+                return False;
+
+       if (!prs_uint32("unknown4b", ps, depth, &info->unknown4b))
+                return False;
+       if (!prs_uint32("unknown5", ps, depth, &info->unknown5))
+                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 (!prs_uint32("unknown9", ps, depth, &info->unknown9))
+                return False;
+       if (!prs_uint32("unknown10", ps, depth, &info->unknown10))
+                return False;
+       if (!prs_uint32("unknown11", ps, depth, &info->unknown11))
+                return False;
+       if (!prs_uint32("unknown12", ps, depth, &info->unknown12))
+                return False;
+
+       if (!prs_uint32("unknown13", ps, depth, &info->unknown13))
+                return False;
+       if (!prs_uint32("unknown14", ps, depth, &info->unknown14))
+                return False;
+       if (!prs_uint32("unknown15", ps, depth, &info->unknown15))
+                return False;
+       if (!prs_uint32("unknown16", ps, depth, &info->unknown16))
+                return False;
+       if (!prs_uint32("unknown17", ps, depth, &info->unknown17))
+                return False;
+
+       for (i=0; i<info->count2; i++)
+               if (!prs_uint32("unknown18", ps, depth, &info->unknown18))
+                       return False;
+
+       if (!prs_uint32("unknown19", ps, depth, &info->unknown19))
+                return False;
+
+       for (i=0; i<info->count1; i++)
+               if (!prs_uint32("unknown20", ps, depth, &info->unknown20))
+                       return False;
+
+       if (!prs_uint32("ptr4", ps, depth, &info->ptr4))
+                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;
+
+       return True;
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+static BOOL net_io_sam_unk0e_info(char *desc, SAM_DELTA_UNK0E *info,
+                                     prs_struct *ps, int depth)
+{
+       int i;
+
+       prs_debug(ps, depth, desc, "net_io_sam_unk0e_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;
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+static BOOL net_io_sam_unk12_info(char *desc, SAM_DELTA_UNK12 *info,
+                                     prs_struct *ps, int depth)
+{
+       int i;
+
+       prs_debug(ps, depth, desc, "net_io_sam_unk12_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;
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+static BOOL net_io_sam_privs_info(char *desc, SAM_DELTA_PRIVS *info,
+                                     prs_struct *ps, int depth)
+{
+       int i;
+
+       prs_debug(ps, depth, desc, "net_io_sam_privs_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(!prs_uint32("priv_count", ps, depth, &info->priv_count))
+                return False;
+       if(!prs_uint32("reserved1", ps, depth, &info->reserved1))
+                return False;
+
+       if(!prs_uint32("ptr1", ps, depth, &info->ptr1))
+                return False;
+       if(!prs_uint32("ptr2", ps, depth, &info->ptr2))
+                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("unknown3", ps, depth, &info->unknown3))
+                return False;
+       if(!prs_uint32("unknown4", ps, depth, &info->unknown4))
+                return False;
+       if(!prs_uint32("unknown5", ps, depth, &info->unknown5))
+                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(!prs_uint32("unknown9", ps, depth, &info->unknown9))
+                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("unknown10", ps, depth, &info->unknown10))
+                       return False;
+
+       if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count))
+                return False;
+
+       info->attributes = talloc(ps->mem_ctx, sizeof(uint32) * info->attribute_count);
+
+       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;
+
+       info->hdr_privslist = talloc(ps->mem_ctx, sizeof(UNIHDR) * info->privlist_count);
+       info->uni_privslist = talloc(ps->mem_ctx, sizeof(UNISTR2) * info->privlist_count);
+
+       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;
+
+       return True;
+}
+
 /*******************************************************************
 reads or writes a structure.
 ********************************************************************/
@@ -2293,70 +2621,66 @@ static BOOL net_io_sam_delta_ctr(char *desc, uint8 sess_key[16],
        prs_debug(ps, depth, desc, "net_io_sam_delta_ctr");
        depth++;
 
-       switch (type)
-        {
+       switch (type) {
                 /* Seen in sam deltas */
-
                 case SAM_DELTA_SAM_STAMP:
-                {
-                        if (!net_io_sam_delta_stamp("", &delta->stamp,
-                                                    ps, depth))
+                        if (!net_io_sam_delta_stamp("", &delta->stamp, ps, depth))
                                 return False;
                         break;
-                }
 
                case SAM_DELTA_DOMAIN_INFO:
-               {
-                       if (!net_io_sam_domain_info("", &delta->domain_info,
-                                                    ps, depth))
+                       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))
+                       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("", sess_key,
-                                                     &delta->account_info,
-                                                     ps, depth))
+                       if (!net_io_sam_account_info("", sess_key, &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))
+                       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))
+                        if (!net_io_sam_alias_info("", &delta->alias_info, ps, depth))
                                 return False;
                        break;
-               }
+
+               case SAM_DELTA_DOM_INFO:
+                        if (!net_io_sam_dom_info("", &delta->dom_info, ps, depth))
+                                return False;
+                       break;
+
                case SAM_DELTA_ALIAS_MEM:
-               {
-                       if (!net_io_sam_alias_mem_info("", 
-                                                       &delta->als_mem_info,
-                                                       ps, depth))
+                       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;
+
+               case SAM_DELTA_UNK0E_INFO:
+                       if (!net_io_sam_unk0e_info("", &delta->unk0e_info, ps, depth))
+                                return False;
+                       break;
+
+               case SAM_DELTA_UNK12_INFO:
+                       if (!net_io_sam_unk12_info("", &delta->unk12_info, ps, depth))
+                                return False;
+                       break;
+
                default:
-               {
-                       DEBUG(0,
-                             ("Replication error: Unknown delta type 0x%x\n",
-                              type));
+                       DEBUG(0, ("Replication error: Unknown delta type 0x%x\n", type));
                        break;
-               }
        }
 
        return True;