1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

23 Commits

Author SHA1 Message Date
Gerald Carter
679e539655 r15712: BUG 3435: patch from volker to fix 'msdfs root = yes' in [homes]
(This used to be commit 466478f07e)
2007-10-10 11:17:09 -05:00
Jeremy Allison
e6676a9a69 r14387: Try and fix the coverity issues (#53, #54) with negative
sink by ensuring all uses of rpcstr_push are consistent
with a size_t dest size arg.
Jeremy.
(This used to be commit f65d7afe19)
2007-10-10 11:15:27 -05:00
Jeremy Allison
ed5095a490 r14336: Try and quieten coverity #53 and #54. Make it obvious
we're using -1 as a special size_t case by casting.
Jeremy.
(This used to be commit 415530bd08)
2007-10-10 11:15:25 -05:00
Jeremy Allison
894358a8f3 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.

The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :

 tmp = realloc(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :

 p = realloc(p, size)
 if (!p) {
    return error;
 }

which will leak the memory pointed to by p on realloc fail.

This commit (hopefully) fixes all these cases by moving to
a standard idiom of :

 p = SMB_REALLOC(p, size)
 if (!p) {
    return error;
 }

Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.

For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :

 tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).

It remains to be seen what this will do to our Coverity bug count :-).

Jeremy.
(This used to be commit 1d710d06a2)
2007-10-10 11:10:59 -05:00
Gerald Carter
0af1500fc0 r13316: Let the carnage begin....
Sync with trunk as off r13315
(This used to be commit 17e63ac4ed)
2007-10-10 11:06:23 -05:00
Jeremy Allison
fa4df827d0 r12194: Ensure that when we set a connection path we've canonicalized
the name (must be abolute - start with /, must not end in /,
must have ./ and ../ removed). Of course for realpath resolved
paths this won't be the case but for others we need this name
to be canonicalized. This name is going into the sharemode db
for #3303 so needs to be in a normalized format.
Jeremy.
(This used to be commit 22e3300911)
2007-10-10 11:05:48 -05:00
Jeremy Allison
6baec64a73 r11420: Fix issue pointed out by Dina Fine <dina@exanet.com>. We can
only tell at parse time from the wire if an incoming name
has wildcards or not. If it's a mangled name and we demangle
the demangled name may contain wildcard characters. Ensure
these are ignored.
Jeremy.
(This used to be commit 4cd8e2a96b)
2007-10-10 11:05:15 -05:00
Jeremy Allison
b67ba1e36b r9545: (Hopefully the last) fixes for DIR -> SMB_STRUCT_DIR.
Jeremy.
(This used to be commit b242f27860)
2007-10-10 11:01:12 -05:00
Jeremy Allison
78d6fa7277 r8963: Clean up the horrid "fake conn struct" part of MSDFS.
Jeremy.
(This used to be commit 14dd5ab632)
2007-10-10 11:00:23 -05:00
Jeremy Allison
abb81cfe26 r8959: Make msdfs code talloc based. Fix leaks.
Jeremy.
(This used to be commit 076023df8e)
2007-10-10 11:00:22 -05:00
Jeremy Allison
a4cdedcc08 r8950: Fix one more mem leak found by Gunther.
Jeremy.
(This used to be commit 547c6ee0a9)
2007-10-10 11:00:22 -05:00
Jeremy Allison
dada62cf82 r8948: Fix valgrind bad free bug found by Gunther.
Jeremy.
(This used to be commit ff291f4c97)
2007-10-10 11:00:22 -05:00
Gerald Carter
9365669a59 r8697: BUG 2908: make sure to allow for the trailing NULL
(This used to be commit 3b505a8243)
2007-10-10 11:00:15 -05:00
Jeremy Allison
bf547ff1ad r7981: MS-DFS tidyup patches from James Peach <jpeach@sgi.com>.
Looking forward to the day he can commit these himself :-).
Jeremy.
(This used to be commit 12ff297829)
2007-10-10 10:58:06 -05:00
Jeremy Allison
ff7e5c2673 r7893: Add in the extra parameters to opendir() to fix the large directory/insane app
problem. Rev vfs version. Doesn't change the normal codepath.
Jeremy.
(This used to be commit 0f03a6bdcd)
2007-10-10 10:58:02 -05:00
Gerald Carter
1253a174f3 r6242: after talking to jeremy, we can actually consolidate
the 2 BOOL flags in dfs_redirect() down to one since
they both are used in essentially the same context
(from what we can tell).

Tested Win98SE, WinXP sp 1 & 2, Win2k3 sp1, and WIn2k Sp4.
All dfs operations still seem to work.
(This used to be commit 59ffacf59c)
2007-10-10 10:56:31 -05:00
Gerald Carter
b751f95a25 r6237: fix my breakage of WinXP sp2 msdfs support.
We did need the special case for RESOLVE_DFSPATH
in the findfirst() code.

Jeremy, please verify I haven't broken the allow_wcard
code you added to resolve_dfs_path()
(This used to be commit 29983398e2)
2007-10-10 10:56:31 -05:00
Jeremy Allison
a5433c4bf7 r6053: Fixup dfs path with the new wildcard parser code split out.
Jeremy.
(This used to be commit e831cef618)
2007-10-10 10:56:19 -05:00
Jeremy Allison
27b84e5e55 r6048: Split out the check_path_syntax into a findfirst/next/wildcard version.
The semantics are different with wildcards.
Jeremy.
(This used to be commit f8b67159fc)
2007-10-10 10:56:18 -05:00
Gerald Carter
c1b9243c28 r5165: BUG 2295: always use get_local_machine_name() rather than digging in the gloval variable 'local_machine'
(This used to be commit 6a6e4af46a)
2007-10-10 10:55:31 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
fddef6fc20 r1115: Fix for #1427. Catch bad path errors at the right point. Ensure all
our pathname parsing is consistent.
Jeremy.
(This used to be commit 5e8237e306)
2007-10-10 10:51:56 -05:00
Stefan Metzmacher
9b4e6c7ea6 r410: merge tpot's changeset 353 from trunk:
Move msdfs.c into the source/smbd directory and remove source/msdfs.

metze
(This used to be commit 88e6e6d29c)
2007-10-10 10:51:22 -05:00