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

304 Commits

Author SHA1 Message Date
Andrew Tridgell
33179a95d8 add some brackets
(This used to be commit bf67721ef5)
2000-06-13 15:46:15 +00:00
Jeremy Allison
9c4079d8c3 Fixed misunderstanding found during CIFS conference. Overlapping lock
ranges (not just included lock ranges) should be handled correctly.
UNIT test still needed.
Jeremy.
(This used to be commit 07872298e3)
2000-05-25 20:05:50 +00:00
Herb Lewis
e522de4808 Using a structure for a tdb key can lead to insideous, hard
to find bugs. On 64 bit IRIX, structure packing means that
a
struct {
SMB_DEV_T dev /* 4 bytes */
SMB_INO_T ino /* 8 bytes */
}

has 4 bytes of padding between the two members. If you
don't null the memory before using it as a tdb key,
you randomly can't find keys depending on what is in
the padding. This caused me immense pain and was hard
to track down.... :-)

Jeremy.
(This used to be commit f2a5ba3f09)
2000-05-10 00:05:27 +00:00
Jeremy Allison
6d9ce38306 Fix for uninitialized memory read in brlock code. brl_locktest now needs
to correctly set the fnum, as the brl_conflict code looks at it.
Jeremy.
(This used to be commit df87259a35)
2000-05-05 20:50:22 +00:00
Jeremy Allison
091c970682 Two fixes. Added missong logic & case in lock split code.
Fixed range split into two, as DLIST_ADD has the wrong semantics...
Jeremy.
(This used to be commit 82681edda1)
2000-05-05 02:17:39 +00:00
Jeremy Allison
fffeaf527d Updated to fix overlapping problem.
Jeremy.
(This used to be commit 9bdfe0f502)
2000-05-04 19:01:14 +00:00
Jeremy Allison
05a28f1dfd Fix for debug statement crash.
Jeremy.
(This used to be commit 57bf92d901)
2000-05-04 00:29:50 +00:00
Jeremy Allison
8c19fa8f7a Fix based on Elrond's code to reduce the store size on removing dead records.
Jeremy.
(This used to be commit 09e92a61a9)
2000-05-03 20:33:25 +00:00
Jeremy Allison
756798d000 Fixed the bug locktest.c found, it was an off-by-one error in the non-overlap
case.
Jeremy.
(This used to be commit 65150c408a)
2000-05-03 19:37:47 +00:00
Jeremy Allison
0d917c6cd6 Fixed silly bug where I wasn't checking for matching fd's in closing a file.
This caused smbd crashes on SIGKILL.
Jeremy.
(This used to be commit d4dcefd12d)
2000-05-03 18:57:21 +00:00
Jeremy Allison
f6bcf3d324 Added range info to the panic message to track down the bug with
locktest.
Jeremy.
(This used to be commit 91f038356b)
2000-05-03 17:50:42 +00:00
Andrew Tridgell
c6230f6431 - clear dead locks at startup
- fixed a bug which caused lock records to not decrease in size
(This used to be commit 51624a3a2f)
2000-05-03 14:29:05 +00:00
Jeremy Allison
20ce61ccc8 Fix for stacking locks in brlock and POSIX. Windows only allows a read lock
to overlay a write lock on the same fnum. When overlaying read locks onto
a write lock, the number of locks is counted, and the first unlock removes
the write lock and downgrades this to a read lock. Do the same when mapping
to POSIX.
Jeremy.
(This used to be commit 74d42644e6)
2000-05-03 02:27:41 +00:00
Jeremy Allison
d009301464 Implemented the last (I hope:-) part of the locking puzzle, the reference
counting when Windows downgrades a write lock to a read lock, then reference
counts the unlocks to match the locks.
With this code the POSIX unlock isn't done until the final Windows unlock.
Jeremy.
(This used to be commit 6eb4fb6eef)
2000-05-02 21:07:25 +00:00
Andrew Tridgell
32d5416b6a 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.
(This used to be commit ee8546342d)
2000-05-02 13:55:42 +00:00
Jeremy Allison
ba020b0612 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.
(This used to be commit 46092ee141)
2000-05-02 03:20:47 +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
830a9e571e locking/posix.c: Fixed double-free nasty crash bug found by insure.
utils/make_smbcodepage.c:
utils/make_unicodemap.c: Insure 'make install' fixes.
Jeremy.
(This used to be commit 3b25f7368b)
2000-05-01 19:43:50 +00:00
Andrew Tridgell
99fbf5c4bc added TDB_INTERNAL, TDB_NOLOCK and TDB_NOMMAP flags.
TDB_INTERNAL replaces the old method of passing a null filename
(This used to be commit 8ec815920d)
2000-05-01 00:41:47 +00:00
Andrew Tridgell
700f72453e - 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
(This used to be commit 03e9cea004)
2000-04-30 11:04:28 +00:00
Jeremy Allison
74ac259e07 Removed tdb locking calls (picky Andrew...:-)
(This used to be commit 6bded3b74e)
2000-04-29 01:09:31 +00:00
Jeremy Allison
9a5eb068ab 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.

Jeremy.
(This used to be commit 3f655de1c7)
2000-04-28 20:54:23 +00:00
Jeremy Allison
46e84a0090 Split off of POSIX locking into separate unit as Andrew requested.
Done so I don't lose my edits... :-).
Jeremy.
(This used to be commit 31a57be658)
2000-04-28 19:38:38 +00:00
Jeremy Allison
1f7d96ee03 Forgot to close when "posix locking" is set to False.
Jeremy.
(This used to be commit b812f09ba8)
2000-04-28 01:08:32 +00:00
Jeremy Allison
f8e5696bd6 Added optimization where we are single opener (don't free POSIX locks).
Jeremy.
(This used to be commit a2deb91128)
2000-04-28 01:01:07 +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
e4d382750c Added the hard code :-).
HEAD should now 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.

Jeremy.
(This used to be commit 135855dbd3)
2000-04-25 20:30:58 +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
Andrew Tridgell
a069d4d72f 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
(This used to be commit 990b16fcf7)
2000-04-23 14:25:04 +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
Jeremy Allison
4217c939ec 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
(This used to be commit 204ca1195c)
2000-04-18 20:41:04 +00:00
Jeremy Allison
019bab27c8 Typo - missing '}'.
Jeremy.
(This used to be commit 0216d81f06)
2000-04-13 16:46:32 +00:00
Jeremy Allison
a018d6b326 Removed "ole locking compat" parameter (no longer used).
We now get/set/check POSIX locks, but I still need to code up the
close fd braindamage...
Jeremy.
(This used to be commit 3de058bd43)
2000-04-12 23:01:11 +00:00
Jeremy Allison
96b3bf3140 Implmented mapping of lock offset/count from 64 bit MS ranges
to either 63 or 31 bit POSIX ranges. Code to get these locks
not yet added.
Jeremy.
(This used to be commit 9c3b9146a3)
2000-04-12 21:46:22 +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
f6be38cae2 include/byteorder.h: ALIGN4/ALIGN2 macros.
include/includes.h: Added SMB_BIG_UINT_BITS.
lib/util.c: Removed align2/align4 - use macros.
libsmb/namequery.c: Use ALIGN2.
locking/locking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T.
                   Needed to move to hiding POSIX locks at a lower layer.
nmbd/nmbd_processlogon.c: Use ALIGN2/ALIGN4 macros.
smbd/blocking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T.
smbd/reply.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T.
Jeremy.
(This used to be commit 491eea8a20)
2000-04-11 19:44:54 +00:00
Andrew Tridgell
b36ea9a7e1 the first of a bunch of changes to code with getting rid of the fd_ptr
element in the fsp

pretty mechanical stuff, but it affects lots of files.
(This used to be commit 368b0bc1b1)
2000-04-10 12:58:14 +00:00
Tim Potter
ebbb007ed2 Fixed compile warning in locking.c:traverse_fn()
(This used to be commit eefc897221)
2000-02-07 00:24:04 +00:00
Luke Leighton
bbe275e95b 1) added void* state argument to tdb_traverse. guess what! there were
two places i found where it was appropriate to _use_ that third argument,
in locking.c and brlock.c!  there was a static traverse_function and
i removed the static variable, typecast it to a void*, passed it to
tdb_traverse and re-cast it back to the traverse_function inside the
tdb_traverse function.  this makes the use of tdb_traverse() reentrant,
which is never going to happen, i know, i just don't like to see
statics lying about when there's no need for them.

as i had to do in samba-tng, all uses of tdb_traverse modified to take
the new void* state argument.

2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient.
i don't know how the other samba team members would react if i deleted
rpcclient from cvs main.  damn, that code's so old, it's unreal.
20 rpcclient commands, instead of about 70 in SAMBA_TNG.
(This used to be commit 49d7f0afbc)
2000-02-04 04:59:31 +00:00
Andrew Tridgell
54e1176ba1 added code to allow traversal of the byte range lock database
this is used with "smbstatus -B" to dump the lock list
(This used to be commit 5f02262914)
2000-01-16 11:14:44 +00:00
Andrew Tridgell
7bc1cc7e07 damn, Solaris already has a "enum lock_type"
changed it to "enum brl_type"
(This used to be commit 6b9ee7662c)
2000-01-14 08:01:44 +00:00
Andrew Tridgell
82af221e4a we now pass all byte range locking tests
the last piece was to use a smb timeout slightly larger than the
locking timeout in bloking locks to prevent a race
(This used to be commit 1b54cb4a33)
2000-01-14 04:32:57 +00:00
Andrew Tridgell
2afd5d5eb5 some more work on the byte range locking
note the ugly global_smbpid - I hope that won't bethere for long, I
just didn't want to do two lots of major surgery at the one time.
Using global_smbpid avoids the big change of getting rid of our
inbuf/outbuf interface to reply routines. I'll do that once the
locking stuff passes all tests.
(This used to be commit f8bebf91ab)
2000-01-14 00:50:48 +00:00
Andrew Tridgell
6c2a1fdf36 the bulk of the new byte range locking coode
it doesn't map to posix locks yet, that will come later.
(This used to be commit 7f2a493095)
2000-01-13 12:09:36 +00:00
Andrew Tridgell
574788039f added the unexpected packet database (unexpected.tdb)
this means "nmblookup -S" now always works, even with broken servers
the database stores all unexpected replies and these can be accessed
by any client.
while doing this I cleaned up a couple of functions, and put in place
a better trn_id generator. in most places the code got quite a bit
simpler due to the addition of simple helper functions.

I haven't yet put the code in to take advantage of this for pdc
replies - that will be next. Jeremys pdc finding code will then work :)
(This used to be commit 280e6359d3)
2000-01-03 03:17:16 +00:00
Andrew Tridgell
9a781a8c6d - added tdb_flags option to tdb_open()
- added TDB_CLEAR_IF_FIRST flag to clear the database if this is the
  first attached process. Useful for non-persistent databases like our
  locking area (this will also make upgrades to new database layouts easier)
- use lock_path() in a couple of places
- leave connections database open while smbd running
- cleaned up some tdb code a little, using macros for constants
(This used to be commit 00e9da3ca5)
2000-01-02 23:00:27 +00:00
Andrew Tridgell
4b37a2c1ee when no shares are returned the *shares pointer must be set to null
(This used to be commit 84fe2337c7)
1999-12-22 00:08:25 +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
9d4b57069c Use VFS operations for file I/O.
(This used to be commit 20bfa71c95)
1999-04-04 05:32:42 +00:00
Andrew Tridgell
d330c907bd Ken McDonell from SGI was interested in adding some profiling
capabilities to Samba so that Samba could talk to the SGI PCP
(Performance Co-Pilot) apps.

This change adds a profiling shared memory area and uses it to count
two fairly trivial things, the number of uid switches and the number
of SMB packets processes. To add more just edit include/profile.h and
then increment it at the right place.

I've also added a -P switch to smbstatus to dump the profile area.
(This used to be commit ef3d61a80a)
1999-04-01 05:22:58 +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
Andrew Tridgell
233aae2081 don't core dump in smbstatus if we can't open the shmem system
(This used to be commit ef9749798a)
1998-10-31 09:31:29 +00:00
Jeremy Allison
9bb7ac81b6 Reasonably large change to give us *exactly* correct NT delete on close semantics.
This was trickier than it looks :-). Check out the new DELETE_ON_CLOSE
flag in the share modes and the new code that iterates through all open
files on the same device and inode in files.c and trans2.c

Also changed the code that modifies share mode entries to take
generic function pointers rather than doing a specific thing so
this sort of change should be easier in the future.

Jeremy.
(This used to be commit 5e6a7cd99d)
1998-10-23 03:34:50 +00:00
Jeremy Allison
b8aec499dc Fixed sys_lseek and seek_file calls so all returns
are *checked* :-).
Jeremy.
(This used to be commit b8b781191d)
1998-10-18 22:06:35 +00:00
Jeremy Allison
fc62d6bf36 Small tidyups for gcc in 'preen' mode....
Jeremy.
(This used to be commit 60dc1a4a00)
1998-10-17 17:41:13 +00:00
Jeremy Allison
cf3a9741dc Changes to test in configure if capabilities are enabled on a system.
Changes to get Samba to compile cleanly with the IRIX compiler
with the options : -fullwarn -woff 1209,1174 (the -woff options
are to turn off warnings about unused function parameters and
controlling loop expressions being constants).
Split prototype generation as we hit a limit in IRIX nawk.
Removed "." code in smbd/filename.c (yet again :-).
Jeremy.
(This used to be commit e0567433bd)
1998-09-28 21:43:48 +00:00
Alexandre Oliva
cf971f88ac automated generation of .dummy files for each subdirectory;
dummy.in files are no longer needed, and new directories will be taken
care of automatically, at configure (or config.status --recheck) time
(This used to be commit 237a8e5fe6)
1998-09-28 00:14:36 +00:00
Alexandre Oliva
e649750cb4 major autoconf clean-up
fix problems in builds with srcdir!=builddir
(This used to be commit 1ffc3b807a)
1998-09-21 09:07:08 +00:00
Jeremy Allison
06cc91f9a6 Added ssize_t to configure code.
Got 'religion' about using size_t and ssize_t for read/write stuff
as part of the code to expose 64 bits to the client.

This checkin does all the 'easy' stuff - such as all the read/write/lock
calls - but now comes the harder parts (open & friends) and all the
file enquiry functions.....

Jeremy.
(This used to be commit 36544fe547)
1998-09-11 01:24:30 +00:00
Andrew Tridgell
012e575e13 ahh, the joy of deleting large chunks of code that someone else has
painstakingly put in :)

This gets rid of most of the #ifdef LARGE_SMB_INO_T ifdefs around
DEBUG() statements. We just use %.0f in all cases. Makes the code a
bit easier to read :)
(This used to be commit 41f0069afc)
1998-09-05 05:23:29 +00:00
Andrew Tridgell
e9ea36e4d2 tridge the destroyer returns!
prompted by the interpret_security() dead code that Jean-Francois
pointed out I added a make target "finddead" that finds potentially
dead (ie. unused) code. It spat out 304 function names ...

I went through these are deleted many of them, making others static
(finddead also reports functions that are used only in the local
file).

in doing this I have almost certainly deleted some useful code. I may
have even prevented compilation with some compile options. I
apologise. I decided it was better to get rid of this code now and add
back the one or two functions that are needed than to keep all this
baggage.

So, if I have done a bit too much "destroying" then let me know. Keep
the swearing to a minimum :)

One bit I didn't do is the ubibt code. Chris, can you look at that?
Heaps of unused functions there. Can they be made static?
(This used to be commit 2204475c87)
1998-09-05 05:07:05 +00:00
Jeremy Allison
83900f2b68 Modified dev_t and ino_t code to be 64 bit clean (including changes
to oplock break message passing). I think that smbd/nmbd are now
inode and offset size independent (at least for 32 bit and 64 bit
systems).

Now to expose all this new functionality to NT clients.....

Jeremy.
(This used to be commit 5910d07bbf)
1998-09-04 20:53:58 +00:00
Jeremy Allison
623a18db4b More 64 bit stuff - now the fcntl locks are 64 bit clean.
Nearly at the stage where I can expose the 64-bit-ness to
the NT clients....
Jeremy.
(This used to be commit 422f1dd450)
1998-09-04 00:23:28 +00:00
Jeremy Allison
7bb86c1b13 Ok - this is the 64 bit widening check in. It changes the configure
to check for stat64 and friends, and then changes much of Samba
to use the data type SMB_OFF_T for file size information.

stat/fstat/lstat/lseek/ftruncate have now become sys_stat etc. to hide
the 64 bit calls if needed.

Note that this still does not expose 64 bit functionality to the
client, as the changes to the reply_xxx smb's are not yet done.

This code change should make these changes possible.

Still to do before full 64 bit-ness to the client:

fcntl lock code.
statfs code
widening of dev_t and ino_t (now possible due to SMB_DEV_T and SMB_OFF_T
types being in place).

Let me know if wierd things happen after this check-in and I'll
fix them :-).

Jeremy.
(This used to be commit 14500936c3)
1998-09-03 18:40:31 +00:00
Jeremy Allison
1855627413 More abstraction of file system data types, to move to a 64
bit file interface for the NT SMB's.

Created a new define, SMB_STRUCT_STAT that currently is
defined to be struct stat - this wil change to a user
defined type containing 64 bit info when the correct
wrappers are written for 64 bit stat(), fstat() and lstat()
calls.

Also changed all sys_xxxx() calls that were previously just
wrappers to the same call prefixed by a dos_to_unix() call
into dos_xxxx() calls. This makes it explicit when a pathname
translation is being done, and when it is not.

Now, all sys_xxx() calls are meant to be wrappers to mask
OS differences, and not silently converting filenames on
the fly.

Jeremy.
(This used to be commit 28aa182dbf)
1998-09-01 20:11:54 +00:00
Jeremy Allison
693480af8b configure.in, configure: include/config.h.in: Added stropts and poll.
include/smb.h: Moved old typedefs of uint8 etc. into include/includes.h where
               all the other defines live (changed them from typedefs to
               defines).
Other changes : changed from using uint32 to SMB_DEV_T and SMB_INO_T
in preparation for moving to size independed (ie. 64 bit clean) device
and inode access. Stat call wrapper comes next :-).

Jeremy.
(This used to be commit 3d9ec96de5)
1998-08-31 20:20:54 +00:00
Andrew Tridgell
98411c48c0 - zero shared memory before freeing it
- changed the hash size to 13 (much smaller than before). This should
  make for more efficient shared memory usage as it will lead to less
  fragmentation.
(This used to be commit 9c1e4c2dae)
1998-08-30 04:35:54 +00:00
Jeremy Allison
dc76502cd8 Turning on blocking locking code. NB. Blocking lock requests that are not
the head of an SMB request (ie. are part of a chain) will not be queued -
this will be fixed when we move to the new chain code. In practice, this
doesn't seem to cause much of a problem (in my admittedly limited testing)
bug a debug level zero message will be placed in the log when this
happens to help determine how real the problem is.

smbd/locking.c: New debug messages.
smbd/blocking.c: New blocking code - handles SMBlock, SMBlockread and SMBlockingX
smbd/chgpasswd.c: Fix for master fd leak.
smbd/files.c: Tidyup comment.
smbd/nttrans.c: Added fnum to debug message.
smbd/process.c: Made chain_reply() use construct_reply_common(). Added blocking
                lock queue processing into idle loop.
smbd/reply.c: Added queue pushes for SMBlock, SMBlockread and SMBlockingX.
Jeremy.
(This used to be commit e1dd03ecda)
1998-08-20 19:28:37 +00:00
Jeremy Allison
12de4034c7 Makefile.in: Moved blocking lock code into smbd/blocking.c for link purposes.
include/includes.h: Added nterr.h.
locking/locking.c: Moved blocking lock code into smbd/blocking.c for link purposes.
smbd/close.c: Added blocking lock removal to file close.
smbd/filename.c: Tidied up unix_convert() so I could read it (:-) in preparation
                 for the stat_cache code.
smbd/nttrans.c: Added WRITE_ATTRIBUTES check.
smbd/reply.c: Fixed multibyte char problem in wildcard mask.
Jeremy.
(This used to be commit 148eaba3da)
1998-08-19 01:49:34 +00:00
Jeremy Allison
1e6837837a smbd/nttrans.c: Fixed bug in split off pipe code.
locking/locking.c: More blocking lock changes.
Jeremy.
(This used to be commit 2ca4fc95a4)
1998-08-17 23:39:59 +00:00
Andrew Tridgell
8978aae696 much cleaner chain pointer handling for both files and pipes.
the chain pointer is now stored as a static and is set whenever a
handle is created or extracted. This also makes the code less error
prone.
(This used to be commit 068a862982)
1998-08-17 03:52:05 +00:00
Andrew Tridgell
6daa579e0f fixed some bugs in the locking_slow code caused by the recent changes.
also fixed a couple of %s/%d bugs in locking slow that have been there
for a while but are now revealed by the gcc printf argument testing.
(This used to be commit 16228c185a)
1998-08-16 05:23:54 +00:00
Andrew Tridgell
a7acf10566 server.c: fixed a bug in close_file() with the new files.c handling code
bitmap.c: added bitmap hanlding code in preparation for increasing the
          default max open files to several thousand
(This used to be commit f573a65b67)
1998-08-16 03:04:06 +00:00
Andrew Tridgell
127655cc88 this checkin gets rid of the global Files[] array and makes it local
in files.c

it should now be faily easy to expand the default MAX_OPEN_FILES to
many thousands.
(This used to be commit b088c804f9)
1998-08-15 07:27:34 +00:00
Jeremy Allison
e13aeea928 configure: Changes for extra headers.
configure.in: Source for header changes.
client/clitar.c: Fixed isXXX macros & debugs for gcc pedantic compile.
include/config.h.in: Added MEMSET, BZERO, MEMORY, RPCSVC_YPCLNT, STRINGS headers.
include/includes.h: Headers for the above.
include/smb.h: Made SIGNAL_CAST POSIX by default void (*)(int).
lib/access.c: Fixed isXXX macros & debugs for gcc pedantic compile.
lib/charset.c: Fixed isXXX macros & debugs for gcc pedantic compile.
lib/debug.c: Fixed signal functs.
lib/kanji.c: Fixed isXXX macros & debugs for gcc pedantic compile.
lib/smbrun.c: Fixed isXXX macros & debugs for gcc pedantic compile.
lib/util.c: Fixed isXXX macros & debugs for gcc pedantic compile.
libsmb/namequery.c: Fixed isXXX macros & debugs for gcc pedantic compile.
locking/shmem.c: Fixed isXXX macros & debugs for gcc pedantic compile.
locking/shmem_sysv.c: Fixed error messages in sysV stuff.
nmbd/asyncdns.c: Fixed signal functs.
nmbd/nmbd.c: Fixed isXXX macros & debugs for gcc pedantic compile.
passdb/passdb.c: Fixed isXXX macros & debugs for gcc pedantic compile.
passdb/smbpassfile.c: Fixed isXXX macros & debugs for gcc pedantic compile.
smbd/chgpasswd.c: Fixed isXXX macros & debugs for gcc pedantic compile.
smbd/ipc.c: Fixed isXXX macros & debugs for gcc pedantic compile.
smbd/nttrans.c: Fixed fsp code path.
smbd/password.c: fixed HAVE_YP_GET_DEFAULT_DOMAIN problem.
smbd/printing.c: Fixed isXXX macros & debugs for gcc pedantic compile.
smbd/reply.c: Fixed isXXX macros & debugs for gcc pedantic compile.
smbd/server.c: Fixed isXXX macros & debugs for gcc pedantic compile.
smbd/trans2.c: Fixed core dump bug.
smbd/uid.c: Fixed isXXX macros & debugs for gcc pedantic compile.
Jeremy.
(This used to be commit 1b9cbcd02e)
1998-08-15 01:19:26 +00:00
Andrew Tridgell
b9623ab59e this is the bug change to using connection_struct* instead of cnum.
Connections[] is now a local array in server.c

I might have broken something with this change. In particular the
oplock code is suspect and some .dll files aren't being oplocked when
I expected them to be. I'll look at it after I've got some sleep.
(This used to be commit c7ee025ead)
1998-08-14 17:38:29 +00:00
Jeremy Allison
3cf6cc6134 Makefile.in: Changed so that make proto will work with ldap & nisplus.
locking/locking.c: Made #ifdef'ed out functions static for Make proto.
lib/util.c: Re-instated old mask_match code for UNIX filesystem checks
            only. Client calls use the new mask_match code. Changed the
            name of the old function to unix_mask_match.
Jeremy.
(This used to be commit b68e756ff5)
1998-08-14 02:02:40 +00:00
Jeremy Allison
ce333b25db More blocking lock code - still #ifdef'ed out - under development.
Jeremy.
(This used to be commit c9695bdf2e)
1998-08-13 02:10:45 +00:00
Andrew Tridgell
fcb5437da6 fixed the nested comment - Jeremy, do you want that unbecome_user() or
not?
(This used to be commit 638ee7d265)
1998-08-12 10:09:41 +00:00
Jeremy Allison
b1778b6b57 include/smb.h: Removed dir_ptr. Not needed.
locking/locking.c: First cut a blocking lock code. #ifdef'ed out for now.
locking/locking_shm.c: Removed dir_ptr. Not needed.
smbd/nttrans.c: More work on ChangeNotify - return is not an error and needs
                to be handled as a nttrans with zero params. Removed dir_ptr. Not needed.
smbd/reply.c:
smbd/server.c:
smbd/trans2.c: Removed dir_ptr. Not needed.

Hmmm. At the moment smbclient is broken - doesn't issue prompt correctly.
This needs looking at.

Jeremy.
(This used to be commit ddfbcc0581)
1998-08-11 23:28:35 +00:00
Jeremy Allison
7448091da6 First implementation of ChangeNotify - this version only checks
for changes in the directory modify timestamps. A better version
will look at the requested client flags, and create a hash that
represents the current state of the directory, and check against
this instead.
debug.c: Added lp_timestamp_logs() function.
loadparm.c: Added "change notify timeout" in seconds (default 60)
- this is the scan rate for a directory.
            Added ""timestamp logs" boolean - default True. Turns
off log timestamps (so I can read them :-).
nttrans.c: ChangeNotify implementation.
server.c: ChangeNotify implementation.
shmem_sysv.c: Added exits on shmem errors (without them smbd can
              core dump if some calls fail).
smb.h: Added ChangeNotify flags for future use.
util.c: Tidied up typedef.
Jeremy.
(This used to be commit a0748c3f53)
1998-08-03 19:07:55 +00:00
Jeremy Allison
7284bb5ca0 Makefile.in: Moved UBIQX stuff into UTILOBJ.
loadparm.c: Added "ole locking compatibility" option (default "true").
locking.c: Changes to implement union in files_struct.
locking_shm.c: Changes to implement union in files_struct.
nttrans.c: Made opening a directory explicit (we have to).
           Added create directory code for nttrans.
reply.c: Changes to implement union in files_struct.
server.c: Changes to implement union in files_struct. Added create directory code.
trans2.c: Changes to implement union in files_struct.
smb.h: Changes to implement union in files_struct.
util.c: Changed linked list code to UNIQX linked list. This will make
        the other lists I need to implement for ChangeNotify and blocking
        locks easier.
Jeremy.
(This used to be commit 3a5eea850b)
1998-07-30 21:18:57 +00:00
Andrew Tridgell
64578c0589 merge from the autoconf2 branch to the main branch
(This used to be commit 3bda7ac417)
1998-07-29 03:08:05 +00:00
Jeremy Allison
c48b3fce6b locking.c: Print messages when we downgrade a lock.
reply.c: Do the same mask expansion we do in trans2.c - needed for Win98.
trans2.c: Make the mask expansion into a function call now we have to
          do it twice.
Jeremy.
(This used to be commit 7b3a9d6285)
1998-07-29 00:27:23 +00:00
Jeremy Allison
83951dd376 locking.c: Don't need to do map_lock_type on *testing* a lock, just on setting.
Jeremy.
(This used to be commit 17f68cc86c)
1998-07-28 18:26:47 +00:00
Jeremy Allison
7abcd0521e loadparm.c: Added strict sync parameter.
locking.c: Added code to deal with real open mode of file.
reply.c: Added strict sync parameter.
server.c: Added strict sync parameter. Fixed open modes.
Jeremy.
(This used to be commit ed57b603b5)
1998-07-28 18:15:31 +00:00
Jeremy Allison
06c0349c44 locking.c: Added lock type to is_locked() and do_lock()
as the code in reply_lockingX wasn't taking account of
           the difference between read and write locks ! How did this
           ever work :-) !
reply.c:
server.c: Add lock type to is_locked() and do_lock().
util.c: Also added code from klausr@ITAP.Physik.Uni-Stuttgart.De
        to fix problem with log files growing too large if an
        smbd writes less than 100 debug messages.
Jeremy.
(This used to be commit 80080abf77)
1998-07-23 00:10:26 +00:00
Jeremy Allison
6491a956ef nttrans.c: More NT SMB stuff.
shmem_sysv.c: Fix for shared memory problems on several systems,
              Second and subsequent use of shmget should use zero
              as the size. Fix from Veselin Terzic <vterzic@systems.DHL.COM>
Jeremy.
(This used to be commit 1cd94b2459)
1998-07-02 22:23:56 +00:00
Jeremy Allison
88d88f5d0d loadparm.c: Did it ! Changed defaults for 'case preserve' and 'short case preserve'.
Also removed 'domain allow/deny' parameters.
shmem_sysv.c: Added strerror code so I can see why sysV calls are failing.
lib/rpc/server/srv_netlog.c: Removed code that used 'domain allow/deny' parameters -
                             replaced with a comment so I will remember to fix this later.
Jeremy.
(This used to be commit 5f46c7c4b1)
1998-06-05 20:46:05 +00:00
Jeremy Allison
ee9a61841a includes.h: SunOS doesn't have strcasecmp, solaris versions prior to 2.6 don't
have vsnprintf.
locking_slow.c: slight tidy.
make_smbcodepage.c: Use safe_strcpy instead of pstrcpy.
nmbd_winsserver.c: Use pstrcpy instead of fstrcpy.
smbmount.c: Fixed reported bug.
util.c: Removed old fstrcpy/fstrcat functions.
Jeremy.
(This used to be commit f257d2e4ba)
1998-05-12 22:11:24 +00:00
Jeremy Allison
f888868f46 This is a security audit change of the main source.
It removed all ocurrences of the following functions :

sprintf
strcpy
strcat

The replacements are slprintf, safe_strcpy and safe_strcat.

It should not be possible to use code in Samba that uses
sprintf, strcpy or strcat, only the safe_equivalents.

Once Andrew has fixed the slprintf implementation then
this code will be moved back to the 1.9.18 code stream.

Jeremy.
(This used to be commit 2d77445400)
1998-05-12 00:55:32 +00:00
Andrew Tridgell
3dfc0c8472 changed to use slprintf() instead of sprintf() just about
everywhere. I've implemented slprintf() as a bounds checked sprintf()
using mprotect() and a non-writeable page.

This should prevent any sprintf based security holes.
(This used to be commit ee09e9dadb)
1998-05-11 06:38:36 +00:00
Jeremy Allison
e300c0346f includes.h: Moved HPUX undefine of SEMMSL to where it actually does something.
ipc.c: Added Luke's debug statement.
locking_slow.c: Added FTRUNCATE_NEEDS_ROOT code for broken systems that
need it (not sure what these are yet).

membuffer.c ntdomain.h proto.h
lib/rpc/include/rpc_dce.h lib/rpc/include/rpc_srvsvc.h
lib/rpc/parse/parse_prs.c lib/rpc/parse/parse_rpc.c
lib/rpc/server/srv_pipe_hnd.c lib/rpc/server/srv_util.c:
   Re-merge of Luke's NTDOM changes 'cos he's a lazy git with
   carpel tunnel syndrome :-).

Jeremy.
(This used to be commit 52e3966fbc)
1998-04-10 18:21:16 +00:00
Andrew Tridgell
93b3c58136 - added a check for broken RH5 include files. With the standard RH5
includes (ie. unpatched RH5) Samba gets file corruption because of the
incorrect definition of the shmid_ds structure. Updating your RH5
installation of glibc-devel fixes this.

- don't try to fcntl_lock() a read-only fd in shmem.c

- allow level 0 debug messages to get through in smbstatus
(This used to be commit 45553771f9)
1998-03-22 01:31:50 +00:00
Jeremy Allison
55f400bd84 This is *not* a big change (although it looks like one).
This is merely updating the Copyright statements from 1997 to 1998.
It's a once a year thing :-).
NO OTHER CHANGES WERE MADE.
Jeremy.
(This used to be commit b9c1697723)
1998-01-22 13:27:43 +00:00
Andrew Tridgell
1df19ae3bc a dummy change to shmem_sysv.c to try and break CVS out of a problem
with the ntdom branch
(This used to be commit 213c3a4ed2)
1997-12-29 12:34:16 +00:00
Andrew Tridgell
637c3ed4a3 - handle ENOSPC in shmem init.
- be a little bit more friendly about grabbing semaphores
(This used to be commit 87f8870893)
1997-12-16 14:06:09 +00:00
Andrew Tridgell
28f37efd34 don't use free and alloc as structure elements
(This used to be commit f7066355b0)
1997-12-04 07:41:48 +00:00
Andrew Tridgell
7da2663f0d don't display locks for dead processes in smbstatus
(This used to be commit c7df484ef6)
1997-11-29 13:35:09 +00:00
Andrew Tridgell
92fcced605 don't use SEM_UNDO because of ridiculously small undo limits on some
OSes. Instead add explicit checks for dead locks at startup.
(This used to be commit 79858d610c)
1997-11-01 08:13:42 +00:00
Andrew Tridgell
264b1e0e75 some locking code cleanups
(This used to be commit 6d77311d6c)
1997-11-01 07:33:55 +00:00
Andrew Tridgell
4400805208 change from * to ^ in hashing of device/inode. Using * meant that if
the device number happened to divide the number of hash buckets we
would only use a small fraction of the hash buckets, which would slow
things down.
(This used to be commit 623ffd701f)
1997-10-31 05:56:07 +00:00
Andrew Tridgell
d5fdd84ffa - cleanup some warnings
- redo the prototypes
(This used to be commit 31dcb51e05)
1997-10-31 02:40:55 +00:00
Andrew Tridgell
87ea4b93ec damn. We need root privilages to do semaphore operations even if we
have done the semget() as root.  The problem is that become_root() and
unbecome_root() are so slow!

I've provided two options. The default is to set the semaphores (but
_not_ the shared memory) world writeable so that a become_root() isn't
needed. Otherwise you can define SECURE_SEMAPHORES and pay the
performance penalty.
(This used to be commit 2bbd8d2cbc)
1997-10-29 02:59:22 +00:00
Andrew Tridgell
cb6941a193 - don't allow locking to initialise twice
- check that it is initialised before de-initialising it!
(This used to be commit 68ad7b9199)
1997-10-29 02:18:08 +00:00
Andrew Tridgell
4fd96fddd2 clean up the hash entry code a bit. Got rid of lp_shmem_hash_size()
and made it private to the 2 shmem implementations. Added new
shmops->hash_size() function.

Added code to handle the IPC system limits by looping decreasing the
size of the resources (semaphores and shared memory) that we request
until we get under the system limits, which can be quite low on some
systems!

Added checks that the creator of the IPC objects is root. Otherwise we
would be open to a security hole where someone pre-creates the shared
memory segment and attaches.
(This used to be commit 6b6f624b63)
1997-10-29 01:59:54 +00:00
Andrew Tridgell
9c717c285a fix for broken sunos4 includes (doesn't have SHM_R)
(This used to be commit 6ca96782ac)
1997-10-28 14:59:06 +00:00
Andrew Tridgell
e75de8adc6 lower the default hash size if SEMMSL isn't defined
(This used to be commit 9f0be847fd)
1997-10-28 14:40:31 +00:00
Andrew Tridgell
c9fa24b7a8 SYSV IPC implementation of fast share modes.
It will try sysv IPC first, then if that fails it will try mmap(),
then after that it will try share files.

I have defined USE_SYSV_IPC for Linux, Solaris and HPUX at the
moment. Probably a lot more could have it defined. In fact, the vast
majority of systems support it. Need autoconf again :-)

It should actually be faster than the mmap() version, and doesn't need
any lock files. This means the problem of the share mem file being on
a NFS drive will be gone.
(This used to be commit cc8fe0f062)
1997-10-28 14:19:54 +00:00
Andrew Tridgell
71d648cdb4 change the default file permissions on the SHARE_MEM_FILE* to
0644. smbstatus now gets only read permission on the share files and
does no locking.

also get rid of some unnecessary umask(0) calls. smbd always runs with
umask(0)
(This used to be commit c6ac10170d)
1997-10-27 14:27:17 +00:00
Andrew Tridgell
f20e6f6b26 shared memory code cleanups (partly preparing for a possible sysV
shared memory implementation)
(This used to be commit 8d1993c71a)
1997-10-22 11:15:14 +00:00
Jeremy Allison
79f4fb52c1 loadparm.c: Changed 'interfaces only' parameter to 'bind interfaces only'. Added
'dos filetimes' parameter for UTIME fix.
locking_shm.c: Fixed typo (sorry Andrew :-).
namepacket.c: Changed lp_interfaces_only() to lp_bind_interfaces_only().
proto.h: The usual.
reply.c: Made filetime calls use new file_utime call (wrapper for sys_utime).
server.c: Made filetime calls use new file_utime call (wrapper for sys_utime).
system.c: Added Andrew's sanity checks to times in sys_utime().
time.c: Moved set_filetime() to server.c. Made null_mtime()global.
trans2.c: Made filetime calls use new file_utime call (wrapper for sys_utime).
Jeremy (jallison@whistle.com)
(This used to be commit 41a1d81c11)
1997-10-20 18:52:04 +00:00
Andrew Tridgell
3e670e4057 a major share modes reorganisation.
The shares modes code is now split into separate files. The shared
memory implementation is in locking_shm.c. The slow implementation is
in locking_slow.c

It is all controlled by a struct share_ops structure that has function
pointers to the implementation of all the functions needed by a share
modes implementation. An initialisation function sets up this
structure. This will make adding new implementations easy and clean.

This also allowed me to get rid of the ugly code in smbstatus. Now
status.c links to the locking code and calls methods in share_ops.

I also renamed some things and generally organised things in a much
cleaner fashion. Defines and structures specific to each
implementation have been moved to the appropriate file and out of
smb.h.
(This used to be commit 65ab9adaa0)
1997-10-20 08:46:00 +00:00
Jeremy Allison
c336a2f081 .cvsignore: Added make_smbcodepage
interface.c: Added is_local_net().
locking.c: Added Fix for zero length share files from Gerald Werner <wernerg@mfldclin.edu>
           plus a race condition fix for the fix.
nameannounce.c: Made function static.
namedbresp.c: extern int ClientDGRAM removed - not used.
namedbserver.c: extern int ClientDGRAM removed - not used.
namedbsubnet.c: Added code to make sockets per subnet.
namepacket.c: Added code to read from all sockets & filter.
nameresp.c: extern int ClientDGRAM removed - not used.
nameserv.c: Indentation tidyup :-).
nameserv.h: Added sockets to struct subnet.
nameservresp.c: Improved debug message.
nmbd.c: Changed to terminte on listen_for_packets exiting.
nmbsync.c: extern int ClientDGRAM & ClientNMB removed - not used.
proto.h: The usual.
util.c: Fixed debug message.
Jeremy (jallison@whistle.com)
(This used to be commit 6904c2de08)
1997-10-17 23:08:07 +00:00
Jeremy Allison
359d42c08d ipc.c: Adding Andrews become_root code to the main branch.
locking.c: Adding Andrews become_root code to the main branch.
pipes.c: Fixing the close_file issue.
proto.h: The usual.
reply.c: Move smb_pass into NTDOMAIN defined code. Fixing the close_file issue.
server.c: Fixing the close_file issue.
trans2.c: Fixing the close_file issue.
uid.c: Adding Andrews become_root code to the main branch.
Jeremy (jallison@whistle.com)
(This used to be commit 16fd4337f7)
1997-10-15 21:53:59 +00:00
Jeremy Allison
9f6a10d173 Broke my own rule about checking in uncompiled source :-(.
Jeremy.
(This used to be commit 9fd056c911)
1997-10-14 00:36:57 +00:00
Jeremy Allison
cdd01aa4dd Added fixes for become_user braindamage.
Jeremy (jallison@whistle.com)
(This used to be commit 08afa51f5c)
1997-10-14 00:16:37 +00:00
Jeremy Allison
fb27bc139f locking.c: Added fix for race condition in slow share mode code.
lsaparse.c: #ifdef'ed out code so this will compile - LUKE PLEASE CHECK THIS.
pipes.c: #ifdef'ed out code so this will compile - LUKE PLEASE CHECK THIS.
server.c: Fixed last known oplock race condition.
smb.h: Re-removed USE_OPLOCK defines - someone checked in an old version.
smbparse.c: #ifdef'ed out code so this will compile - LUKE PLEASE CHECK THIS.
Jeremy (jallison@whistle.com)
(This used to be commit 1e1366ddc5)
1997-10-07 18:46:19 +00:00
Jeremy Allison
1f7a84bc9c Finally ! Found & fixed crash bug with logging message when deleting
invalid share mode entries. Thanks to berg@wienrg.aut.alcatel.at (Dietmar Berg)
for the stack backtrace.
Jeremy (jallison@whistle.com)
(This used to be commit db4c2cb50e)
1997-10-06 19:50:51 +00:00
Jeremy Allison
2e92be3aaf client.c: Changed shadowed variable.
locking.c: Removed USE_OPLOCKS - now the default.
params.c: Removed unused variable.
proto.h: Updated.
reply.c: Removed USE_OPLOCKS - now the default.
server.c: Removed USE_OPLOCKS - now the default.
smb.h: Removed USE_OPLOCKS - now the default.
smbparse.c: Changed shadowed variable.
status.c: Removed USE_OPLOCKS - now the default.
util.c: Removed USE_OPLOCKS - now the default.
Jeremy (jallison@whistle.com)
(This used to be commit b93509846d)
1997-10-06 17:52:25 +00:00
Jeremy Allison
c89eaa20d1 Making it harder for share_mode_entries to be left with
non-zero op_type fields. Paranoia code really.
Jeremy (jallison@whistle.com)
(This used to be commit 21ecb46f56)
1997-10-03 23:45:34 +00:00
Jeremy Allison
2f7b04061e locking.c: Fixed incorrect parameter count in debug statements. May explain
solaris crashes.
reply.c: Added NT specific error code. Put oplock break code in correct place
         in reply_lockingX.
server.c: Removed unneeded error mapping stuff.
          Fixed race condition in oplock code.
trans2.c: Added NT specific error code.
util.c: Added paranoia check in interpret_addr. Some core dumps
        reported here. Upped fcntl debug levels.

Andrew. Please check the NT specific error code handling (search
for the string "/* Ugly - NT specific hack - but needed (JRA) */",
this makes NT and 95 clients behave correctly here - please check
your Visual Basic apps with this code.

Jeremy (jallison@whistle.com).
(This used to be commit 97ee4a5f69)
1997-10-03 20:36:06 +00:00
Jeremy Allison
5864551aef OPLOCK CHECK-IN - oplocks are now *OPERATIONAL* !!!!
Yipeee. At least as far as I can check in a short time :-).

local.h: Changed OPLOCK_BREAK_TIMEOUT to 30 seconds.
locking.c: Big changes to delete oplocks on a share mode entry.
proto.h: updated.
reply.c: Added oplock break code in lockingX reply & readbraw reply.
server.c: Add batch oplock code. Force server shutdown if client fails
          to respond to oplock break.
smb.h: Fix silly slow share mode oplock define bug.
status.c: Add oplock status info.

Jeremy (jallison@whistle.com)
(This used to be commit 4c83d37239)
1997-10-01 23:32:22 +00:00
Jeremy Allison
dff16872ca Syncing up current oplock work in progress. #ifdef'ed out
so should have no effect on other work.
Jeremy (jallison@whistle.com)
(This used to be commit 7e3d4c8b21)
1997-09-26 19:26:56 +00:00
Jeremy Allison
cef59090bb Adding Andrews buffer overflow fixes into the main branch.
Jeremy (jallison@whistle.com)
(This used to be commit e7eb1f044d)
1997-09-26 18:55:29 +00:00
Jeremy Allison
6dd6b1383c Makefile: Removed earlier errors.
includes.h: Added INADDR_LOOPBACK define.
locking.c: More code to support oplocks.
proto.h: Updated.
server.c: More code to support oplocks. Moved processing of an SMB out of
process() into a separate function so it is easier to call from an oplock
break.
smb.h: Added oplock fields.
Jeremy (jallison@whistle.com)
(This used to be commit f46dbaf08e)
1997-09-25 00:25:44 +00:00
Andrew Tridgell
552818e60e - change a lot of occurances of errno to use strerror(errno). We can't
assume all our users are programmers :-)

- automatically create the smbpasswd file if it doesn't exist when
running smbpasswd.
(This used to be commit 1d2361bd2d)
1997-09-15 05:43:37 +00:00
Jeremy Allison
30416c0b8a charcnv.c client.c clitar.c kanji.c kanji.h loadparm.c
mangle.c smb.h util.c:

  Big merge to allow KANJI support to be in the main
binary without explicitly compiling with it.

locking.c: Fix for smbstatus not being able to read files.
namepacket.c: Removed unneccesary debug statement.
trans2.c: Added Luke's proposed fix (ifdefed out until further testing).
nmblookup.c: Fixed bug where query fails and status is done on bogus IP.

Jeremy (jallison@whistle.com)
(This used to be commit 9196255022)
1997-09-11 20:17:32 +00:00
Andrew Tridgell
22e4d4e9d4 added a new type to mkproto.awk so it can handle shmem.c
in general if you add a new type that is returned by a non-static
function then just add it to the list of known types in mkproto.awk
(This used to be commit 1d4ce07435)
1997-08-28 02:22:44 +00:00
Samba Release Account
15ae50ca52 Makefile: Added UNIXWARE 2.x with shadow passwords from fja@extratech.com
client.c:	Made prompt appear at debug level 0. Fixed strcasecmp redefinition.
            Caused client to use set_blocking rather than making fcntl calls itself.
dir.c:		Removed redundent snum parameters.
includes.h:	Added SCO fixes.
loadparm.c:	Made default 'files to hide' a null string.
nmbd.c:		Removed O_NONBLOCK from pid file open for platforms that dont have it.
proto.h:	Changed snum to cnum where needed. Changed is_xx_path to is_in_path
            (now called via MACRO).
quotas.c:	Swapped setuid/seteuid calls when restoring uid.
reply.c:	Removed redundent snum parameters.
server.c:	Changed snum to cnum where needed. Setup new veto_list, hide_list
            namelists. Added standard_sub changes from
            Stefaan A Eeckels <Stefaan.Eeckels@ecc.lu> and
            Paul Rippin <pr3245@nopc.eurostat.cec.be>
shmem.c:	Changed cast for sizeof to be int before negating.
smb.h:		Added new veto_list, hide_list entries to connections.
            Added IS_PRINT, IS_HIDDEN_PATH, IS_VETO_PATH macros.
trans2.c:	Removed redundent snum parameters.
util.c:		Added standard_sub_basic changes from
            Stefaan A Eeckels <Stefaan.Eeckels@ecc.lu> and
            Paul Rippin <pr3245@nopc.eurostat.cec.be>
            Fixed up veto/hidden path processing so the paths are
            pres-parsed and checked for wildcards (for speed).
Jeremy (jallison@whistle.com)
(This used to be commit 9afa36f787)
1997-07-24 17:25:11 +00:00
Samba Release Account
6835bd679c Fix silly crash bug in FAST_SHARE_MODES (same bug as was in
SLOW_SHARE_MODES - duh !).
Jeremy (jallison@whistle.com)
(This used to be commit d38ac4f3a2)
1997-07-15 17:47:43 +00:00
Samba Release Account
fb1429c197 client.c: New print queue query code from Jeff C. Foster " <jfoste@wgc.woodward.com>
ipc.c:			Added code for returning restricted lists of servers.
loadparm.c:		Changed default for force create mode to 000.
				Changed default maxmux to 50 to comply with NT.
locking.c:		Fixed silly crash bug with slow share mode code.
nameannounce.c:	Added code for returning restricted lists of servers.
namedbserver.c:	Added code for returning restricted lists of servers.
nameelect.c:	Added code for returning restricted lists of servers.
namework.c:		Added code for returning restricted lists of servers.
nmbsync.c:		Added code for returning restricted lists of servers.
server.c:		Added quota fix Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at>
smb.h:			Added define for COPYBUF_SIZE.
system.c:		Rename across filesystems Patch from Warren Birnbaum
				<warrenb@hpcvscdp.cv.hp.com>
util.c:			Minor fix for warning.
(This used to be commit 1c6e433caa)
1997-07-01 01:19:13 +00:00
Samba Release Account
9e37076f2b shmem.c: Changed debug to higher level
uid.c:		Stop smbrun from deleting device files.
util.c:		Added EAGAIN to known error list.
Jeremy (jallison@whistle.com)
(This used to be commit c07db8d8e7)
1997-06-27 00:26:59 +00:00
Samba Release Account
ccf4314fe7 loadparm.c: Ensure printer services cannot be read only and don't use share mode locking.
locking.c:	Changed aborts to returns so not so drastic on PANIC errors.
proto.h:	Removed definition of open_file as this is now never externally called.
reply.c:	Changed reply_mknew, reply_ctemp, reply_printopen to go through open_file_shared.
server.c:	Modified open_file_shared to be more robust and be useful for printer & temp files.
		Removed truncate option from open_file (now all truncates are done in open_file_shared).
util.c:		Added EAGAIN to errors checked in open_socket_out().
version.h:	Updated to 1.9.17alpha2.
jallison@whistle.com
(This used to be commit d8471909b7)
1997-05-27 20:28:45 +00:00
Samba Release Account
aa864415c5 dir.c: Fixed double slash issue.
includes.h: Changed to ifdef FAST_SHARE_MODES.
ipc.c:  Changed lp_workgroup() to myworkgroup.
loadparm.c:  Added new shared mem parameters. Added Luke's fix.
locking.c: Rewrite to do share modes better (both fast and slow modes).
nameannounce.c:  Changed lp_workgroup() to myworkgroup. Added Luke's fix.
nameconf.c:  Changed lp_workgroup() to myworkgroup.
namedbname.c:  Improved debug.
namedbserver.c:  Changed lp_workgroup() to myworkgroup.
namedbsubnet.c:  Added Luke's fix - rewritten somewhat.
namedbwork.c:  Changed lp_workgroup() to myworkgroup.
nameelect.c:  Added Luke's fix - rewritten somewhat.
nameresp.c:  Stoped shadowing global.
nameserv.c:  Added Luke's fix - Improved debug.
nameservreply.c:  Improved debug.
namework.c:  Changed lp_workgroup() to myworkgroup.
nmbd.c:  Added Luke's fix - Changed lp_workgroup() to myworkgroup.
pipes.c:   Changed lp_workgroup() to myworkgroup.
proto.h:   Added Luke's fix, added smb_shm_ proto's.
reply.c:  Changed lp_workgroup() to myworkgroup.
server.c:  Rewrite to do share modes better (both fast and slow modes).
shmem.c:  Rewrite to do share modes better (both fast and slow modes).
smb.h:  Rewrite to do share modes better (both fast and slow modes).
status.c:  Rewrite to do share modes better (both fast and slow modes).
trans2.c:  Fixed double slash issue.
util.c:  Tidied up, created myworkgroup.
Jeremy Allison (jallison@whistle.com).
(This used to be commit 2a1711eaaf)
1997-05-20 00:32:51 +00:00
Samba Release Account
0f1f0ceb95 'The mother of all checkins' :-). Jeremy Allison (jallison@whistle.com)
Wed May  7 1997: Update for 1.9.17alpha1 release - 'browsefix release'
designed to make browsing across subnets work.

byteorder.h:	Updated copyright to 1997.
charcnv.c:      Updated copyright to 1997.
charset.c 	Updated copyright to 1997.
charset.h	Updated copyright to 1997.
client.c	Updated copyright to 1997.
clientutil.c	Updated copyright to 1997.
dir.c		Updated copyright to 1997.
fault.c		Updated copyright to 1997.
includes.h	Updated copyright to 1997.
interface.c	Updated copyright to 1997.
ipc.c		Updated copyright to 1997.
kanji.c		Updated copyright to 1997.
kanji.h		Updated copyright to 1997.
loadparm.c	Updated copyright to 1997.
locking.c	Updated copyright to 1997.
mangle.c	Updated copyright to 1997.
message.c	Updated copyright to 1997.
nameannounce.c

	Made use of WINS subnet explicit.
Added reset_announce_timer() so announcement
can be made immediately when we become a master.
Expanded code to do sync with dmb.

namebrowse.c

	Removed redundent checks for AM_MASTER in
sync code. Made use of WINS subnet explicit.

namedbname.c	Made use of WINS subnet explicit.
namedbresp.c	Made use of WINS subnet explicit.
namedbserver.c	Made use of WINS subnet explicit.

namedbsubnet.c

	Explicitly add workgroup to WINS subnet
when we become a dmb. Made use of WINS subnet explicit.

namedbwork.c

	Made use of WINS subnet explicit. Removed
redundent check_work_servertype() function.

nameelect.c

	Explicitly add workgroup to WINS subnet
when we become a master browser. Made use of WINS subnet explicit.

namelogon.c	Updated copyright to 1997.
namepacket.c	Updated copyright to 1997.
namequery.c	Updated copyright to 1997.

nameresp.c

	Made use of WINS subnet explicit. Made nmbd fail if
configured as master browser and one exists already.

nameserv.c

	Made use of WINS subnet explicit. Remove redundent
logon server and domain master code.

nameserv.h	Add emumerate subnet macros.
nameservreply.c	Made use of WINS subnet explicit.
nameservresp.c	Updated copyright to 1997.

namework.c

	Made use of WINS subnet explicit. Updated code to
add sync browser entries to add subnet parameter.

nmbd.c

	Added sanity check for misconfigured nmbd.

nmblib.c	Updated copyright to 1997.
nmblookup.c	Updated copyright to 1997.
nmbsync.c

	Removed redundent AM_ANY_MASTER check.

params.c	Updated copyright to 1997.
password.c	Updated copyright to 1997.
pipes.c		Updated copyright to 1997.
predict.c	Updated copyright to 1997.
printing.c	Updated copyright to 1997.

proto.h

	Changed protos for new nmbd code.

quotas.c	Updated copyright to 1997.
replace.c	Updated copyright to 1997.
reply.c		Updated copyright to 1997.
server.c	Updated copyright to 1997.
shmem.c		Updated copyright to 1997.
smb.h		Updated copyright to 1997.
smbencrypt.c	Updated copyright to 1997.
smbpasswd.c	Updated copyright to 1997.
smbrun.c	Updated copyright to 1997.
status.c	Updated copyright to 1997.
system.c	Updated copyright to 1997.
testparm.c	Updated copyright to 1997.
testprns.c	Updated copyright to 1997.
time.c		Updated copyright to 1997.
trans2.c	Updated copyright to 1997.
trans2.h	Updated copyright to 1997.
uid.c		Updated copyright to 1997.
username.c	Updated copyright to 1997.
util.c		Updated copyright to 1997.
version.h

	Changed to 1.9.17alpha1.
(This used to be commit cf23a155a1)
1997-05-08 01:14:17 +00:00
Samba Release Account
869f24e0b1 locking.c proto.h shmem.c smb.h status.c :
Changed shm_ prefixes to smb_shm_ prefixes as shm_ is a POSIX.4
prefix. Updated fd code in FAST_SHARE_MODE code
to work with new fd indirection.
quotas.c: Fixed #ifdef not on position zero.
Jeremy. (jra@cygnus.com).
(This used to be commit c9a9d56642)
1997-01-15 01:53:25 +00:00
Samba Release Account
8bc7d6bebd Makefile: Changes to split Solaris into Solaris2.3 and previous, and 2.4 and after from Paul Eggert.
Makefile: Added AMIGA changes from Rask Ingemann Lambertsen <rask@k4315.kampsax.dtu.dk>.
charset.c: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at>
charset.h: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at>
clitar.c: Patch to re-sync after read fail from (lost contributor name, sorry).
includes.h: Patch for AMIGA from Rask Ingemann Lambertsen <rask@k4315.kampsax.dtu.dk>
includes.h: Patch for SunOS atexit by Jeremy (jra@cygnus.com)
interface.c: Patch for AMIGA from Rask Ingemann Lambertsen <rask@k4315.kampsax.dtu.dk>
kanji.h: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at>
locking.c: Patch to fix file locking from Jeremy (jra@cygnus.com)
locking.c: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com)
pipes.c: Patch to fix file locking from Jeremy (jra@cygnus.com)
proto.h: Patch to fix file locking from Jeremy (jra@cygnus.com)
reply.c: Patch to fix file locking from Jeremy (jra@cygnus.com)
server.c: Patch to fix file locking from Jeremy (jra@cygnus.com)
server.c: Patch for FAST_SHARE_MODE fix from (lost contributor name, sorry).
smb.h: Patch to fix file locking from Jeremy (jra@cygnus.com)
smb.h: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com)
status.c: Patch to fix file locking from Jeremy (jra@cygnus.com)
statuc.c: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com)
system.c: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at>
trans2.c: Patch to fix file locking from Jeremy (jra@cygnus.com)
trans2.c: Patch to fix volume name reported to Win95 from Jeremy (jra@cygnus.com)
util.c: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at>
util.c: Patch to fix client_name from continuously returning UNKNOWN (from various contributors).
version.h: Update to 1.9.16p10.
(This used to be commit 03d28fa32e)
1997-01-09 18:02:17 +00:00
Samba Release Account
75e3bbc651 Moved fcntl locking code into util.c to allow it to be
called from nmbd code.
jra@cygnus.com
(This used to be commit d718f4fd30)
1996-12-10 17:53:00 +00:00
Andrew Tridgell
e23f2b9cef - changed the umask handling. We now set the umask to 0 and explicitly
set the mode on all created files. I think this is a better policy.

- change the debug levels on some items

- fix a charset handling bug which affected foreign and extended
charset users

- no longer switch back to the original directory when idle, instead
switch to / as the original directory may not be readable by ordinary
users.

- fix some bugs where the create mode of files was not being
explicitly set (it was relying on the umask and using fopen). Not a
big bug as it only affected obscure commands like the messaging ops.

- got rid of the lock code in the lpq cache as its no longer needed

- rewrote smbrun to be faster and to remove the security hole. We now
don't actually need a external smbrun binary, its all done by smbd.

- add a more explicit warning about uids and gids of -1 or 65535
(This used to be commit 5aa735c940)
1996-10-04 09:31:07 +00:00
Andrew Tridgell
0c33046a0a - added "netbios name" option in smb.conf to make controlling the name
that samba uses possible

- added "socket address" option to allow virtual SMB servers (on
systems with IP aliasing line Linux)

- disabled FAST_SHARE_MODES by default in Linux as older Linux boxes
can't do shared writeable mappings. We really need autoconf ...

- added new option types in loadparm so a string type can be specified
ot be uppercase only, this is used for the workgroup and netbios name
options

- auto-create the lock directory if it doesn't exist in shared mem
startup

- get rid of announce_backup()

- change a few comments in nmbd code

- rewrote the chaining code completely. Hopefully it will handle any
depth chains now.

- added LPRng support
(This used to be commit e9eac6cd49)
1996-08-19 11:17:29 +00:00
Andrew Tridgell
efb8113d00 - made FAST_SHARE_MODES standard for Linux
- you can now press enter after a password prompt with "smbclient -L
hostname" and it will use a blank username and password, the same as
if you used -U%

- changed the wins.dat store code to not go via a string variable
(just use fprintf instead)

- removed a "unsigned long" that luke put back in, changing it to
uint32 to keep 64 bit machines happy. Naughtly luke!

- allow guest non-connnected print queue listings so ms client 3 can
work
(This used to be commit 917160dee6)
1996-08-17 14:27:12 +00:00
Andrew Tridgell
47673b32ed - added FAST_SHARE_MODES code
- added some named pipe code from Jim
(This used to be commit c94866e9e4)
1996-08-15 15:11:34 +00:00
Andrew Tridgell
ebc96b7309 changed "unsigned long" to "uint32" in several places (for IP
addresses) to keep 64 bit machines happy.
(This used to be commit b4aaec504a)
1996-08-14 15:02:28 +00:00
Andrew Tridgell
dc38599c5a - change date as a demo for john
- modified plp printing parser to work on my system
(This used to be commit 9408f91e1b)
1996-06-19 12:23:54 +00:00
Andrew Tridgell
7e3b4a1c0d got rid of a lot of redundent header files as we now globally generate
prototypes automatically using "make proto". This is much less prone
to error than the old method of manually adding prototypes
(This used to be commit b551dc98f7)
1996-06-10 04:38:24 +00:00
Andrew Tridgell
de411c701e moved some more locking routines to locking.c, and moved replacement
routines for broken OSes from util.c to replace.c.
(This used to be commit 3ee9d45426)
1996-06-10 03:39:58 +00:00
Samba Release Account
0e8fd33987 Initial version imported to CVS
(This used to be commit 291551d807)
1996-05-04 07:50:46 +00:00