/** send a session setup request */ struct smb2_request *smb2_session_setup_send(struct smb2_session *session, struct smb2_session_setup *io) { struct smb2_request *req; NTSTATUS status; req = smb2_request_init(session->transport, SMB2_OP_SESSSETUP, 0x18, true, io->in.secblob.length); if (req == NULL) return NULL; SBVAL(req->out.hdr, SMB2_HDR_SESSION_ID, session->uid); SCVAL(req->out.body, 0x02, io->in.vc_number); SCVAL(req->out.body, 0x03, io->in.security_mode); SIVAL(req->out.body, 0x04, io->in.capabilities); SIVAL(req->out.body, 0x08, io->in.channel); SBVAL(req->out.body, 0x10, io->in.previous_sessionid); req->session = session; status = smb2_push_o16s16_blob(&req->out, 0x0C, io->in.secblob); if (!NT_STATUS_IS_OK(status)) { talloc_free(req); return NULL; } smb2_transport_send(req); return req; }
/* send a keepalive request */ struct smb2_request *smb2_keepalive_send(struct smb2_transport *transport) { struct smb2_request *req; req = smb2_request_init(transport, SMB2_OP_KEEPALIVE, 0x04, False, 0); if (req == NULL) return NULL; SSVAL(req->out.body, 0x02, 0); smb2_transport_send(req); return req; }
/* initialise a smb2 request for tree operations */ struct smb2_request *smb2_request_init_tree(struct smb2_tree *tree, uint16_t opcode, uint16_t body_fixed_size, bool body_dynamic_present, uint32_t body_dynamic_size) { struct smb2_request *req = smb2_request_init(tree->session->transport, opcode, body_fixed_size, body_dynamic_present, body_dynamic_size); if (req == NULL) return NULL; req->session = tree->session; req->tree = tree; return req; }
/* initialise a smb2 request for tree operations */ struct smb2_request *smb2_request_init_tree(struct smb2_tree *tree, uint16_t opcode, uint16_t body_fixed_size, BOOL body_dynamic_present, uint32_t body_dynamic_size) { struct smb2_request *req = smb2_request_init(tree->session->transport, opcode, body_fixed_size, body_dynamic_present, body_dynamic_size); if (req == NULL) return NULL; SBVAL(req->out.hdr, SMB2_HDR_UID, tree->session->uid); SIVAL(req->out.hdr, SMB2_HDR_TID, tree->tid); req->session = tree->session; req->tree = tree; return req; }