/* The following definitions come from smbd/smb2_process.c */
#if !defined(WITH_SMB1SERVER)
-bool smb1_srv_send(struct smbXsrv_connection *xconn, char *buffer,
- bool do_signing, uint32_t seqnum,
- bool do_encrypt,
- struct smb_perfcount_data *pcd);
+bool smb1_srv_send(struct smbXsrv_connection *xconn,
+ char *buffer,
+ bool do_signing,
+ uint32_t seqnum,
+ bool do_encrypt);
#endif
size_t srv_smb1_set_message(char *buf,
size_t num_words,
_smb_setlen_large(outbuf, outsize);
show_msg(outbuf);
- if (!smb1_srv_send(aio_ex->smbreq->xconn, outbuf,
- true, aio_ex->smbreq->seqnum+1,
- IS_CONN_ENCRYPTED(fsp->conn), NULL)) {
+ if (!smb1_srv_send(aio_ex->smbreq->xconn,
+ outbuf,
+ true,
+ aio_ex->smbreq->seqnum + 1,
+ IS_CONN_ENCRYPTED(fsp->conn))) {
exit_server_cleanly("handle_aio_read_complete: smb1_srv_send "
"failed.");
}
SSVAL(aio_ex->outbuf.data,smb_vwv4,(numtowrite>>16)&1);
show_msg((char *)aio_ex->outbuf.data);
if (!smb1_srv_send(aio_ex->smbreq->xconn,
- (char *)aio_ex->outbuf.data,
- true, aio_ex->smbreq->seqnum+1,
- IS_CONN_ENCRYPTED(fsp->conn),
- &aio_ex->smbreq->pcd)) {
+ (char *)aio_ex->outbuf.data,
+ true,
+ aio_ex->smbreq->seqnum + 1,
+ IS_CONN_ENCRYPTED(fsp->conn))) {
exit_server_cleanly("schedule_aio_write_and_X: "
"smb1_srv_send failed.");
}
}
show_msg(outbuf);
- if (!smb1_srv_send(aio_ex->smbreq->xconn, outbuf,
- true, aio_ex->smbreq->seqnum+1,
- IS_CONN_ENCRYPTED(fsp->conn),
- NULL)) {
+ if (!smb1_srv_send(aio_ex->smbreq->xconn,
+ outbuf,
+ true,
+ aio_ex->smbreq->seqnum + 1,
+ IS_CONN_ENCRYPTED(fsp->conn))) {
exit_server_cleanly("handle_aio_write_complete: "
"smb1_srv_send failed.");
}
}
show_msg((char *)req->outbuf);
- if (!smb1_srv_send(xconn, (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(conn), &req->pcd)) {
+ if (!smb1_srv_send(xconn,
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(conn))) {
exit_server_cleanly("send_trans_reply: smb1_srv_send failed.");
}
}
show_msg((char *)req->outbuf);
- if (!smb1_srv_send(xconn, (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(conn), &req->pcd))
+ if (!smb1_srv_send(xconn,
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(conn))) {
exit_server_cleanly("send_trans_reply: smb1_srv_send "
"failed.");
+ }
tot_data_sent += this_ldata;
tot_param_sent += this_lparam;
return;
send:
- if (!smb1_srv_send(
- req->xconn, (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn) || req->encrypted,
- &req->pcd)) {
- exit_server_cleanly("api_dcerpc_cmd_write_done: "
- "smb1_srv_send failed.");
- }
+ if (!smb1_srv_send(req->xconn,
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn) || req->encrypted)) {
+ exit_server_cleanly("api_dcerpc_cmd_write_done: "
+ "smb1_srv_send failed.");
+ }
TALLOC_FREE(req);
}
NT_STATUS_EQUAL(old, status)?"":nt_errstr(status)));
reply_nterror(req, status);
- if (!smb1_srv_send(req->xconn, (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn)
- ||req->encrypted, &req->pcd)) {
+ if (!smb1_srv_send(req->xconn,
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn) ||
+ req->encrypted)) {
exit_server_cleanly("api_dcerpc_cmd_read_done: "
"smb1_srv_send failed.");
}
reply_smb1_outbuf(req, 1, 0);
SSVAL(req->outbuf, smb_vwv0, NO_PROTOCOL_CHOSEN);
- ok = smb1_srv_send(xconn, (char *)req->outbuf,
- false, 0, false, NULL);
+ ok = smb1_srv_send(xconn, (char *)req->outbuf, false, 0, false);
if (!ok) {
DBG_NOTICE("smb1_srv_send failed\n");
}
}
show_msg((char *)req->outbuf);
if (!smb1_srv_send(xconn,
- (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(conn),
- &req->pcd)) {
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(conn))) {
exit_server_cleanly("send_nt_replies: smb1_srv_send failed.");
}
TALLOC_FREE(req->outbuf);
/* Send the packet */
show_msg((char *)req->outbuf);
if (!smb1_srv_send(xconn,
- (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(conn),
- &req->pcd)) {
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(conn))) {
exit_server_cleanly("send_nt_replies: smb1_srv_send failed.");
}
show_msg(break_msg);
if (!smb1_srv_send(xconn,
- break_msg, false, 0,
- IS_CONN_ENCRYPTED(fsp->conn),
- NULL)) {
+ break_msg,
+ false,
+ 0,
+ IS_CONN_ENCRYPTED(fsp->conn))) {
exit_server_cleanly("send_break_message_smb1: "
"smb1_srv_send failed.");
}
DEBUG(3,("write-IPC nwritten=%d\n", (int)nwritten));
send:
- if (!smb1_srv_send(req->xconn, (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
- &req->pcd)) {
- exit_server_cleanly("construct_reply: smb1_srv_send failed.");
- }
+ if (!smb1_srv_send(req->xconn,
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn) || req->encrypted)) {
+ exit_server_cleanly("construct_reply: smb1_srv_send failed.");
+ }
TALLOC_FREE(req);
}
Send an smb to a fd.
****************************************************************************/
-bool smb1_srv_send(struct smbXsrv_connection *xconn, char *buffer,
- bool do_signing, uint32_t seqnum,
- bool do_encrypt,
- struct smb_perfcount_data *pcd)
+bool smb1_srv_send(struct smbXsrv_connection *xconn,
+ char *buffer,
+ bool do_signing,
+ uint32_t seqnum,
+ bool do_encrypt)
{
size_t len = 0;
ssize_t ret;
char errbuf[smb_size];
error_packet(errbuf, 0, 0, NT_STATUS_INVALID_PARAMETER,
__LINE__, __FILE__);
- if (!smb1_srv_send(xconn, errbuf, true, seqnum, encrypted,
- NULL)) {
+ if (!smb1_srv_send(xconn, errbuf, true, seqnum, encrypted)) {
exit_server_cleanly("construct_reply_chain: "
"smb1_srv_send failed.");
}
shipit:
if (!smb1_srv_send(first_req->xconn,
- (char *)first_req->outbuf,
- true, first_req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn)||first_req->encrypted,
- &first_req->pcd)) {
+ (char *)first_req->outbuf,
+ true,
+ first_req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn) ||
+ first_req->encrypted)) {
exit_server_cleanly("construct_reply_chain: smb1_srv_send "
"failed.");
}
{
char errbuf[smb_size];
error_packet(errbuf, 0, 0, status, __LINE__, __FILE__);
- if (!smb1_srv_send(req->xconn, errbuf, true,
- req->seqnum+1, req->encrypted,
- NULL)) {
+ if (!smb1_srv_send(req->xconn,
+ errbuf,
+ true,
+ req->seqnum + 1,
+ req->encrypted)) {
exit_server_cleanly("construct_reply_chain: "
"smb1_srv_send failed.");
}
memcpy(smb_buf(req.outbuf), req.buf, req.buflen);
}
- ok = smb1_srv_send(req.xconn,
- (char *)outbuf,
- true, seqnum+1,
- false, &req.pcd);
+ ok = smb1_srv_send(req.xconn, (char *)outbuf, true, seqnum + 1, false);
TALLOC_FREE(outbuf);
if (!ok) {
exit(1);
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-bool smb1_srv_send(struct smbXsrv_connection *xconn, char *buffer,
- bool do_signing, uint32_t seqnum,
- bool do_encrypt,
- struct smb_perfcount_data *pcd);
+bool smb1_srv_send(struct smbXsrv_connection *xconn,
+ char *buffer,
+ bool do_signing,
+ uint32_t seqnum,
+ bool do_encrypt);
NTSTATUS allow_new_trans(struct trans_state *list, uint64_t mid);
void smb_request_done(struct smb_request *req);
const char *smb_fn_name(int type);
send:
ok = smb1_srv_send(req->xconn,
- (char *)req->outbuf,
- true,
- req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn),
- NULL);
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn));
if (!ok) {
exit_server_cleanly("reply_lock_done: smb1_srv_send failed.");
}
SSVALS(buf,smb_vwv0,0xFFFF);
show_msg(buf);
if (!smb1_srv_send(req->xconn,
- buf,
- false, 0, /* no signing */
- IS_CONN_ENCRYPTED(conn),
- &req->pcd)) {
+ buf,
+ false,
+ 0, /* no signing */
+ IS_CONN_ENCRYPTED(conn))) {
exit_server_cleanly("reply_writebraw: smb1_srv_send "
"failed.");
}
}
ok = smb1_srv_send(req->xconn,
- (char *)req->outbuf,
- true,
- req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn),
- NULL);
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn));
if (!ok) {
exit_server_cleanly("reply_lock_done: smb1_srv_send failed.");
}
void reply_echo(struct smb_request *req)
{
connection_struct *conn = req->conn;
- struct smb_perfcount_data local_pcd;
- struct smb_perfcount_data *cur_pcd;
int smb_reverb;
int seq_num;
START_PROFILE(SMBecho);
- smb_init_perfcount_data(&local_pcd);
-
if (req->wct < 1) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBecho);
for (seq_num = 1 ; seq_num <= smb_reverb ; seq_num++) {
- /* this makes sure we catch the request pcd */
- if (seq_num == smb_reverb) {
- cur_pcd = &req->pcd;
- } else {
- cur_pcd = &local_pcd;
- }
-
SSVAL(req->outbuf,smb_vwv0,seq_num);
show_msg((char *)req->outbuf);
if (!smb1_srv_send(req->xconn,
- (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(conn)||req->encrypted,
- cur_pcd))
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(conn) || req->encrypted))
exit_server_cleanly("reply_echo: smb1_srv_send failed.");
}
}
ok = smb1_srv_send(req->xconn,
- (char *)req->outbuf,
- true,
- req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn),
- NULL);
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn));
if (!ok) {
exit_server_cleanly("reply_lock_done: smb1_srv_send failed.");
}
}
show_msg((char *)req->outbuf);
if (!smb1_srv_send(xconn,
- (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(conn),
- &req->pcd)) {
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(conn))) {
exit_server_cleanly("send_trans2_replies: smb1_srv_send failed.");
}
TALLOC_FREE(req->outbuf);
/* Send the packet */
show_msg((char *)req->outbuf);
if (!smb1_srv_send(xconn,
- (char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(conn),
- &req->pcd))
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(conn))) {
exit_server_cleanly("send_trans2_replies: smb1_srv_send failed.");
+ }
TALLOC_FREE(req->outbuf);
0xffff);
} else {
reply_nterror(req, status);
- ok = smb1_srv_send(
- req->xconn,
- (char *)req->outbuf,
- true,
- req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn),
- NULL);
+ ok = smb1_srv_send(req->xconn,
+ (char *)req->outbuf,
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn));
if (!ok) {
exit_server_cleanly("smb_set_posix_lock_done: "
"smb1_srv_send failed.");
reply_smb1_outbuf(req, 1, 0);
SSVAL(req->outbuf, smb_vwv0, NO_PROTOCOL_CHOSEN);
- ok = smb1_srv_send(xconn, (char *)req->outbuf,
- false, 0, false, NULL);
+ ok = smb1_srv_send(xconn, (char *)req->outbuf, false, 0, false);
if (!ok) {
DBG_NOTICE("smb1_srv_send failed\n");
}
struct smbd_server_connection *sconn, uint64_t mid);
#if !defined(WITH_SMB1SERVER)
-bool smb1_srv_send(struct smbXsrv_connection *xconn, char *buffer,
- bool do_signing, uint32_t seqnum,
- bool do_encrypt,
- struct smb_perfcount_data *pcd)
+bool smb1_srv_send(struct smbXsrv_connection *xconn,
+ char *buffer,
+ bool do_signing,
+ uint32_t seqnum,
+ bool do_encrypt)
{
size_t len = 0;
ssize_t ret;
if (!NT_STATUS_IS_OK(status)) {
if (!smb1_srv_send(req->xconn,
(char *)req->outbuf,
- true, req->seqnum+1,
- IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
- &req->pcd)) {
+ true,
+ req->seqnum + 1,
+ IS_CONN_ENCRYPTED(req->conn) ||
+ req->encrypted)) {
exit_server_cleanly("construct_reply_smb1negprot: "
"smb1_srv_send failed.");
}
* name"
*/
unsigned char buf[5] = {0x83, 0, 0, 1, 0x81};
- (void)smb1_srv_send(xconn,(char *)buf, false,
- 0, false, NULL);
+ (void)smb1_srv_send(xconn, (char *)buf, false, 0, false);
exit_server_cleanly("connection denied");
} else if (!NT_STATUS_IS_OK(status)) {
exit_server_cleanly(nt_errstr(status));
*(uint32_t *)(outbuf+4) = in_addr->sin_addr.s_addr;
*(uint16_t *)(outbuf+8) = htons(retarget_port);
- if (!smb1_srv_send(xconn, (char *)outbuf, false, 0, false,
- NULL)) {
+ if (!smb1_srv_send(xconn, (char *)outbuf, false, 0, false)) {
exit_server_cleanly("netbios_session_retarget: smb1_srv_send "
"failed.");
}
DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n",
msg_type, msg_flags));
- if (!smb1_srv_send(xconn, outbuf, false, 0, false, NULL)) {
+ if (!smb1_srv_send(xconn, outbuf, false, 0, false)) {
exit_server_cleanly("reply_special: smb1_srv_send failed.");
}