int secword=0;
time_t t = req->request_time.tv_sec;
NTTIME nttime;
- BOOL negotiate_spnego = False;
+ bool negotiate_spnego = false;
char *large_test_path;
unix_to_nt_time(&nttime, t);
(lp_security(global_loadparm) != SEC_SHARE) &&
lp_use_spnego(global_loadparm) &&
(req->flags2 & FLAGS2_EXTENDED_SECURITY)) {
- negotiate_spnego = True;
+ negotiate_spnego = true;
capabilities |= CAP_EXTENDED_SECURITY;
}
smbsrv_terminate_connection(req->smb_conn, "multiple negprot's are not permitted");
return;
}
- req->smb_conn->negotiate.done_negprot = True;
+ req->smb_conn->negotiate.done_negprot = true;
p = req->in.data;
- while (True) {
+ while (true) {
size_t len;
protos = talloc_realloc(req, protos, char *, protos_count + 1);
io->readx.in.mincnt = SVAL(req->in.vwv, VWV(6));
io->readx.in.remaining = SVAL(req->in.vwv, VWV(9));
if (req->flags2 & FLAGS2_READ_PERMIT_EXECUTE) {
- io->readx.in.read_for_execute = True;
+ io->readx.in.read_for_execute = true;
} else {
- io->readx.in.read_for_execute = False;
+ io->readx.in.read_for_execute = false;
}
if (req->smb_conn->negotiate.client_caps & CAP_LARGE_READX) {
req->smb_conn->negotiate.calling_name);
NT_STATUS_NOT_OK_RETURN(status);
- req->smb_conn->negotiate.done_nbt_session = True;
+ req->smb_conn->negotiate.done_nbt_session = true;
return NT_STATUS_OK;
}
/*
pull a DATA_BLOB from a request packet, returning a talloced blob
- return False if any part is outside the data portion of the packet
+ return false if any part is outside the data portion of the packet
*/
-BOOL req_pull_blob(struct smbsrv_request *req, const uint8_t *src, int len, DATA_BLOB *blob)
+bool req_pull_blob(struct smbsrv_request *req, const uint8_t *src, int len, DATA_BLOB *blob)
{
if (len != 0 && req_data_oob(req, src, len)) {
- return False;
+ return false;
}
(*blob) = data_blob_talloc(req, src, len);
- return True;
+ return true;
}
/* check that a lump of data in a request is within the bounds of the data section of
the packet */
-BOOL req_data_oob(struct smbsrv_request *req, const uint8_t *ptr, uint32_t count)
+bool req_data_oob(struct smbsrv_request *req, const uint8_t *ptr, uint32_t count)
{
if (count == 0) {
- return False;
+ return false;
}
/* be careful with wraparound! */
ptr >= req->in.data + req->in.data_size ||
count > req->in.data_size ||
ptr + count > req->in.data + req->in.data_size) {
- return True;
+ return true;
}
- return False;
+ return false;
}
/*
fill a single entry in a search find reply
*/
-static BOOL find_fill_info(struct smbsrv_request *req,
+static bool find_fill_info(struct smbsrv_request *req,
const union smb_search_data *file)
{
uint8_t *p;
if (req->out.data_size + 43 > req_max_data(req)) {
- return False;
+ return false;
}
req_grow_data(req, req->out.data_size + 43);
memcpy(p+30, file->search.name, MIN(strlen(file->search.name)+1, 12));
SCVAL(p,42,0);
- return True;
+ return true;
}
/* callback function for search first/next */
-static BOOL find_callback(void *private, const union smb_search_data *file)
+static bool find_callback(void *private, const union smb_search_data *file)
{
struct search_state *state = (struct search_state *)private;
NTSTATUS status)
{
if (NT_STATUS_IS_OK(status)) {
- req->smb_conn->negotiate.done_sesssetup = True;
+ req->smb_conn->negotiate.done_sesssetup = true;
/* we need to keep the session long term */
req->session = talloc_steal(req->smb_conn, req->session);
}
user_info = talloc(req, struct auth_usersupplied_info);
if (!user_info) goto nomem;
- user_info->mapped_state = False;
+ user_info->mapped_state = false;
user_info->logon_parameters = 0;
user_info->flags = 0;
user_info->client.account_name = sess->old.in.user;
user_info = talloc(req, struct auth_usersupplied_info);
if (!user_info) goto nomem;
- user_info->mapped_state = False;
+ user_info->mapped_state = false;
user_info->logon_parameters = 0;
user_info->flags = 0;
user_info->client.account_name = sess->nt1.in.user;
setup the signing key for a connection. Called after authentication succeeds
in a session setup
*/
-BOOL smbsrv_setup_signing(struct smbsrv_connection *smb_conn,
+bool smbsrv_setup_signing(struct smbsrv_connection *smb_conn,
DATA_BLOB *session_key,
DATA_BLOB *response)
{
if (!set_smb_signing_common(&smb_conn->signing)) {
- return False;
+ return false;
}
return smbcli_simple_set_signing(smb_conn,
&smb_conn->signing, session_key, response);
* pretend we have seen a
* valid packet, so we don't
* turn it off */
- smb_conn->signing.seen_valid = True;
+ smb_conn->signing.seen_valid = true;
}
}
}
-BOOL smbsrv_init_signing(struct smbsrv_connection *smb_conn)
+bool smbsrv_init_signing(struct smbsrv_connection *smb_conn)
{
smb_conn->signing.mac_key = data_blob(NULL, 0);
if (!smbcli_set_signing_off(&smb_conn->signing)) {
- return False;
+ return false;
}
switch (lp_server_signing(global_loadparm)) {
case SMB_SIGNING_OFF:
- smb_conn->signing.allow_smb_signing = False;
+ smb_conn->signing.allow_smb_signing = false;
break;
case SMB_SIGNING_SUPPORTED:
- smb_conn->signing.allow_smb_signing = True;
+ smb_conn->signing.allow_smb_signing = true;
break;
case SMB_SIGNING_REQUIRED:
- smb_conn->signing.allow_smb_signing = True;
- smb_conn->signing.mandatory_signing = True;
+ smb_conn->signing.allow_smb_signing = true;
+ smb_conn->signing.mandatory_signing = true;
break;
case SMB_SIGNING_AUTO:
if (lp_domain_logons(global_loadparm)) {
- smb_conn->signing.allow_smb_signing = True;
+ smb_conn->signing.allow_smb_signing = true;
} else {
- smb_conn->signing.allow_smb_signing = False;
+ smb_conn->signing.allow_smb_signing = false;
}
break;
}
- return True;
+ return true;
}
/*
************************************************************/
/**
* Check a packet supplied by the server.
- * @return False if we had an established signing connection
- * which had a back checksum, True otherwise
+ * @return false if we had an established signing connection
+ * which had a back checksum, true otherwise
*/
-BOOL smbsrv_signing_check_incoming(struct smbsrv_request *req)
+bool smbsrv_signing_check_incoming(struct smbsrv_request *req)
{
- BOOL good;
+ bool good;
req_signing_alloc_seq_num(req);
switch (req->smb_conn->signing.signing_state)
{
case SMB_SIGNING_ENGINE_OFF:
- return True;
+ return true;
case SMB_SIGNING_ENGINE_BSRSPYL:
case SMB_SIGNING_ENGINE_ON:
{
if (req->in.size < (HDR_SS_FIELD + 8)) {
- return False;
+ return false;
} else {
good = check_signed_incoming_message(&req->in,
&req->smb_conn->signing.mac_key,
}
}
}
- return False;
+ return false;
}
}
/* callback function for trans2 findfirst/findnext */
-static BOOL find_callback(void *private, const union smb_search_data *file)
+static bool find_callback(void *private, const union smb_search_data *file)
{
struct find_state *state = talloc_get_type(private, struct find_state);
struct smb_trans2 *trans = state->op->trans;
trans->out.data.length > trans->in.max_data) {
/* restore the old length and tell the backend to stop */
smbsrv_blob_grow_data(trans, &trans->out.data, old_length);
- return False;
+ return false;
}
state->last_entry_offset = old_length;
- return True;
+ return true;
}
/*
SMB2SRV_CHECK(op->send_fn(op));
}
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, True, op->info->out.blob.length));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, true, op->info->out.blob.length));
/* TODO: this is maybe a o16s32_blob */
SMB2SRV_CHECK(smb2_push_o16s16_blob(&req->out, 0x02, op->info->out.blob));
struct smb2_getinfo *info;
struct smb2srv_getinfo_op *op;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x28, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x28, true);
SMB2SRV_TALLOC_IO_PTR(info, struct smb2_getinfo);
/* this overwrites req->io_ptr !*/
SMB2SRV_TALLOC_IO_PTR(op, struct smb2srv_getinfo_op);
SMB2SRV_CHECK_ASYNC_STATUS(op, struct smb2srv_setinfo_op);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x02, False, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x02, false, 0));
smb2srv_send_reply(req);
}
struct smb2_setinfo *info;
struct smb2srv_setinfo_op *op;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x20, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x20, true);
SMB2SRV_TALLOC_IO_PTR(info, struct smb2_setinfo);
/* this overwrites req->io_ptr !*/
SMB2SRV_TALLOC_IO_PTR(op, struct smb2srv_setinfo_op);
union smb_open *io;
SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_open);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x58, True, io->smb2.out.blob.length));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x58, true, io->smb2.out.blob.length));
SSVAL(req->out.body, 0x02, io->smb2.out.oplock_flags);
SIVAL(req->out.body, 0x04, io->smb2.out.create_action);
union smb_open *io;
DATA_BLOB blob;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x38, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x38, true);
SMB2SRV_TALLOC_IO_PTR(io, union smb_open);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_create_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
union smb_close *io;
SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_close);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x3C, False, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x3C, false, 0));
SSVAL(req->out.body, 0x02, io->smb2.out.flags);
SIVAL(req->out.body, 0x04, io->smb2.out._pad);
{
union smb_close *io;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x18, False);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x18, false);
SMB2SRV_TALLOC_IO_PTR(io, union smb_close);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_close_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
union smb_flush *io;
SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_flush);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x04, False, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x04, false, 0));
SSVAL(req->out.body, 0x02, 0);
union smb_flush *io;
uint16_t _pad;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x18, False);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x18, false);
SMB2SRV_TALLOC_IO_PTR(io, union smb_flush);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_flush_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
union smb_read *io;
SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_read);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, True, io->smb2.out.data.length));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, true, io->smb2.out.data.length));
/* TODO: avoid the memcpy */
SMB2SRV_CHECK(smb2_push_o16s32_blob(&req->out, 0x02, io->smb2.out.data));
{
union smb_read *io;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x30, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x30, true);
SMB2SRV_TALLOC_IO_PTR(io, union smb_read);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_read_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
union smb_write *io;
SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_write);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, True, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, true, 0));
SSVAL(req->out.body, 0x02, io->smb2.out._pad);
SIVAL(req->out.body, 0x04, io->smb2.out.nwritten);
{
union smb_write *io;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x30, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x30, true);
SMB2SRV_TALLOC_IO_PTR(io, union smb_write);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_write_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
union smb_lock *io;
SMB2SRV_CHECK_ASYNC_STATUS_ERR(io, union smb_lock);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x04, False, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x04, false, 0));
SSVAL(req->out.body, 0x02, io->smb2.out.unknown1);
{
union smb_lock *io;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x30, False);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x30, false);
SMB2SRV_TALLOC_IO_PTR(io, union smb_lock);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_lock_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
union smb_ioctl *io;
SMB2SRV_CHECK_ASYNC_STATUS_ERR(io, union smb_ioctl);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x30, True, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x30, true, 0));
SSVAL(req->out.body, 0x02, io->smb2.out._pad);
SIVAL(req->out.body, 0x04, io->smb2.out.function);
union smb_ioctl *io;
struct smb2_handle h;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x38, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x38, true);
SMB2SRV_TALLOC_IO_PTR(io, union smb_ioctl);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_ioctl_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
DATA_BLOB blob = data_blob(NULL, 0);
SMB2SRV_CHECK_ASYNC_STATUS(io, union smb_notify);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, True, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, true, 0));
#define MAX_BYTES_PER_CHAR 3
{
union smb_notify *io;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x20, False);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x20, false);
SMB2SRV_TALLOC_IO_PTR(io, union smb_notify);
SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_notify_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
};
/* callback function for SMB2 Find */
-static BOOL smb2srv_find_callback(void *private, const union smb_search_data *file)
+static bool smb2srv_find_callback(void *private, const union smb_search_data *file)
{
struct smb2srv_find_state *state = talloc_get_type(private, struct smb2srv_find_state);
struct smb2_find *info = state->info;
info->out.blob.length > info->in.max_response_size) {
/* restore the old length and tell the backend to stop */
smbsrv_blob_grow_data(state, &info->out.blob, old_length);
- return False;
+ return false;
}
state->last_entry_offset = old_length;
- return True;
+ return true;
}
static void smb2srv_find_send(struct ntvfs_request *ntvfs)
struct smb2srv_find_state *state;
SMB2SRV_CHECK_ASYNC_STATUS(state, struct smb2srv_find_state);
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, True, state->info->out.blob.length));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, true, state->info->out.blob.length));
if (state->info->out.blob.length > 0) {
SIVAL(state->info->out.blob.data + state->last_entry_offset, 0, 0);
struct smb2srv_find_state *state;
struct smb2_find *info;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x20, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x20, true);
SMB2SRV_TALLOC_IO_PTR(info, struct smb2_find);
/* this overwrites req->io_ptr !*/
SMB2SRV_TALLOC_IO_PTR(state, struct smb2srv_find_state);
return;
}
- status = smb2srv_setup_reply(req, 0x04, False, 0);
+ status = smb2srv_setup_reply(req, 0x04, false, 0);
if (!NT_STATUS_IS_OK(status)) {
smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
talloc_free(req);
return;
}
- status = smb2srv_setup_reply(req, 0x40, True, io->out.secblob.length);
+ status = smb2srv_setup_reply(req, 0x40, true, io->out.secblob.length);
if (!NT_STATUS_IS_OK(status)) {
smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
talloc_free(req);
}
NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint16_t body_fixed_size,
- BOOL body_dynamic_present, uint32_t body_dynamic_size)
+ bool body_dynamic_present, uint32_t body_dynamic_size)
{
uint32_t flags = 0x00000001;
uint32_t pid = IVAL(req->in.hdr, SMB2_HDR_PID);
return;
}
- status = smb2srv_setup_reply(req, 8, True, 0);
+ status = smb2srv_setup_reply(req, 8, true, 0);
if (!NT_STATUS_IS_OK(status)) {
smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
talloc_free(req);
smb_conn->negotiate.zone_offset = get_time_zone(time(NULL));
smb_conn->config.security = SEC_USER;
- smb_conn->config.nt_status_support = True;
+ smb_conn->config.nt_status_support = true;
status = smbsrv_init_sessions(smb_conn, UINT64_MAX);
NT_STATUS_NOT_OK_RETURN(status);
return;
}
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, True, io->smb2.out.secblob.length));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, true, io->smb2.out.secblob.length));
SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1, unknown1);
SBVAL(req->out.hdr, SMB2_HDR_UID, io->smb2.out.uid);
{
union smb_sesssetup *io;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x18, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x18, true);
SMB2SRV_TALLOC_IO_PTR(io, union smb_sesssetup);
io->smb2.level = RAW_SESSSETUP_SMB2;
return;
}
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x04, False, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x04, false, 0));
SSVAL(req->out.body, 0x02, 0);
{
uint16_t _pad;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x04, False);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x04, false);
_pad = SVAL(req->in.body, 0x02);
SSVAL(req->in.body, 0, 2);
- status = smb2srv_setup_reply(req, 0x18, False, 0);
+ status = smb2srv_setup_reply(req, 0x18, false, 0);
NT_STATUS_NOT_OK_RETURN(status);
SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1, 0x0000);
unknown1 = 0x0001;
}
- SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, False, 0));
+ SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x10, false, 0));
SIVAL(req->out.hdr, SMB2_HDR_TID, io->smb2.out.tid);
SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1,unknown1);
{
union smb_tcon *io;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x08, True);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x08, true);
SMB2SRV_TALLOC_IO_PTR(io, union smb_tcon);
io->smb2.level = RAW_TCON_SMB2;
return;
}
- status = smb2srv_setup_reply(req, 0x04, False, 0);
+ status = smb2srv_setup_reply(req, 0x04, false, 0);
if (!NT_STATUS_IS_OK(status)) {
smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
talloc_free(req);
{
uint16_t _pad;
- SMB2SRV_CHECK_BODY_SIZE(req, 0x04, False);
+ SMB2SRV_CHECK_BODY_SIZE(req, 0x04, false);
_pad = SVAL(req->in.body, 0x02);