summaryrefslogtreecommitdiff
path: root/source3/lib/system.c
AgeCommit message (Collapse)AuthorFilesLines
2001-03-23Sync up with 2.2 ACL code.Jeremy Allison1-4/+0
Jeremy. (This used to be commit 5b9a88c2d0da3479f91131f66ff741e88f9760ee)
2001-03-19Added sys_dlopen/sys_dlsym/sys_dlclose.Jeremy Allison1-0/+31
Jeremy. (This used to be commit 49f0e7e7143f82bce9dfd8b06e9e515bc0869ab7)
2001-03-17removed useless debug msgAndrew Tridgell1-3/+0
(This used to be commit 348ebe30d047d69968df0f33b227e52b5bbabafe)
2001-03-17lib/system.c (Finally) fixed all insure errors in password caching code. We ↵Jeremy Allison1-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. (This used to be commit af364b93d92f70aa52195c46d3cc516830752609)
2001-02-13change pstrcpy() in setup_pwret() to fstrcpy() since we areGerald Carter1-2/+2
using fstrings. Spotted by Elrond. Thanks :-) jerry (This used to be commit a55a4fea9728550c4d28b05910c0b7d5080714b3)
2001-01-31lib/system.c: Fix for pw caching.Jeremy Allison1-12/+37
srv_samr.c: Fix for pw caching. smbd/nttrans.c: Fix to allow trans create to set ACL on open. Jeremy. (This used to be commit c4f810a7588a2faf41f4222dc77678c53ab1dec0)
2001-01-24Fix insure problems with passwd caching code.Jeremy Allison1-6/+10
Jeremy. (This used to be commit 2bd4f163890be58456a7e49b1adbed3f5834ff9e)
2001-01-24Added modification to Richard Bollinger getpw[nam|uid] cache patch. OnlyJeremy Allison1-2/+14
uses cache max 100 times. Jeremy. (This used to be commit 3712e35c5460d341ba750fe5e7bce8ef63c9f8ef)
2001-01-24getpw[nam|uid] caching patch from "Richard Bollinger"Gerald Carter1-7/+37
<rabollinger@home.com> jerry (This used to be commit 158430ba6a030061bc7d7b84126c6f7ea0041c91)
2000-10-08sys_popen got damaged when converted from FILE * to int fd I think.Jeremy Allison1-14/+3
Patrick Powell kindly pointed out the bug. Jeremy. (This used to be commit 1f156b2420b7ecf1266e650efc3cee55362e29dd)
2000-09-29added a hack to get 64 bit locking working with the broken fcntl()Andrew Tridgell1-0/+14
call in glibc 2.1.95. This hack only gets enabled if you define GLIBC_HACK_FCNTL64 (This used to be commit d8b9ec741cc57b5f3dd1b3ef782a7baed402beaa)
2000-06-12totally rewrote the async signal, notification and oplock notificationAndrew Tridgell1-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! (This used to be commit 44766c39e0027c762bee8b33b12c621c109a3267)
2000-06-11Linux kernel oplocks now seem to work, but need a _lot_ of testingAndrew Tridgell1-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. (This used to be commit b28cc4163bc2faaa80c5782fc02c8f03c410cdeb)
2000-06-10continued the split of the kernel level oplocks code into a moreAndrew Tridgell1-0/+2
modular form. In this pass I added oplock_irix.c and added a "struct kernel_oplocks" that describes a kernel oplock implementation. (This used to be commit b5ceab810292602ea9a81696c20a781c16b706c2)
2000-06-09clean up oplock capability code ready for Linux codeAndrew Tridgell1-7/+15
(This used to be commit 70dcc791b45ac64fc536ef449e4e6b53b2b68fd4)
2000-05-02Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison1-1/+31
of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a)
2000-04-17got rid of some more old configure tests and includesAndrew Tridgell1-17/+0
(This used to be commit f137648504362479143d50477fa38ebf7147968b)
2000-04-16converted a bunch more functions to use a fd instead of a FILE*Andrew Tridgell1-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 (This used to be commit a09470817c5b21dba42f9ef4ce5e8b768a254c0b)
2000-03-16Fixes to add "paranoid" option to popen. Checks some basic things.Jeremy Allison1-1/+56
Jeremy (This used to be commit 3b8cbb10de322fd7a1063fb5b681790b10d24ab0)
2000-02-23lib/system.c: Fixed gcc warnings.Jeremy Allison1-1/+0
nmbd/nmbd_processlogon.c: Use "True" and "False" instead of 1 and 0. Others - preparing for multiple pdu write code. Jeremy. (This used to be commit 9f879ec396230deba34fbe5e82d8a65f92137c54)
2000-02-15Added replacement functions sys_popen and sys_pclose. These are basedJeremy Allison1-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. (This used to be commit b52e92b09d4ca3b66e534f520468dee27065d048)
1999-12-22include/includes.h: Trimmed down unicode directory entry to be POSIX complient.Jeremy Allison1-3/+4
lib/system.c: Trimmed down unicode directory entry to be POSIX complient. lib/util_unistr.c: Added wstrdup(). Jeremy. (This used to be commit ca64f4ab00c6d54022ba9bd4b869523566a242d7)
1999-12-22First cut at unicode sys_xx functions. Now to start moving upwards.....Jeremy Allison1-0/+169
Jeremy. (This used to be commit b5eb009cc3cfd1adc044e91911d59acdb54c30cb)
1999-12-13first pass at updating head branch to be to be the same as the SAMBA_2_0 branchAndrew Tridgell1-38/+159
(This used to be commit 453a822a76780063dff23526c35408866d0c0154)
1999-12-01sys_select added one more argument (read, write selectors).Luke Leighton1-3/+4
(This used to be commit e4d92ff9dfc51735e6932748f66a7c20b2c1cb6a)
1999-07-16check to see if copy_passwd_struct() ever receives its own internalLuke Leighton1-0/+7
buffer as an argument :-) :-) (This used to be commit 0d1f5e5a6d1cbceda3be3d5626842116e6e91809)
1999-07-06using jeremy's sys_getpwnam() call in the more critical area: Get_Pwnam().Luke Leighton1-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(). (This used to be commit 436a89145524d3539b3a247f98c1e71f0616dd70)
1999-07-06added jeremy's sys_getpwnam() and sys_getpwuid() routines from 2_0 tree.Luke Leighton1-0/+57
(This used to be commit df756f37230bcc47ef6a2067b6ddd8a0e2a125d1)
1998-11-25Makefile.in: Added maintainer mode fixes.Jeremy Allison1-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. (This used to be commit 6acb4b68f68d516e2ac3c47e500f5600d653435e)
1998-11-17Added the same open()/fopen()/creat()/mmap() -> sys_XXX calls.Jeremy Allison1-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. (This used to be commit 18ff93a9abbf68ee8c59c0af3e57c63e4a015dac)
1998-10-05fixed typo in getgroups codeAndrew Tridgell1-1/+3
(This used to be commit 046e8a50219ca69ab326fa672c5fcb1ab3689b3b)
1998-10-02added sys_getwd()Andrew Tridgell1-3/+13
(This used to be commit 688d19de50c01222c42f61f825fab93a7005f5b6)
1998-09-29Got very strict about the differences and uses ofJeremy Allison1-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. (This used to be commit e570db46fc3a78e499523fd342e9a34cebb18998)
1998-09-25Makefile.in: Fixed bug with continuation line causing proto to fail.Jeremy Allison1-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. (This used to be commit e8be306f23963ac00b1a383ebe0cc1421529fb02)
1998-09-18got rid of SMB_STRUCT_STATVFS. I don't think we should be definingAndrew Tridgell1-15/+0
structures that only apply on some platforms. (This used to be commit 926591067cd8646426ca06df0b00a1d6f6dd5752)
1998-09-18include/includes.h:Jeremy Allison1-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. (This used to be commit 14c134e8316687aa5a4ee089c2acfa6428faceae)
1998-09-17configure configure.in: Added checks for statvfs64. Last bit of 64 bit ↵Jeremy Allison1-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. (This used to be commit c512b1b91fb7f2a7a93b9033a33e06d966daadb4)
1998-09-17configure configure.in: Added tests for fseek64 and ftell64.Jeremy Allison1-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. (This used to be commit c381d32e3dc23fe887408016cae821aceb30da2c)
1998-09-11Ok so with this bugfix 64 bit file access actually seems to work :-).Jeremy Allison1-1/+1
Problems were just dumb bugs like (defining sys_lseek to return 'int' DOH !). Jeremy. (This used to be commit 54dd51176fbab18af0b21bdee71b53f8f86573a8)
1998-09-03Ok - this is the 64 bit widening check in. It changes the configureJeremy Allison1-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. (This used to be commit 14500936c321d15995c963766aac67bf1f4e3824)
1998-09-01Missed one struct stat.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 03ae657a36c986ba4248b297e64ec7898a1914e6)
1998-09-01More abstraction of file system data types, to move to a 64Jeremy Allison1-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 used to be commit 28aa182dbffaa4ffd86047e608400de4b26e80eb)
1998-08-28This checking fixes the statcache bug that stopped NetBench from runningJeremy Allison1-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 used to be commit 779b924ec1f6c81ff578d22295b20fece698d1fc)
1998-08-14this is the bug change to using connection_struct* instead of cnum.Andrew Tridgell1-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. (This used to be commit c7ee025ead4a85b6fa44a832047b878451845fb6)
1998-07-29merge from the autoconf2 branch to the main branchAndrew Tridgell1-13/+21
(This used to be commit 3bda7ac417107a7b01d91805ca71c4330657ed21)
1998-05-11changed to use slprintf() instead of sprintf() just aboutAndrew Tridgell1-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. (This used to be commit ee09e9dadb69aaba5a751dd20ccc6d587d841bd6)
1998-04-13Changes to allow Samba to be compiled with -Wstrict-prototypesJeremy Allison1-2/+0
with gcc. (Not a big change although it looks like it :-). Jeremy. (This used to be commit cd2613c57261456485fe4eeecfda209ada70de8e)
1998-01-22This is *not* a big change (although it looks like one).Jeremy Allison1-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. (This used to be commit b9c16977231efb274e08856f7f3f4408dad6d96c)
1997-10-20loadparm.c: Changed 'interfaces only' parameter to 'bind interfaces only'. AddedJeremy Allison1-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) (This used to be commit 41a1d81c112a82ad2ae1b3c4ee81051f133ce1ed)
1997-09-26Adding Andrews buffer overflow fixes into the main branch.Jeremy Allison1-2/+2
Jeremy (jallison@whistle.com) (This used to be commit e7eb1f044d3101679dc7a118820ea5efe0cd837c)