[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Wed Oct 26 09:54:03 MDT 2011
The branch, master has been updated
via 1d53109 s3:libsmb: make use of map_nt_error_from_unix_common() in clitrans.c
via 9a3e596 s3:libsmb: avoid using smb_flg2 in cli_trans.c
via f3166e7 s3:libsmb: replace smb_size - 4 with MIN_SMB_SIZE in clitrans.c
via 7221ce9 s3:libsmb: use 'tevent_' instead of 'event_' in clitrans.c
via f8f7f4e s3:libsmb: make use of smb_buffer_oob() in clitrans.c
via 431b476 s3:libsmb: use smb_len_nbt() in clitrans.c
via 7682f61 s3:include: implement trans_oob() as wrapper to smb_buffer_oob()
via 5f520e7 libcli/smb: add smb_buffer_oob() helper
from d66d7c2 s3-netapi: remove pointless use_memory_krb5_ccache.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 1d531090bc07b0f83b9b80239c202a87f0cbc2ef
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 15:47:21 2011 +0200
s3:libsmb: make use of map_nt_error_from_unix_common() in clitrans.c
metze
Autobuild-User: Stefan Metzmacher <metze at samba.org>
Autobuild-Date: Wed Oct 26 17:53:15 CEST 2011 on sn-devel-104
commit 9a3e5965b468bbaf432991ab0719131c5e293eb2
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 15:46:33 2011 +0200
s3:libsmb: avoid using smb_flg2 in cli_trans.c
metze
commit f3166e75ef0cfbeafb748dd601af6391def8503a
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 15:44:52 2011 +0200
s3:libsmb: replace smb_size - 4 with MIN_SMB_SIZE in clitrans.c
metze
commit 7221ce9bd5b0a3dde9d32d403cce465b642289fb
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 15:43:08 2011 +0200
s3:libsmb: use 'tevent_' instead of 'event_' in clitrans.c
metze
commit f8f7f4e3abb3190e6608379c6d2fc3b4eb8532c1
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 15:41:34 2011 +0200
s3:libsmb: make use of smb_buffer_oob() in clitrans.c
metze
commit 431b47686850c624225c015f35dd72606e092ce9
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 15:41:02 2011 +0200
s3:libsmb: use smb_len_nbt() in clitrans.c
metze
commit 7682f61e1003c6e43ba46013eb45248d676c4476
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 14:23:48 2011 +0200
s3:include: implement trans_oob() as wrapper to smb_buffer_oob()
metze
commit 5f520e771786d416d55c8d0a84e411c73fc5396c
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Oct 26 14:20:53 2011 +0200
libcli/smb: add smb_buffer_oob() helper
A copy of trans_oob().
metze
-----------------------------------------------------------------------
Summary of changes:
libcli/smb/smb_util.h | 2 ++
libcli/smb/util.c | 12 ++++++++++++
source3/include/proto.h | 1 -
source3/include/smb_macros.h | 3 +++
source3/lib/util.c | 19 -------------------
source3/libsmb/clitrans.c | 24 +++++++++++++-----------
source3/libsmb/proto.h | 2 +-
7 files changed, 31 insertions(+), 32 deletions(-)
Changeset truncated at 500 lines:
diff --git a/libcli/smb/smb_util.h b/libcli/smb/smb_util.h
index b5a0652..322ecb6 100644
--- a/libcli/smb/smb_util.h
+++ b/libcli/smb/smb_util.h
@@ -23,3 +23,5 @@ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib);
uint32_t unix_perms_to_wire(mode_t perms);
mode_t wire_perms_to_unix(uint32_t perms);
mode_t unix_filetype_from_wire(uint32_t wire_type);
+
+bool smb_buffer_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
diff --git a/libcli/smb/util.c b/libcli/smb/util.c
index b8c3dc5..b02ae00 100644
--- a/libcli/smb/util.c
+++ b/libcli/smb/util.c
@@ -163,3 +163,15 @@ mode_t unix_filetype_from_wire(uint32_t wire_type)
}
}
+bool smb_buffer_oob(uint32_t bufsize, uint32_t offset, uint32_t length)
+{
+ if ((offset + length < offset) || (offset + length < length)) {
+ /* wrap */
+ return true;
+ }
+ if ((offset > bufsize) || (offset + length > bufsize)) {
+ /* overflow */
+ return true;
+ }
+ return false;
+}
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3002fc3..6ff2854 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -567,7 +567,6 @@ struct server_id interpret_pid(const char *pid_string);
char *procid_str_static(const struct server_id *pid);
bool procid_valid(const struct server_id *pid);
bool procid_is_local(const struct server_id *pid);
-bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
bool is_offset_safe(const char *buf_base, size_t buf_len, char *ptr, size_t off);
char *get_safe_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
char *get_safe_str_ptr(const char *buf_base, size_t buf_len, char *ptr, size_t off);
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 79d2f68..ef4b9bf 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -301,4 +301,7 @@ extern const char toupper_ascii_fast_table[];
#define toupper_ascii_fast(c) toupper_ascii_fast_table[(unsigned int)(c)];
#endif
+#define trans_oob(bufsize, offset, length) \
+ smb_buffer_oob(bufsize, offset, length)
+
#endif /* _SMB_MACROS_H */
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 8157c0f..f547ec2 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2016,25 +2016,6 @@ bool procid_is_local(const struct server_id *pid)
}
/****************************************************************
- Check if offset/length fit into bufsize. Should probably be
- merged with is_offset_safe, but this would require a rewrite
- of lanman.c. Later :-)
-****************************************************************/
-
-bool trans_oob(uint32_t bufsize, uint32_t offset, uint32_t length)
-{
- if ((offset + length < offset) || (offset + length < length)) {
- /* wrap */
- return true;
- }
- if ((offset > bufsize) || (offset + length > bufsize)) {
- /* overflow */
- return true;
- }
- return false;
-}
-
-/****************************************************************
Check if an offset into a buffer is safe.
If this returns True it's safe to indirect into the byte at
pointer ptr+off.
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index 91157b6..4bc9f4a 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -29,7 +29,7 @@ struct trans_recvblob {
struct cli_trans_state {
struct cli_state *cli;
- struct event_context *ev;
+ struct tevent_context *ev;
uint8_t cmd;
uint16_t mid;
const char *pipe_name;
@@ -140,10 +140,10 @@ static NTSTATUS cli_pull_trans(uint8_t *inbuf,
* length. Likewise for param_ofs/param_disp.
*/
- if (trans_oob(smb_len(inbuf), param_ofs, *pnum_param)
- || trans_oob(*ptotal_param, *pparam_disp, *pnum_param)
- || trans_oob(smb_len(inbuf), data_ofs, *pnum_data)
- || trans_oob(*ptotal_data, *pdata_disp, *pnum_data)) {
+ if (smb_buffer_oob(smb_len_nbt(inbuf), param_ofs, *pnum_param)
+ || smb_buffer_oob(*ptotal_param, *pparam_disp, *pnum_param)
+ || smb_buffer_oob(smb_len_nbt(inbuf), data_ofs, *pnum_data)
+ || smb_buffer_oob(*ptotal_data, *pdata_disp, *pnum_data)) {
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
@@ -205,7 +205,7 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
cmd += 1;
}
- param_offset = smb_size - 4;
+ param_offset = MIN_SMB_SIZE;
switch (cmd) {
case SMBtrans:
@@ -375,7 +375,7 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
static void cli_trans_done(struct tevent_req *subreq);
struct tevent_req *cli_trans_send(
- TALLOC_CTX *mem_ctx, struct event_context *ev,
+ TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct cli_state *cli, uint8_t cmd,
const char *pipe_name, uint16_t fid, uint16_t function, int flags,
uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
@@ -490,6 +490,7 @@ static void cli_trans_done(struct tevent_req *subreq)
req, struct cli_trans_state);
NTSTATUS status;
bool sent_all;
+ const uint8_t *inhdr;
uint8_t wct;
uint16_t *vwv;
uint32_t num_bytes;
@@ -521,6 +522,7 @@ static void cli_trans_done(struct tevent_req *subreq)
if (NT_STATUS_IS_ERR(status)) {
goto fail;
}
+ inhdr = inbuf + NBT_HDR_SIZE;
sent_all = ((state->param_sent == state->num_param)
&& (state->data_sent == state->num_data));
@@ -579,7 +581,7 @@ static void cli_trans_done(struct tevent_req *subreq)
if ((state->rparam.total == state->rparam.received)
&& (state->rdata.total == state->rdata.received)) {
- state->recv_flags2 = SVAL(inbuf, smb_flg2);
+ state->recv_flags2 = SVAL(inhdr, HDR_FLG2);
cli_trans_cleanup_primary(state);
tevent_req_done(req);
return;
@@ -723,7 +725,7 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
uint8_t **rdata, uint32_t min_rdata, uint32_t *num_rdata)
{
TALLOC_CTX *frame = talloc_stackframe();
- struct event_context *ev;
+ struct tevent_context *ev;
struct tevent_req *req;
NTSTATUS status = NT_STATUS_OK;
@@ -735,7 +737,7 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
goto fail;
}
- ev = event_context_init(frame);
+ ev = tevent_context_init(frame);
if (ev == NULL) {
status = NT_STATUS_NO_MEMORY;
goto fail;
@@ -752,7 +754,7 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
}
if (!tevent_req_poll(req, ev)) {
- status = map_nt_error_from_unix(errno);
+ status = map_nt_error_from_unix_common(errno);
goto fail;
}
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index ffb2ca0..e1f2c3e 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -822,7 +822,7 @@ size_t clistr_pull_talloc(TALLOC_CTX *ctx,
/* The following definitions come from libsmb/clitrans.c */
struct tevent_req *cli_trans_send(
- TALLOC_CTX *mem_ctx, struct event_context *ev,
+ TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct cli_state *cli, uint8_t cmd,
const char *pipe_name, uint16_t fid, uint16_t function, int flags,
uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
--
Samba Shared Repository
More information about the samba-cvs
mailing list