security descriptors and registry.
authorLuke Leighton <lkcl@samba.org>
Thu, 12 Nov 1998 16:03:35 +0000 (16:03 +0000)
committerLuke Leighton <lkcl@samba.org>
Thu, 12 Nov 1998 16:03:35 +0000 (16:03 +0000)
source/include/rpc_reg.h
source/rpc_parse/parse_misc.c
source/rpc_parse/parse_prs.c
source/rpc_parse/parse_reg.c

index 59f3fb6f05d91a3c7a9b2e26cab29bb77d1914e1..163dfd67fe079a22a943ddc53e8481ed2cf578d1 100644 (file)
@@ -108,7 +108,7 @@ typedef struct q_reg_set_key_sec_info
 
        uint32 ptr;       /* pointer */
        BUFHDR hdr_sec;    /* header for security data */
-       SEC_DESC_BUF *data;    /* security data */
+       SEC_DESC_BUF data;    /* security data */
        
 } REG_Q_SET_KEY_SEC;
 
index b21057033f0e82b2e77d93cd78cc04c9b0e69aac..9d5620bbf0842ce667254e63c6f44baec31cd9eb 100644 (file)
@@ -296,6 +296,43 @@ void make_buf_hdr(BUFHDR *hdr, int max_len, int len)
        hdr->buf_len     = len;
 }
 
+/*******************************************************************
+ prs_uint16 wrapper.  call this and it sets up a pointer to where the
+ uint16 should be stored, or gets the size if reading
+ ********************************************************************/
+void smb_io_hdrbuf_pre(char *desc,  BUFHDR *hdr, prs_struct *ps, int depth, uint32 *offset)
+{
+       (*offset) = ps->offset;
+       if (ps->io)
+       {
+               /* reading. */
+               smb_io_hdrbuf(desc, hdr, ps, depth);
+       }
+       else
+       {
+               ps->offset += sizeof(uint32) * 2;
+       }
+}
+
+/*******************************************************************
+ smb_io_hdrbuf wrapper.  call this and it retrospectively stores the size.
+ does nothing on reading, as that is already handled by ...._pre()
+ ********************************************************************/
+void smb_io_hdrbuf_post(char *desc,  BUFHDR *hdr, prs_struct *ps, int depth, 
+                               uint32 ptr_hdrbuf, uint32 start_offset)
+{
+       if (!ps->io)
+       {
+               /* storing: go back and do a retrospective job.  i hate this */
+               int data_size = ps->offset - start_offset;
+               uint32 old_offset = ps->offset;
+
+               make_buf_hdr(hdr, data_size, data_size);
+               ps->offset = ptr_hdrbuf;
+               smb_io_hdrbuf(desc, hdr, ps, depth);
+               ps->offset = old_offset;
+       }
+}
 /*******************************************************************
 reads or writes a BUFHDR structure.
 ********************************************************************/
index cc068778ac330c4ee9c0e1d557f8a5832283f21b..8df7d06a3962e580575140bd89db5084b85de36f 100644 (file)
@@ -305,7 +305,7 @@ BOOL prs_string(char *name, prs_struct *ps, int depth, char *str, uint16 len, ui
  ********************************************************************/
 BOOL prs_uint16_pre(char *name, prs_struct *ps, int depth, uint16 *data16, uint32 *offset)
 {
-       (*offset) = ps->io;
+       (*offset) = ps->offset;
        if (ps->io)
        {
                /* reading. */
@@ -348,7 +348,7 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16,
  ********************************************************************/
 BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset)
 {
-       (*offset) = ps->io;
+       (*offset) = ps->offset;
        if (ps->io)
        {
                /* reading. */
index 57de5f8968794e910ff650f3b1c9617263f81a14..7e9b12b4ec8e1c4838025509b28268c6b9d383b5 100644 (file)
@@ -541,6 +541,68 @@ void reg_io_r_close(char *desc,  REG_R_CLOSE *r_u, prs_struct *ps, int depth)
        prs_uint32("status", ps, depth, &(r_u->status));
 }
 
+/*******************************************************************
+makes a structure.
+********************************************************************/
+void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol, 
+                               uint32 buf_len, SEC_DESC *sec_desc)
+{
+       if (q_i == NULL) return;
+
+       memcpy(&(q_i->pol), pol, sizeof(q_i->pol));
+
+       q_i->unknown = 0x7;
+
+       q_i->ptr = 1;
+       make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len);
+       make_sec_desc_buf(&(q_i->data), buf_len, sec_desc);
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void reg_io_q_set_key_sec(char *desc,  REG_Q_SET_KEY_SEC *r_q, prs_struct *ps, int depth)
+{
+       if (r_q == NULL) return;
+
+       prs_debug(ps, depth, desc, "reg_io_q_set_key_sec");
+       depth++;
+
+       prs_align(ps);
+       
+       smb_io_pol_hnd("", &(r_q->pol), ps, depth); 
+
+       prs_uint32("unknown", ps, depth, &(r_q->unknown));
+       prs_uint32("ptr    ", ps, depth, &(r_q->ptr    ));
+
+       if (r_q->ptr != 0)
+       {
+               uint32 hdr_offset;
+               uint32 old_offset;
+               smb_io_hdrbuf_pre("hdr_sec", &(r_q->hdr_sec), ps, depth, &hdr_offset);
+               old_offset = ps->offset;
+               sec_io_desc_buf("data   ", &(r_q->data   ), ps, depth);
+               prs_align(ps);
+               smb_io_hdrbuf_post("hdr_sec", &(r_q->hdr_sec), ps, depth, hdr_offset, old_offset);
+       }
+}
+
+/*******************************************************************
+reads or writes a structure.
+********************************************************************/
+void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, int depth)
+{
+       if (r_q == NULL) return;
+
+       prs_debug(ps, depth, desc, "reg_io_r_get_key_sec");
+       depth++;
+
+       prs_align(ps);
+       
+       prs_uint32("status", ps, depth, &(r_q->status));
+}
+
+
 /*******************************************************************
 makes a structure.
 ********************************************************************/