1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

rpc_server/srv_lsa.c: Bring into sync with 2.0.x.

rpc_server/srv_pipe_hnd.c: Bring into sync with 2.0.x.
smbd/blocking.c: Improve blocking debug reporting.
utils/torture.c: Added check for NT locking bug.
Jeremy.
(This used to be commit e8ff6d3fb5)
This commit is contained in:
Jeremy Allison 2000-05-04 21:57:28 +00:00
parent fffeaf527d
commit 045469493c
4 changed files with 41 additions and 19 deletions

View File

@ -90,6 +90,8 @@ static void init_dom_query(DOM_QUERY *d_q, char *dom_name, DOM_SID *dom_sid)
fstring sid_str;
int domlen = strlen(dom_name);
*sid_str = '\0';
d_q->uni_dom_max_len = domlen * 2;
d_q->uni_dom_str_len = domlen * 2;
@ -99,8 +101,10 @@ static void init_dom_query(DOM_QUERY *d_q, char *dom_name, DOM_SID *dom_sid)
/* this string is supposed to be character short */
init_unistr2(&d_q->uni_domain_name, dom_name, domlen);
sid_to_string(sid_str, dom_sid);
init_dom_sid2(&d_q->dom_sid, dom_sid);
if(dom_sid) {
sid_to_string(sid_str, dom_sid);
init_dom_sid2(&d_q->dom_sid, dom_sid);
}
}
/***************************************************************************
@ -128,7 +132,7 @@ lsa_reply_query_info
***************************************************************************/
static BOOL lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata,
char *dom_name, DOM_SID *dom_sid)
char *dom_name, DOM_SID *dom_sid, uint32 status_code)
{
LSA_R_QUERY_INFO r_q;
@ -136,12 +140,14 @@ static BOOL lsa_reply_query_info(LSA_Q_QUERY_INFO *q_q, prs_struct *rdata,
/* set up the LSA QUERY INFO response */
r_q.undoc_buffer = 0x22000000; /* bizarre */
r_q.info_class = q_q->info_class;
if(status_code == 0) {
r_q.undoc_buffer = 0x22000000; /* bizarre */
r_q.info_class = q_q->info_class;
init_dom_query(&r_q.dom.id5, dom_name, dom_sid);
init_dom_query(&r_q.dom.id5, dom_name, dom_sid);
}
r_q.status = 0x0;
r_q.status = status_code;
/* store the response in the SMB stream */
if(!lsa_io_r_query("", &r_q, rdata, 0)) {
@ -484,7 +490,8 @@ static BOOL api_lsa_enum_trust_dom(prs_struct *data, prs_struct *rdata)
ZERO_STRUCT(q_e);
/* grab the enum trust domain context etc. */
lsa_io_q_enum_trust_dom("", &q_e, data, 0);
if(!lsa_io_q_enum_trust_dom("", &q_e, data, 0))
return False;
/* construct reply. return status is always 0x0 */
lsa_reply_enum_trust_dom(&q_e, rdata, 0, NULL, NULL);
@ -500,6 +507,8 @@ static BOOL api_lsa_query_info(prs_struct *data, prs_struct *rdata)
LSA_Q_QUERY_INFO q_i;
fstring name;
DOM_SID *sid = NULL;
uint32 status_code = 0;
memset(name, 0, sizeof(name));
ZERO_STRUCT(q_i);
@ -525,11 +534,12 @@ static BOOL api_lsa_query_info(prs_struct *data, prs_struct *rdata)
break;
default:
DEBUG(0,("api_lsa_query_info: unknown info level in Lsa Query: %d\n", q_i.info_class));
status_code = (NT_STATUS_INVALID_INFO_CLASS | 0xC0000000);
break;
}
/* construct reply. return status is always 0x0 */
if(!lsa_reply_query_info(&q_i, rdata, name, sid))
if(!lsa_reply_query_info(&q_i, rdata, name, sid, status_code))
return False;
return True;

View File

@ -77,7 +77,7 @@ void init_rpc_pipe_hnd(void)
Initialise an outgoing packet.
****************************************************************************/
static BOOL pipe_init_outgoing_data(output_data *o_data, uint32 len)
static BOOL pipe_init_outgoing_data(output_data *o_data)
{
/* Reset the offset counters. */
o_data->data_sent_length = 0;
@ -93,7 +93,7 @@ static BOOL pipe_init_outgoing_data(output_data *o_data, uint32 len)
* Initialize the outgoing RPC data buffer.
* we will use this as the raw data area for replying to rpc requests.
*/
if(!prs_init(&o_data->rdata, len, 4, MARSHALL)) {
if(!prs_init(&o_data->rdata, MAX_PDU_FRAG_LEN, 4, MARSHALL)) {
DEBUG(0,("pipe_init_outgoing_data: malloc fail.\n"));
return False;
}
@ -486,7 +486,7 @@ authentication failed. Denying the request.\n", p->name));
* Process the complete data stream here.
*/
if(pipe_init_outgoing_data(&p->out_data, MAX_PDU_FRAG_LEN))
if(pipe_init_outgoing_data(&p->out_data))
ret = api_pipe_request(p);
/*
@ -537,14 +537,14 @@ static ssize_t process_complete_pdu(pipes_struct *p)
/*
* We assume that a pipe bind is only in one pdu.
*/
if(pipe_init_outgoing_data(&p->out_data, MAX_PDU_FRAG_LEN))
if(pipe_init_outgoing_data(&p->out_data))
reply = api_pipe_bind_req(p, &rpc_in);
break;
case RPC_BINDRESP:
/*
* We assume that a pipe bind_resp is only in one pdu.
*/
if(pipe_init_outgoing_data(&p->out_data, MAX_PDU_FRAG_LEN))
if(pipe_init_outgoing_data(&p->out_data))
reply = api_pipe_bind_auth_resp(p, &rpc_in);
break;
case RPC_REQUEST:
@ -716,7 +716,7 @@ static BOOL read_from_remote(pipes_struct *p)
* Create the response data buffer.
*/
if(!pipe_init_outgoing_data(&p->out_data, 65536)) {
if(!pipe_init_outgoing_data(&p->out_data)) {
DEBUG(0,("read_from_remote: failed to create outgoing buffer.\n"));
return False;
}

View File

@ -117,8 +117,8 @@ BOOL push_blocking_lock_request( char *inbuf, int length, int lock_timeout, int
ubi_slAddTail(&blocking_lock_queue, blr);
DEBUG(3,("push_blocking_lock_request: lock request length=%d blocked with expiry time %d \
for fnum = %d, name = %s\n", length, (int)blr->expire_time,
DEBUG(3,("push_blocking_lock_request: lock request length=%d blocked with expiry time %d (+%d) \
for fnum = %d, name = %s\n", length, (int)blr->expire_time, lock_timeout,
blr->fsp->fnum, blr->fsp->fsp_name ));
return True;

View File

@ -998,8 +998,20 @@ static void run_locktest5(int dummy)
goto fail;
}
/* Check for NT bug... */
ret = cli_lock(&cli1, fnum1, 0, 8, 0, READ_LOCK) &&
cli_lock(&cli1, fnum3, 0, 1, 0, READ_LOCK);
cli_close(&cli1, fnum1);
fnum1 = cli_open(&cli1, fname, O_RDWR, DENY_NONE);
ret = cli_lock(&cli1, fnum1, 7, 1, 0, WRITE_LOCK);
EXPECTED(ret, True);
printf("this server %s the NT locking bug\n", ret ? "doesn't have" : "has");
cli_close(&cli1, fnum1);
fnum1 = cli_open(&cli1, fname, O_RDWR, DENY_NONE);
cli_unlock(&cli1, fnum3, 0, 1);
ret = cli_lock(&cli1, fnum1, 0, 4, 0, WRITE_LOCK) &&
cli_lock(&cli1, fnum1, 0, 4, 0, READ_LOCK);
cli_lock(&cli1, fnum1, 1, 1, 0, READ_LOCK);
EXPECTED(ret, True);
printf("the same process %s overlay a write with a read lock\n", ret?"can":"cannot");
@ -1040,7 +1052,7 @@ static void run_locktest5(int dummy)
/* We should have 3 stacked locks here. Ensure we need to do 3 unlocks. */
ret = cli_unlock(&cli1, fnum1, 0, 4) &&
ret = cli_unlock(&cli1, fnum1, 1, 1) &&
cli_unlock(&cli1, fnum1, 0, 4) &&
cli_unlock(&cli1, fnum1, 0, 4);