diff options
Diffstat (limited to 'source4/smb_server/smb2')
-rw-r--r-- | source4/smb_server/smb2/fileinfo.c | 8 | ||||
-rw-r--r-- | source4/smb_server/smb2/fileio.c | 32 | ||||
-rw-r--r-- | source4/smb_server/smb2/find.c | 10 | ||||
-rw-r--r-- | source4/smb_server/smb2/keepalive.c | 2 | ||||
-rw-r--r-- | source4/smb_server/smb2/negprot.c | 7 | ||||
-rw-r--r-- | source4/smb_server/smb2/receive.c | 12 | ||||
-rw-r--r-- | source4/smb_server/smb2/sesssetup.c | 8 | ||||
-rw-r--r-- | source4/smb_server/smb2/tcon.c | 13 |
8 files changed, 48 insertions, 44 deletions
diff --git a/source4/smb_server/smb2/fileinfo.c b/source4/smb_server/smb2/fileinfo.c index 4f4b790702..41b31f586f 100644 --- a/source4/smb_server/smb2/fileinfo.c +++ b/source4/smb_server/smb2/fileinfo.c @@ -53,7 +53,7 @@ static void smb2srv_getinfo_send(struct ntvfs_request *ntvfs) 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)); @@ -205,7 +205,7 @@ void smb2srv_getinfo_recv(struct smb2srv_request *req) 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); @@ -247,7 +247,7 @@ static void smb2srv_setinfo_send(struct ntvfs_request *ntvfs) 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); } @@ -349,7 +349,7 @@ void smb2srv_setinfo_recv(struct smb2srv_request *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); diff --git a/source4/smb_server/smb2/fileio.c b/source4/smb_server/smb2/fileio.c index 3e4d7ffceb..47b5dbe60c 100644 --- a/source4/smb_server/smb2/fileio.c +++ b/source4/smb_server/smb2/fileio.c @@ -31,7 +31,7 @@ static void smb2srv_create_send(struct ntvfs_request *ntvfs) 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); @@ -58,7 +58,7 @@ void smb2srv_create_recv(struct smb2srv_request *req) 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); @@ -88,7 +88,7 @@ static void smb2srv_close_send(struct ntvfs_request *ntvfs) 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); @@ -107,7 +107,7 @@ void smb2srv_close_recv(struct smb2srv_request *req) { 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); @@ -126,7 +126,7 @@ static void smb2srv_flush_send(struct ntvfs_request *ntvfs) 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); @@ -138,7 +138,7 @@ void smb2srv_flush_recv(struct smb2srv_request *req) 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); @@ -157,7 +157,7 @@ static void smb2srv_read_send(struct ntvfs_request *ntvfs) 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)); @@ -170,7 +170,7 @@ void smb2srv_read_recv(struct smb2srv_request *req) { 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); @@ -199,7 +199,7 @@ static void smb2srv_write_send(struct ntvfs_request *ntvfs) 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); @@ -212,7 +212,7 @@ void smb2srv_write_recv(struct smb2srv_request *req) { 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); @@ -234,7 +234,7 @@ static void smb2srv_lock_send(struct ntvfs_request *ntvfs) 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); @@ -245,7 +245,7 @@ void smb2srv_lock_recv(struct smb2srv_request *req) { 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); @@ -269,7 +269,7 @@ static void smb2srv_ioctl_send(struct ntvfs_request *ntvfs) 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); @@ -294,7 +294,7 @@ void smb2srv_ioctl_recv(struct smb2srv_request *req) 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); @@ -330,7 +330,7 @@ static void smb2srv_notify_send(struct ntvfs_request *ntvfs) 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 @@ -384,7 +384,7 @@ void smb2srv_notify_recv(struct smb2srv_request *req) { 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); diff --git a/source4/smb_server/smb2/find.c b/source4/smb_server/smb2/find.c index 9ab62c35f5..c594adf7a0 100644 --- a/source4/smb_server/smb2/find.c +++ b/source4/smb_server/smb2/find.c @@ -40,7 +40,7 @@ struct smb2srv_find_state { }; /* 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; @@ -54,12 +54,12 @@ static BOOL smb2srv_find_callback(void *private, const union smb_search_data *fi 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) @@ -68,7 +68,7 @@ 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); @@ -141,7 +141,7 @@ void smb2srv_find_recv(struct smb2srv_request *req) 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); diff --git a/source4/smb_server/smb2/keepalive.c b/source4/smb_server/smb2/keepalive.c index ed4903ec29..f40bcc485c 100644 --- a/source4/smb_server/smb2/keepalive.c +++ b/source4/smb_server/smb2/keepalive.c @@ -38,7 +38,7 @@ static void smb2srv_keepalive_send(struct smb2srv_request *req) 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); diff --git a/source4/smb_server/smb2/negprot.c b/source4/smb_server/smb2/negprot.c index 2aca91adf8..78c17aa03e 100644 --- a/source4/smb_server/smb2/negprot.c +++ b/source4/smb_server/smb2/negprot.c @@ -27,6 +27,7 @@ #include "smb_server/service_smb_proto.h" #include "smb_server/smb2/smb2_server.h" #include "smbd/service_stream.h" +#include "param/param.h" static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB *_blob) { @@ -52,7 +53,7 @@ static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB * return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(server_credentials); + cli_credentials_set_conf(server_credentials, global_loadparm); nt_status = cli_credentials_set_machine_account(server_credentials); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(10, ("Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(nt_status))); @@ -121,7 +122,7 @@ static void smb2srv_negprot_send(struct smb2srv_request *req, struct smb2_negpro 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); @@ -196,7 +197,7 @@ void smb2srv_reply_smb_negprot(struct smbsrv_request *smb_req) req->in.size = NBT_HDR_SIZE+SMB2_HDR_BODY+body_fixed_size; req->in.allocated = req->in.size; - req->in.buffer = talloc_size(req, req->in.allocated); + req->in.buffer = talloc_array(req, uint8_t, req->in.allocated); if (!req->in.buffer) goto nomem; req->in.hdr = req->in.buffer + NBT_HDR_SIZE; req->in.body = req->in.hdr + SMB2_HDR_BODY; diff --git a/source4/smb_server/smb2/receive.c b/source4/smb_server/smb2/receive.c index a8c0e6f786..a440c33dc0 100644 --- a/source4/smb_server/smb2/receive.c +++ b/source4/smb_server/smb2/receive.c @@ -28,6 +28,7 @@ #include "smbd/service_stream.h" #include "lib/stream/packet.h" #include "ntvfs/ntvfs.h" +#include "param/param.h" static int smb2srv_request_destructor(struct smb2srv_request *req) { @@ -58,7 +59,7 @@ struct smb2srv_request *smb2srv_init_request(struct smbsrv_connection *smb_conn) } 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); @@ -81,7 +82,8 @@ NTSTATUS smb2srv_setup_reply(struct smb2srv_request *req, uint16_t body_fixed_si req->out.size = SMB2_HDR_BODY+NBT_HDR_SIZE+body_fixed_size; req->out.allocated = req->out.size + body_dynamic_size; - req->out.buffer = talloc_size(req, req->out.allocated); + req->out.buffer = talloc_array(req, uint8_t, + req->out.allocated); NT_STATUS_HAVE_NO_MEMORY(req->out.buffer); req->out.hdr = req->out.buffer + NBT_HDR_SIZE; @@ -235,7 +237,7 @@ void smb2srv_send_error(struct smb2srv_request *req, NTSTATUS error) 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); @@ -514,12 +516,12 @@ NTSTATUS smbsrv_init_smb2_connection(struct smbsrv_connection *smb_conn) /* this is the size that w2k uses, and it appears to be important for good performance */ - smb_conn->negotiate.max_recv = lp_max_xmit(); + smb_conn->negotiate.max_recv = lp_max_xmit(global_loadparm); 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); diff --git a/source4/smb_server/smb2/sesssetup.c b/source4/smb_server/smb2/sesssetup.c index 76f89d43d2..7d72193e6e 100644 --- a/source4/smb_server/smb2/sesssetup.c +++ b/source4/smb_server/smb2/sesssetup.c @@ -42,7 +42,7 @@ static void smb2srv_sesssetup_send(struct smb2srv_request *req, union smb_sessse 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); @@ -187,7 +187,7 @@ void smb2srv_sesssetup_recv(struct smb2srv_request *req) { 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; @@ -215,7 +215,7 @@ static void smb2srv_logoff_send(struct smb2srv_request *req) 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); @@ -226,7 +226,7 @@ void smb2srv_logoff_recv(struct smb2srv_request *req) { uint16_t _pad; - SMB2SRV_CHECK_BODY_SIZE(req, 0x04, False); + SMB2SRV_CHECK_BODY_SIZE(req, 0x04, false); _pad = SVAL(req->in.body, 0x02); diff --git a/source4/smb_server/smb2/tcon.c b/source4/smb_server/smb2/tcon.c index b476e97168..572d3b5bf5 100644 --- a/source4/smb_server/smb2/tcon.c +++ b/source4/smb_server/smb2/tcon.c @@ -41,7 +41,8 @@ static NTSTATUS smb2srv_send_oplock_break(void *p, struct ntvfs_handle *h, uint8 req = smb2srv_init_request(handle->tcon->smb_conn); NT_STATUS_HAVE_NO_MEMORY(req); - req->in.buffer = talloc_size(req, NBT_HDR_SIZE + SMB2_MIN_SIZE); + req->in.buffer = talloc_array(req, uint8_t, + NBT_HDR_SIZE + SMB2_MIN_SIZE); NT_STATUS_HAVE_NO_MEMORY(req->in.buffer); req->in.size = NBT_HDR_SIZE + SMB2_MIN_SIZE; req->in.allocated = req->in.size; @@ -69,7 +70,7 @@ static NTSTATUS smb2srv_send_oplock_break(void *p, struct ntvfs_handle *h, uint8 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); @@ -371,7 +372,7 @@ static void smb2srv_tcon_send(struct smb2srv_request *req, union smb_tcon *io) 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); @@ -388,7 +389,7 @@ void smb2srv_tcon_recv(struct smb2srv_request *req) { 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; @@ -421,7 +422,7 @@ static void smb2srv_tdis_send(struct smb2srv_request *req) 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); @@ -437,7 +438,7 @@ void smb2srv_tdis_recv(struct smb2srv_request *req) { uint16_t _pad; - SMB2SRV_CHECK_BODY_SIZE(req, 0x04, False); + SMB2SRV_CHECK_BODY_SIZE(req, 0x04, false); _pad = SVAL(req->in.body, 0x02); |