1
0
mirror of https://github.com/samba-team/samba.git synced 2025-06-18 19:17:08 +03:00

76 Commits

Author SHA1 Message Date
Michael Adam
74ed53a115 Slight reformatting of fd_close_posix(), while I'm at it.
Wrap lines and remove trailing space.

Michael
2008-04-21 00:21:24 +02:00
Michael Adam
d928e6648d Change fd_close_posix() to return int instead of NTSTATUS.
The errno is handed up through the VFS layer to the callers.

Michael
2008-04-21 00:21:24 +02:00
Michael Adam
df264bf3e0 Don't modify the fsp in fd_close_posix() anymore.
Now that it is inside the vfs layer, this function should
not alter the fsp (i.e. set fsp->fh->fd = -1) anymore.
That belongs above the vfs layer.

Michael
2008-04-21 00:21:24 +02:00
Michael Adam
3cf56b124a Move the posix pending close functionality down into the VFS layer.
This hides the pending close fds from the outside. Call order
of SMB_VFS_CLOSE is reversed. Originally, it was:

fd_close -> fd_close_posix -> SMB_VFS_CLOSE -> close

And now it is:

fd_close -> SMB_VFS_CLOSE -> fd_close_posix -> close

This is in preparation of removing the fd parameter
from the SMB_VFS_CLOSE function. But it is also the right
place for the pending close calls anyways.

Michael
2008-04-21 00:21:23 +02:00
Michael Adam
ee5a20becd Remove redundant parameter fd from SMB_VFS_GETLOCK().
Michael
2008-01-07 22:18:50 +01:00
Michael Adam
4f3ab2c406 Remove redundant parameter fd from SMB_VFS_LOCK().
Michael
2008-01-07 16:38:23 +01:00
Michael Adam
f3365b74ac Remove redundant connection_struct from fd_close_posix() parameter list.
Michael
2007-12-22 02:01:32 +01:00
Volker Lendecke
841f4ccbfb Convert the posix_pending_close_db to dbwrap_rbt 2007-12-11 16:16:54 +01:00
Volker Lendecke
2f3c865707 Tiny simplifications
locking.c:open_read_only was unused

don't export the silly boolean flag locking_init(bool read_only)
2007-12-10 12:22:01 +01:00
Volker Lendecke
8ee502e1e5 Remove two statics 2007-12-10 12:22:01 +01:00
Jeremy Allison
a1725f4ff7 Add MAX_DNS_NAME_LENGTH, remove more pstrings.
Jeremy.
2007-11-15 18:27:26 -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
888e657d75 r24571: Only look at errno if the close call actually failed
Patch from Ofir Azoulay <Ofir.Azoulay@expand.com> -- thanks
2007-10-10 12:30:06 -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
James Peach
171dc060e2 r23510: Tidy calls to smb_panic by removing trailing newlines. Print the
failed expression in SMB_ASSERT.
2007-10-10 12:23:23 -05:00
Volker Lendecke
9b10dbbd5d r23183: Check in a change made by Tridge:
This replaces the internal explicit dev/ino file id representation by a
"struct file_id". This is necessary as cluster file systems and NFS
don't necessarily assign the same device number to the shared file
system. With this structure in place we can now easily add different
schemes to map a file to a unique 64-bit device node.

Jeremy, you might note that I did not change the external interface of
smb_share_modes.c.

Volker
2007-10-10 12:22:52 -05:00
James Peach
853f41edb8 r23096: Make the lock failure message prettier. 2007-10-10 12:22:45 -05:00
Stefan Metzmacher
3a28443079 r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users

metze
2007-10-10 12:19:00 -05:00
Jeremy Allison
83dbbdff34 r21191: Add in the POSIX open/mkdir/unlink calls.
Move more error code returns to NTSTATUS.
Client test code to follow... See if this
passes the build-farm before I add it into
3.0.25.
Jeremy.
2007-10-10 12:17:47 -05:00
Volker Lendecke
609dbec600 r19668: Convert the locking params to use struct share_param instead of snum 2007-10-10 12:15:46 -05:00
Volker Lendecke
e4b8c79a9d r17452: Some C++ warnings 2007-10-10 11:38:34 -05:00
Jeremy Allison
43d24fbd41 r17041: Trying to track down a *big* memory leak in the new lock code.
Fix a small one first.... (easy to valgrind).
Jeremy
2007-10-10 11:19:21 -05:00
Jeremy Allison
2f8cabe98d r17000: Allow CIFS POSIX locks to coexist with Windows locks.
We shouldn't allow this on the same smbd, but the cifsfs
client negotiates POSIX locks then sends Windows ones.
Doh ! Can't fix shipped client code....
Jeremy.
2007-10-10 11:19:17 -05:00
Jeremy Allison
f11933b3ac r16992: Fix bug #3922 reported by jason@ncac.gwu.edu, correctly
look at the return code.
Jeremy.
2007-10-10 11:19:17 -05:00
Jeremy Allison
edd72d37de r16987: Fix the logic errors in ref-counting Windows locks.
Hopefully will fix the build farm. Still a few errors
in RAW-LOCK to look at though...
Jeremy.
2007-10-10 11:19:16 -05:00
Jeremy Allison
53094435d8 r16973: Fix subtle logic error in lock ref counting found by
cifsfs client 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
Jeremy Allison
e8d86362ba r16307: Make sure we know we must pass a valid pointer here.
Klocwork #1129.
Jeremy.
2007-10-10 11:17:32 -05:00
Jeremy Allison
08e52ead03 r15018: Merge Volker's ipc/trans2/nttrans changes over
into 3.0. Also merge the new POSIX lock code - this
is not enabled unless -DDEVELOPER is defined.
This doesn't yet map onto underlying system POSIX
locks. Updates vfs to allow lock queries.
Jeremy.
2007-10-10 11:15:57 -05:00
Jeremy Allison
bc1a605a39 r14703: Clarify the return codes for the POSIX locking case. This
was confusing.
Jeremy.
2007-10-10 11:15:44 -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
Jeremy Allison
c7fe18761e 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.
2007-10-10 10:58:18 -05:00
Jeremy Allison
960a5d37d1 r7975: One more tidyup to ensure we're using "struct posix_lock".
Jeremy.
2007-10-10 10:58:05 -05:00
Jeremy Allison
f2bcfdddc7 r7972: Tidy up the posix locking in memory db code whilst I'm waiting for jht
to get back to me with a backtrace.
Jeremy.
2007-10-10 10:58:05 -05:00
Herb Lewis
58e307664e r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunk
so our numbers don't get out of sync
2007-10-10 10:56:43 -05:00
Jeremy Allison
b94db3a758 r5625: Reformat (tidy). 2007-10-10 10:55:51 -05:00
Jeremy Allison
620f2e608f 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.
2007-10-10 10:53:32 -05:00
Jeremy Allison
c6b144654a r3120: Fix bug #1955 reported by Love <lha@stacken.kth.se>. Inconsistent error return.
Jeremy.
2007-10-10 10:53:01 -05:00
Alexander Bokovoy
c2689ed118 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 -
Alexander Bokovoy
91984ef5ca 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
-
Jeremy Allison
e9b4fb8b9a Fixes for HPUX only having limited POSIX lock range from Michael Steffens <michael.steffens@hp.com>
Jeremy.
-
Jeremy Allison
09a218a9f6 Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
-
Jeremy Allison
5d5762d178 Lots of fixes for error paths where tdb_fetch() data need freeing.
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>.
Jeremy.
-
Tim Potter
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
-
Tim Potter
2d0922b0ea Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. -
Simo Sorce
e61aec84ed move to SAFE_FREE() -
Jeremy Allison
ce9f959964 Fix the 62bit locking onto 32 bit NFS mounts problem generically for HPUX.
Don. please check this out.
Jeremy.
-
Jeremy Allison
8fad517770 NFS v2 can return ENOLCK when greater than 31 bit offsets are used.
Treat this the same as an EFBIG error.
Jeremy
-
Jeremy Allison
bd9cbf4c68 Ignore locks of length zero as they mean different things in Win32
and POSIX.
Jeremy.
-