1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-30 19:42:05 +03:00

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 commit is contained in:
Luke Leighton
-
parent 062b9302c1
commit b2d9cbef6f
9 changed files with 346 additions and 516 deletions

View File

@ -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);
}