/**************************************************************************** issue a single SMBwrite and don't wait for a reply ****************************************************************************/ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset, uint16 mode, char *buf, size_t size) { Q_WRITE_ANDX qw; R_WRITE_ANDX rw; Q_WRITE_ANDX_D qd; R_WRITE_ANDX_D rd; R_WRITE_ANDX_6 *rs = &rw.ctr.r6; Q_WRITE_ANDX_12 *qs = &qw.ctr.q12; ZERO_STRUCT(qw); ZERO_STRUCT(rw); ZERO_STRUCT(qd); ZERO_STRUCT(rd); qd.wcount = 12; qw.wcount = 12; qs->andx.cmd = 0xff; qs->fnum = fnum; qs->startpos = offset; qs->vwv5 = IS_BITS_SET_ALL(mode, 0x0008) ? 0xFFFFFFFF : 0; qs->write_through = mode; qs->vwv8 = IS_BITS_SET_ALL(mode, 0x0008) ? size : 0; qs->numtowrite = size; qs->smb_doff = 0x3b; /* HACK! */ qd.data = buf; qd.datalen = size; cli->nterr = cli_SMBwriteX(cli->hnd, &qw, &rw, &qd, &rd, NULL, NULL); if (cli->nterr != 0) return -1; if (rw.wcount != 6) return -1; return rs->nwritten; }
static BOOL process_request_pdu(pipes_struct *p, prs_struct *rpc_in_p) { BOOL auth_verify = IS_BITS_SET_ALL(p->ntlmssp_chal_flags, NTLMSSP_NEGOTIATE_SIGN); size_t data_len = p->hdr.frag_len - RPC_HEADER_LEN - RPC_HDR_REQ_LEN - (auth_verify ? RPC_HDR_AUTH_LEN : 0) - p->hdr.auth_len; if(!p->pipe_bound) { DEBUG(0,("process_request_pdu: rpc request with no bind.\n")); set_incoming_fault(p); return False; } /* * Check if we need to do authentication processing. * This is only done on requests, not binds. */ /* * Read the RPC request header. */ if(!smb_io_rpc_hdr_req("req", &p->hdr_req, rpc_in_p, 0)) { DEBUG(0,("process_request_pdu: failed to unmarshall RPC_HDR_REQ.\n")); set_incoming_fault(p); return False; } if(p->ntlmssp_auth_validated && !api_pipe_auth_process(p, rpc_in_p)) { DEBUG(0,("process_request_pdu: failed to do auth processing.\n")); set_incoming_fault(p); return False; } if (p->ntlmssp_auth_requested && !p->ntlmssp_auth_validated) { /* * Authentication _was_ requested and it already failed. */ DEBUG(0,("process_request_pdu: RPC request received on pipe %s where \ authentication failed. Denying the request.\n", p->name)); set_incoming_fault(p); return False; }