1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-04 05:18:06 +03:00
Commit Graph

66 Commits

Author SHA1 Message Date
Jeremy Allison
5b9a88c2d0 Sync up with 2.2 ACL code.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
49f0e7e714 Added sys_dlopen/sys_dlsym/sys_dlclose.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
348ebe30d0 removed useless debug msg 0001-01-01 00:00:00 +00:00
Jeremy Allison
af364b93d9 lib/system.c (Finally) fixed all insure errors in password caching code. We can't
stop libc routines from calling getpwXXX functions, so caching a pointer to them
is impossible. This new code now makes two copies of the returned struct passwd
struct - one used as a cache, one returned to allow the caller to modify. When
doing a lookup we compare against the cached copy. Code is now easier to understand
also.
smbd/posix_acls.c: If we move the head of the linked list, remember to pass a
reference to that pointer.....
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
a55a4fea97 change pstrcpy() in setup_pwret() to fstrcpy() since we are
using fstrings.  Spotted by Elrond.  Thanks :-)




jerry
0001-01-01 00:00:00 +00:00
Jeremy Allison
c4f810a758 lib/system.c: Fix for pw caching.
srv_samr.c: Fix for pw caching.
smbd/nttrans.c: Fix to allow trans create to set ACL on open.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
2bd4f16389 Fix insure problems with passwd caching code.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
3712e35c54 Added modification to Richard Bollinger getpw[nam|uid] cache patch. Only
uses cache max 100 times.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
158430ba6a getpw[nam|uid] caching patch from "Richard Bollinger"
<rabollinger@home.com>



jerry
0001-01-01 00:00:00 +00:00
Jeremy Allison
1f156b2420 sys_popen got damaged when converted from FILE * to int fd I think.
Patrick Powell kindly pointed out the bug.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
d8b9ec741c added a hack to get 64 bit locking working with the broken fcntl()
call in glibc 2.1.95. This hack only gets enabled if you define
GLIBC_HACK_FCNTL64
0001-01-01 00:00:00 +00:00
Andrew Tridgell
44766c39e0 totally rewrote the async signal, notification and oplock notification
handling in Samba. This was needed due to several limitations and
races in the previous code - as a side effect the new code is much
cleaner :)

in summary:

- changed sys_select() to avoid a signal/select race condition. It is a
  rare race but once we have signals doing notification and oplocks it
  is important.

- changed our main processing loop to take advantage of the new
  sys_select semantics

- split the notify code into implementaion dependent and general
  parts. Added the following structure that defines an implementation:

struct cnotify_fns {
	void * (*register_notify)(connection_struct *conn, char *path, uint32 flags);
	BOOL (*check_notify)(connection_struct *conn, uint16 vuid, char *path, uint32 flags, void *data, time_t t);
	void (*remove_notify)(void *data);
};


then I wrote two implementations, one using hash/poll (like our old
code) and the other using the new Linux kernel change notify. It
should be easy to add other change notify implementations by creating
a sructure of the above type.

- fixed a bug in change notify where we were returning the wrong error
  code.

- rewrote the core change notify code to be much simpler

- moved to real-time signals for leases and change notify

Amazingly, it all seems to work. I was very surprised!
0001-01-01 00:00:00 +00:00
Andrew Tridgell
b28cc4163b Linux kernel oplocks now seem to work, but need a _lot_ of testing
I had to modify sys_select() to not loop on EINTR. I added a wrapper
called sys_select_intr() which gives the old behaviour.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
b5ceab8102 continued the split of the kernel level oplocks code into a more
modular form. In this pass I added oplock_irix.c and added a "struct
kernel_oplocks" that describes a kernel oplock implementation.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
70dcc791b4 clean up oplock capability code ready for Linux code 0001-01-01 00:00:00 +00:00
Jeremy Allison
148628b616 Added sys_fork() and sys_getpid() functions to stop the overhead
of doing a system call every time we want to just get our pid.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
f137648504 got rid of some more old configure tests and includes 0001-01-01 00:00:00 +00:00
Andrew Tridgell
a09470817c converted a bunch more functions to use a fd instead of a FILE*
to support some of this I added the following functions in util_file.c

file_lines_pload : load lines from a pipe
file_pload : load a pipe into memory
0001-01-01 00:00:00 +00:00
Jeremy Allison
3b8cbb10de Fixes to add "paranoid" option to popen. Checks some basic things.
Jeremy
0001-01-01 00:00:00 +00:00
Jeremy Allison
9f879ec396 lib/system.c: Fixed gcc warnings.
nmbd/nmbd_processlogon.c: Use "True" and "False" instead of 1 and 0.
Others - preparing for multiple pdu write code.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
b52e92b09d Added replacement functions sys_popen and sys_pclose. These are based
on the glibc source code and are safer than the traditional popen as
they don't use a shell to exec the requested command. Now we have
these functions they can be tightened up (environment etc.) as required
to make a safe popen. It should now be safe to add the environement
variable loading code to loadparm.c
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
ca64f4ab00 include/includes.h: Trimmed down unicode directory entry to be POSIX complient.
lib/system.c: Trimmed down unicode directory entry to be POSIX complient.
lib/util_unistr.c: Added wstrdup().
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
b5eb009cc3 First cut at unicode sys_xx functions. Now to start moving upwards.....
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
453a822a76 first pass at updating head branch to be to be the same as the SAMBA_2_0 branch 0001-01-01 00:00:00 +00:00
Luke Leighton
e4d92ff9df sys_select added one more argument (read, write selectors). 0001-01-01 00:00:00 +00:00
Luke Leighton
0d1f5e5a6d check to see if copy_passwd_struct() ever receives its own internal
buffer as an argument :-) :-)
0001-01-01 00:00:00 +00:00
Luke Leighton
436a891455 using jeremy's sys_getpwnam() call in the more critical area: Get_Pwnam().
made sure that hashed_getpwnam() has the copy-passwd-struct-wrapper
around it, too.
TODO: replace all calls of getpwnam() with sys_getpwnam().
0001-01-01 00:00:00 +00:00
Luke Leighton
df756f3723 added jeremy's sys_getpwnam() and sys_getpwuid() routines from 2_0 tree. 0001-01-01 00:00:00 +00:00
Jeremy Allison
6acb4b68f6 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
18ff93a9ab 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.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
046e8a5021 fixed typo in getgroups code 0001-01-01 00:00:00 +00:00
Andrew Tridgell
688d19de50 added sys_getwd() 0001-01-01 00:00:00 +00:00
Jeremy Allison
e570db46fc Got very strict about the differences and uses of
uid_t, gid_t and vuid. Added sys_getgroups() to get
around the int * return problem. Set correct datatypes
for all uid, gid and vuid variables.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
e8be306f23 Makefile.in: Fixed bug with continuation line causing proto to fail.
Added $(PROGS) $(SPROGS) as targets for make clean.
acconfig.h: Added HAVE_IRIX_SPECIFIC_CAPABILITIES.
configure.in: Added sys/capability.h header check.
              Added function checks for srandom random srand rand.
              Added HAVE_IRIX_SPECIFIC_CAPABILITIES test.
includes.h: Added #include <sys/capability.h>.
ntdomain.h: Moved struct acct_info into here from smb.h
smb.h: Added KERNEL_OPLOCK_CAPABILITY define.
       Moved enum action_type into rpcclient.h
       Moved struct cli_state into client.h
       Moved struct nt_client_info, struct tar_client_info, struct client_info
             into rpcclient.h
lib/genrand.c: Changed to use sys_random() & friends.
lib/smbrun.c: Lose capabilities after fork.
lib/system.c: Added set_process_capability(), set_inherited_process_capability()
              sys_random(), sys_srandom().
lib/util.c: Added Ander's EFBIG lock check to fcntl_lock for 64 bit access to an
            32 bit mounted NFS filesystem.
nmbd/nmbd.c: Changed to use sys_random() & friends.
nmbd/nmbd_browsesync.c: Changed to use sys_random() & friends.
passdb/ldap.c: Missed one pdb_encode_acct_ctrl call.
passdb/passdb.c: Changed to Ander's code for ' ' characters.
passdb/smbpass.c: Added Ander's code to reset ACB_PWNOTREQ.
script/mkproto.awk: Added 'long' to prototypes.
smbd/chgpasswd.c: Lose capabilities after fork.
smbd/open.c: Do the mmap *after* the kernel oplock.
smbd/oplock.c: Removed stub code from kernel oplock path.
               Added set_process_capability(), set_inherited_process_capability() calls.
smbd/reply.c: Initialize count = 0, offset = 0.
smbd/server.c: Added set_process_capability(), set_inherited_process_capability() calls.
tests/summary.c: Ensure we have RANDOM or RAND.
utils/smbpasswd.c: Added Ander's code to reset ACB_PWNOTREQ.
utils/torture.c: Changed to use sys_random() & friends.

Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
926591067c got rid of SMB_STRUCT_STATVFS. I don't think we should be defining
structures that only apply on some platforms.
0001-01-01 00:00:00 +00:00
Jeremy Allison
14c134e831 include/includes.h:
lib/system.c: Can't assume every system has a statvfs varient.
              Return -1 for those that don't.
smbd/reply.c: Fixed printf warning.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
c512b1b91f configure configure.in: Added checks for statvfs64. Last bit of 64 bit widening (I hope :-).
include/config.h.in: Added #undef STAT_STATVFS64.
include/includes.h: Added SMB_STRUCT_STATVFS type, Changed SMB_BIG_INTEGER to
                    SMB_BIG_UINT and SMB_BIG_INT types.
include/smb.h: Added flag defines from CIFS spec.
lib/debug.c: Fixed one more mode_t issue.
lib/system.c: Added sys_statvfs wrapper.
lib/util.c: Changed trim_string to use size_t.
param/loadparm.c: Moved "blocking locks" into locking section. Alphabetised
                  locking options. Question - shuld we do this for all options ?
passdb/ldap.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT.
passdb/nispass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT.
passdb/smbpass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT.
smbd/dfree.c: Changed to use 64 bit types if available. Moved to use unsigned
              types.
smbd/dosmode.c: Fixed one more mode_t issue.
smbd/negprot.c: Changed literals to be FLAG_ #defines.
smbd/nttrans.c: Removed dead code.
smbd/open.c: Changed disk_free call.
smbd/process.c: Changed literals to be FLAG_ #defines.
smbd/reply.c: Changed disk_free call.
smbd/trans2.c: Fixed but in SMB_QUERY_FS_VOLUME_INFO call. Was using
               UNICODE - should use ascii.
tests/summary.c: Added STAT_STATVFS64 check.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
c381d32e3d configure configure.in: Added tests for fseek64 and ftell64.
config.h.in: Added fseek64 and ftell64.
includes.h: Added definition of SMB_BIG_INTEGER.
smb.h: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
access.c: Tidyup of dbug statement.
system.c: Added sys_fseek and sys_ftell. Changed mode calls to use mode_t.
asyncdns.c: Tidyup of comment.
loadparm.c: Tidyup of set_default_server_announce_type() function definition.
ldap.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
nispass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
smbpass.c: Changed (*getsmbpwpos) and (*setsmbpwpos) to use SMB_BIG_INTEGER.
smbpassfile.c: Use sys_fseek().
chgpasswd.c: Tidyup of debug statement.
dosmode.c: Changed mode calls to use mode_t.
ipc.c: Removal of dead code.
nttrans.c: Changed mode calls to use mode_t.
open.c: Changed mode calls to use mode_t.
pipes.c: Removal of dead code.
reply.c: Removal of dead code.
trans2.c: Removal of dead code. Changed mode calls to use mode_t.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
54dd51176f Ok so with this bugfix 64 bit file access actually seems to work :-).
Problems were just dumb bugs like (defining sys_lseek to return 'int' DOH !).

Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
14500936c3 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
03ae657a36 Missed one struct stat.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
28aa182dbf 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
779b924ec1 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.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
c7ee025ead 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.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
3bda7ac417 merge from the autoconf2 branch to the main branch 0001-01-01 00:00:00 +00:00
Andrew Tridgell
ee09e9dadb 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
cd2613c572 Changes to allow Samba to be compiled with -Wstrict-prototypes
with gcc. (Not a big change although it looks like it :-).

Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
b9c1697723 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
41a1d81c11 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)
0001-01-01 00:00:00 +00:00
Jeremy Allison
e7eb1f044d Adding Andrews buffer overflow fixes into the main branch.
Jeremy (jallison@whistle.com)
0001-01-01 00:00:00 +00:00