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

377 Commits

Author SHA1 Message Date
Volker Lendecke
0e6e3c90c9 r17228: Modest reformatting
(This used to be commit 640b4297a4)
2007-10-10 11:38:20 -05:00
Jeremy Allison
dc5f6687e4 r17152: Don't handle the delete pending here, await
reschedule.
Jeremy.
(This used to be commit 11bab9d579)
2007-10-10 11:38:16 -05:00
Jeremy Allison
201bd24ac3 r17142: Ensure we record the correct can_read/can_write
from the client requested access mask.
Jeremy.
(This used to be commit 12490fafc7)
2007-10-10 11:38:15 -05:00
Jeremy Allison
dada5b4853 r17140: Get rid of the lock release/reacquire code ! Turns out
that create dispositions that cause O_TRUNC break
oplocks. This simplifies the code - although we have
to keep separate the client requested access mask and
the access mask we actually use to open the file.
Jeremy.
(This used to be commit 3bcd52a475)
2007-10-10 11:38:15 -05:00
Jeremy Allison
48e1e45183 r17131: Optimisation - when doing a stat open don't open the
file unless we really have to (ie. O_CREAT and file
doesn't exist).
Jeremy.
(This used to be commit 788aa15ea2)
2007-10-10 11:38:14 -05:00
Jeremy Allison
addc07be7d r17130: Remove unneeded unlock call.
Jeremy.
(This used to be commit b3b5aec0ee)
2007-10-10 11:38:14 -05:00
Jeremy Allison
4815e2c344 r17128: Missed a logic error in my last patch. Ensure we deal with any
oplocks that were granted when we had released the lock. Fix
strange case where stat open grants a batch oplock on file
create, but grants no oplock on file open.
Jeremy.
(This used to be commit b7374835e6)
2007-10-10 11:38:14 -05:00
Jeremy Allison
0e292222c3 r17125: Drastic problems require drastic solutions. There's
no way to get all the cases where kernel oplocks are
on and we can't open the file and get the correct
semantics (think about the open with truncate with
an attribute only open - we'd need a vfs change to
add the truncate(fname, len) call). So always drop
the share mode lock before doing any real fd opens and
then re-acquire it afterwards. We're already dealing
with the race in the create case, and we deal with
any other races in the same way. Volker, please
examine *carefully* :-). This should fix the problems
people reported with kernel oplocks being on.
Jeremy.
(This used to be commit 8171c4c404)
2007-10-10 11:38:13 -05:00
Jeremy Allison
fbdcf2663b 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.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Jeremy Allison
54ea3c23e3 r16435: Add in the uid info that Jerry needs into the
share_mode struct. Allows us to know the unix
uid of the opener of the file/directory. Needed
for info level queries on open files.
Jeremy.
(This used to be commit d929323d6f)
2007-10-10 11:18:54 -05:00
Gerald Carter
b32d2ecf9c r16219: BUG 3836, 3837, 3004: compile warning fixes from Jason Mader.
(This used to be commit 6c1f1c091f)
2007-10-10 11:17:26 -05:00
Volker Lendecke
4d1688bf6b r16198: Fix Klocwork 1023
(This used to be commit 3a7d01afbe)
2007-10-10 11:17:24 -05:00
Jeremy Allison
73cc5f1e25 r15960: Don't double-free (ensure we always free file_fsp in
the same place on error - I missed the extra free in
delay_for_oplocks).
Jeremy.
(This used to be commit 146a264815)
2007-10-10 11:17:15 -05:00
Jeremy Allison
b990e78866 r15959: Ooops. Use the right file_free call...
Jeremy.
(This used to be commit 1117a327bd)
2007-10-10 11:17:15 -05:00
Jeremy Allison
7361c7a883 r15958: Make us pass RAW-OPLOCK with kernel oplocks off.
This allows a requestor to set FORCE_OPLOCK_BREAK_TO_NONE
to ensure we don't break to level 2. Fixed a couple
of resource leaks in error paths in open_file_ntcreatex.
Jeremy.
(This used to be commit c7c9adcce7)
2007-10-10 11:17:14 -05:00
Jeremy Allison
41f139c0bb r15949: Patch for bug #3308 to stop us returning duplicate
mid replies on path based set-eof trans2 calls.
Needs modification for HEAD (as in head open_file_ntcreateX
properly returns NTSTATUS - I'll fix this tomorrow my
time). Secondly it still fails the Samba4 RAW-OPLOCK
smbtorture because of an interesting case. Our oplock
code always returns "break to level 2" if it can.
In this case (path-based set-eof or set-allocation size
on an exclusive oplocked file) W2K3 always sends a
break-to-none. We send the break to none (from level2)
after we've done the write for eof or allocation size.
I need to work out some way of telling our break code
to always break to none (might need to extend the message
field).
Jeremy.
(This used to be commit ad9895c654)
2007-10-10 11:17:14 -05:00
James Peach
0a1ca7fa3d r15943: Update misleading DEBUG statements and comments that refer to
open_file_shared.
(This used to be commit 784126edff)
2007-10-10 11:17:14 -05:00
Jeremy Allison
aca0a3ad3a r15404: Check for WRITE_THOUGH before calling lp_ fn. I hate
extra fn calls.
Jeremy.
(This used to be commit e468e1e5c2)
2007-10-10 11:16:41 -05:00
Jeremy Allison
ec8b810a16 r15293: Don't ever set O_SYNC on open unless "strict sync = yes".
This could be the cause of the perf. problem reported
between 3.0.14a and 3.0.2x. Lufthansa has *wireless*
on their flights to the USA now...  (I'm in heaven ! :-).
Jeremy.
(This used to be commit dbc03125f2)
2007-10-10 11:16:32 -05:00
Jeremy Allison
f60111e074 r15138: Teach Samba the difference between exclusive and batch oplocks.
Pass Samba4 oplock test (with kernel oplocks off).
Jeremy.
(This used to be commit 3c260bcce2)
2007-10-10 11:16:26 -05:00
James Peach
4fa5559800 r14898: This change is an attempt to improve the quality of the information that
is produced when a process exits abnormally.

First, we coalesce the core dumping code so that we greatly improve our
odds of being able to produce a core file, even in the case of a memory
fault. I've removed duplicates of dump_core() and split it in two to
reduce the amount of work needed to actually do the dump.

Second, we refactor the exit_server code path to always log an explanation
and a stack trace. My goal is to always produce enough log information
for us to be able to explain any server exit, though there is a risk
that this could produce too much log information on a flaky network.

Finally, smbcontrol has gained a smbd fault injection operation to test
the changes above. This is only enabled for developer builds.
(This used to be commit 56bc02d644)
2007-10-10 11:15:53 -05:00
Stefan Metzmacher
18e93247aa r14883: add 'smbd:sharedelay' option, so that we can speed up BASE-DENY2 in make test
as done in samba4

metze
(This used to be commit b98dd258a7)
2007-10-10 11:15:52 -05:00
Jeremy Allison
5067cca077 r14602: Fix another logic bug in new oplock handling. Just
because lck->num_share_modes != 0 doesn't mean that
there *are* other valid share modes. They may be
all marked "UNUSED" or be deferred open entries.
In that case don't downgrade the granted oplock to
level2 needlessly - a client can have an exclusive
oplock in this case. The original code handled this
correctly in the lck->num_share_modes == 0 case but
not in the case where there were no valid share modes
but lck->num_share_modes != 0. I'll clean up my
Samba4 torture tester for this and commit it tomorrow.
Jeremy.
(This used to be commit 306061c93d)
2007-10-10 11:15:39 -05:00
Jeremy Allison
292afdba59 r14596: Fix a logic bug with multiple oplock contention.
The sad thing is the core of this bug fix is just
removing a paranoia "exit_server" call, as the
rest of the logic was already correct :-).

Lots of comments to explain the logic added.

I will look at adding tests to exercise this,
might be possible.

Jeremy.
(This used to be commit c2488db727)
2007-10-10 11:15:38 -05:00
Volker Lendecke
f8fccdfd37 r13694: Committing patch from Aleksey Fedoseev <aleksey at fedoseev dot net> to NULL
out a pointer after talloc_destroy().

Volker
(This used to be commit 788e52eb5d)
2007-10-10 11:10:24 -05:00
Gerald Carter
fb5362c069 r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()
macro which sets the freed pointer to NULL.
(This used to be commit b65be8874a)
2007-10-10 11:10:14 -05:00
Jeremy Allison
51e8dc417b r13559: Fix bug #3522 reported by Sandeep Tamhankar <sandman@electric-cloud.com>.
mkdir foo returns the wrong error message when file foo exists.
Jeremy.
(This used to be commit c8185e7f94)
2007-10-10 11:10:14 -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
21a30a1346 r13314: This code has been causing problems since 1.9.x I think.
Remove check_for_pipe() - Volker was completely correct.
If it gets re-added it will be in a old open call path, not
in the generic code path.
Jeremy.
(This used to be commit 50c894a6e9)
2007-10-10 11:06:23 -05:00
Jeremy Allison
66d5a32d9c r13299: From testing W2K3 and W2K the delete on close bit seems to be always
honored (ie. the file gets deleted) for derectories when set at open
time - even though it doesn't show in the qfileinfo call. This is not
true of files.... (if anyone from the EU is listening, it's stuff like
this that makes CIFS non-documentable :-).
Jeremy.
(This used to be commit e2fc8a196a)
2007-10-10 11:06:22 -05:00
Jeremy Allison
d14af63e6a r13293: Rather a big patch I'm afraid, but this should fix bug #3347
by saving the UNIX token used to set a delete on close flag,
and using it when doing the delete. libsmbsharemodes.so still
needs updating to cope with this change.
Samba4 torture tests to follow.
Jeremy.
(This used to be commit 23f16cbc2e)
2007-10-10 11:06:21 -05:00
Jeremy Allison
86c9bac4c3 r13274: Fix for bug #3467. Not a show stopper.
jason qian <jason@infrant.com> was a *fantastic*
help in tracking this down.
Jeremy.
(This used to be commit 9f4a9c70fa)
2007-10-10 11:06:20 -05:00
Jeremy Allison
3317484799 r12877: Stop passing structs around in smb messages, instead
always linearize into little-endian. Should fix all
Solaris issues with this, plus provide a cleaner base
moving forward for cluster-aware Samba where smbd's
can communicate across different compilers/architectures
(eventually these message will have to go cross-machine).
Jeremy.
(This used to be commit d01824b785)
2007-10-10 11:06:05 -05:00
Volker Lendecke
4d1d826be4 r12735: After talking to Tridge and Jeremy... This needs to be made more generic
before it goes in.

Volker
(This used to be commit 2c3d5c029a)
2007-10-10 11:06:02 -05:00
Volker Lendecke
a189257c15 r12721: GPFS 2.4 on Linux will contain some windows semantics, ie share modes and
oplocks across the cluster. Adapt Samba to it.

The gpfs API is called via libgpfs.so. This code is written with dlopen(), so
that you can compile on a system with gpfs installed and later on run on
systems without gpfs available.

So to actually make Samba call gpfs share mode calls you need to compile with
gpfs.h and libgpfs.so around and set 'gpfs share = yes' on the shares you
export from GPFS.

Volker
(This used to be commit 2253b17a1a)
2007-10-10 11:06:01 -05:00
Volker Lendecke
67706697c5 r12460: Fixes for bug 3349
(This used to be commit 040eda6bf0)
2007-10-10 11:05:56 -05:00
Jeremy Allison
ab7a4f7e8e r12213: Final fix for #3303 - send rename messages to smbd's
that have open file handles to allow them to correctly
implement delete on close. There is a further correctness
fix I'm intending to add to this to cope with different share
paths, but not right now...
Jeremy.
(This used to be commit 932e337db8)
2007-10-10 11:05:49 -05:00
Jeremy Allison
7d2771e758 r12203: Add the share path into the sharemode db. This involves
revving the minor version number for libsmbsharemodes (we
now have a new _ex interface that takes the share path
as well as the filename). Needed for #3303. Some code written
by SATOH Fumiyasu <fumiya@samba.gr.jp> included in the changes
to locking/locking.c. The smbstatus output is a bit of a mess
and needs overhauling...
Jeremy.
(This used to be commit 9d93af713f)
2007-10-10 11:05:49 -05:00
Jeremy Allison
533da83852 r11341: Put directory opens into the share mode db so we
can treat them similarly to file opens (delete on
close, share mode violations etc.). This fixes bug
#3216 I will up the default hash size on the locking
db in a later commit as this means more entries.
Jeremy.
(This used to be commit 1134abbbb3)
2007-10-10 11:05:13 -05:00
Jeremy Allison
c5260e733c r10943: Unused variable. Bug #3160 from jason@ncac.gwu.edu
Jeremy.
(This used to be commit 5647a5d4b0)
2007-10-10 11:04:57 -05:00
Jeremy Allison
bd87876a8b r10930: Fix erroneous debug spotted by Herb.
Jeremy.
(This used to be commit b2e22e7d12)
2007-10-10 11:04:56 -05:00
Jeremy Allison
94fe079be7 r10744: Fix for the second incarnation of bug #3088, pushed by Alex Masterov
<alex@infobit.ru>. A fcbopen specific part of the code was erroneously
being called as part of the mainline open. Note, that this patch
superceeds and replaces the fix that Volker added for this bug
(which he added a Samba4 torture test for ) :

"Fix a race condition in Samba 3. If two files are opened simultaneously with
NTCREATEX_DISP_CREATE (create if not exists, else fail) they might end up with
two or more times NT_STATUS_OK as EEXIST is not correctly handled."

Jeremy.
(This used to be commit 5d7ab9a17e)
2007-10-10 11:04:51 -05:00
Gerald Carter
54abd2aa66 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
(This used to be commit 939c3cb5d7)
2007-10-10 11:04:48 -05:00
Jeremy Allison
11c79fa98f r10133: Fix bug #3044. open-exec is read-only.
Jeremy.
(This used to be commit ed644d4014)
2007-10-10 11:03:33 -05:00
Volker Lendecke
fa2ec3651e r9584: Fix a race condition in Samba 3. If two files are opened simultaneously with
NTCREATEX_DISP_CREATE (create if not exists, else fail) they might end up with
two or more times NT_STATUS_OK as EEXIST is not correctly handled.

Jeremy, please look closely at this. You can easily verify this by adding a
smb_msleep(100) to the top of open_file_ntcreate and run the new samba4
torture test. It does also happen without the msleep, but not as reliably.

Thanks,

Volker
(This used to be commit 58b9e48df0)
2007-10-10 11:01:14 -05:00
Volker Lendecke
4fffd271d0 r8492: open_mode_check does not use the parameter p_flags, so remove it.
Volker
(This used to be commit ed9cb0061d)
2007-10-10 11:00:06 -05:00
Jeremy Allison
af8a691db1 r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the torture
tests on this as it's very late NY time (just wanted to get this work
into the tree). I'll test this over the weekend....
Jerry - in looking at the difference between the two trees there
seem to be some printing/ntprinting.c and registry changes we might
want to examine to try keep in sync.
Jeremy.
(This used to be commit c7fe18761e)
2007-10-10 10:58:18 -05:00
Jeremy Allison
f2f55d703d r7963: Add aio support to 3.0.
Jeremy.
(This used to be commit 1de27da470)
2007-10-10 10:58:05 -05:00
Jeremy Allison
0835575415 r6673: Fix the write cache based on some VERY good detective work
from Ingo Kilian <ikilian@web.de>.
You must do a make clean after updating this.
Jeremy.
(This used to be commit 3b2cd19fcb)
2007-10-10 10:56:50 -05:00
Jeremy Allison
da70ef7c06 r6344: Fix bug #2601 - it seems that DOS_OPEN_EXEC does mean readonly. Needed
for Win9x and OS/2 clients. More Samba4 tests against W2k3 will be needed
to confirm this but in the meantime get it up and running.
Jeremy.
(This used to be commit 77c0ade9fa)
2007-10-10 10:56:37 -05:00
Herb Lewis
978ca84860 r6225: get rid of warnings from my compiler about nested externs
(This used to be commit efea76ac71)
2007-10-10 10:56:30 -05:00
Jeremy Allison
d318fe4025 r6200: Returned access should contain share mode as well as open mode.
Jeremy.
(This used to be commit 3aa784c077)
2007-10-10 10:56:28 -05:00
Jeremy Allison
1045c78624 r6174: Fixup T2 open call - we were returning 2 bytes short.
Jeremy.
(This used to be commit 0c7de7615b)
2007-10-10 10:56:27 -05:00
Jeremy Allison
0557c6cba2 r6172: Tidy up error processing significantly. Remove unix_ERR_XXX global nastyness.
Jeremy.
(This used to be commit d3379fe61b)
2007-10-10 10:56:27 -05:00
Jeremy Allison
67425afa3e r6152: Correctly check OpenX open modes.
Jeremy.
(This used to be commit 326124a7b3)
2007-10-10 10:56:25 -05:00
Jim McDonough
99509cb0b5 r5854: Fix coredump when OS/2 checks for long file name support (with .+,;=[].).
Bugzilla 2338.

Thanks to Guenter Kukkukk <guenter.kukkukk@kukkukk.com>
(This used to be commit c137362871)
2007-10-10 10:56:05 -05:00
Jeremy Allison
56b22250f4 r5848: Fix inherit owner to chown directories in a porable and secure way (from
just secure on Linux). Idea from tridge.
Jeremy.
(This used to be commit c0924a497b)
2007-10-10 10:56:05 -05:00
Jeremy Allison
cc5ba986bf r5792: Added new parameter "inherit owner". If set on a share, the created file/directory
will be owned by the same uid as the containing directory. Doing this for directories
in a race-free mannor has only been tested on Linux (it depends on being able to open
a directory and then do a fchown on that file descriptor). If this functionality is
not available then the code silently downgrades to not changing the ownership of a
new directory. This new parameter (docs to follow) finally makes it possible to create
"drop boxes" on Samba, which requires all files within a directory to be commonly owned.
A HOWTO on how to use this will follow.
Jeremy.
(This used to be commit 2e1f727184)
2007-10-10 10:56:01 -05:00
Jeremy Allison
a4deaac09f r5630: This may be a mistake ... needs more cthon investigation.
Jeremy.
(This used to be commit 0322c58846)
2007-10-10 10:55:51 -05:00
Jeremy Allison
02bce09010 r5623: Horrible band-aid patch to fix Blue-Arc torture tester.
I know this isn't right but will work until I can refactor
the deny mode code with the Samba4 algorithm.
Jeremy.
(This used to be commit f38f464c72)
2007-10-10 10:55:51 -05:00
Jeremy Allison
02c25a2683 r5014: Split out the request to send an async level II oplock break into a
new function to make it clear when it's called. Remove async parameter
that had been overloaded into request_oplock_break.
Inspired by work from Nadav Danieli <nadavd@exanet.com>.
Jeremy.
(This used to be commit 05697fb502)
2007-10-10 10:55:11 -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
46f546571b r4007: Fix bug #2088 - ensure inherit permissions is only applied on a new file,
not an existing one.
Jeremy.
(This used to be commit fbbdb72cf1)
2007-10-10 10:53:27 -05:00
Volker Lendecke
ea9f97886b r3853: Fix an uninitialized variable warning. Jeremy, there are some of these in
charcnv.c.

Volker
(This used to be commit 650d52648d)
2007-10-10 10:53:21 -05:00
Jeremy Allison
2efbc238d4 r3002: Fix for bug #1886 - prevent delete on close being set
for readonly files (and return the correct error code).
We now pass the Samba4 test suite on this.
Jeremy.
(This used to be commit 6ae417f12c)
2007-10-10 10:52:59 -05:00
Jeremy Allison
69e87ef8c3 r2083: Fix memleak on return code path.
Jeremy.
(This used to be commit b0af241fd1)
2007-10-10 10:52:31 -05:00
Jeremy Allison
a96dfe038e r2027: Fix for but #1657, used initialized variable, from
Helmut Heinreichsberger <helmut.heinreichsberger@chello.at>.
Jeremy.
(This used to be commit 07f7aa6afb)
2007-10-10 10:52:29 -05:00
Jeremy Allison
57c07e2785 r1304: Turns out non-io opens that cause oplock breaks are a *different* set
of desired access flags from those that cause sharing violations.
Oplock breaks are caused by : ~(SYNCHRONIZE_ACCESS|FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES)
Sharing violations are caused by : ~(SYNCHRONIZE_ACCESS|READ_CONTROL_ACCESS|FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES)
We now pass the torture rename test again.
I still need to work out if subsequent opens will cause sharing violations with an existing open
mode of SYNCHRONIZE_ACCESS|READ_CONTROL_ACCESS|FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES;
Jeremy.
(This used to be commit 38002bfc1c)
2007-10-10 10:52:05 -05:00
Jeremy Allison
3e0f586298 r1263: Make "defer sharing violations" a global parameter.
Jeremy.
(This used to be commit 42cdeccc36)
2007-10-10 10:52:04 -05:00
Jeremy Allison
7f05a7d0c8 r1260: Added new parameter in the protocol section. "defer sharing violations",
by default set to "yes" (to correctly emulate Windows). I've added this to
ensure if we find a critical problem with this new code when 3.0.5 ships
it can be turned off to test for bugs.
Jeremy.
(This used to be commit bee0619cc4)
2007-10-10 10:52:03 -05:00
Jeremy Allison
459cb00785 r1097: Fix errno being incorrectly set. Noticed by Richard.
Jeremy.
(This used to be commit c8a55e92dd)
2007-10-10 10:51:54 -05:00
Jeremy Allison
effd4a3385 r1089: Removed spurious oplock message in deferred open processing.
Fix smb signing sequence counts.
Jeremy.
(This used to be commit 7e2a5c3661)
2007-10-10 10:51:54 -05:00
Jeremy Allison
2fc57c9a2c r1085: Now it's had some proper user testing, merge in the deferred open fix. I'm
still doing more testing, but it fixes a behaviour that we've been wrong
on ever since the start of Samba.
Jeremy.
(This used to be commit 894cc6d162)
2007-10-10 10:51:54 -05:00
Jeremy Allison
efc96df3d5 r974: Fix open code to pass more torture tests. We now pass the Samba4
oplock test. We do this be changing the algorithm when breaking
oplocks slightly. Previously we broke an oplock, then re-loaded
the share modes and re-iterated. Now we break all oplocks, then
re-load the share modes and check the share details - then iterate.
This seems to match the way Win2k3 does it.
Jeremy.
(This used to be commit 5ec4f4e4e6)
2007-10-10 10:51:51 -05:00
Jeremy Allison
e003407584 r945: "Correct" (as in, more correct) way to handle stat opens. Doesn't regress
the torture tester. Passes OPEN tests in Samba3 and Samba4 and oplock tests
in Samba4. Last thing to check, can an "attribute only" open actually create
a file. I think it can....
Jeremy.
(This used to be commit d8177a42d4)
2007-10-10 10:51:50 -05:00
Jeremy Allison
28cbc5f8f9 r779: Fix specific case of open that doesn't cause oplock break, or share mode check.
Test case provided by Volker will be added later. There may be other tests
needed.
Jeremy.
(This used to be commit 1f8e7946ed)
2007-10-10 10:51:37 -05:00
Jeremy Allison
8b9a044b58 r742: Volker discovered that we can truncate a locked file. Well I never ! :-).
Jeremy
(This used to be commit 1099d60113)
2007-10-10 10:51:36 -05:00
Richard Sharpe
80f72a6300 r740: Fix Bug #1301. Return NT_STATUS_SHARING_VIOLATION when share mode locking
requests fail.
(This used to be commit 5082eb30d0)
2007-10-10 10:51:36 -05:00
Jeremy Allison
722aa118c6 Added per-share parameter "store dos attributes". When set, will store
dos attributes in an EA. Based on an original patch from tridge, but
modified somewhat to cover all cases.
Jeremy.
(This used to be commit ed653cd468)
2004-04-02 18:46:19 +00:00
Jeremy Allison
7cea655424 Fix for #1064 - ensure truncate attribute checking is done correctly on "hidden" dot files.
Jeremy.
(This used to be commit a6045c904f)
2004-03-19 23:46:48 +00:00
Jeremy Allison
3fb52e5cc0 Can't set allocation size on directories, return correct error code on
fail if file exists and target is a directory. gentest.
Jeremy.
(This used to be commit f4a7ea6dc2)
2004-02-28 01:53:30 +00:00
Jeremy Allison
5447f1f467 More gentest error fixups.
Jeremy.
(This used to be commit 00f71fc836)
2004-02-24 00:55:05 +00:00
Jeremy Allison
013a051103 Remove unneeded second open for filename ending in '.' now we know it's
a mangled name. Added const. Fix inspired by Andrew Bartlett ideas.
Jeremy.
(This used to be commit 87eb336d65)
2003-11-18 02:06:41 +00:00
Jeremy Allison
3fe18a46a3 Fix signing miss-sequence noticed by Stefan Metzmacher <metze@metzemix.de>
Jeremy.
(This used to be commit 63f3315643)
2003-10-21 17:40:58 +00:00
Jeremy Allison
6d6401a67a Implement SMBexit properly. Found by Samba4 tester. You must do a make
clean proto all; after this commit.
Jeremy.
(This used to be commit 27af1f9fea)
2003-08-19 01:53:45 +00:00
Jeremy Allison
4e8b36a574 Fix SMBseek and get/set position information SMBs. Works against
Samba4 tester. You will need a make clean; make all after this !
Jeremy.
(This used to be commit 10d90171ed)
2003-08-14 21:16:06 +00:00
Jeremy Allison
3bbe9c0869 An oplock break reply from the client causes the sequence number to be
updated by 2 if there is no open reply outstanding, else by one....
Yes - this makes no sense....
Jeremy.
(This used to be commit b43ce1ff61)
2003-08-07 05:36:08 +00:00
Jeremy Allison
79a5d2e31b Finish tridge's patch as referenced here :
make sure we don't allow the creation of directories containing
wildcard characters. I've only put this in mkdir at the moment, but I
suspect this will apply to all places that can create new filenames.

We need to allow the opening of existing filenames that contain
wildcards, but not allow the creation of new ones.

Jeremy.
(This used to be commit 7f111e545d)
2003-07-29 17:34:20 +00:00
Jeremy Allison
60097e0d8d Fix from matt.zinkevicius@hp.com to stop files being created on read-only
shares in some circumstances.
Jeremy.
(This used to be commit b826e8c898)
2003-07-24 19:10:52 +00:00
Tim Potter
80c1f1d865 Fixup a bunch of printf-style functions and debugs to use unsigned long when
displaying pid_t, uid_t and gid_t values.  This removes a whole lot of warnings
on some of the 64-bit build farm machines as well as help us out when 64-bit
uid/gid/pid values come along.
(This used to be commit f93528ba00)
2003-07-22 04:31:20 +00:00
Jeremy Allison
e5aa73dab1 Fix spotted by Nadav Danieli <nadavd@exanet.com> - ensure dev and inode
to fix open mode race condition.
Jeremy.
(This used to be commit cbde1c8dfc)
2003-07-07 22:29:40 +00:00
Jeremy Allison
ce72beb2b5 Removed strupper/strlower macros that automatically map to strupper_m/strlower_m.
I really want people to think about when they're using multibyte strings.
Jeremy.
(This used to be commit ff222716a0)
2003-07-03 19:11:31 +00:00
Jeremy Allison
78a4f6fc4b More fixes for debug log to catch logic error.
Jeremy.
(This used to be commit 84a7714eba)
2003-05-22 18:56:51 +00:00
Jeremy Allison
4f7e6108bd Add more info to debug info...
Jeremy.
(This used to be commit 6d3b72b499)
2003-05-22 18:45:24 +00:00
Alexander Bokovoy
bc2a3748e9 Prefix VFS API macros with SMB_ for consistency and to avoid problems with VFS_ macros at system side. We currently have one clash with AIX and its VFS_LOCK. Compiled and tested -- no new functionality or code, just plain rename of macros for yet-unreleased VFS API version. Needs to be done before a24 is out
(This used to be commit c2689ed118)
2003-05-14 10:59:01 +00:00
Alexander Bokovoy
c9bfb7660b Eliminate NULL pointers from VFS interface. All hooks now really callable, producing either correct result or returning error if the feature isn't supported in the configuration
(This used to be commit af0a17349e)
2003-05-12 16:03:16 +00:00
Alexander Bokovoy
e7c8c15888 Fix VFS layer:
1. Finally work with cascaded modules with private data storage per module
2. Convert VFS API to macro calls to simplify cascading
3. Add quota support to VFS layer (prepare to NT quota support)

Patch by Stefan (metze) Metzemacher, with review of Jelmer and me
Tested in past few weeks. Documentation to new VFS API for third-party developers to follow
(This used to be commit 91984ef5ca)
2003-05-11 23:34:18 +00:00
Jeremy Allison
7ce38082f3 Fix for bugid 51 from Dragan Krnic.
Jeremy.
(This used to be commit a2af45154d)
2003-05-01 17:45:38 +00:00
Andrew Bartlett
29133d9677 This is really trying to be a StrnCpy (most names will overflow the 10 char
limit)
(This used to be commit 0e04761abe)
2003-04-24 05:43:45 +00:00
Andrew Bartlett
2a3a9f0bf4 Merge the 'safe' parts of my StrnCpy patch - many of the users really wanted
a pstrcpy/fstrcpy or at most a safe_strcpy().

These have the advantage of being compiler-verifiable.

Get these out of the way, along with a rewrite of 'get_short_archi' in the
spoolss client and server.  (This pushes around const string pointers, rather
than copied strings).

Andrew Bartlett
(This used to be commit 32fb801ddc)
2003-04-23 13:27:35 +00:00
Jeremy Allison
2aa7b1573c Add runtime tests for "impossible" case with -DDEVELOPER. Trying to catch logic
error on Linux.
Jeremy.
(This used to be commit 546d1a941b)
2003-04-22 17:30:53 +00:00
Jeremy Allison
7d4eef34e3 Correctly return access denied on share mode deny when we can't open the
file. This is a regression that was damaged by other code.
Jeremy.
(This used to be commit 7844a53df7)
2003-02-12 01:13:35 +00:00
Jeremy Allison
ce85e52eff Ensure we only ever set fsp->conn in one place.
Jeremy.
(This used to be commit d8a42753cc)
2003-02-04 01:43:10 +00:00
Jeremy Allison
70a03079a7 Ensure Samba passes the open attribute truncate tests in smbtorture.
Jeremy.
(This used to be commit b3df40bc80)
2003-02-04 01:11:56 +00:00
Jeremy Allison
b61f89826f Fix for interesting resource constraint condition. When all opens are
level 2 and a request for open with no oplock is received then the
smbd should send *synchronous* break messages, not asynchronous,
otherwise it spins very rapidly, releasing the lock, sending the
'break to none' messages and then re-acquiring the lock before
any other process has a chance to get the lock and remove it's own
oplock (at least on linux).
Jeremy
(This used to be commit 33e3e863eb)
2003-01-30 01:41:46 +00:00
Jeremy Allison
7f4177aa9e Fix open problem with changing attributes on an existing file - based
on work by  <steve@griffin.sio2.nl>.
Jeremy.
(This used to be commit 1cff725e37)
2003-01-08 02:09:18 +00:00
Jeremy Allison
20f1cf6cdc Fix problem with "hide unreadable". stat file opens are baaack :-).
Jeremy.
(This used to be commit 62038a0abf)
2003-01-03 18:50:13 +00:00
Jeremy Allison
faf1f0df4d Very curious. It turns out attribute matching on truncate only matters
when opening truncate with current SYSTEM|HIDDEN -> NONE. It's fine to
truncate on open with current NONE -> SYSTEM | HIDDEN.
Jeremy.
(This used to be commit 3bf21ca936)
2002-11-19 01:46:10 +00:00
Jeremy Allison
b51160452e Fix to correctly return NT_STATUS_DELETE_PENDING.
Jeremy.
(This used to be commit 4ec381d642)
2002-11-05 21:47:03 +00:00
Jeremy Allison
f735551b9e First cut of new ACL mapping code from Andreas Gruenbacher <agruen@suse.de>.
This is not 100% the same as what SuSE shipped in their Samba, there is
a crash bug fix, a race condition fix, and a few logic changes I'd like to
discuss with Andreas. Added Andreas to (C) notices for posix_acls.c
Jeremy.
(This used to be commit 40eafb9dde)
2002-10-23 01:22:32 +00:00
Gerald Carter
a834a73e34 sync'ing up for 3.0alpha20 release
(This used to be commit 65e7b5273b)
2002-09-25 15:19:00 +00:00
Andrew Tridgell
e90b652848 updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb)
2002-07-15 10:35:28 +00:00
Jeremy Allison
81a0d5b5e9 Matched W2K *insane* open semantics....
Jeremy.
(This used to be commit 6819e81da4)
2002-03-26 00:38:12 +00:00
Jeremy Allison
c90cd26e94 Fix the mp3 rename bug - also tidy up our open code and remove the special
cases for rename and unlink. Had to add desired_access into the share mode record.
Jeremy.
(This used to be commit 3b1b8ac435)
2002-03-23 02:57:44 +00:00
Jeremy Allison
bffc69a877 Fix stupid typo !
Jeremy.
(This used to be commit d0b58f66ed)
2002-03-21 21:23:22 +00:00
Jeremy Allison
b9e91d2a8e Remove the "stat open" code - make it inline. This should fix the
bugs with opening and renaming mp3 files, also the word rename
problems that people have had for a while.
Needs a make clean :-) make.
Also added JohnR's printing fix.
Jeremy.
(This used to be commit 504e5ef049)
2002-03-20 00:46:53 +00:00
Jeremy Allison
3bb219161a Added POSIX ACL layer into the vfs.
Jeremy.
(This used to be commit 7d59445b69)
2002-03-12 00:08:08 +00:00
Jeremy Allison
db4c62d7ed Implemented default ACL patch (set inherit acls = true on a per share basis).
Based on code donated by Olaf Frczyk <olaf@cbk.poznan.pl>. Further commit
will change to sending via vfs interface.
Jeremy.
(This used to be commit d85133e269)
2002-03-11 21:57:12 +00:00
Jeremy Allison
11c0e88d9e Fixed delete on close semantics - preparing for share mode rewrite.
Jeremy.
(This used to be commit 25dd73be29)
2002-03-07 04:21:12 +00:00
Andrew Tridgell
97d96862ca This is a nasty hack to fix "xcopy /o" from win2000 on a Samba share
The hack passes the true ntcreate desired_access down to open_file_shared1()
from the ntcreatex function. This is used to determine if share modes
should be used in denying this open.

This hack will become unnecessary when we redo open.c to use the proper
NTCreateX semantics rather than trying to jam the ntcreate semantics into
openX semantics.
(This used to be commit d09ae0c667)
2002-02-26 05:45:33 +00:00
Tim Potter
cd38c3a71c Merge of smbclient print crash bug fix from app head.
(This used to be commit a56298d56a)
2002-02-15 02:46:13 +00:00
Tim Potter
cd68afe312 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
(This used to be commit 6a58c9bd06)
2002-01-30 06:08:46 +00:00
Jeremy Allison
9d8ed7220f Fixed display of "remote downlevel document" in old print job submission
case.
Jeremy.
(This used to be commit 248770d730)
2002-01-25 20:16:14 +00:00
Andrew Tridgell
630e0ae8ef don't use O_NONBLOCK in open(). This was added erroneously for kernel
oplocks and really shouldn't be used
(This used to be commit c3a83002cf)
2002-01-17 00:25:13 +00:00
Jeremy Allison
68245b54cd Added the O_NOFOLLOW flag if follow symlinks is set off.
Jeremy.
(This used to be commit 4f1f5f28b5)
2002-01-12 00:50:01 +00:00
Jeremy Allison
28df80cf68 Moved fchown_acl change to the point where we *really* know if we
created the file or not.
Jeremy.
(This used to be commit 32dffa0ba7)
2001-12-16 23:44:38 +00:00
Jeremy Allison
59a8827f5d Spelling pedents strike again :-).
Jeremy.
(This used to be commit 0187d4ba16)
2001-11-28 18:10:13 +00:00
Jeremy Allison
a17867af97 Ensure the CAN_WRITE is checked and prevents O_CREAT and O_TRUNC from
being set. Also prevent an open on a file on a readonly share from
setting delete on close.
Jeremy.
(This used to be commit 1f3dcd99bd)
2001-11-28 05:03:37 +00:00
Jeremy Allison
1a50b36d97 Re-added "Share modes" meaning don't allow deny mode conflict. Due to
user demand (don't talk to me about removing parameters.... :-).
Jeremy.
(This used to be commit b69127391b)
2001-11-28 04:47:46 +00:00
Jeremy Allison
01d91a8249 Fix for the logic bug wrt. existant oplocks. See long message
in samba-technical for explaination.
Jeremy.
(This used to be commit 8150f0f3f7)
2001-11-27 23:12:25 +00:00
Jeremy Allison
064b3e7da7 nsswitch/winbindd_group.c nsswitch/winbindd_user.c: formatting fixups.
smbd/open.c: Fix "delete on close" for directories.
Jeremy.
(This used to be commit 014b0973a3)
2001-11-27 06:28:06 +00:00
Jeremy Allison
d05bbf0422 Fixed delete on close bug. Added core dump code to winbindd.
Jeremy.
(This used to be commit a58d0f91f9)
2001-11-23 11:18:20 +00:00
Jeremy Allison
88b55f47b4 Move from timestamp to gen count file id's for finding oplocked files
in a tdb.
Jeremy.
(This used to be commit 058ae6b58f)
2001-10-20 21:59:34 +00:00
Tim Potter
dc1fc3ee8e Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.
(This used to be commit 2d0922b0ea)
2001-10-02 04:29:50 +00:00
Jeremy Allison
abaa4ab96a Change log message to 2 from zero when failing to create directory.
Stops spurious profile creation messages.
Jeremy.
(This used to be commit fa74d07207)
2001-09-24 23:50:28 +00:00
Simo Sorce
61b2794968 move to SAFE_FREE()
(This used to be commit a95943fde0)
2001-09-17 11:25:41 +00:00
Simo Sorce
72c35310b2 use variables _before_ freeing them!
thanks to Andreas Moroder for spotting these two.
(This used to be commit 01f30ca0ad)
2001-09-15 13:21:54 +00:00
Andrew Tridgell
387f1fd09c fixed formatting to make the code vaguely readable. It's still a dogs
breakfast, but at least you can follow the indents
(This used to be commit 9955ea0aaa)
2001-09-05 21:11:52 +00:00
Andrew Tridgell
e8e98c9ea0 converted smbd to use NTSTATUS by default
major changes include:

- added NSTATUS type
- added automatic mapping between dos and nt error codes
- changed all ERROR() calls to ERROR_DOS() and many to ERROR_NT()
  these calls auto-translate to the client error code system
- got rid of the cached error code and the writebmpx code

We eventually will need to also:
- get rid of BOOL, so we don't lose error info
- replace all ERROR_DOS() calls with ERROR_NT() calls

but that is too much for one night
(This used to be commit 83d9896c1e)
2001-08-27 08:19:43 +00:00
Jeremy Allison
ecea36501e Missed '\' at eol...
Jeremy.
(This used to be commit 0dbd1be704)
2001-08-22 01:06:27 +00:00
Jeremy Allison
85e063f5b8 Tidyup fixes for fcntl spin problem.
Jeremy.
(This used to be commit 27d3dd0e7c)
2001-08-22 01:01:37 +00:00
Jeremy Allison
e4275a35a6 Fixed the (incorrect) paranioa fix I put in for the fcntl lock spin.
Don't delete a share mode that failed to remove the oplock (doh!),
just set the oplock entry to zero....
Jeremy.
(This used to be commit fe4aa72018)
2001-08-22 00:29:40 +00:00
Volker Lendecke
e6a6dee027 This is Jeremy pretending to be Volker, 'cos the
link from Seattle is having problems.
I've added 3 things here to work on the fcntl spin
problem.
1). Check *all* tdb return codes... :-).
2). If we're asking ourselves to break an oplock, and we can't
find a fsp pointer that matches the entry, this is a *logic bug*
and we should abort and panic so someone with gdb can pick up
the pieces.
3). After we've broken an oplock, ensure that the entry itself
has been removed, and if not remove it ourselves. This should
not be neccessary in a correctly working environmen,t, but will
provide an added layer of robustness in error situations.
4). I hate german keyboards :-) :-).
Jeremy.
(This used to be commit 1c94fa8064)
2001-08-21 01:25:45 +00:00
Jeremy Allison
76f36b8c36 We were making an assumption in the oplock
break code path that was invalid (ie. we were assuming
we could infer a non-levelII oplock when such an oplock
was detected - this may no longer be valid once we've
processed the break process dealing with the break will
change the state of it anyway.
This prevents the state where we get the following packet
trace :

client                      server
NTcreate ->
                         <- NTcreate resp
NTcreate ->
                         <- break to level II
ok - broken ->
                         <- break to none

Thanks to Alan Romeril for providing the trace that allowed
me to track this down.

Jeremy.
(This used to be commit c343e4f490)
2001-07-24 01:18:43 +00:00
Jeremy Allison
aa91def29f Fix race where wrong action (created or opened) could be returned.
Jeremy.
(This used to be commit af5b649b01)
2001-07-05 23:37:09 +00:00
Andrew Tridgell
527e824293 strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn.
(This used to be commit c41fc06376)
2001-07-04 07:36:09 +00:00
Andrew Tridgell
87fbb7092b The big character set handling changeover!
This commit gets rid of all our old codepage handling and replaces it with
iconv. All internal strings in Samba are now in "unix" charset, which may
be multi-byte. See internals.doc and my posting to samba-technical for
a more complete explanation.
(This used to be commit debb471267)
2001-07-04 07:15:53 +00:00
Jeremy Allison
d1f38ac531 Fixed the first locking error (test #8 found by locktest code from
Clarion locktest.
Jeremy.
(This used to be commit 5c42845b5b)
2001-06-30 01:59:48 +00:00
Jeremy Allison
850a0e27e1 Extra debug in open.c, fix for bad debug message in reply.c
Jeremy.
(This used to be commit 2c2fc85136)
2001-06-19 07:31:55 +00:00
Jeremy Allison
6f78636a56 Removed mktemp from HEAD - same as done in 2.2.
Jeremy.
(This used to be commit 121b59669f)
2001-04-18 05:12:46 +00:00
Jeremy Allison
71ae6a09cd Finally got the semantics right (hurrah!).
Jeremy.
(This used to be commit 362574c5a3)
2001-04-16 00:34:03 +00:00
Jeremy Allison
d5b74f7130 Correct fix for open readonly with truncate.
Jeremy.
(This used to be commit 6706e258e1)
2001-04-16 00:02:29 +00:00
Jeremy Allison
2df39394fe This little piece of insanity is inspired by the
fact that an NT client can open a file for O_RDONLY,
but set the create disposition to FILE_EXISTS_TRUNCATE.
If the client *can* write to the file, then it expects to
truncate the file, even though it is opening for readonly.
Quicken uses this stupid trick in backup file creation...
Thanks *greatly* to "David W. Chapman Jr." <dwcjr@inethouston.net>
for helping track this one down. It didn't bite us in 2.0.x
as we always opened files read-write in that release.
Jeremy.
(This used to be commit 5baef56831)
2001-04-14 20:47:30 +00:00
Jeremy Allison
53850c51ca configure:
configure.in:
include/config.h.in:
include/profile.h:
smbd/vfs-wrap.c:
smbd/vfs.c:
Added fchmod and fchown to VFS (sorry Gerald - but we needed them anyway).
smbd/dosmode.c:
smbd/files.c:
printing/printfsp.c:
smbd/close.c:
smbd/open.c:
Fixed "dos filemode" correctly so there are no race conditions. Forces test
of open of file O_WRONLY before allowing fchmod as root. Afterwards, calls
standard close function that preserves POSIX locks due to POSIX-me-harder
braindamage. :-). Andrew please review this code.
Also - in removing the tmpdir param in smbrun an extra NULL parameter
was missed in each print_run_command() call (which is a varargs fn.).
Now fixed.
Jeremy.
(This used to be commit 32397e5bc6)
2001-04-14 00:19:12 +00:00
Jeremy Allison
819482c071 Fixed potential file descriptor leak with MS-Access fix.
Jeremy.
(This used to be commit 192887fe72)
2001-04-13 20:49:11 +00:00
Jeremy Allison
6e7f03f9b9 This is a big, rather ugly patch. Whilst investigating the files not truncated
when copying to a full disk problem, I discovered that we were not allowing
the delete on close flag to be set properly, this led to other things, and
after investigation of the proper delete on close semantics and their relationship
to the file_share_delete flag I discovered there were some cases where we
weren't doing the deny modes properly. And this after only 5 years working
on them..... :-) :-).
So here's the latest attempt. I realised the delete on close flag needs to
be set across all smbds with a dev/ino pair open - in addition, the delete
on close flag, allow share delete and delete access requested all need to
be stored in the share mode tdb.
The "delete_on_close" entry in the fsp struct is now redundant and should
really be removed. This may also mean we can get rid of the "iterate_fsp"
calls that I didn't like adding in the first place. Whilst doing this patch,
I also discovered we needed to do the se_map_generic() call for file opens
and POSIX ACL mapping, so I added that also.
This code, although ugly, now passes the deny mode torture tests plus the
delete on close tests I added. I do need to add one more multiple connection
delete on close test to make sure I got the semantics exactly right, plus we
should also (as Andrew suggested) move to random testing here.

The good news is that NT should now correctly delete the file on disk
full error when copying to a disk :-).

Jeremy.
(This used to be commit 51987684bd)
2001-03-30 08:57:24 +00:00
Jeremy Allison
e670b3564c smbd/posix_acls.c: Saving and restoring errno here is the wrong place. Moved it
to the places where [f]chmod_acl is called instead.
Jeremy.
(This used to be commit 641ada44ae)
2001-03-26 19:18:06 +00:00
Jeremy Allison
da3053048c Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMR
RPC code to merge with new passdb code.
Currently rpcclient doesn't compile. I'm working on it...
Jeremy.
(This used to be commit 0be41d5158)
2001-03-11 00:32:10 +00:00
Jeremy Allison
b15e9adea1 Sync up with POSIX ACL code from 2.2.
Jeremy.
(This used to be commit e0431672cc)
2001-01-24 21:54:44 +00:00
Jeremy Allison
2f7c1db093 include/vfs.h:
smbd/vfs-wrap.c:
smbd/vfs.c: Added fchmod_acl and chmod_acl.
lib/substitute.c:
smbd/lanman.c:
smbd/open.c:
smbd/process.c:
smbd/reply.c:
smbd/service.c: Removed sessetup_user variable. Added current_user_info struct
which conatins domain info etc. Added '%D' for client domain parameter.
Jeremy.
(This used to be commit 2844ec3d51)
2001-01-23 01:52:30 +00:00
Jeremy Allison
ccb5cbf175 Fixed very subtle bug returning correct error on an open, when we have
a choice of invalid share mode and access denied. We must return the
access denied by preference, but also remember to break the oplocks...
This is needed for multi-user MS-Access.
Jeremy.
(This used to be commit 7eb7241442)
2000-12-11 21:09:48 +00:00
Jeremy Allison
bbce6b44eb Fix for vfs_fstat() crash with new stat code.
Jeremy.
(This used to be commit 979aa01e01)
2000-10-20 23:59:47 +00:00
Jeremy Allison
abf055046f Ok - this is a big patch - and it may break smbd a bit (although
I hope not). If you encounter strange file-serving behavior after this
patch then back it out. I analysed our stat() usage and realised we
were doing approx. 3 stat calls per open, and 2 per getattr/setattr.
This patch should fix all that. It causes the stat struct returned
from unix_convert() (which now *must* be passed a valid SMB_STRUCT_STAT
pointer) to be passed through into the open code. This should prevent
the multiple stats that were being done so as not to violate layer
encapsulation in the API's.

Herb - if you could run a NetBench test with this code and do a
padc/par syscall test and also run with the current 2.2.0 code
and test the padc/par syscalls I'd appreciate it - you should
find the number of stat calls reduced - not sure by how much.

The patch depends on unix_convert() actually finding the file
and returning a stat struct, or returning a zero'd out stat
struct if the file didn't exist. I believe we can guarentee this
to be the case - I just wasn't confident enough to make this
an assertion before.

Ok ok - I did write this whilst at the Miami conference.....
sometimes you get a little free time at these things :-).

Jeremy.
(This used to be commit 66a5c05ec4)
2000-10-19 02:58:24 +00:00
Jeremy Allison
636f146abf Restructuring of vfs layer to include a "this" pointer - can be an fsp or
a conn struct depending on the call.
We need this to have a clean NT ACL call interface.
This will break any existing VFS libraries (that's why this is pre-release
code).
Andrew gets credit for this one :-) :-).

In addition - added Herb's WITH_PROFILE changes - Herb - please examine
the changes I've made to the smbd/reply.c code you added. The original
code was very ugly and I have replaced it with a
START_PROFILE(x)/END_PROFILE(x) pair using the preprocessor.
Please check this compiles ok with the --with-profile switch.
Jeremy.
(This used to be commit b07611f815)
2000-10-06 03:21:49 +00:00
Jeremy Allison
3ad2ee22bb utf-8 and EUC3 patch from Hiroshi Miura Samba User Group Japan staff.
mkdir high bits patch from Robert Dahlem" <Robert.Dahlem@gmx.net>.
jeremy.
(This used to be commit b40191d271)
2000-10-03 02:12:14 +00:00
Andrew Tridgell
c5285699d9 open files with O_NONBLOCK when available. This is necessary to
prevent possible deadlocks with kernel leases and harmless when kernel
leases are not used.

basically we don't ever want smbd to block
(This used to be commit 9fd67b94a7)
2000-06-15 14:15:48 +00:00
Andrew Tridgell
f94f053b76 added support for kernel level share modes. These are a (small) hack,
I suspect we will either get rid of them or do them properly at some
stage.
(This used to be commit fabe1f350e)
2000-06-15 09:35:37 +00:00
Jeremy Allison
28d8970987 Check fstat return for error.
Jeremy.
(This used to be commit c54e77b1f9)
2000-05-12 00:11:49 +00:00
Andrew Tridgell
49a0e6d598 more merging voodoo
this adds "#define OLD_NTDOMAIN 1" in lots of places. Don't panic -
this isn't permanent, it should go after another few merge steps have
been done
(This used to be commit 92109d7b3c)
2000-05-10 10:41:59 +00:00
Jeremy Allison
693ffb8466 Added sys_fork() and sys_getpid() functions to stop the overhead
of doing a system call every time we want to just get our pid.
Jeremy.
(This used to be commit 148628b616)
2000-05-02 02:23:41 +00:00
Jeremy Allison
be828fcec8 Made changes suggested by Andrew review.
fd_close now calls fd_close_posix() directly.
set_posix_lock/release_posix_lock() now handle the reference counting.
More changes due when this gets moved to the file locking/posix.c
Jeremy.
(This used to be commit 239abd48f0)
2000-04-28 00:39:23 +00:00
Jeremy Allison
4b60a33c6f Ok - this is more subtle than it looks :-).
When a file is being closed, once it passes the fnum and tid tests then
the locking context should be ignored when removing all locks. This is
what is done in the brl close case, but when you have outstanding
POSIX locks, then you cannot remove all the brl locks in one go, you
have to get the lock list and call do_unlock individually. As this
uses global_smbpid as the locking context, you need to make sure
that this is set correctly for the specific lock being removed. I
now do this by storing the smbpid in each entry in the unlock list returned from
the query call. I removed the smbpid from fsp (not needed) and
things seem ok (even with the stupid smbpid tricks that smbtorture plays :-).

Jeremy.
(This used to be commit 6baa96bb46)
2000-04-27 23:28:56 +00:00
Jeremy Allison
36db78feda Fixed subtle unlocking bug when a file is closed. We need to store the
smbpid used when a file was opened in the files_struct. Else we use
the wrong global_smbpid when we are closing the file and trying to
remove the brl locks - this causes the brl locks to be left when the
file is closed as the samba_context check fails.
Jeremy.
(This used to be commit 2746e5602e)
2000-04-27 22:23:04 +00:00
Jeremy Allison
3d3c50326b Did the rewrite Andrew wanted where all knowledge of POSIX locking is
removed from the smbd/open.c code.
We now use a dlink list of structures indexed by dev/inode to store
all pending fd's for close. This could be rewritten to use lib/hash.c
if this is discovered to be too slow in use.
Andrew, please take a look and let me know if this is what you
had in mind.
Jeremy.
(This used to be commit 0487841120)
2000-04-27 21:12:33 +00:00
Jeremy Allison
e3987ff7a6 Fixed crash bugs Andrew pointed out with LOCK4 smbtorture
test. Was miscounting posix locks, plus was not taking into account
the case where other_fsp == fsp in the 'move locks' case. DOH ! This
code will be re-written anyway :-).
Jeremy.
(This used to be commit 5278ec016c)
2000-04-27 18:46:10 +00:00
Jeremy Allison
644f22ac61 Added the code that keeps fd's open across a close if there are other fsp's
open on the same dev/inode pair with existing POSIX locks.

This is done at the smbd/open layer, so smbd just calls fd_close() and
the transfer of any open fd's is done under the covers of fd_close().
When an fsp is closed and no other fsp's open on the same dev/inode
pair have existing POSIX locks then all fd's associated with this fsp
are closed.

Now only the hard part of doing the POSIX range unlock code when read
locks overlap remains for full POSIX/SMB lock integration....

Jeremy.
(This used to be commit 1df48ed55e)
2000-04-24 20:48:40 +00:00
Jeremy Allison
e82dbfcbe9 Now that fsp's are created on successful file open, the structure member
fsp->open is no longer needed (if an fsp pointer is valid, then it's open :-).

NB for Luke, this patch also did not apply to TNG. TNG is not yet
identical w.r.t file serving with HEAD. This makes it impossible for
me to help maintain TNG. Please fix asap.

lib/substitute.c: Removed unused variable (pidstr).

Jeremy.
(This used to be commit 389b700a26)
2000-04-24 19:23:51 +00:00
Jeremy Allison
6259f51dd9 This is a *big* checkin that may break some things, but implements the
new open mechanism Andrew & I discussed.

config.sub:
configure: Included the QNX patch.

include/vfs.h:
smbd/vfs-wrap.c:
smbd/vfs.c: Added ftruncate vfs call (needed).

Note that we will also need locking calls in the vfs (to be added).

lib/util_unistr.c:
nmbd/nmbd_processlogon.c: Fix for NT domain logons causing nmbd to core dump.
                          Also fix for sidsize DOS bug.

locking/locking.c: Check value of ret before using it for memdup.

printing/printing.c: Convert print_fsp_open to return an allocated fsp.

rpc_server/srv_lsa.c: Fix for NT domain logons.

I have removed all use of lp_share_modes() from the code (although I
left the parameter in the table for backwards compatibility). It no longer makes
sense for this to exist.

smbd/close.c: Removed lp_share_modes().
smbd/fileio.c: Fixed parameters to unlock_share_entry call in panic code.
smbd/files.c: Correctly set the unix_ERR_code to ERRnofids on fsp allocation fail.

smbd/nttrans.c:
smbd/reply.c:
smbd/trans2.c: Changed all occurrences of open_file_shared/open_directory/
               open_file_stat to return an fsp from the call.

smbd/open.c: Changed all occurrences of open_file_shared/open_directory/
             open_file_stat to return an fsp from the call.

In addition I have fixed a long standing race condition in the deny mode
processing w.r.t. two smbd's creating a file. Andrew, please note that
your original idea of using open with O_EXCL in this case would not work
(I went over the races very carefully) and so we must re-check deny modes
*after* the open() call returns. This is because there is a race between
the open with O_EXCL and the lock of the share mode entry. Imagine the
case where the first smbd does the open with O_EXCL and a deny mode of DENY_ALL,
but is pre-empted before it locks the share modes and creates the deny
mode entry for DENY_ALL. A second smbd could then come in with O_RDONLY
and a deny mode of DENY_NONE and the two opens would be allowed.

The *only* way to fix this race is to lock the share modes after the
open and then do the deny mode checks *after* this lock in the case
where the file did not originally exist.

This code will need extensive testing but seems to initially work.

Jeremy.
(This used to be commit ab0ecc39d6)
2000-04-22 00:33:16 +00:00
Andrew Tridgell
54de56a1be the changes to the main smb code
------------
The following series of commits are for the new tdb based printing
backend. This completely replaces our old printing backend.

Major changes include:

- all print ops are now done in printing/*.c rather than scattered all
  over the place
- system job ids are decoupled from SMB job ids
- the lpq parsers don't need to be nearly so smart, they only need to
  parse the filename, the status and system job id
- we can store lots more info about a job, including the full job name
- the queue cache control is much better

I also added a new utility routine file_lines_load() that loads a text
file and parses it into lines. This is used in out lpq parsing and I
also want to use it to replace all of our fgets() based code in other
places.
(This used to be commit d870542c28)
2000-04-16 06:22:31 +00:00
Jeremy Allison
8316237e9c Code to map tdb locks onto POSIX. Mainly placeholder code at the moment,
but the structure is done enough so that Andrew can look it over and give
a yea/nay decision.
Jeremy.
(This used to be commit db96f83e34)
2000-04-12 17:59:09 +00:00
Jeremy Allison
2311ecab4c The latest open() code changes broke the NT directory opens. Detect if a
read-only open on a directory was done and return an EISDIR from open_file().
Changed interface to fd_close to return error.
Jeremy.
(This used to be commit df4302f391)
2000-04-11 21:38:45 +00:00
Andrew Tridgell
689ec46450 the bulk of the changes to get rid of fd_ptr and move print open
handling to printing/printing.c

most of this was just replacing things like fsp->fd_ptr->fd with fsp->fd

the changes in open.c are quite dramatic. Most of it is removing all
the functions that handled the fd multiplexing
(This used to be commit d1827a3648)
2000-04-10 13:05:23 +00:00
Tim Potter
92bf37e21d Don't assume that the (files_struct *) passed to fd_attempt_close()
will be non-NULL.
(This used to be commit 02f845e543)
2000-02-17 23:22:26 +00:00
Tim Potter
ae7696117e Put back lots of missing calls to dos_to_unix(). Thanks to
aono@cc.osaka-kyoiku.ac.jp (Tomoki AONO)
(This used to be commit 176c405d27)
2000-02-03 23:08:24 +00:00
Tim Potter
16bb009dbb Mega-VFS merge. Yeah baby!
Synopsis: change every disk access function to work through a vfs_ops
structure contained in the connection_struct.
(This used to be commit 3aad500c0f)
2000-02-03 05:17:25 +00:00
Andrew Tridgell
4e15be9cf1 fixed some typos in access_table() which, amaziingly enough, make no
difference to the result.
(This used to be commit 9e28b7220b)
2000-01-16 13:17:05 +00:00
Andrew Tridgell
62b02ca2e2 made access_table() a pure logic function - makes it simpler to apply
maths to
(This used to be commit 0ad62f128d)
2000-01-16 12:53:12 +00:00
Andrew Tridgell
446f2aef83 as obelix would say "these romans are crazy"
I've finally got the access table code right for the case where the
two opens are on the same connection. It is _incredibly_ complex, but
now all 1296 test cases pass.

I'll be very surprised if anyone by MS and us gets this right at
CIFS2000
(This used to be commit 31a5857ce4)
2000-01-16 12:26:42 +00:00
Andrew Tridgell
2d96e58287 rewrote the access_table() code to get it right for *.exe, *.dll,
*.sym and *.com files. I still find it incredible that SMB treats file
locking differently depending on the file name - that is so ugly it
stinks.

anyway, we now behave the same way as NT, except for the
same-connection case which I'm still working on.
(This used to be commit 5b9be3feca)
2000-01-16 11:21:33 +00:00
Jeremy Allison
3a6c2069d7 Added "inherit permissions" patch.
Fixed locking bug found by Andrew.
Jeremy.
(This used to be commit 38dffd360d)
2000-01-14 01:41:04 +00:00
Andrew Tridgell
826446ddef changes to reflect the new syntax of the locking calls.
(This used to be commit 44117df2c9)
2000-01-13 12:10:48 +00:00
Andrew Tridgell
f2fc3a2dca fix a error in access_table revealed by the new deny test in smbtorture. We now exactly match NT for normal files. We still don't match for *.exe files though
(This used to be commit 3f7fea58e8)
2000-01-08 11:32:00 +00:00
Jeremy Allison
faa302c768 Fixed deny mode bug :
: If a file is resident on NT and the first user opens it read/write with DENY_READ then a subsequent
: attempt by a second user (running under Windows 95) to open it read/write DENY_NONE fails.
: Under samba 2.0.5a the second open succeeds but the file is write only.
Jeremy.
(This used to be commit 974af581fe)
2000-01-08 01:23:13 +00:00
Andrew Tridgell
4e1291a83f converted all our existing shared memory code to use a tdb database
instead of either sysv or mmap shared memory or lock files.

this means we can now completely remove
	locking_shm.c
	locking_slow.c
	shmem.c
	shmem_sysv.c
and lots of other things also got simpler

locking.c got a bit larger, but is much better compartmentalised now
(This used to be commit e48c2d9937)
1999-12-21 09:25:59 +00:00
Andrew Tridgell
3db52feb1f first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
(This used to be commit 453a822a76)
1999-12-13 13:27:58 +00:00
Tim Potter
4085fb08fd Fix incorrect conversion of fd_attempt_open() calls to vfs_ops.open().
Use VFS I/O for fd_attempt_open() and check_access_allowed_for_current_user().
(This used to be commit abf31ca66f)
1999-04-05 05:19:34 +00:00
Tim Potter
10858bba8e Use VFS operations for file I/O.
Changed arg to fd_attempt_close() from fd to fsp_struct.
(This used to be commit c40124bc9a)
1999-04-04 05:57:16 +00:00
Andrew Tridgell
e50ab2b528 fixed warnings (and potential errors) due to integer overflow when
creating locking masks
(This used to be commit 5e2844d5ed)
1998-12-07 22:43:43 +00:00
Jeremy Allison
bfc38ff872 Makefile.in: Added maintainer mode fixes.
aclocal.m4: Added AC_LIBTESTFUNC.
configure.in: Fixed -lsecurity -lsec problems.
client.c: dos_ fixes.
groupdb/aliasunix.c: Dead code removal.
include/includes.h: Added default PRINTCAP_NAME.
lib/genrand.c: dos_ fixes.
lib/replace.c: Added strtoul.
lib/system.c: dos_ fixes.
lib/util.c: dos_ fixes.
lib/util_sid.c: Signed/unsigned fixes.
lib/util_str.c: removed bad const.
locking/locking_slow.c: dos_ fixes.
printing/printing.c: dos_ fixes.
rpc_server/srv_samr.c: Dead code removal.
rpc_server/srv_sid.c: global_myworkgroup defined with wrong size AGAIN !
smbd/dir.c: dos_ fixes.
smbd/open.c: dos_ fixes.
smbd/oplock.c: dos_ fixes.
smbd/reply.c smbd/server.c smbd/service.c smbd/uid.c: dos_ fixes.

Jeremy.
(This used to be commit 6acb4b68f6)
1998-11-25 21:17:20 +00:00
Jeremy Allison
768761820e Added the same open()/fopen()/creat()/mmap() -> sys_XXX calls.
Tidied up some of the mess (no other word for it). Still doesn't
compile cleanly. There are calls with incorrect parameters that
don't seem to be doing the right thing.

This code still needs surgery :-(.

Jeremy.
(This used to be commit 18ff93a9ab)
1998-11-17 20:50:07 +00:00