summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
1998-11-11changed syntax of registry commands so keys can start with HKLM or HKU.Luke Leighton1-13/+55
sorted lookupsids command (This used to be commit 13a0ee851fe0ce9acddfe57f9aba19fc78085c39)
1998-11-10util functions split into relevant modules, first pass.Luke Leighton1-1992/+99
(This used to be commit d448906e68cec5019fa83f7d31b862efff41e2da)
1998-11-09Makefile.in: Removed rpc_server/srv_ldap_helpers.c per J.F.'s instructions.Jeremy Allison1-1/+1
client/client.c: client/clitar.c: include/client.h: smbwrapper/smbw_dir.c: smbwrapper/smbw_stat.c: smbwrapper/smbw.c: lib/util.c: Converted all use of 'mode' to uint16. smbd/quotas.c: Fixed stupid comment bug I put in there :-(. printing/printing.c: Fix from J.F. to new code. Jeremy. (This used to be commit bacd3e9d2036a804e73644a28fc498f229c8446c)
1998-10-28use abort() instead of exit() in smb_panic()Andrew Tridgell1-1/+1
the reason we don't return() here is that smb_panic() is used not just for segv but also for detected errors (such as buffer overflows) (This used to be commit 7a50ca81a5842f7139e67c0ff9de79518599f445)
1998-10-23include/smb.h: Added #defines for lots of things - makes our code a *lot* ↵Jeremy Allison1-1/+1
easier to read. lib/util.c: Fixed Luke's set_first_token() function - should return void. smbd/close.c: Move delete_on_close into file_fd_struct structure. smbd/ipc.c: Changed local_machine back to fstring. smbd/nttrans.c: Use defines for mapping share modes. smbd/open.c: Move delete_on_close into file_fd_struct structure, added code for ALLOW_SHARE_DELETE. smbd/reply.c: Use defines for mapping share modes. smbd/trans2.c: Move delete_on_close into file_fd_struct structure. Jeremy. (This used to be commit 8e1ce307bd6a9056b4a95fe6f52ff42dc6e03a08)
1998-10-22rpctorture commandLuke Leighton1-0/+5
(This used to be commit b4ae65e2d0582274d67d02ea190f6d3d83b48594)
1998-10-20Fixed bug found by John Blair where trim_string wasn'tJeremy Allison1-7/+89
correctly trimming trailing multibyte code page strings. Jeremy. (This used to be commit dbdbce29f56d03f6abf1ee3d96ca2032e688dcbc)
1998-10-20some quite important bug-fixes i missed because i transferred the wrongLuke Leighton1-1/+3
smb.tgz file from my portable. particularly the call to mem_data followed by a realloc of that data in cli_pipe.c's rpc_read() function. smbd responses now use p->rdata_i which is a faked-up pointer into p->rdata's response data. rdata can be very long; rdata_i is limited to point to no more than max_tsize - 0x18 in length. this will make it an almost trivial task to add the encrypted rpc headers after rdata_i, and mem_buf_copy will cope admirably with rhdr chained to rdata_i chained to auth_verifier etc etc... (This used to be commit 05a297e3a98c14360782af4ad0d851638fb5da9a)
1998-10-19- dce/rpc codeLuke Leighton1-16/+4
- removed debug info in struni2 and unistr2 (security risk) - rpc_pipe function was getting pointer to data then calling realloc *dur* - password check function, the start of "credential checking", user, wks, domain, pass as the credentials (not just user,pass which is incorrect in a domain context) - cli_write needs to return ssize_t not size_t, because total can be -1 if the write fails. - fixed signed / unsigned warnings (how come i don't get those any more when i compile with gcc???) - nt password change added in smbd. yes, jeremy, i verified that the SMBtrans2 version still works. (This used to be commit fcfb40d2b0fc565ee4f66b3a3761c246366a2ef3)
1998-10-19removed an incorrect commentAndrew Tridgell1-4/+0
(This used to be commit 5abdb70e2a5cda2df444dfe5a9cdcb751be75ca8)
1998-10-18Fixed sys_lseek and seek_file calls so all returnsJeremy Allison1-2/+3
are *checked* :-). Jeremy. (This used to be commit b8b781191dd7d28944d87eec5fa0fbef798e289b)
1998-10-16Re-added code to tell the user how many open files theyJeremy Allison1-5/+7
have. Needed for server diagnosis purposes... Jeremy. (This used to be commit 04d79a9ae515e7259277f9980552f1d61df239f1)
1998-10-05- fixed cast warningsAndrew Tridgell1-11/+13
- ignore *.po32 files (This used to be commit 469474803d39ceec7155792d364787318708fb91)
1998-10-05added a function set_maxfiles() to set our file rlimit to the maxAndrew Tridgell1-0/+23
possible and return the max. (This used to be commit 7a7b5ee1689b6be57752d176c7b77a2f1b453486)
1998-10-04more solaris 2.5 fixups. It now seems to be working pretty well.Andrew Tridgell1-0/+1
(This used to be commit c4e450817886b40474cebdfc50c0c16fb4646baf)
1998-10-04use *SMBSERVER convention in smbwrapper to allow us to connect toAndrew Tridgell1-1/+1
servers that we don't know the netbios name of. (This used to be commit 147d49dade3901835b5d60b02c495bea544ff5e9)
1998-10-04added support for printing via smbwrapperAndrew Tridgell1-1/+11
You can print using "cp filename /smb/SERVER/PRINTER/jobname" You can list the current printqueue using ls (This used to be commit 080fb61b69620e26e8122705383dc2bd0468a519)
1998-10-03added simple device/inode number support based on a checksum of theAndrew Tridgell1-1/+1
filename (This used to be commit 5674fb4e9dc4d92213d763c8cecd26efc23a9720)
1998-10-03fixed a bug in name_len() (thanks to kooros@kooros.netrack.net)Andrew Tridgell1-7/+7
(This used to be commit f05f0a01cefbf19943a53c3307eb992d77238b51)
1998-10-03added unlink() and rename() support to smbwrapperAndrew Tridgell1-1/+1
(This used to be commit b85d96144728e8a29c7c1114462e28bf3b144b80)
1998-10-03- ignore *.p filesAndrew Tridgell1-1/+1
- make msleep() non-static (This used to be commit 688a749484aa807075d2ce16d750c4f3494f3e55)
1998-09-29Got very strict about the differences and uses ofJeremy Allison1-5/+9
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-28Fixed problems found in lint pass over the old code by <cpeterso@microsoft.com>.Jeremy Allison1-4/+7
These were the problems that still existed in the 2.0 branch. Jeremy. (This used to be commit 3fd28812f75f2311a114ff905143634e3bbb1fac)
1998-09-28Changes to test in configure if capabilities are enabled on a system.Jeremy Allison1-2/+2
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 e0567433bd72aec17bf5a54cc292701095d25f09)
1998-09-25Makefile.in: Fixed bug with continuation line causing proto to fail.Jeremy Allison1-0/+13
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-25added rpcclient programLuke Leighton1-0/+40
(This used to be commit aa38f39d67fade4dfd7badb7a9b39c833a1dd1ca)
1998-09-23First cut at kernel oplocks. This should have no effect unless runninJeremy Allison1-218/+0
on a machine that supports them in autoconf. Move various functions out of lib/util.c into smbd/process.c and smbd/oplock.c where they belong. Jeremy. (This used to be commit c3c5e13f85c97939746070132dad941e79c546fb)
1998-09-19Remove some byte-copying code in unix_format() that did nothing exceptJeremy Allison1-8/+0
slow down my benchmark :-). Jeremy. (This used to be commit b55f93b213ee61c35e7a87a2be63191d55186bd6)
1998-09-18got rid of some #ifdef LARGE_XXXX stuff and got rid of non-portable LLAndrew Tridgell1-15/+4
suffix from some constants. (This used to be commit 84956eddf32aa66c787ec76bdb60d2843fa7a025)
1998-09-17configure configure.in: Added checks for statvfs64. Last bit of 64 bit ↵Jeremy Allison1-3/+3
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-15Removed hideous inefficiencies in old trim_string code. This was makingJeremy Allison1-15/+22
calls to strlen() a profiling hotspot. Jeremy. (This used to be commit ffa450acddb7aec6a440ae3fe6032c109805d176)
1998-09-11Added ssize_t to configure code.Jeremy Allison1-102/+105
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 36544fe5476f7770bd5748574fc54be7b3ee4d4a)
1998-09-05ahh, the joy of deleting large chunks of code that someone else hasAndrew Tridgell1-13/+0
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 41f0069afc02169932e04ff0039bb6328eaaf04d)
1998-09-05tridge the destroyer returns!Andrew Tridgell1-168/+30
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 2204475c87f3024ea8fd1fbd7385b2def617a46f)
1998-09-05got rid of interpret_security(). Thanks to Jean-Francois for pointingAndrew Tridgell1-17/+0
out it is no longer used (replaced by enumerated types in loadparm.c) (This used to be commit 88df8a8b25921389ee9d017b770bbae143cc51b8)
1998-09-04More 64 bit stuff - now the fcntl locks are 64 bit clean.Jeremy Allison1-51/+61
Nearly at the stage where I can expose the 64-bit-ness to the NT clients.... Jeremy. (This used to be commit 422f1dd45074c0e28203aca5952e57bbe56676b6)
1998-09-03Ok - this is the 64 bit widening check in. It changes the configureJeremy Allison1-55/+59
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-02we are never interested in SIGPIPE so just ignore (block) itAndrew Tridgell1-9/+0
always. Don't even install a handler. (This used to be commit 72c383f4b7bcce5374632dc972df16ab0e2542b9)
1998-09-01More abstraction of file system data types, to move to a 64Jeremy Allison1-13/+13
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-31configure.in, configure: include/config.h.in: Added stropts and poll.Jeremy Allison1-46/+47
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 3d9ec96de5e04e83abafe9c5d980bd39eee856ea)
1998-08-31bounds check next_token() to prevent possible buffer overflowsAndrew Tridgell1-11/+15
(This used to be commit 3eade55dc7c842bdc50205c330802d211fae54d3)
1998-08-30added a function zero_free(void *, int size) that zeros an area ofAndrew Tridgell1-0/+11
memory then frees it. Useful for catching bugs. (This used to be commit 99782754f79f3795f81cbf57caeb0925f6a66c10)
1998-08-28This checking fixes the statcache bug that stopped NetBench from runningJeremy Allison1-5/+5
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-24Changed ASSERT macros to SMB_ASSERT macros as some systems alreadyJeremy Allison1-1/+1
have an ASSERT macro defined. Jeremy. (This used to be commit dbe6ad014a8b5dcbf17d7cd9865650c2e040d666)
1998-08-22added ASSERT() and ASSERT_ARRAY() macros and sprinkled them liberallyAndrew Tridgell1-5/+3
in the rpc code. (This used to be commit e6ce1c5b5a9f29d8fcbbd23019186ff5c600e795)
1998-08-21added new smb.conf option "panic action". see my samba-technicalAndrew Tridgell1-9/+9
explanation. (This used to be commit c6899df44c34088a4d2bf1edc840320b0ba7e32e)
1998-08-15configure: Changes for extra headers.Jeremy Allison1-2/+2
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 1b9cbcd02e575dc0a95fa589f720df30a4acc46b)
1998-08-14this is the bug change to using connection_struct* instead of cnum.Andrew Tridgell1-3/+89
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-08-14Makefile.in: Changed so that make proto will work with ldap & nisplus.Jeremy Allison1-3/+134
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 b68e756ff57622c6c74f28031d4be964d7b1c9bc)
1998-08-08added --with-nisplus-home optionAndrew Tridgell1-4/+4
(This used to be commit 70000c21909a154344b489e8aa18a5868ff52865)