NTSTATUS smbd_smb2_process_negprot(struct smbXsrv_connection *xconn,
uint64_t expected_seq_low,
const uint8_t *inpdu, size_t size);
-void smb2_multi_protocol_reply_negprot(struct smb_request *req);
+NTSTATUS smb2_multi_protocol_reply_negprot(struct smb_request *req);
DATA_BLOB smbd_smb2_generate_outbody(struct smbd_smb2_request *req, size_t size);
conn POINTER CAN BE NULL HERE !
****************************************************************************/
-void smb2_multi_protocol_reply_negprot(struct smb_request *req)
+NTSTATUS smb2_multi_protocol_reply_negprot(struct smb_request *req)
{
size_t choice = 0;
bool choice_set = false;
DEBUG(0, ("negprot got no protocols\n"));
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBnegprot);
- return;
+ return NT_STATUS_INVALID_PARAMETER;
}
if (req->buf[req->buflen-1] != '\0') {
DEBUG(0, ("negprot protocols not 0-terminated\n"));
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBnegprot);
- return;
+ return NT_STATUS_INVALID_PARAMETER;
}
p = (const char *)req->buf + 1;
TALLOC_FREE(cliprotos);
reply_nterror(req, NT_STATUS_NO_MEMORY);
END_PROFILE(SMBnegprot);
- return;
+ return NT_STATUS_NO_MEMORY;
}
cliprotos = tmp;
TALLOC_FREE(cliprotos);
reply_nterror(req, NT_STATUS_NO_MEMORY);
END_PROFILE(SMBnegprot);
- return;
+ return NT_STATUS_NO_MEMORY;
}
DEBUG(3, ("Requested protocol [%s]\n",
TALLOC_FREE(cliprotos);
END_PROFILE(SMBnegprot);
- return;
+ return NT_STATUS_OK;
}
{
struct smbd_server_connection *sconn = xconn->client->sconn;
struct smb_request *req;
+ NTSTATUS status;
if (!(req = talloc(talloc_tos(), struct smb_request))) {
smb_panic("could not allocate smb_request");
req->inbuf = (uint8_t *)talloc_move(req, &inbuf);
- smb2_multi_protocol_reply_negprot(req);
+ status = smb2_multi_protocol_reply_negprot(req);
if (req->outbuf == NULL) {
/*
* req->outbuf == NULL means we bootstrapped into SMB2.
*/
return;
}
- /* This code path should only *ever* bootstrap into SMB2. */
- exit_server_cleanly("Internal error SMB1negprot didn't reply "
- "with an SMB2 packet");
+ if (!NT_STATUS_IS_OK(status)) {
+ if (!srv_send_smb(req->xconn,
+ (char *)req->outbuf,
+ true, req->seqnum+1,
+ IS_CONN_ENCRYPTED(req->conn)||req->encrypted,
+ &req->pcd)) {
+ exit_server_cleanly("construct_reply_smb1negprot: "
+ "srv_send_smb failed.");
+ }
+ TALLOC_FREE(req);
+ } else {
+ /* This code path should only *ever* bootstrap into SMB2. */
+ exit_server_cleanly("Internal error SMB1negprot didn't reply "
+ "with an SMB2 packet");
+ }
}
static void smbd_server_connection_write_handler(