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

493 Commits

Author SHA1 Message Date
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
766aa4ff5c Fixed one more Debug problem with inode in non-64 bit case.
Jeremy.
(This used to be commit 94d63cc382)
1998-09-05 03:38:50 +00:00
Jeremy Allison
98f524bde4 Bugfix for leak in reference counted file struct.
Added "nt smb support" parameter to allow NT SMB's to be turned off.
Jeremy.
(This used to be commit 63f65f5027)
1998-09-05 03:14:40 +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
Andrew Tridgell
4acd373e5b changed the SMBtrans reply code to align at the same alignment as
observed from NT. We were aligning the data before but not the
parameters. This aligns both.

This change may break some other parts of ipc.c if we have relied on
the alignment somewhere, so if you think this broke something then let
me know.
(This used to be commit d252d33101)
1998-09-03 05:37:15 +00:00
Andrew Tridgell
0b5cc17309 fixed a bug in the name mangling code. It implicitly assumed that
mangling a name can't increase it's size which isn't true. (imagine a
file called "L B" which mangles to "LB~XX")

The symptoms were that users couldn't run batch files from short
directory names that contained non 8.3 characters (such as spaces).
(This used to be commit c319d8ea3f)
1998-09-03 03:14:31 +00:00
Jeremy Allison
0067ea1b5a Fix for PR#9497 - not waiting for child.
Jeremy.
(This used to be commit e817d836bb)
1998-09-02 17:23:41 +00:00
Andrew Tridgell
148691b1c5 we are never interested in SIGPIPE so just ignore (block) it
always. Don't even install a handler.
(This used to be commit 72c383f4b7)
1998-09-02 05:00:47 +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
Andrew Tridgell
a5f8955ccb check that a valid pipe is passed before doing a pipe close.
I made this change after getting a segv in reply_pipe_close(). The
funny thing was that pipes_open was 1 and Pipes was NULL. That "can't
happen" and suggests that we have a wild pointer somewhere.

I suspect the rpc code, as I was playing with long share names (a
share called "averylongusername") at the time and the logs show lots
of srvsvc operations. I bet there is a buffer in the rpc code
somewhere that is overflowing and trashing bits of the data segment.
(This used to be commit 9fee8c2eb7)
1998-09-01 01:10:01 +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
61b5fd6f32 bounds check next_token() to prevent possible buffer overflows
(This used to be commit 3eade55dc7)
1998-08-31 03:11:42 +00:00
Jeremy Allison
38142a1ebb This checking fixes the statcache bug that stopped NetBench from running
correctly. Added new parameter "stat cache size" - set to 50 by default.

I now declare the statcache code officially "open" for business :-).
It gets a hit rate of 97% with a NetBench run and seems to make
using a case insensitive run as efficient as a case sensitive run.

Also tidied up our sys_select usage - added a maxfd parameter and
also added an implementation of select in terms of poll(), for systems
where poll() is much faster. This is disabled by default.

Jeremy.
(This used to be commit 779b924ec1)
1998-08-28 21:46:29 +00:00
Jeremy Allison
d0cfc1f041 Fixed stat cache statistics calculation. Oops.
Jeremy.
(This used to be commit d6a9087e7e)
1998-08-27 20:51:12 +00:00
Jeremy Allison
5e5e320d36 This is the stat cache code - seems to work fine (needs heavy
NetBench testing though.... :-). Attempts to efficiently reduce
the number of stat() calls Samba does.
Jeremy.
(This used to be commit d0e48a2d80)
1998-08-27 20:38:53 +00:00
Andrew Tridgell
2c065107b1 changed the default permissions code to do this:
if ((sbuf->st_mode & S_IWUSR) == 0)
      result |= aRONLY;

rather than the very complex user/group permissions checks we do
currently. This is equivalent ot setting "alternate permissions = yes"
in the old code. The change is motivated by three main reasons:

1) it's basically impossible to second guess whether a file is
writeable without trying to open it for writing. ACLs, root squash etc
just make it too hard.

2) setting it not RONLY if the owner can write is closer to what NT
does (eg. look at a cdrom - files are not marked read only).

3) it prevents the silly problem of copying files from a read only
share to a writeable share and then finding you can't write to them as
windows preserves the RONLY flag. Lots of people get bitten by this
when they drag a folder from a Samba drive. It also hurts some install
programs.

I have also added a new flag type for loadparm.c called
FLAG_DEPRECATED which I've set for "alternate permissions". I'll soon
add code to testparm to give a warning about deprecated options.
(This used to be commit c4363a12fd)
1998-08-25 06:40:42 +00:00
Jeremy Allison
5ae06b99c0 Added code to (correctly) ignore TRANSACT2_SETFILEINFO with SMB_SET_FILE_ALLOCATION_INFO.
Office 97 expects this call to succeed when you tell it you do NT SMB calls.
Jeremy.
(This used to be commit 260e7e2740)
1998-08-25 02:29:17 +00:00
Jeremy Allison
8afc9c80ac Changed ASSERT macros to SMB_ASSERT macros as some systems already
have an ASSERT macro defined.
Jeremy.
(This used to be commit dbe6ad014a)
1998-08-24 21:49:10 +00:00
Andrew Tridgell
3f3f47b0bd added ASSERT() and ASSERT_ARRAY() macros and sprinkled them liberally
in the rpc code.
(This used to be commit e6ce1c5b5a)
1998-08-22 02:54:21 +00:00
Christopher R. Hertel
7fe3a42857 nmbd and smbd had different behavior with respect to log files. nmbd would
default to overwrite and smbd would default to append.  Also, the -a option
(actually a toggle, such that "-a -a" would set the default) was documented
as append mode for nmbd, and *overwrite mode* for smbd.

nmbd now defaults to append mode, to match smbd.  The -a option now always
means append, and I've added the -o option to both, meaning overwrite.

Note that the change to nmbd's default behavior may confuse some people.
I've not seen anything about 2.0.0 changes in the WHATSNEW.txt file.
Where would I document a change like this?

Chris -)-----
(This used to be commit b1d374fb14)
1998-08-21 17:21:55 +00:00
Andrew Tridgell
541cd2a2d9 don't attempt to answer QFILEINFO/SMB_QUERY_FILE_STREAM_INFO queries -
if we do then NTws gets a BSOD.

I checked and NT server refuses these queries too :)
(This used to be commit d2fb7ee8f5)
1998-08-21 14:31:43 +00:00
Andrew Tridgell
038e3433d3 added new smb.conf option "panic action". see my samba-technical
explanation.
(This used to be commit c6899df44c)
1998-08-21 11:37:40 +00:00
Andrew Tridgell
60cf7ad5cf fixed a bug in trans2_qfilepathinfo() where we used the length of the
basename of a file but the whole file name. silly error.
(This used to be commit 6e00de7a1d)
1998-08-21 05:58:57 +00:00
Jeremy Allison
81b580fd22 Fixes for the problem in blocking locks with file_fsp returning the
chain_fsp on close (if you don't know what this means, consider yourself
lucky - this one took a day to track down :-).
Jeremy.
(This used to be commit 193cb53824)
1998-08-21 01:30:29 +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
3f153e592b Blocking lock code split out...
Jeremy.
(This used to be commit 9cdb148ef5)
1998-08-19 01:49:57 +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
Jeremy Allison
b935fc0862 Fixed bug introduced by the recent changes where the chain_fnum
could be overwritten in oplock processing code.
Jeremy.
(This used to be commit 908a583b48)
1998-08-17 22:59:53 +00:00
Andrew Tridgell
28788ca46c removed some of the rough edges from the splitup
(This used to be commit 722312c326)
1998-08-17 14:11:44 +00:00
Andrew Tridgell
dd2e202e5c move soem variables from server.c that don't belong there.
(This used to be commit f92475aa3c)
1998-08-17 13:44:05 +00:00
Andrew Tridgell
c3effa8b59 this completes the splitup of server.c.
the splitup was done with an axe, not a scalpel, so there are some
rough edges. I mostly wanted to get the general form right with fine
tuning of what goes where to come later. Still, this is better than
what we had before where server.c was a general repository for
anything that didn't fit elsewhere.
(This used to be commit a6d194886a)
1998-08-17 13:11:34 +00:00
Andrew Tridgell
0922615405 more splitting of server.c
created dosmode.c and filename.c
(This used to be commit 534a90ca44)
1998-08-17 07:40:06 +00:00
Andrew Tridgell
4c5c26b1ef now that we have no global arrays we can start to split up the monster
server.c without breaking things.

this splits off netprot.c and fileio.c for negprot and read/write/seek
handling respectively.
(This used to be commit b3d7014643)
1998-08-17 07:15:54 +00:00
Andrew Tridgell
72ed7049d8 added some optimisation for the case where the number of open files is
very large. files.c now promotes a files_struct to the top of the list
if it is used when it is more than 10 elements from the top.

also moved common linked list code for the 5 sets of linked lists that
I've created over the past few days into dlinklist.h (I've explained
to Chris why I didn't use the ubiqx code)
(This used to be commit 1eb9ae2996)
1998-08-17 06:47:53 +00:00
Andrew Tridgell
983dc71c98 moved connection_struct handling code into smbd/conn.c and changed it
to a linked list with bitmap format.
(This used to be commit b7aaab1b6b)
1998-08-17 06:13:32 +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
f2d538a105 some cleanups from the conversion of Pipes[] to a linked list. I also
removed most cases where a pnum is used and substituted a pipes_struct*.

in files.c I added a offset of 0x1000 to all file handles on the
wire. This makes it much less likely that bad parsing will give us the
wrong field.
(This used to be commit 8bc2627ff2)
1998-08-17 03:06:20 +00:00
Andrew Tridgell
b590b27b45 - some tidying up in files.c
- handle null fsp in DEBUG() at end of reply_ntcreate_and_X(). Jeremy,
  can you fix this properly?

- get snum right in print queue code in ipc.c (it was broken by my
  connections_struct changes).
(This used to be commit b3dd378575)
1998-08-16 06:20:18 +00:00
Andrew Tridgell
739d0b1ddc got rid of the Files[] array completely (previously I'd just made it
private to files.c)

It now is a doubly linked list with a bitmap for allocated file
numbers. Similarly for the fd_ptr code. I also changed the default
maximum number of open files to 4096. The static cost is 1 bit per
file.

It all seems to work, and it passes the "does Sue scream" test, but if
you see weird behaviour then please investigate. With the volume of
new code that has gone in there are bound to be one or two bugs
lurking.

note that you must do a "make clean" before building this as many data
structures have changed in size.
(This used to be commit 79755ce970)
1998-08-16 04:08:47 +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
6a6e8958ad changed find_free_file() to file_new().
(This used to be commit 3daee29636)
1998-08-16 02:32:55 +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
Christopher R. Hertel
b067f0e2b9 Debug output formatting change. I'm trying to combine log lines that
really should be together.  Chris -)-----
(This used to be commit 8880fc58fa)
1998-08-13 00:01:02 +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