summaryrefslogtreecommitdiff
path: root/source3/smbd/msdfs.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r24253: From Jan Martin <Jan.Martin@rwedea.com>.Jeremy Allison1-0/+8
---------------------------------------------------------- In rare cases, Samba 3.0.25b shows directory contents at the wrong position in the file tree when displaying a subdirectory of a DFS link. The problem occurs whenever Windows XP asks for a DFS referral for a subdirectory of a DFS link with a trailing backslash. Windows does not do this very often, but we saw it several times per day on our central DFS server. smbd/msdfs.c, dfs_path_lookup() does the following with the requested path: - in line 390, the local copy 'localpath' is 'unix_convert'ed; the trailing backslash is removed inside unix_convert - in lines 417-20, 'dfspath' (another copy of the requested path) is mangled another way without removing trailing backslashes That's why the following loop (lines 435-461) that is meant to synchronously cut off the last path component from both strings until it comes to a DFS link, does not handle both strings the same. When the original path ended with a backslash, 'canon_dfspath' has always one component more than 'localpath', so that *consumedcntp gets too big in line 446. This value is reported to the client. ---------------------------------------------------------- Bug #4860. Jeremy. (This used to be commit 42d1c6713a56197ca8dfebf74eb0d483102148f7)
2007-10-10r23843: Fix bug #4777, reported by Bill Marshall <bmarsh@us.ibm.com>.Jeremy Allison1-1/+2
Doing a DFS traverse through a deep link could fail (not using explorer). Jeremy. (This used to be commit cd93f0cb00207098014e41e0ba16210cb150b895)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23522: Save us a kilobyte stack space in a hot code path: I can't see a reasonVolker Lendecke1-3/+5
why check_path_syntax should not be able to run in-line. The destination pointer either walks side by side with the source pointer or is decremented. So as far as I can see s>=d is true throughout the whole routine. Jeremy, I'm checking this only into 3_0 for now. Please review and ack or directly merge this to 3_0_26. Thanks, Volker (This used to be commit 34a13c82a3b72d6900614b57c58fbaefeeca8fa7)
2007-10-10r22590: Make TALLOC_ARRAY consistent across all uses.Jeremy Allison1-4/+8
That should be it.... Jeremy. (This used to be commit 603233a98bbf65467c8b4f04719d771c70b3b4c9)
2007-10-10r22064: Fix the DFS code to work better with Vista clients. AllowJeremy Allison1-32/+36
"host msdfs = true" to be set in the [global] section and allow Vista to see shares with "msdfs root = yes" and "msdfs root = no" off the same server. Down to an error message really :-). Jeremy. (This used to be commit 1a0f69bb21fd03a18514dfc93c84568708144e28)
2007-10-10r22001: change prototype of dump_data(), so that it takes unsigned char * now,Stefan Metzmacher1-3/+3
which matches what samba4 has. also fix all the callers to prevent compiler warnings metze (This used to be commit fa322f0cc9c26a9537ba3f0a7d4e4a25941317e7)
2007-10-10r21961: Repair bug introduced by rev. 21960.Jeremy Allison1-0/+6
We need to do the initial strtok to set up the internal state. Jeremy. (This used to be commit 8c7042b4192cb33988c1bbccdd4a80bb99fd0118)
2007-10-10r21960: Fix bugs 4463,4464,4465,4466. Thanks Jason :-)Volker Lendecke1-2/+0
(This used to be commit a2e27c443101a59ef3429a55e049af3ebd5ec1f2)
2007-10-10r21942: Hoist by our own petard :-). Older smbclient binariesJeremy Allison1-2/+2
were not able to connect to the rewritten dfs code as they set the dfs flag bit but then send local paths. Now that our dfs code is a *lot* more robust in detecting this sort of braindamage we can just call into it directly on getting a DFS flag and let the parser sort it out without having to check it's actually connecting to a dfs enabled share (I'm proud of this code :-). Jeremy. (This used to be commit 8c4d929c76ba56d59f651c57d1feb37d2916a436)
2007-10-10r21803: Missed part of patch to make self-referrals work.Jeremy Allison1-0/+1
Jeremy. (This used to be commit b1fa55e513f506bfb58687b692e1507732b00fbc)
2007-10-10r21800: Check-in the DFS rewrite. I am still testing this but itJeremy Allison1-370/+459
works from smbclient and Windows, and I am promising to support and fix both client and server code moving forward. Still need to test the RPC admin support but I haven't changed that code. Jeremy. (This used to be commit 7a7862c01d07796ef206b255c676ad7dc2cc42fc)
2007-10-10r21759: Fix the same bug in a more elegant way, strrchr_mJeremy Allison1-7/+12
is an expensive call.... Jeremy. (This used to be commit 321a136dbce1a0532f123ea79ecb91f987b9a286)
2007-10-10r21758: Fix a very specific dfs bug when passing in POSIXJeremy Allison1-3/+6
pathnames. When we're working out how much we've consumed we need to backtrack by either a '/' or '\\' component, as both are valid separators. Jeremy. (This used to be commit 1722ea20db2d531f92fb18fa5783f09258727c64)
2007-10-10r21756: An invarient the dfs code depended on for POSIX pathsJeremy Allison1-4/+1
is no longer true, so fix it. Jeremy. (This used to be commit 698159c0ee8d9adb3b56231c0c8ad2ddebd5be11)
2007-10-10r21754: Volker is completely correct. There's no need forJeremy Allison1-1/+31
the RESOLVE_DFSPATH macros and their varients any more. Fix reporting profile bug with all error returns. Jeremy. (This used to be commit cdf0fdb1049fd68b46885cbea887dc0e595fa524)
2007-10-10r21251: Okay, after Jeremy has kindly tested this, check it in :-)Volker Lendecke1-1/+5
Attached find a workaround that works for me. This is not the "correct" fix, to me it seems our DFS referral marshalling is broken. Vista requests level 4, we reply with level 2, and Vista seems not to like that. If we reply with level 3 it seems more happy. Needs more work! Volker (This used to be commit 4c3a9135629415086698da28596f68f7a9db9133)
2007-10-10r21226: Fix bug #4377 (rename of "foo" -> "Foo" fails).Jeremy Allison1-11/+29
This is actually an interesting case as it exposed bad code in our DFS redirect module (that was where the bug was introduced). Caused by our turning on dfsroot be default. Jeremy. (This used to be commit 5fe25588f57ee59d70a66c755dfe70312e7afd08)
2007-10-10r20718: Sync up the filename path parsing changes from SAMBA_3_0_24.Jeremy Allison1-2/+4
The only difference between the two trees now w.r.t file serving are the changes to smbd/open.c in this branch I need to review. Jeremy. (This used to be commit f4474edf6a0c71001dbd01429ef70bafad6abd74)
2007-10-10r19963: Add 'registry shares = yes' and registry key security descriptors.Volker Lendecke1-0/+1
(This used to be commit 6cab254c49e07b11c170511ec613f0f33914c3e6)
2007-10-10r18481: Use pidl-generated server side code for dfs.Jelmer Vernooij1-5/+6
(This used to be commit 3f337c104d42321595161d0283b39357df252a8e)
2007-10-10r17453: Fix msdfs RPC management (this broke with the autogenerated dfs rpcs).Günther Deschner1-0/+1
* Remove "unknown" from dfs_Enum (samba4 dfs IDL updates to follow). * When encountering an unsupported infolevel the rpc server must reply with a dfs_info_0 structure and WERR_OK (observed from w2k3 when talking to nt4). Guenther (This used to be commit f9bef1f08f7d2a4c95c28329ac73e8646f033998)
2007-10-10r17376: Fix bug #3985 - ensure in msdfs we check for ourJeremy Allison1-14/+8
netbios aliases. Reported by Björn Jacke <bjoern@j3e.de>. Probably needs to be in 3.0.23b (if Björn approves of the fix). Jeremy. (This used to be commit e9e711fe37d9aec28b329dbfe2ad3ebfc1771825)
2007-10-10r17348: Some C++ warningsVolker Lendecke1-2/+2
(This used to be commit ae6b9b34e59167e3958bfdb9997fa25340b9a0a3)
2007-10-10r16968: The function parse_processed_dfs_path() is dependent on theJeremy Allison1-5/+11
fact that check_path_syntax() will convert '\\' characters to '/'. When POSIX pathnames have been selected this doesn't happen, so we must look for the unaltered separator of '\\' instead of the modified '/'. Stevef please check this with the CIFSFS MS-DFS code ! Jeremy (This used to be commit 883bb398e58f54ee79160487b49b79a4774ef939)
2007-10-10r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison1-1/+7
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
2007-10-10r16797: Add msdfs proxy junctions in the netdfs rpc enumeration.Günther Deschner1-0/+1
Guenther (This used to be commit 6bf350895a648ef9b824c94b894e8d7a8989eb97)
2007-10-10r16203: Fix potentially writing one result of strtok beyond the end of alt_path.Volker Lendecke1-1/+2
Found by Klocwork, ID 653. Volker (This used to be commit 4cb8cf221f986b15de3ac608b173310c14248533)
2007-10-10r15712: BUG 3435: patch from volker to fix 'msdfs root = yes' in [homes]Gerald Carter1-1/+4
(This used to be commit 466478f07e6233b89f442660ad42ef7ee870ad48)
2007-10-10r14387: Try and fix the coverity issues (#53, #54) with negativeJeremy Allison1-4/+4
sink by ensuring all uses of rpcstr_push are consistent with a size_t dest size arg. Jeremy. (This used to be commit f65d7afe1977d9d85046732842f9643716c15088)
2007-10-10r14336: Try and quieten coverity #53 and #54. Make it obviousJeremy Allison1-2/+2
we're using -1 as a special size_t case by casting. Jeremy. (This used to be commit 415530bd082bf351f5e4c1fd32408f123ed77f85)
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)