Andrew Tridgell [Sun, 30 Apr 2000 11:04:28 +0000 (11:04 +0000)]
- 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
Andrew Tridgell [Sun, 30 Apr 2000 04:45:16 +0000 (04:45 +0000)]
YIPEE!!!!!
We finally have a perfect emulation of Microsoft wildcard
matching. The routine ms_fnmatch() does wildcard matching with all MS
wildcards (including the unicode wildcards), and masktest against a
NT4 workstation with hundreds of thousands of random exmaples has not
found a single error.
amazingly it is only about 60 lines of code, but it has taken us years
to get it right. I didn't sleep much last night :)
Jeremy Allison [Fri, 28 Apr 2000 21:09:26 +0000 (21:09 +0000)]
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 Allison [Fri, 28 Apr 2000 20:54:23 +0000 (20:54 +0000)]
Ok - this is the *third* implementation of this (third time's the charm :-).
This implementation keeps all POSIX lock records in a separate in memory
tdb database only known about in locking/posix.c. In addition, the pending
close fd's are also held in a tdb which has an array of fd's indexed by
device and inode.
The walk-split code uglyness has been moved to posix.c from brlock.c,
which is the only place that needs to know about it, and the extra
functions hacked into brlock to expose internal state have been removed.
This implementation passes smbtorture locktest4, the only thing I need
to check now for completeness is what to do about lock upgrade/downgrades
which Win32 allows under some *very* strange circumstances.
Luke Leighton [Fri, 28 Apr 2000 08:45:46 +0000 (08:45 +0000)]
oh, dear, two commits-in-one.
1) spoolss code, wrote spoolss_getprinterdata then discovered i need
getprinter not data. argh!
2) returning uint32 results from cmd_* now, now void. fixup all sam
commands because that's the one where it's needed.
now, samedit -S \\server -U% -l log -c 'enumusers -u' will work, and
if it fails, samedit returns an exit status.
i want to abstract cli_error() so that i can parse NT_STATUSxxxxx into
a unix error code. cli_error() currently *has* to receive a cli_state
which is, like... bogus, in msrpc code.
Tim Potter [Fri, 28 Apr 2000 07:51:59 +0000 (07:51 +0000)]
Modified timeout parameters slightly. Still not happy with ntdom behaviour
when winbind daemon dies.
Pass contents of environment variable WINBINDD_DOMAIN to winbindd daemon
with each of {set,get,end}{pw,gr}ent() calls.
Removed pwent_ndx and grent_ndx statics for the moment - need to think
about how to implement server-side reuse of these in order to get clients
restarting from the correct point after when a get{pw,gr}ent() call has
been interrupted.
Jeremy Allison [Fri, 28 Apr 2000 02:06:19 +0000 (02:06 +0000)]
Added tdb_get/set_int_byblob, which takes a size_t len and then implemented
the tdb_get/set_int string functions in terms of them. Will be useful in storing
POSIX pending close records (which are ints but indexed by dev/inode pairs).
Jeremy.
Jeremy Allison [Fri, 28 Apr 2000 00:39:23 +0000 (00:39 +0000)]
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 [Thu, 27 Apr 2000 23:28:56 +0000 (23:28 +0000)]
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 Allison [Thu, 27 Apr 2000 22:23:04 +0000 (22:23 +0000)]
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 [Thu, 27 Apr 2000 21:12:33 +0000 (21:12 +0000)]
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 [Thu, 27 Apr 2000 18:46:10 +0000 (18:46 +0000)]
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.
Luke Leighton [Wed, 26 Apr 2000 04:21:53 +0000 (04:21 +0000)]
more merge. easy (no complaints :) using dirdiff. hey, paul, dirdiff is
great!
jeremy, i renamed read_pipe and write_pipe to match your functions. i
still have write_then_read_pipe() because it does a write, then a read,
then a select(). still have to talk to andrew about this one :)
Jeremy Allison [Tue, 25 Apr 2000 20:36:28 +0000 (20:36 +0000)]
Same fix I just put into HEAD. Luke, I cannot compile tng at the moment
(configure fails with libtool failure ?) but this is the core of the
POSIX locking fix.
Map brl locks correctly into POSIX locks, including the
really nasty case of large range unlock.
There is a lot of pretty ASCII art in locking/brlock.c explaining
exactly how this code works. If it is unclear, please ask me.
merge from HEAD:
> fixed a memory leak I caused last week with my lines[] changes
> fixed another memory leak
Luke, we should maybe have a source/sync-status.txt, so
people (including us) know, which files are completely
in-sync with HEAD and one can just drop in the new
version, and for which files one needs to extract a diff
in HEAD and then apply that to TNG.
Doing some real stuff:
Rewrote lsa_query_info server-side API to use an
LSA_INFO_UNION.
Implemented server-side lsa auditsettings response, now
samba tells everybody, it audits everything. NT tells this
info only admins.
By trying to set the auditsettings, found the LSA_SET_INFO
opcode. I've also got the LSA_Q_SET_INFO-struct, but
neither the parser, nor the response-struct. I hope to add
the parser at least soon.
If you want to do something crazy and destroy your nt-box,
you could now write up the client-code for lsa_set_info and
try setting the member-name and sid. ("Don't do that at
home, kids!")
Jeremy Allison [Mon, 24 Apr 2000 20:48:40 +0000 (20:48 +0000)]
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 Allison [Mon, 24 Apr 2000 19:23:51 +0000 (19:23 +0000)]
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.
Andrew Tridgell [Sun, 23 Apr 2000 14:25:04 +0000 (14:25 +0000)]
fixed a locking database bug - it was actually harmless except that
smbstatus could display the wrong filename when files change dev/inum
after a rename