summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-03-22 15:30:43 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-03-23 12:49:39 +1100
commit1923b78209aaa2aa926dedd19e6c97fb449c48c8 (patch)
tree534acb7efe0910616511dd645b86a4b7cd5422a7 /source3/libsmb
parentcd4306b01e4097b76777a9a85cc226e8b0e8f613 (diff)
downloadsamba-1923b78209aaa2aa926dedd19e6c97fb449c48c8.tar.gz
samba-1923b78209aaa2aa926dedd19e6c97fb449c48c8.tar.bz2
samba-1923b78209aaa2aa926dedd19e6c97fb449c48c8.zip
s3-lib Remove the clobber_region() code.
This code wrote to the full buffer in fstrcpy(), pstrcpy() and other fixed-length string manipulation functions. The hope of this code was to find out at run time if we were mixing up pstring and fstring etc, and to record where this came from. It has a runtime performance impact (particularly if compiled with --enable-developer). It is being removed because of the complexity it adds, and the distinct lack of bugs that this complexity has been credited in finding. The macro-based compile-time checking of string sizes remains. Andrew Bartlett
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clientgen.c7
-rw-r--r--source3/libsmb/clistr.c27
2 files changed, 8 insertions, 26 deletions
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 096dd2f3fd..7eb10c4f1d 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -615,13 +615,6 @@ struct cli_state *cli_initialise_ex(int signing_state)
memset(cli->outbuf, 0, cli->bufsize);
memset(cli->inbuf, 0, cli->bufsize);
-
-#if defined(DEVELOPER)
- /* just because we over-allocate, doesn't mean it's right to use it */
- clobber_region(__FUNCTION__, __LINE__, cli->outbuf+cli->bufsize, SAFETY_MARGIN);
- clobber_region(__FUNCTION__, __LINE__, cli->inbuf+cli->bufsize, SAFETY_MARGIN);
-#endif
-
/* initialise signing */
cli->signing_state = smb_signing_init(cli,
allow_smb_signing,
diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
index aeb0bc64c8..8856e03dd0 100644
--- a/source3/libsmb/clistr.c
+++ b/source3/libsmb/clistr.c
@@ -20,9 +20,7 @@
#include "includes.h"
-size_t clistr_push_fn(const char *function,
- unsigned int line,
- struct cli_state *cli,
+size_t clistr_push_fn(struct cli_state *cli,
void *dest,
const char *src,
int dest_len,
@@ -32,42 +30,35 @@ size_t clistr_push_fn(const char *function,
if (dest_len == -1) {
if (((ptrdiff_t)dest < (ptrdiff_t)cli->outbuf) || (buf_used > cli->bufsize)) {
DEBUG(0, ("Pushing string of 'unlimited' length into non-SMB buffer!\n"));
- return push_string_base(function, line,
- cli->outbuf,
+ return push_string_base(cli->outbuf,
(uint16_t)(cli_ucs2(cli) ? FLAGS2_UNICODE_STRINGS : 0),
dest, src, -1, flags);
}
- return push_string_base(function, line,
- cli->outbuf,
+ return push_string_base(cli->outbuf,
(uint16_t)(cli_ucs2(cli) ? FLAGS2_UNICODE_STRINGS : 0),
dest, src, cli->bufsize - buf_used,
flags);
}
/* 'normal' push into size-specified buffer */
- return push_string_base(function, line,
- cli->outbuf,
+ return push_string_base(cli->outbuf,
(uint16_t)(cli_ucs2(cli) ? FLAGS2_UNICODE_STRINGS : 0),
dest, src, dest_len, flags);
}
-size_t clistr_pull_fn(const char *function,
- unsigned int line,
- const char *inbuf,
+size_t clistr_pull_fn(const char *inbuf,
char *dest,
const void *src,
int dest_len,
int src_len,
int flags)
{
- return pull_string_fn(function, line, inbuf,
+ return pull_string_fn(inbuf,
SVAL(inbuf, smb_flg2), dest, src, dest_len,
src_len, flags);
}
-size_t clistr_pull_talloc_fn(const char *function,
- unsigned int line,
- TALLOC_CTX *ctx,
+size_t clistr_pull_talloc_fn(TALLOC_CTX *ctx,
const char *base,
uint16_t flags2,
char **pp_dest,
@@ -75,9 +66,7 @@ size_t clistr_pull_talloc_fn(const char *function,
int src_len,
int flags)
{
- return pull_string_talloc_fn(function,
- line,
- ctx,
+ return pull_string_talloc_fn(ctx,
base,
flags2,
pp_dest,