summaryrefslogtreecommitdiff
path: root/source3/smbd/msdfs.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-4/+2
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 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r13316: Let the carnage begin....Gerald Carter1-1/+7
Sync with trunk as off r13315 (This used to be commit 17e63ac4ed8325c0d44fe62b2442449f3298559f)
2007-10-10r12194: Ensure that when we set a connection path we've canonicalizedJeremy Allison1-1/+1
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 22e3300911809692b595f49e87d91e3111923e6a)
2007-10-10r11420: Fix issue pointed out by Dina Fine <dina@exanet.com>. We canJeremy Allison1-1/+2
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 4cd8e2a96b98ff711905e8c6f416b22440c16062)
2007-10-10r9545: (Hopefully the last) fixes for DIR -> SMB_STRUCT_DIR.Jeremy Allison1-1/+1
Jeremy. (This used to be commit b242f278601e1a23c9116009482e802326d418f7)
2007-10-10r8963: Clean up the horrid "fake conn struct" part of MSDFS.Jeremy Allison1-11/+19
Jeremy. (This used to be commit 14dd5ab632ff9abb9582e6484187c6ee1573cdd6)
2007-10-10r8959: Make msdfs code talloc based. Fix leaks.Jeremy Allison1-134/+195
Jeremy. (This used to be commit 076023df8ea7c0f03baf8102e55d347e05542c7b)
2007-10-10r8950: Fix one more mem leak found by Gunther.Jeremy Allison1-4/+4
Jeremy. (This used to be commit 547c6ee0a965b425719cdb834dd5d68a3a3e7117)
2007-10-10r8948: Fix valgrind bad free bug found by Gunther.Jeremy Allison1-2/+6
Jeremy. (This used to be commit ff291f4c97b76fb3e9b71a07752ca68c23011273)
2007-10-10r8697: BUG 2908: make sure to allow for the trailing NULLGerald Carter1-2/+1
(This used to be commit 3b505a824365222352be6a5ad2fb26586415a7a3)
2007-10-10r7981: MS-DFS tidyup patches from James Peach <jpeach@sgi.com>.Jeremy Allison1-25/+36
Looking forward to the day he can commit these himself :-). Jeremy. (This used to be commit 12ff2978295a84fe6177af129c495a0021befacc)
2007-10-10r7893: Add in the extra parameters to opendir() to fix the large ↵Jeremy Allison1-1/+1
directory/insane app problem. Rev vfs version. Doesn't change the normal codepath. Jeremy. (This used to be commit 0f03a6bdcdbdf60da81e0aeffa84ac6e48fc6a04)
2007-10-10r6242: after talking to jeremy, we can actually consolidateGerald Carter1-8/+10
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 59ffacf59c98f2f8277d76ec22712e438fd40618)
2007-10-10r6237: fix my breakage of WinXP sp2 msdfs support.Gerald Carter1-5/+16
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 29983398e2f7f1dc609d4d981e20f594918243bb)
2007-10-10r6053: Fixup dfs path with the new wildcard parser code split out.Jeremy Allison1-22/+17
Jeremy. (This used to be commit e831cef618d55c362e8d3a8a4c2b9f2ed7d4d7bd)
2007-10-10r6048: Split out the check_path_syntax into a findfirst/next/wildcard version.Jeremy Allison1-2/+2
The semantics are different with wildcards. Jeremy. (This used to be commit f8b67159fc1c8224a7caf41409b2654846f34a2d)
2007-10-10r5165: BUG 2295: always use get_local_machine_name() rather than digging in ↵Gerald Carter1-4/+3
the gloval variable 'local_machine' (This used to be commit 6a6e4af46a5c0a693a3dd9d558a4d1c1e5d72d95)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-7/+6
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 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r1115: Fix for #1427. Catch bad path errors at the right point. Ensure allJeremy Allison1-2/+2
our pathname parsing is consistent. Jeremy. (This used to be commit 5e8237e306f0bb0e492f10fb6487938132899384)
2007-10-10r410: merge tpot's changeset 353 from trunk:Stefan Metzmacher1-0/+1019
Move msdfs.c into the source/smbd directory and remove source/msdfs. metze (This used to be commit 88e6e6d29ca14e0cddbc1df611051a96568dc0c9)