summaryrefslogtreecommitdiffstats
path: root/source/lib/system.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed password entry caching bug pointed out by Elrond.Jeremy Allison2001-04-301-14/+25
| | | | Jeremy.
* Sync up with 2.2 ACL code.Jeremy Allison2001-03-231-4/+0
| | | | Jeremy.
* Added sys_dlopen/sys_dlsym/sys_dlclose.Jeremy Allison2001-03-191-0/+31
| | | | Jeremy.
* removed useless debug msgAndrew Tridgell2001-03-171-3/+0
|
* lib/system.c (Finally) fixed all insure errors in password caching code. We ↵Jeremy Allison2001-03-171-56/+53
| | | | | | | | | | | | | 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.
* change pstrcpy() in setup_pwret() to fstrcpy() since we areGerald Carter2001-02-131-2/+2
| | | | | | | | | using fstrings. Spotted by Elrond. Thanks :-) jerry
* lib/system.c: Fix for pw caching.Jeremy Allison2001-01-311-12/+37
| | | | | | srv_samr.c: Fix for pw caching. smbd/nttrans.c: Fix to allow trans create to set ACL on open. Jeremy.
* Fix insure problems with passwd caching code.Jeremy Allison2001-01-241-6/+10
| | | | Jeremy.
* Added modification to Richard Bollinger getpw[nam|uid] cache patch. OnlyJeremy Allison2001-01-241-2/+14
| | | | | uses cache max 100 times. Jeremy.
* getpw[nam|uid] caching patch from "Richard Bollinger"Gerald Carter2001-01-241-7/+37
| | | | | | | | <rabollinger@home.com> jerry
* sys_popen got damaged when converted from FILE * to int fd I think.Jeremy Allison2000-10-081-14/+3
| | | | | Patrick Powell kindly pointed out the bug. Jeremy.
* added a hack to get 64 bit locking working with the broken fcntl()Andrew Tridgell2000-09-291-0/+14
| | | | | call in glibc 2.1.95. This hack only gets enabled if you define GLIBC_HACK_FCNTL64
* totally rewrote the async signal, notification and oplock notificationAndrew Tridgell2000-06-121-109/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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!
* Linux kernel oplocks now seem to work, but need a _lot_ of testingAndrew Tridgell2000-06-111-8/+18
| | | | | I had to modify sys_select() to not loop on EINTR. I added a wrapper called sys_select_intr() which gives the old behaviour.
* continued the split of the kernel level oplocks code into a moreAndrew Tridgell2000-06-101-0/+2
| | | | | modular form. In this pass I added oplock_irix.c and added a "struct kernel_oplocks" that describes a kernel oplock implementation.
* clean up oplock capability code ready for Linux codeAndrew Tridgell2000-06-091-7/+15
|
* Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison2000-05-021-1/+31
| | | | | of doing a system call every time we want to just get our pid. Jeremy.
* got rid of some more old configure tests and includesAndrew Tridgell2000-04-171-17/+0
|
* converted a bunch more functions to use a fd instead of a FILE*Andrew Tridgell2000-04-161-88/+14
| | | | | | | 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
* Fixes to add "paranoid" option to popen. Checks some basic things.Jeremy Allison2000-03-161-1/+56
| | | | Jeremy
* lib/system.c: Fixed gcc warnings.Jeremy Allison2000-02-231-1/+0
| | | | | | nmbd/nmbd_processlogon.c: Use "True" and "False" instead of 1 and 0. Others - preparing for multiple pdu write code. Jeremy.
* Added replacement functions sys_popen and sys_pclose. These are basedJeremy Allison2000-02-151-7/+224
| | | | | | | | | 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.
* include/includes.h: Trimmed down unicode directory entry to be POSIX complient.Jeremy Allison1999-12-221-3/+4
| | | | | | lib/system.c: Trimmed down unicode directory entry to be POSIX complient. lib/util_unistr.c: Added wstrdup(). Jeremy.
* First cut at unicode sys_xx functions. Now to start moving upwards.....Jeremy Allison1999-12-221-0/+169
| | | | Jeremy.
* first pass at updating head branch to be to be the same as the SAMBA_2_0 branchAndrew Tridgell1999-12-131-38/+159
|
* sys_select added one more argument (read, write selectors).Luke Leighton1999-12-011-3/+4
|
* check to see if copy_passwd_struct() ever receives its own internalLuke Leighton1999-07-161-0/+7
| | | | buffer as an argument :-) :-)
* using jeremy's sys_getpwnam() call in the more critical area: Get_Pwnam().Luke Leighton1999-07-061-3/+3
| | | | | | made sure that hashed_getpwnam() has the copy-passwd-struct-wrapper around it, too. TODO: replace all calls of getpwnam() with sys_getpwnam().
* added jeremy's sys_getpwnam() and sys_getpwuid() routines from 2_0 tree.Luke Leighton1999-07-061-0/+57
|
* Makefile.in: Added maintainer mode fixes.Jeremy Allison1998-11-251-220/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Added the same open()/fopen()/creat()/mmap() -> sys_XXX calls.Jeremy Allison1998-11-171-3/+59
| | | | | | | | | | 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.
* fixed typo in getgroups codeAndrew Tridgell1998-10-051-1/+3
|
* added sys_getwd()Andrew Tridgell1998-10-021-3/+13
|
* Got very strict about the differences and uses ofJeremy Allison1998-09-291-1/+49
| | | | | | | 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.
* Makefile.in: Fixed bug with continuation line causing proto to fail.Jeremy Allison1998-09-251-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* got rid of SMB_STRUCT_STATVFS. I don't think we should be definingAndrew Tridgell1998-09-181-15/+0
| | | | structures that only apply on some platforms.
* include/includes.h:Jeremy Allison1998-09-181-1/+3
| | | | | | | 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.
* configure configure.in: Added checks for statvfs64. Last bit of 64 bit ↵Jeremy Allison1998-09-171-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* configure configure.in: Added tests for fseek64 and ftell64.Jeremy Allison1998-09-171-3/+29
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Ok so with this bugfix 64 bit file access actually seems to work :-).Jeremy Allison1998-09-111-1/+1
| | | | | | Problems were just dumb bugs like (defining sys_lseek to return 'int' DOH !). Jeremy.
* Ok - this is the 64 bit widening check in. It changes the configureJeremy Allison1998-09-031-62/+109
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Missed one struct stat.Jeremy Allison1998-09-011-2/+2
| | | | Jeremy.
* More abstraction of file system data types, to move to a 64Jeremy Allison1998-09-011-22/+22
| | | | | | | | | | | | | | | | | | | | | 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 checking fixes the statcache bug that stopped NetBench from runningJeremy Allison1998-08-281-18/+52
| | | | | | | | | | | | | | 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 is the bug change to using connection_struct* instead of cnum.Andrew Tridgell1998-08-141-7/+7
| | | | | | | | 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.
* merge from the autoconf2 branch to the main branchAndrew Tridgell1998-07-291-13/+21
|
* changed to use slprintf() instead of sprintf() just aboutAndrew Tridgell1998-05-111-1/+1
| | | | | | | 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.
* Changes to allow Samba to be compiled with -Wstrict-prototypesJeremy Allison1998-04-131-2/+0
| | | | | | with gcc. (Not a big change although it looks like it :-). Jeremy.
* This is *not* a big change (although it looks like one).Jeremy Allison1998-01-221-1/+1
| | | | | | | This is merely updating the Copyright statements from 1997 to 1998. It's a once a year thing :-). NO OTHER CHANGES WERE MADE. Jeremy.
* loadparm.c: Changed 'interfaces only' parameter to 'bind interfaces only'. AddedJeremy Allison1997-10-201-0/+9
| | | | | | | | | | | | | '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)