summaryrefslogtreecommitdiffstats
path: root/source3/rpc_parse/parse_reg.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-08-03 20:30:25 +0000
committerLuke Leighton <lkcl@samba.org>1999-08-03 20:30:25 +0000
commit8598bf2a7f0f71ae7a023aac054c4df42b969ce6 (patch)
tree53352e656e5d01de5a2711b62ac1239979f6d53f /source3/rpc_parse/parse_reg.c
parent9c593512155a4e1d9eb01ac63d4458df59b7357d (diff)
downloadsamba-8598bf2a7f0f71ae7a023aac054c4df42b969ce6.tar.gz
samba-8598bf2a7f0f71ae7a023aac054c4df42b969ce6.tar.xz
samba-8598bf2a7f0f71ae7a023aac054c4df42b969ce6.zip
reverted jeremy's c++-like security descriptor modifications as the
simplest method to get rpcclient's reggetsec command working. the buffers passed as arguments in do_reg_get_key_sec() do need to be locally allocated not dynamically allocated, as two calls to reg_get_key_sec() are needed. on the first, the server fills in the size of the security descriptor buffer needed. on the second, the server fills in the security descriptor buffer. (This used to be commit b2d9cbef6f65bb696df8d8f49aa0c240e0bb1f50)
Diffstat (limited to 'source3/rpc_parse/parse_reg.c')
-rw-r--r--source3/rpc_parse/parse_reg.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c
index b97fe3958b3..47e1ae3af25 100644
--- a/source3/rpc_parse/parse_reg.c
+++ b/source3/rpc_parse/parse_reg.c
@@ -135,8 +135,7 @@ static void reg_io_hdrbuf_sec(uint32 ptr, uint32 *ptr3, BUFHDR *hdr_sec, SEC_DES
}
if (ptr3 == NULL || *ptr3 != 0)
{
- /* JRA - this line is probably wrong... */
- sec_io_desc_buf("data ", &data , ps, depth);
+ sec_io_desc_buf("data ", data , ps, depth);
}
smb_io_hdrbuf_post("hdr_sec", hdr_sec, ps, depth, hdr_offset,
data->max_len, data->len);
@@ -152,7 +151,8 @@ creates a structure.
void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
char *name, char *class,
SEC_ACCESS *sam_access,
- SEC_DESC_BUF *sec_buf)
+ SEC_DESC_BUF *sec_buf,
+ int sec_len, SEC_DESC *sec)
{
int len_name = name != NULL ? strlen(name ) + 1: 0;
int len_class = class != NULL ? strlen(class) + 1: 0;
@@ -175,8 +175,9 @@ void make_reg_q_create_key(REG_Q_CREATE_KEY *q_c, POLICY_HND *hnd,
q_c->data = sec_buf;
q_c->ptr2 = 1;
- make_buf_hdr(&(q_c->hdr_sec), sec_buf->len, sec_buf->len);
+ make_buf_hdr(&(q_c->hdr_sec), sec_len, sec_len);
q_c->ptr3 = 1;
+ make_sec_desc_buf(q_c->data, sec_len, sec);
q_c->unknown_2 = 0x00000000;
}
@@ -548,7 +549,7 @@ void reg_io_r_close(char *desc, REG_R_CLOSE *r_u, prs_struct *ps, int depth)
makes a structure.
********************************************************************/
void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol,
- SEC_DESC_BUF *sec_desc_buf)
+ uint32 buf_len, SEC_DESC *sec_desc)
{
if (q_i == NULL) return;
@@ -557,8 +558,8 @@ void make_reg_q_set_key_sec(REG_Q_SET_KEY_SEC *q_i, POLICY_HND *pol,
q_i->sec_info = DACL_SECURITY_INFORMATION;
q_i->ptr = 1;
- make_buf_hdr(&(q_i->hdr_sec), sec_desc_buf->len, sec_desc_buf->len);
- q_i->data = sec_desc_buf;
+ make_buf_hdr(&(q_i->hdr_sec), buf_len, buf_len);
+ make_sec_desc_buf(q_i->data, buf_len, sec_desc);
}
/*******************************************************************
@@ -601,7 +602,7 @@ void reg_io_r_set_key_sec(char *desc, REG_R_SET_KEY_SEC *r_q, prs_struct *ps, in
makes a structure.
********************************************************************/
void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol,
- uint32 sec_buf_size, SEC_DESC_BUF *psdb)
+ uint32 buf_len, SEC_DESC_BUF *sec_buf)
{
if (q_i == NULL) return;
@@ -611,10 +612,14 @@ void make_reg_q_get_key_sec(REG_Q_GET_KEY_SEC *q_i, POLICY_HND *pol,
GROUP_SECURITY_INFORMATION |
DACL_SECURITY_INFORMATION;
- q_i->ptr = psdb != NULL ? 1 : 0;
- q_i->data = psdb;
+ q_i->ptr = sec_buf != NULL ? 1 : 0;
+ q_i->data = sec_buf;
- make_buf_hdr(&(q_i->hdr_sec), sec_buf_size, 0);
+ if (sec_buf != NULL)
+ {
+ make_buf_hdr(&(q_i->hdr_sec), buf_len, 0);
+ make_sec_desc_buf(q_i->data, buf_len, NULL);
+ }
}
/*******************************************************************
@@ -671,7 +676,8 @@ void reg_io_r_get_key_sec(char *desc, REG_R_GET_KEY_SEC *r_q, prs_struct *ps, i
if (r_q->ptr != 0)
{
- sec_io_desc_buf("", &r_q->data, ps, depth);
+ smb_io_hdrbuf("", &(r_q->hdr_sec), ps, depth);
+ sec_io_desc_buf("", r_q->data, ps, depth);
prs_align(ps);
}