1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

887 Commits

Author SHA1 Message Date
Herb Lewis
f9a52cadbf Fix for misunderstanding of fsync added when vfs layer
was done. Samba was doing fsync's (bleagh).
Jeremy.
-
Herb Lewis
6bf74da8b8 Fix for check_kernel_oplocks looking for the var directory
before it may need to be created.
Jeremy.
-
Herb Lewis
ebb4f76550 This is reall Jeremy commiting as Herb at SGI labs. Fix
for "socket operation on non-socket" error in log.smb
on HEAD branch startup (server_fd not initialized to -1).
Jeremy.
-
Andrew Tridgell
43860215d4 - use smb_gwtpwnam() in another couple of places
- don't call add/del user if the scripts are empty
-
Andrew Tridgell
88ad00b82a added secrets.tdb and changed storage of trust account password to use
it
-
Andrew Tridgell
76da586396 fixed a vfs crash bug -
Jeremy Allison
1152f2ed00 Fix for dual unix_to_dos conversion in readdir from A.V.Shutko <AVShutko@mail.khstu.ru>
Jeremy.
-
Jeremy Allison
b899943658 Fix for read_file() returning -1.
Jeremy.
-
Jeremy Allison
e8ff6d3fb5 rpc_server/srv_lsa.c: Bring into sync with 2.0.x.
rpc_server/srv_pipe_hnd.c: Bring into sync with 2.0.x.
smbd/blocking.c: Improve blocking debug reporting.
utils/torture.c: Added check for NT locking bug.
Jeremy.
-
Andrew Tridgell
8b7a10febe a minimal change to get appliance mode to work with winbindd
we needed to accept usernames of the form DOMAIN/user, which means we
needed to pass the domain to a getpwnam() like routine in certain
critical spots.

What I'd rather do is get rid of "char *user" everywhere and use the
new userdom_struct, but that will have to wait a few days.
-
Andrew Tridgell
8e53f781d3 - use full_name instead of real_name
- got rid of guest map code in lpq parser
-
Andrew Tridgell
cd5dcd9e65 if the stat cache is off then don't initialise it -
Jeremy Allison
577ddbfbec Insure uninitialized memory read fixes.
Jeremy.
-
Andrew Tridgell
ee8546342d split the username in the vuser structure into a separate
userdom_struct. As the name implies this also contains a domain
(unused at the moment).

This will be important shortly, as operation in appliance mode needs
the domain to be always carried with the username.
-
Andrew Tridgell
610fcef4d3 fixed a memory leak (calling hash_table_init twice) -
Jeremy Allison
46092ee141 Moved uglyness needed in fcntl locking (64->32 bit mapping, NFS
errors etc.) into locking/posix.c, where it is needed. fcntl_lock in lib/util.c
is now very small and clean.
Added (*lock) op to vfs layer.
Jeremy.
-
Jeremy Allison
148628b616 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.
-
Andrew Tridgell
09355fcd50 - added some error checking
- removed the VTP hook in smbd
-
Andrew Tridgell
0bab030074 fixed dptr_wcard handling (need to use strdup) -
Andrew Tridgell
4a15924ffe removed more cruft from our old wildcard matching code -
Andrew Tridgell
85d634974f go back to ascii in SMB_FIND_FILE_BOTH_DIRECTORY_INFO
NT gives out unicode, but NT clients can't handle a unicode response!
-
Andrew Tridgell
38f5e13367 fixed our smbsearch code. We now store the mask with the dptr, this
turns out to be essential for a correct implementation (there ins't
enough room to store all possible masks in the status return
structure!)
-
Andrew Tridgell
03e9cea004 - removed all our old wildcard matching code and replaced it with a
call to ms_fnmatch(). This also removes all the Win9X semantics stuff
and a bunch of other associated cruft.

- moved the stat cache code into statcache.c

- fixed the uint16 alignment requirements of ascii_to_unistr() and
  unistr_to_ascii()

- trans2 SMB_FIND_FILE_BOTH_DIRECTORY_INFO returns the short name as
  unicode always (at least thats what NT4 does)

- fixed some errors in the in-memory tdb code. Still ugly, but doesn't
  crash as much
-
Jeremy Allison
858eb53dc5 Moved deletion of vfs handle into smbd/conn.c as it was being done too
soon in smbd/service.c (file operations were being done after the
handle was closed).

It looks cleaner in smbd/conn.c as it is part of the closing of a conn
struct anyway.

Jeremy.
-
Jeremy Allison
239abd48f0 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.
-
Jeremy Allison
6baa96bb46 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.
-
Jeremy Allison
2746e5602e 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.
-
Jeremy Allison
0487841120 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.
-
Jeremy Allison
5278ec016c 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.
-
Jeremy Allison
9cde198108 Fixed range check on writeX.
Jeremy.
-
Jeremy Allison
4a4b7a994b Tidyup of smbecho.
Jeremy.
-
Andrew Tridgell
d7cd7c88fd moved trans2.h and nterr.h into includes.h with all our other includes -
Jeremy Allison
1df48ed55e 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.
-
Jeremy Allison
389b700a26 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.
-
Andrew Tridgell
2fba24ef0e moved INSURE hook into util.c -
Andrew Tridgell
e4ddd1a4a9 fixed two uninitialised memory references -
Andrew Tridgell
bb9b3e03de trick to get full stack trace when using the free version of insure -
Andrew Tridgell
53077295b7 insure caught an uninitialised memory reference - ensure it starts as
zero
-
Andrew Tridgell
062d79bf8b avoided a memory leak in the ubi code by deleting a mangled cache
entry before adding to ensure that we don't ever add a duplicate entry

this code can be removed when ubi gets fixed
-
Andrew Tridgell
d0fc1675df don't copy a null groups list -
Andrew Tridgell
1106fa7f24 fixed overlapping strcpy() found by insure -
Andrew Tridgell
14251aab2e fixed uninitialised snum -
Jeremy Allison
ab0ecc39d6 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.
-
Andrew Tridgell
e2eacdd74c split fsusage() into a separate module (to fix linking problems with
spoolssd in tng)
-
Andrew Tridgell
95246a8432 patch from luke to split out lanman code from ipc.c into lanman.c -
Andrew Tridgell
2c2d95d77d - got rid of the "passive" option
- cleaned up the standard_sub_*() calls a lot
-
Jeremy Allison
204ca1195c locking/locking.c: Fixed placeholder code for POSIX locking.
printing/printing.c: Cast tdb_delete to (tdb_traverse_func) to stop warning.
                     tmpfile gives mirror warning.
smbd/groupname.c: Remember to file_lines_free() on exit.
tdb/tdb.h: Add tdb_traverse_func typedef.
Jeremy
-
Luke Leighton
a0afe0d5f8 ReadDirName calls vfs->readdirname calls dos_readdirname.
replaced with readdirname.  ditto for OpenDir and CloseDir.
-
Andrew Tridgell
384ecd9d66 converted a couple more functions to use a fd instead of a FILE*
added a new utility fn file_lines_slashcont() which is used to handle
files that treat a \ followed by a newline as a blank
-
Andrew Tridgell
a09470817c converted a bunch more functions to use a fd instead of a FILE*
to support some of this I added the following functions in util_file.c

file_lines_pload : load lines from a pipe
file_pload : load a pipe into memory
-