summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
1998-07-31This is the checkin of the debug changes.Christopher R. Hertel1-278/+1
Makefile.in: I've added debug.o. proto.h : Rebuilt, as is standard for these sorts of things. smb.h : New macros, etc. util.c : Debug code removed. I'll check in debug.c in the next step. Chris -)----- (This used to be commit 653c17c1b8e34bfbd05ea35ada9436a50d5a7ba4)
1998-07-30Makefile.in: Moved UBIQX stuff into UTILOBJ.Jeremy Allison1-35/+45
loadparm.c: Added "ole locking compatibility" option (default "true"). locking.c: Changes to implement union in files_struct. locking_shm.c: Changes to implement union in files_struct. nttrans.c: Made opening a directory explicit (we have to). Added create directory code for nttrans. reply.c: Changes to implement union in files_struct. server.c: Changes to implement union in files_struct. Added create directory code. trans2.c: Changes to implement union in files_struct. smb.h: Changes to implement union in files_struct. util.c: Changed linked list code to UNIQX linked list. This will make the other lists I need to implement for ChangeNotify and blocking locks easier. Jeremy. (This used to be commit 3a5eea850bb256b39cff8ace1e4fb4e0c1f5472b)
1998-07-29get rid of the runtime test for broken getgroups() and add a compileAndrew Tridgell1-7/+7
time test instead. This also allows us to get rid of the igroups element of a couple of structures. (This used to be commit 8b25fe734166b76ceebf8d9543c706ebe0fddc96)
1998-07-29merge from the autoconf2 branch to the main branchAndrew Tridgell1-194/+79
(This used to be commit 3bda7ac417107a7b01d91805ca71c4330657ed21)
1998-07-23locking.c: Added lock type to is_locked() and do_lock()Jeremy Allison1-27/+54
as the code in reply_lockingX wasn't taking account of the difference between read and write locks ! How did this ever work :-) ! reply.c: server.c: Add lock type to is_locked() and do_lock(). util.c: Also added code from klausr@ITAP.Physik.Uni-Stuttgart.De to fix problem with log files growing too large if an smbd writes less than 100 debug messages. Jeremy. (This used to be commit 80080abf772a470d5f0f4dcd4a75fb2a09a9fb2a)
1998-07-16Makefile: Added CC=gcc to DGUX on Intel. Comment from ross@filmworks.com.Jeremy Allison1-1/+29
ipc.c: loadparm.c: printing.c: Added code from <Dirk.DeWachter@rug.ac.be> to implement print queue pausing. New parameters are "queuepause command" and "queueresume command". util.c: Added fix for mount options in autmount map. lib/rpc/include/rpc_misc.h: Removed duplicate pipe names for Jean-Francois. Jeremy. (This used to be commit 559a9bf2bbdeae3e76ba9178779cd3a9537c4e91)
1998-07-15util.c: I've added a function called mem_dup(). Similar to strdup(),Christopher R. Hertel1-0/+13
mem_dup() allocates the required memory before copying the source data. It returns NULL if memory could not be allcoated, else a pointer to the newly allocated memory. proto.h: Rebuilt to add the prototype for mem_dup(). (This used to be commit 7f7e265ab457d046441d502d4b8447bc2c966675)
1998-07-10Fix for bug PR#8294 reported by <detlef.lammermann@er.materna.de>Jeremy Allison1-1/+1
- the Files array was storing the 'dos_to_unix' translated name, rather than the untranslated name. This could case problems when the name was run through dos_to_unix again. Jeremy. (This used to be commit 5f4be1498f7c907a539fe9b5998dfbcaa9e20e20)
1998-06-16clientgen: Added USE_SSL for client shutdown.Jeremy Allison1-19/+0
clitar.c: Added 'Samba style' comments before string_create_s(). loadparm.c: Fixed missing comma in SSL code. util.c: Removed string_create_s(). Currently it's only called from clitar.c and having it here as well as a static in clitar causes the compile to break (Richard, please decide where you want this function). lib/rpc/parse/parse_net.c: Fix from <anders.blomdell@control.lth.se> to stop coredump on missing parameter. Jeremy. (This used to be commit d23b44322570cb9a7aa2b86407bf4f91010a237b)
1998-06-16CLITAR changes to overcome some reported problems and add Jay's changesRichard Sharpe1-0/+19
(This used to be commit e1468dac0333eacea0a6f85f968e0a6d85af7f4c)
1998-06-16Added SSL support from Christian Starkjohann <cs@obdev.at>Jeremy Allison1-16/+64
This patch may not yet compile with -DUSE_SSL enabled, further Makefile changes may be needed. But it was important to get this code in place before I go off to USENIX. Jeremy. (This used to be commit 31e768369fdc61e07c59630c86c62239f3d3f3f7)
1998-06-04Fixed file descriptor leak in open_socket_out - this couldJeremy Allison1-0/+1
cause nmbd to run out of fd's. Test case found by Eloy Paris. Jeremy. (This used to be commit 9e2570317138cc6a7ffdc603564f863ff20139b8)
1998-05-27Ooops - fixed Win95 crash bugs with earlier code.Jeremy Allison1-3/+7
Jeremy (This used to be commit 6baeb4ad96bc58cf1bd53f6621067af8344c9556)
1998-05-27Newly re-written do_match and mask_match functions, with theJeremy Allison1-103/+235
help of Ums Harald <Harald.Ums@pro-sieben.de>, who has been testing our 8.3 wildcards with a test suite. With his new code for 8.3 matching, this is the test done (I'm quoting from his email) "I tested it by generating a directory with about 7600 Files and run automatc tests with about 4000 patterns. The result from Win95 -> WinNT and Win95 -> Samba where identical according to diff." I have also re-written the long filename wildcard code, so that doing DIR a*z now matches files : AAA.BBB.CCCC....ZZZZ correctly, and other fixes besides. I sincerely hope I can lay this (horrid) issue to rest now :-). Jeremy. (This used to be commit 94e3f0d9b48c1ac6d9235eb6600aff1c47e024bc)
1998-05-26smb.h: More NT SMB stuff (just defines).Jeremy Allison1-1/+7
smbpass.c: Do *NOT* make this function static. It breaks the compile on gcc util.c: Getting closer to MS wildcard semantics. A trailing '*' matches any trailing dot-separated components. trans2.c: Removed hacks that change multiple '?' -> '*' as this breaks things now. trans2.h: Removed NT_FILE_ATTRIBUTE_NORMAL - now FILE_ATTRIBUTE_NORMAL is defined in smb.h. Jeremy. (This used to be commit 42a65511068cd9006350c80bbed2f346f3f01cb0)
1998-05-19Fix to do NT wildcard matching.Jeremy Allison1-2/+24
Jeremy. (This used to be commit 170070b9c793805df9f8629e70027f17b949425f)
1998-05-19passdb.c: Fixed typo in coment.Jeremy Allison1-31/+22
smb.h: Removed comments no longer valid. smbpass.c: Stopped dummy function from being prototyped. util.c: Fix for multibyte char problems with strlower, strupper and string_replace. Jeremy. (This used to be commit cd244b45a5d35fceee2a4034b0c6aabdb58871aa)
1998-05-19Fixed signed/unsigned warning.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 6b6539cad8962f2913d892abae811afc72432678)
1998-05-18Makefile:Luke Leighton1-4/+4
- added nisppass.c and NISPLUS_FLAGS includes.h: - renamed USE_LDAP to USE_LDAP_DB. renamed NISPLUS to USE_NISPLUS_DB. added default define of USE_SMBPASS_DB. - removed ldap headers: they are local only to ldap.c ldap.c : - made all ldap-specific functions static. - added dummy sam21 functions loadparm.c : - renamed NISPLUS to NISPLUS_HOME mkproto.awk - commented out ldap-specific #ifdef generation code: it's not needed now that ldap-specific functions in ldap.c are static nisppass.c : - first attempt at an add function from (This used to be commit f215d375f0f1e12894c2a9e86bd28d4776d337c1)
1998-05-15util.c: Re-seed the crypto random number generator after a fork, so allJeremy Allison1-0/+10
smbds started from the same parent won't use the same sequence. Jeremy. (This used to be commit d3f507d05df9d0dd313b39bc99ebf11451dc0120)
1998-05-14some pretty horrible formatting in standard_sub_basic(): makes the functionLuke Leighton1-48/+56
unreadable and unmaintainable (This used to be commit eefeb61242449ea2a8d5f64e15d37f90789bdacc)
1998-05-14chgpasswd.c: Added comments to #ifdefsJeremy Allison1-8/+64
ipc.c: Caused samba password changing not to be done if UNIX password changing requested and not successful. util.c: Added string_to_sid() and sid_to_string() functions. lib/rpc/client/cli_samr.c: lib/rpc/include/rpc_misc.h: lib/rpc/parse/parse_lsa.c: lib/rpc/parse/parse_misc.c: lib/rpc/parse/parse_net.c: lib/rpc/parse/parse_samr.c: lib/rpc/server/srv_lsa.c: lib/rpc/server/srv_lsa_hnd.c: lib/rpc/server/srv_netlog.c: lib/rpc/server/srv_samr.c: lib/rpc/server/srv_util.c: Changes so that instead of passing SIDs around as char *, they are converted to DOM_SID at the earliest opportunity, and passed around as that. Also added dynamic memory allocation of group sids. Preparing to auto-generate machine sid. Jeremy. (This used to be commit 134d6fa79c1b6b9505a2c84ba9bfb91dd3be76e5)
1998-05-12includes.h: SunOS doesn't have strcasecmp, solaris versions prior to 2.6 don'tJeremy Allison1-64/+7
have vsnprintf. locking_slow.c: slight tidy. make_smbcodepage.c: Use safe_strcpy instead of pstrcpy. nmbd_winsserver.c: Use pstrcpy instead of fstrcpy. smbmount.c: Fixed reported bug. util.c: Removed old fstrcpy/fstrcat functions. Jeremy. (This used to be commit f257d2e4bafd3944cca737699913a8d868279ca6)
1998-05-12This is a security audit change of the main source.Jeremy Allison1-65/+125
It removed all ocurrences of the following functions : sprintf strcpy strcat The replacements are slprintf, safe_strcpy and safe_strcat. It should not be possible to use code in Samba that uses sprintf, strcpy or strcat, only the safe_equivalents. Once Andrew has fixed the slprintf implementation then this code will be moved back to the 1.9.18 code stream. Jeremy. (This used to be commit 2d774454005f0b54e5684cf618da7060594dfcbb)
1998-05-11ldap back-end database developmentLuke Leighton1-26/+0
Makefile: created PASSBD_OBJ group includes.h: added #ifdef USE_LDAP to #include <ldap> headers ldap.c: - renamed "_machine" to "_trust" everywhere. - added sam_passwd support routines - removed get_ldappwd_entry function: replaced with get_sampwd_entry - removed getldappwnam/uid: replaced with getsampwnam/uid - other messing about bits which are probably going to annoy the hell out of jean-francois (sorry!) mkproto.awk: - added stuff to wrap ldap.c protos with #ifdef USE_LDAP - added uid_t and gid_t return results to the prototype generation passdb.c: - created getsam21pwent, add_sam21pwd_entry, mod_sam21pwd_entry. - modified getsampwnam/uid and created getsam21pwnam/rid functions to replace the local get_smbpwd_entry() and get_ldappwd_entry() functions, which jeremy didn't like anyway because they were dual-purpose. - added utility routines which are or may be useful to all the password database routines. password.c: - renamed "machine_" to "trust_" everywhere. smbpass.c: - removed get_smbpwd_entry function: replaced it with get_sampwd_entry functions in passdb.c - moved code that decoded acct_ctrl into passdb.c - moved encode_acct_ctrl into passdb.c - removed getsmbpwnam/uid: replaced with getsampwnam/uid - renamed "machine_" to "trust_" everywhere. smbpasswd.c: - renamed "machine_" to "trust_" everywhere. util.c: - moved gethexpwd function into passdb.c lib/rpc/server/srv_util.c: - moved user_rid_to_uid, group_rid_to_rid etc etc into passdb.c (This used to be commit 673ab50c4c2c25db355d90efde3a6bfbb4d8369e)
1998-05-11changed to use slprintf() instead of sprintf() just aboutAndrew Tridgell1-3/+3
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-05-07moving gethexpwd into util.c, because it's used in both smbpass.c and ldap.cLuke Leighton1-0/+27
(This used to be commit abe261b2f5ea7036e7be6230876176d134ef4ee4)
1998-05-07This should (hopefully :-) be the final fix for the %U %G substitutionJeremy Allison1-0/+16
problem.... smbpass.c: Removed Luke's dire warning - as some of the functions in here *need* to be called externally :-). Jeremy. (This used to be commit 1fd8d12ca414066acec71b33eb8a13e16c2acd3a)
1998-05-06loadparm.c: Added #ifdef USE_LDAP around ldap code.Jeremy Allison1-16/+0
server.c: Moved %U, %G and %N into standard_sub() from standard_sub_basic() as only smbd knows about usernames. Also fixes problem with calling standard_sub_basic() from loadparm.c. smbpass.c: Partial tidyup of machine_password_lock() code - not finished yet. util.c: Moved %U, %G and %N into standard_sub() from standard_sub_basic() as only smbd knows about usernames. Also fixes problem with calling standard_sub_basic() from loadparm.c. lib/rpc/server/srv_ldap_helpers.c: Added #ifdef USE_LDAP around ldap code. lib/rpc/server/srv_samr.c: Added #ifdef USE_LDAP around ldap code. Jeremy. (This used to be commit 446b98ca071170fc950bad86ad96b58308a5b75c)
1998-05-06much faster pstrcpy() and fstrcpy()Andrew Tridgell1-16/+24
also print out the first 50 chars of an overflowing string so we have some chance of working out what is causng them. (This used to be commit 7a67e76722521ac8099cbcda054b0f4bf45c7bfe)
1998-04-25This looks like a big change but really isn't.Jeremy Allison1-2/+2
It is changing the global variables "myname" and "myworkgroup" to "global_myname" and "global_myworkgroup" respectively. This is to make it very explicit when we are messing with a global (don't ask - it makes the domain client code much clearer :-). Jeremy. (This used to be commit 866406bfe399cf757c8275093dacd5ce4843afa0)
1998-04-15ipc.c: Fix for printer queue spinning with Win95.Jeremy Allison1-1/+4
nmbd.c: Fix for always overwriting log despite append setting. smb.h: Addition of last time password changed entry to account info. smbpass.c: Changes to support last time changed field in smbpasswd file. smbpasswd.c: Changes to support last time changed field in smbpasswd file. util.c: Fix for always overwriting log despite append setting. Jeremy. (This used to be commit eb4fe9ecdf539209efab07dc992447ea7370cf93)
1998-04-13Changes to allow Samba to be compiled with -Wstrict-prototypesJeremy Allison1-2/+2
with gcc. (Not a big change although it looks like it :-). Jeremy. (This used to be commit cd2613c57261456485fe4eeecfda209ada70de8e)
1998-04-12minor reformatting of debug messages (so people don't think there is aAndrew Tridgell1-3/+3
. on the end of their host names) (This used to be commit dd3fe9fb471a803747957a898693a5890d71e176)
1998-04-09Makefile, loadparm.c, server.c, smb.h, util.c: Patch fromJeremy Allison1-0/+57
stn@techfak.uni-kiel.de (Stefan Nehlsen) to get homes from the NIS+ map. smbpasswd.c: Tidy up of cli_state structure. Jeremy. (This used to be commit fc2295e0f5729585fdb3ee47edb290851d4071c5)
1998-04-07want all of data in show_msg at log levels > 50.Luke Leighton1-27/+33
(This used to be commit 2245f4908ee3d33fd05f0a19abda89053cbfceb9)
1998-03-25Fix for is_in_path from "Steven Hartland" <steven_hartland@pa.press.net> -Jeremy Allison1-1/+1
hide files was not working. Jeremy. (This used to be commit 8d686f3b6b9008aad8c80bf2b1781a9c3359cc3f)
1998-03-24Fixed 'unused variable' warnings found with gcc -Wall -Werror.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 6eca266fe5a3368ab207bdf8729421b57f47f22e)
1998-03-24ypserver not available: AUTOMOUNT server and path don't work.Samba Release Account1-14/+10
fix: set default values to local server / path _before_ attempting to find the ypserver's auto.home entry. (This used to be commit 051ec104feaa48b9d147cc5479857c10915bdd26)
1998-03-24clientgen.c ipc.c smbpasswd.c: Fixes for warnings (from Herb).Jeremy Allison1-0/+4
quotas.c: Linux quota fix. util.c: Ensure smb_read_error is zero in all calls that can set it. lib/rpc/include/rpc_misc.h lib/rpc/include/rpc_netlogon.h lib/rpc/parse/parse_misc.c lib/rpc/parse/parse_net.c lib/rpc/server/srv_netlog.c : Modify Luke's code to call SamOEMhash(). Jeremy. (This used to be commit 7f749708383b8b36c3f23a5fbc5cbdf39bc8e555)
1998-03-23a pointless commit to check on a problem Luke reported with CVSAndrew Tridgell1-2/+2
(This used to be commit a947d9ceba9a00dc71e9cd7f8103e3559a931427)
1998-03-17this isn't a big commit, it just looks like it :-)Andrew Tridgell1-59/+67
I needed the client_name() and client_addr() functions in swat so I could tell who was connecting from where. The problem was that these functions didn't take a file descriptor parameter they just used the global "Client". So I needed to change all calls to pass a parameter ... lots of files. (This used to be commit a776058900a727591bd7b69debdaa25c0e31d693)
1998-03-16Adding the same change as was added to 1.9.18 branch to add theJeremy Allison1-0/+9
"name resolve order" parameter. source/Makefile: Re-ordered link for name resolve order code. source/clientgen.c: source/clientutil.c: Added calls to resolve_name(). source/includes.h: Added HPUX zombie fix. source/loadparm.c: Added new name resolve order parameter. source/namequery.c: Re-wrote to include parsing of lmhosts file, new resolve_name() function requested by John. source/nmbd.c: Tell resolve_name not to do WINS lookups if we are the WINS server. source/nmbd_lmhosts.c: Call lmhosts parsing functions in namequery.c source/password.c: Call resolve_name() to lookup security=server name. source/reply.c: source/time.c: source/trans2.c: "fake directory create times" fix from Jim Hague - hague@research.canon.com.au. source/util.c: Removed isalnum() test in Get_Hostname() that seems to cause problems on many systems. Jeremy. (This used to be commit 7f118970da7c43eaddcf92dc056d3e849f1e7d5c)
1998-03-14added the ability to start/stop the server from SWAT.Andrew Tridgell1-1/+1
I needed to modify the way the pidfile is handled in nmbd and smbd to do this. Jeremy, you may wish to look at what I've done as it probably breaks the Whistle use of pidfiles. In particular I've removed the -f option and instead smbd and nmbd always create a pidfile in the lock directory. (This used to be commit 20bb22d61b986d2036c681fc33db60f2b2b3c1c7)
1998-03-11"For I have laboured mightily on Luke's code, and hath brokenJeremy Allison1-0/+25
all I saw" - the book of Jeremy, chapter 1 :-). So here is the mega-merge of the NTDOM branch server code. It doesn't include the new client side pieces, we'll look at that later. This should give the same functionality, server wise, as the NTDOM branch does, only merged into the main branch. Any fixes to domain controler functionality should be added to the main branch, not the NTDOM branch. This code compiles without warnings on gcc2.8, but will need further testing before we are sure all the working functionality of the NTDOM server branch has been correctly carried over. I hereby declare the server side of the NTDOM branch dead (and all who sail in her :-). Jeremy. (This used to be commit 118ba4d77a33248e762a2cf843fb7cbc906ee6e7)
1998-03-03Change the multibyte character set support so thatJeremy Allison1-0/+72
Kanji support is one case of multibyte character support, rather than being a specific case in single byte character support. This allows us to add Big5 Chinese support (code page 950) and Korean Hangul support (code page 949) at very little cost. Also allows us to easily add future multibyte code pages. Makefile: Added codepages 949, 950 as we now support more multibyte codepages. asyncdns.c: Fixed problem with child being re-spawned when parent killed. charcnv.c charset.c client.c clitar.c kanji.c kanji.h smb.h util.c loadparm.c: Generic multibyte codepage support (adding Big5 Chinese and Korean Hangul). nmbd.c: Fixed problem with child being re-spawned when parent killed. mangle.c: Modified str_checksum so that first 15 characters have more effect on outcome. This helps with short name mangling as most 'long' names are still shorter than 15 chars (bug was foobar_mng and foobar_sum would hash to the same value, with the modified code they hash differently. Jeremy. (This used to be commit 299016338cfb47f0c585875ef9b468121fcee97d)
1998-02-24nmbd_incomingdgrams.c: Fix for typo.Jeremy Allison1-4/+4
nmbd_sendannounce.c: Remote announcement was announcing to the wrong name ! nmblookup.c: Fix for substitutions not seeing hostname. testparm.c: Fix for substitutions not seeing hostname. wsmbstatus.c: Fix for substitutions not seeing hostname. util.c: Change read_udp_socket to use sockaddr_in rather than dubiously messing around with an opaque data type (sockaddr). Jeremy. (This used to be commit 776ccf5c0641b5aa300236c2612b5f2761d1179f)
1998-02-20nmbd_packets.c: nmbd_subnetdb.c: Patch from Andrey Alekseyev ↵Jeremy Allison1-30/+112
<fetch@muffin.arcadia.spb.ru> to fix the fact that retransmit_or_expire_response_records() wasn't looking at the WINS subnet. server.c: Patch from jkf@soton.ac.uk to add %p (NIS server path) substitution. smbpass.c: Fix to stop parsing failing on non-valid lines. trans2.c: Fix for volume serial number code. util.c: Patch from jkf@soton.ac.uk to add %p (NIS server path) substitution. Fix for warnings under RH5. gcc 2.8. Jeremy. (This used to be commit e58ab3bbe6e939ba678ad5482e58e0191c8dcbcb)
1998-02-14Fix to make us compile cleanly with gcc 2.8.Jeremy Allison1-3/+0
Jeremy. (This used to be commit 0a535680077a9e436362fd7f1711f62b35317fa4)
1998-02-11Makefile: Added AIX 3.2.5.Jeremy Allison1-0/+32
loadparm.c: Added "win95 bug compatibility" parameter. local.h: Replaced MAX_OPEN_FILES back to 100 from 10 (oops). reply.c: Fixed ulogoff check against uid - changed to vuid. server.c: Changed file struct save of uid - changed to vuid. smb.h: Changed id in struct current_user to vuid. Changed file struct uid to vuid. time.c: Added "win95 bug compatibility" atime -> mtime return. trans2.c: Added "win95 bug compatibility" fixes. uid.c: Changed id in struct current_user to vuid - added checks to set/reset it. util.c: Added code to expand environment variables. version.h : still at 1.9.18 (head branch doesn't matter too much at present). Jeremy. (This used to be commit adc903bcf59ad1664babd7f1d43675d3a75bfbc9)