1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-10 13:57:47 +03:00

65 Commits

Author SHA1 Message Date
Jeremy Allison
c19fdf43d1 Fix MSDFS bug noticed by Ofir Azoulay <Ofir.Azoulay@expand.com>.
There is no reason to ensure the target host is ourselves, and
this breaks MS clients in some cases.
Jeremy.
2008-04-02 11:23:36 -07:00
Volker Lendecke
fd34ce4370 strtok -> strtok_r 2008-01-23 15:08:04 +01:00
Jeremy Allison
4c32a22ac5 Don't build rpctorture anymore - not maintained. Just remove.
Remove all vestiges of pstring (except for smbctool as noted
in previous commit).
Jeremy
2007-12-07 12:26:32 -08:00
Jeremy Allison
e203ba2227 Always define PATH_MAX. Makes code simpler (removes
a bunch of #defines). Remove pstring from msdfs.c.
Jeremy.
2007-11-10 22:31:34 -08:00
Jeremy Allison
f35a266b3c RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
2007-10-18 17:40:25 -07:00
Volker Lendecke
25cc27df97 r25327: Normalize the path we return for 'msdfs proxy'
We now accept both \\server\tmp and \server\tmp. There are other places
where this might be necessary, but at least the functionality is a bit
easier now.
2007-10-10 12:31:00 -05:00
Volker Lendecke
d4eddf88d2 r25324: Fix "msdfs proxy"
Jeremy, please check!
2007-10-10 12:30:59 -05:00
Volker Lendecke
b64df8a3c5 r25184: Fix some C++ warnings and an uninitialized variable 2007-10-10 12:30:49 -05:00
Jeremy Allison
37cf2c2727 r25173: Use the append_buffer version in a loop.
Jeremy.
2007-10-10 12:30:48 -05:00
Jeremy Allison
39c211a702 r25138: More pstring elimination. Add a TALLOC_CTX parameter
to unix_convert().
Jeremy.
2007-10-10 12:30:44 -05:00
Jeremy Allison
0c9a8c4dff r25111: Move to talloced pathnames on most code paths.
There are now ony 17 pstrings left in reply.c,
and these will be easy to remove (and I'll be
doing that shortly). Had to fix an interesting
bug in pull_ucs2_base_talloc() when a source
string is not null terminated :-).
Jeremy.
2007-10-10 12:30:41 -05:00
Jeremy Allison
cf6b6f9c3a r25102: Rewrite msdfs code to use talloced filenames. Passes make test
and make valgrindtest. Final step will be to change srvstr_get_path()
to return talloced memory in the major codepaths.
Jeremy.
2007-10-10 12:30:40 -05:00
Jeremy Allison
dee8beba7a r25009: Large patch discussed with Volker. Move unix_convert to a talloc-based
interface. More development will come on top of this. Remove the
"mangled map" parameter.
Jeremy.
2007-10-10 12:30:32 -05:00
Jeremy Allison
42d1c6713a r24253: From Jan Martin <Jan.Martin@rwedea.com>.
----------------------------------------------------------
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.
2007-10-10 12:29:21 -05:00
Jeremy Allison
cd93f0cb00 r23843: Fix bug #4777, reported by Bill Marshall <bmarsh@us.ibm.com>.
Doing a DFS traverse through a deep link could fail (not using
explorer).
Jeremy.
2007-10-10 12:28:33 -05:00
Andrew Tridgell
b0132e94fc r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text 2007-10-10 12:28:22 -05:00
Jeremy Allison
407e6e695b r23779: Change from v2 or later to v3 or later.
Jeremy.
2007-10-10 12:28:20 -05:00
Volker Lendecke
34a13c82a3 r23522: Save us a kilobyte stack space in a hot code path: I can't see a reason
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
2007-10-10 12:23:25 -05:00
Jeremy Allison
603233a98b r22590: Make TALLOC_ARRAY consistent across all uses.
That should be it....
Jeremy.
2007-10-10 12:19:49 -05:00
Jeremy Allison
1a0f69bb21 r22064: Fix the DFS code to work better with Vista clients. Allow
"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.
2007-10-10 12:19:08 -05:00
Stefan Metzmacher
fa322f0cc9 r22001: change prototype of dump_data(), so that it takes unsigned char * now,
which matches what samba4 has.

also fix all the callers to prevent compiler warnings

metze
2007-10-10 12:18:59 -05:00
Jeremy Allison
8c7042b419 r21961: Repair bug introduced by rev. 21960.
We need to do the initial strtok to set up the internal state.
Jeremy.
2007-10-10 12:18:53 -05:00
Volker Lendecke
a2e27c4431 r21960: Fix bugs 4463,4464,4465,4466. Thanks Jason :-) 2007-10-10 12:18:52 -05:00
Jeremy Allison
8c4d929c76 r21942: Hoist by our own petard :-). Older smbclient binaries
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.
2007-10-10 12:18:51 -05:00
Jeremy Allison
b1fa55e513 r21803: Missed part of patch to make self-referrals work.
Jeremy.
2007-10-10 12:18:35 -05:00
Jeremy Allison
7a7862c01d r21800: Check-in the DFS rewrite. I am still testing this but it
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.
2007-10-10 12:18:34 -05:00
Jeremy Allison
321a136dbc r21759: Fix the same bug in a more elegant way, strrchr_m
is an expensive call....
Jeremy.
2007-10-10 12:18:28 -05:00
Jeremy Allison
1722ea20db r21758: Fix a very specific dfs bug when passing in POSIX
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.
2007-10-10 12:18:28 -05:00
Jeremy Allison
698159c0ee r21756: An invarient the dfs code depended on for POSIX paths
is no longer true, so fix it.
Jeremy.
2007-10-10 12:18:28 -05:00
Jeremy Allison
cdf0fdb104 r21754: Volker is completely correct. There's no need for
the RESOLVE_DFSPATH macros and their varients
any more. Fix reporting profile bug with all
error returns.
Jeremy.
2007-10-10 12:18:28 -05:00
Volker Lendecke
4c3a913562 r21251: Okay, after Jeremy has kindly tested this, check it in :-)
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
2007-10-10 12:17:51 -05:00
Jeremy Allison
5fe25588f5 r21226: Fix bug #4377 (rename of "foo" -> "Foo" fails).
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.
2007-10-10 12:17:49 -05:00
Jeremy Allison
f4474edf6a r20718: Sync up the filename path parsing changes from SAMBA_3_0_24.
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.
2007-10-10 12:17:04 -05:00
Volker Lendecke
6cab254c49 r19963: Add 'registry shares = yes' and registry key security descriptors. 2007-10-10 12:16:16 -05:00
Jelmer Vernooij
3f337c104d r18481: Use pidl-generated server side code for dfs. 2007-10-10 11:51:43 -05:00
Günther Deschner
f9bef1f08f r17453: Fix msdfs RPC management (this broke with the autogenerated dfs rpcs).
* 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
2007-10-10 11:38:34 -05:00
Jeremy Allison
e9e711fe37 r17376: Fix bug #3985 - ensure in msdfs we check for our
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.
2007-10-10 11:38:29 -05:00
Volker Lendecke
ae6b9b34e5 r17348: Some C++ warnings 2007-10-10 11:38:27 -05:00
Jeremy Allison
883bb398e5 r16968: The function parse_processed_dfs_path() is dependent on the
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
2007-10-10 11:19:16 -05:00
Jeremy Allison
9dafb7f48c r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
2007-10-10 11:19:14 -05:00
Günther Deschner
6bf350895a r16797: Add msdfs proxy junctions in the netdfs rpc enumeration.
Guenther
2007-10-10 11:19:11 -05:00
Volker Lendecke
4cb8cf221f r16203: Fix potentially writing one result of strtok beyond the end of alt_path.
Found by Klocwork, ID 653.

Volker
2007-10-10 11:17:25 -05:00
Gerald Carter
466478f07e r15712: BUG 3435: patch from volker to fix 'msdfs root = yes' in [homes] 2007-10-10 11:17:09 -05:00
Jeremy Allison
f65d7afe19 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.
2007-10-10 11:15:27 -05:00
Jeremy Allison
415530bd08 r14336: Try and quieten coverity #53 and #54. Make it obvious
we're using -1 as a special size_t case by casting.
Jeremy.
2007-10-10 11:15:25 -05:00
Jeremy Allison
1d710d06a2 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.
2007-10-10 11:10:59 -05:00
Gerald Carter
17e63ac4ed r13316: Let the carnage begin....
Sync with trunk as off r13315
2007-10-10 11:06:23 -05:00
Jeremy Allison
22e3300911 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.
2007-10-10 11:05:48 -05:00
Jeremy Allison
4cd8e2a96b 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.
2007-10-10 11:05:15 -05:00
Jeremy Allison
b242f27860 r9545: (Hopefully the last) fixes for DIR -> SMB_STRUCT_DIR.
Jeremy.
2007-10-10 11:01:12 -05:00