summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
1997-04-09Large changes from jra@cygnus.com. Mainly browser updates.Samba Release Account1-4/+2
access.c: Fixed crash if yp domain unavailable. includes.h: Moved ifdefs for minor platform. interface.c: Changed name of ipgrp to wins_ip to make it clearer. loadparm.c: Changed default of wins support to 'no'. nameannounce.c: Many changes to fix cross subnet browsing. namebrowse.c: Many changes to fix cross subnet browsing. namedbname.c: Many changes to fix cross subnet browsing. namedbresp.c: Many changes to fix cross subnet browsing. namedbsubnet.c: Many changes to fix cross subnet browsing. namedbwork.c: Many changes to fix cross subnet browsing. nameelect.c: Many changes to fix cross subnet browsing. namelogon.c: Many changes to fix cross subnet browsing. namepacket.c: Many changes to fix cross subnet browsing. nameresp.c: Many changes to fix cross subnet browsing. nameserv.c: Many changes to fix cross subnet browsing. nameserv.h: Many changes to fix cross subnet browsing. nameservreply.c: Many changes to fix cross subnet browsing. nameservresp.c: Many changes to fix cross subnet browsing. namework.c: Many changes to fix cross subnet browsing. nmbd.c: Change to search wins subnet. nmbsync.c: Change to check if we are any master before proceeding. proto.h: Added find_subnet_all() and check_work_servertype(). util.c: Moved 'done' settings on name resolution. (This used to be commit a82476eee2c521e5eed092bc367da0a7cef23de1)
1997-02-23Makefile: Added cleandir target.Samba Release Account1-3/+3
chgpasswd.c: Added patch from Roland Haag <haag@think.de> to allow password changes to be done more than once. loadparm.c: Added entries for the "directory mode/directory mask parameters". Changed default file mode to 644. proto.h: Added sys_gethostbyname. server.c: Added directory mode changes. system.c: Added sys_gethostbyname. trans2.c: Added NT_FILE_ATTRIBUTE_NORMAL patch from Roger Orr <rorr@csfp.csfb.com> trans2.h: Defined NT_FILE_ATTRIBUTE_NORMAL for above patch. util.c: Changes calls to gethostbyname to sys_gethostbyname. jra@cygnus.com (This used to be commit d8d8a7ee00971fca7a8d079bfb547af107df35a4)
1997-02-13Fixed bugs in my YOST replacement code. Doing a trim_stringSamba Release Account1-1/+9
in unix_clean_name caused directory names to go from ./ to "". This is now checked for, unix_clean name returns ./ in these cases. jra@cygnus.com (This used to be commit 64a16d9c2aae0405437f28dbb00e68080c09a7a1)
1997-02-10Added trim_string(s, "./", 0) to unix_clean_name to removeSamba Release Account1-0/+3
leading ./ characters. jra@cygnus.com (This used to be commit 617370314ef0d19002243105f5c8a549e3397152)
1997-02-03Fixed const definitions for StrCaseXXX calls.Samba Release Account1-2/+2
jra@cygnus.com (This used to be commit cbb59639659476054571d4bd18b5df55b0e11a2e)
1997-02-02util.c: StrCaseCmp and StrnCaseCmp terminated incorrectly, giving falseSamba Release Account1-7/+14
answers when a string was partially identical. this issue is still outstanding, and needs to be investigated further. loadparm.c: added lp_logon_path() parameter. ipc.c: in NetUserGetInfo, lp_logon_path() can be returned instead of always specifying \\SAMBA_SERVER\HOMES (which may not necessarily exist). it is now possible to specify lp_logon_path() as \\ARBITRARY_SERVER\%U, just like NT server can. the default is \\SAMBA_SERVER\HOMES, just like it used to be. lkcl (This used to be commit d5b6ad7cb87d6b1a9342f027ac4f57ffdb54b4f3)
1997-01-09Makefile: Changes to split Solaris into Solaris2.3 and previous, and 2.4 and ↵Samba Release Account1-8/+2
after from Paul Eggert. Makefile: Added AMIGA changes from Rask Ingemann Lambertsen <rask@k4315.kampsax.dtu.dk>. charset.c: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at> charset.h: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at> clitar.c: Patch to re-sync after read fail from (lost contributor name, sorry). includes.h: Patch for AMIGA from Rask Ingemann Lambertsen <rask@k4315.kampsax.dtu.dk> includes.h: Patch for SunOS atexit by Jeremy (jra@cygnus.com) interface.c: Patch for AMIGA from Rask Ingemann Lambertsen <rask@k4315.kampsax.dtu.dk> kanji.h: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at> locking.c: Patch to fix file locking from Jeremy (jra@cygnus.com) locking.c: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com) pipes.c: Patch to fix file locking from Jeremy (jra@cygnus.com) proto.h: Patch to fix file locking from Jeremy (jra@cygnus.com) reply.c: Patch to fix file locking from Jeremy (jra@cygnus.com) server.c: Patch to fix file locking from Jeremy (jra@cygnus.com) server.c: Patch for FAST_SHARE_MODE fix from (lost contributor name, sorry). smb.h: Patch to fix file locking from Jeremy (jra@cygnus.com) smb.h: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com) status.c: Patch to fix file locking from Jeremy (jra@cygnus.com) statuc.c: Patch to add granularity of lock files to usec by Jeremy (jra@cygnus.com) system.c: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at> trans2.c: Patch to fix file locking from Jeremy (jra@cygnus.com) trans2.c: Patch to fix volume name reported to Win95 from Jeremy (jra@cygnus.com) util.c: Patch for Western European Languages from Josef Hinteregger <joehtg@joehtg.co.at> util.c: Patch to fix client_name from continuously returning UNKNOWN (from various contributors). version.h: Update to 1.9.16p10. (This used to be commit 03d28fa32eb094affa33133ebe2602fdb70f6361)
1996-12-10Added Whistle veto file functions. Moved fcntl locking fromSamba Release Account1-0/+225
locking.c to util.c jra@cygnus.com (This used to be commit f2d481a2d3a9adca7c94427f291a379958c3c0da)
1996-10-24- added support for TMPDIR env variableAndrew Tridgell1-1/+16
- fixed fault.c for linux 2.1 - put back in the FIND_SELF failing code - cleaned up casts in encryption (This used to be commit 3af04f1580b2569c0a4f2549bf6352c7a25afa0d)
1996-10-05I have fixed quite a few important bugs in this commit.Andrew Tridgell1-6/+111
Luke, can you take special note of the bug fixes to nmbd so you can propogate them to your new code. - rewrote the code that used to use fromhost(). We now call gethostbyaddr() only if necessary and a maximum of once per connection. Calling gethostbyaddr() causes problems on some systems so avoiding it if possible is a good thing :-) - added the "fake oplocks" option. See the docs in smb.conf(5) and Speed.txt - fixed a serious bug in nmbd where it would try a DNS lookup on FIND_SELF queries. This caused a lot of unnecessary (and incorrect) DNS lookups to happen. FIND_SELF queries should only go to the internal name tables. - don't set FIND_SELF for name queries if we are a wins proxy, as we are supposed to be answering queries for other hosts. - fixed a bug in nmbd which had "if (search | FIND_LOCAL)" instead of "if (search & FIND_LOCAL)". Luke, this was in nameservreply.c - the above 3 bugs together meant that DNS queries were being cached, but the cache wasn't being used, so every query was going to DNS, no wonder nmbd has been chewing so much CPU time! Another side effect was that queries on names in lmhosts weren't being answered for bcast queries with "wins proxy" set. - ignore the maxxmit for seconday session setups (see CIFS spec) - close user opened files in a uLogoffX for user level security (see CIFS spec) - added uid into the files struct to support the above change (This used to be commit ea472b7217b7693627a13a7b1e428a0a6a3d8755)
1996-10-04- changed the umask handling. We now set the umask to 0 and explicitlyAndrew Tridgell1-2/+6
set the mode on all created files. I think this is a better policy. - change the debug levels on some items - fix a charset handling bug which affected foreign and extended charset users - no longer switch back to the original directory when idle, instead switch to / as the original directory may not be readable by ordinary users. - fix some bugs where the create mode of files was not being explicitly set (it was relying on the umask and using fopen). Not a big bug as it only affected obscure commands like the messaging ops. - got rid of the lock code in the lpq cache as its no longer needed - rewrote smbrun to be faster and to remove the security hole. We now don't actually need a external smbrun binary, its all done by smbd. - add a more explicit warning about uids and gids of -1 or 65535 (This used to be commit 5aa735c940ccdb6acae5f28449d484181c912e49)
1996-10-02- fix the EALREADY bug so connections to slow hosts with smbclient getAndrew Tridgell1-2/+2
through - add workarounds to handle the win95 and WinNT bugs in handling password lengths in sessionsetup (This used to be commit 671b3a3a770c824ae77fcb83dc551054a880edad)
1996-10-02- a huge pile of changes from Luke which implement the browse.confAndrew Tridgell1-1/+1
stuff and also fix a pile of nmbd bugs. Unfortunately I found it very hard to disentangle the new features from the bug fixes so I am putting in the new code. I hope this is the last big pile of changes to the 1.9.16 series! (This used to be commit 20b6203dac4bbb43e4e7bea0b214496d76d679d9)
1996-08-24removed all of lukes recent changes. I need to do a p2 release butSamba Release Account1-333/+333
can't test the multi group changes. I also found that some of lukes changes wiped out some recent bug fixes. Is your CVS tree ok luke? (This used to be commit 8b7fe224bce64803d55ae279fa61ef3ebbbb0241)
1996-08-23- fixed bugs in nmb response packet checking.Samba Release Account1-333/+333
- added multiple workgroup code - samba can register under different (unique) NetBIOS aliases, one per workgroup it joins. lkcl (This used to be commit f24e341e7e4d8726b98d3a0f83b24f61817fe536)
1996-08-22- fix client for pathworks 4 accessAndrew Tridgell1-0/+7
- fix "connection already connected" bug in open_socket_out() (This used to be commit fcce452557a6f5cfc46972617ed6932bb7fbeb95)
1996-08-22- add timeouts to connect() for password server connections. ThisAndrew Tridgell1-6/+63
makes multiple password servers practical. (This used to be commit 5c3e8326cc45d3cbd076475e445ce461a2bf7560)
1996-08-21- new handling of ST_TYPE bits, they are now consolidated much more inAndrew Tridgell1-1/+1
DFLT_SERVER_TYPE in nameserv.h - got rid of a lot of spurious domain controller stuff. Samba is not a domain controller yet, but it can be a domain master. We were claiming to be a domain controller in some packets which may have caused problems - don't do preferred master startups on the WINS pseudo-net - don't do election requests on the WINS pseudo-net - fix a nasty bug in become_non_master() which wiped out the bits in remove_type before using them. The result was that samba didn't like losing its master status. - changed the logic in the election packet handling to enable us to become a non-master whenever we receive a winning election frame, even if we aren't expecting it - get another packet from the socket in nmbd when we reject one of our own packets, this stops us from going into the packet reading code too often and makes nmbd much snappier - always remove a name immediately when we try to release it, don't wait for the lack of response from the network, otherwise we will end up replying to name that we don't really own. We still send the dereg packets, we just don't wait for them to time out. (This used to be commit eb84f2f342375439d94481a0ccf47c9593544e32)
1996-08-19- added "netbios name" option in smb.conf to make controlling the nameAndrew Tridgell1-10/+13
that samba uses possible - added "socket address" option to allow virtual SMB servers (on systems with IP aliasing line Linux) - disabled FAST_SHARE_MODES by default in Linux as older Linux boxes can't do shared writeable mappings. We really need autoconf ... - added new option types in loadparm so a string type can be specified ot be uppercase only, this is used for the workgroup and netbios name options - auto-create the lock directory if it doesn't exist in shared mem startup - get rid of announce_backup() - change a few comments in nmbd code - rewrote the chaining code completely. Hopefully it will handle any depth chains now. - added LPRng support (This used to be commit e9eac6cd49c352349580ddb13d720cb201aecc48)
1996-08-17- added support for Amiga-unix (based on BSD I think)Andrew Tridgell1-5/+2
- changed the order of PROGS and SPROGS in Makefile (SPROGS first) - another 64 bit cleanup (for INADDR_NONE) - added paranoia code in DirCacheAdd() to detect looping - fixed important DirCache flush bug - rewrote the NetServerEnum code after I found it could return servers from multiple workgroups at once, and this could cause browsing havoc. Now a null workgroup query is equivalent to a query for the servers primary workgroup - got rid of my_workgroup() - got rid of "workgroup = *" comment in Makefile. We no longer support a workgroup of *, users must set the workgroup explicitly - the wins.dat file was being stored in a different format to what it was being loaded in - this could cause havoc. fixed. - uppercase our netbios name and the workgroup name at startup - if accept fails in main loop when running as a daemon then continue, don't just exit! - don't use ./ on smbclient in smbtar - better code to detect if a process exists (This used to be commit ec3d53963064b50ff33e8eff47812aac82f164ba)
1996-08-16- added the "remote announce" optionAndrew Tridgell1-2/+9
- made the lp_string() code able to handle any length string - got rid of the obsolete lmhosts code, instead users should use "interfaces" and "remote announce". lmhosts now is just used as a IP to netbios name map - cleanup the inet_address() code (This used to be commit be2b67940302b2e63890cb865fe3948c2206ea91)
1996-08-15- added FAST_SHARE_MODES codeAndrew Tridgell1-6/+10
- added some named pipe code from Jim (This used to be commit c94866e9e44ea1eb72da06bc65ef1c032ae8e0c9)
1996-08-14changed "unsigned long" to "uint32" in several places (for IPAndrew Tridgell1-7/+7
addresses) to keep 64 bit machines happy. (This used to be commit b4aaec504ae66dc6a0f05d12529100cb62d47afd)
1996-08-13- sequent-ptx support from bressler@iftccu.ca.boeing.com (RickAndrew Tridgell1-1/+1
Bressler) - machten support from Trevor Strohman (trev@figment.tenon.com) - added qinfo command to client as part of drag-and-drop printer support for win95 from David Chappell <chappell@mouse.cc.trincoll.edu> He also added the "printer driver" option - use sigblock() on more systems and use sigsetmask(0) instead of sigunblock() as its more portable. This beats a problem with zombies on heavilily loaded systems. - added internals.doc written by David Chappell into the source tree - get rid of PRINT_COMMAND options from local.h as they are no longer relevent - new kanji code from Fujita - don't set the recursion_available flag on queries in nmbd - fix a potential bug with pointer subtraction in printing.c - got rid of error_count code as the real fix (the EOF problem) is now in (This used to be commit aa6f8b04d125b5bc00f267abf72b800228aabf7d)
1996-08-12minor fix to write_data() for EOF handlingAndrew Tridgell1-2/+2
(This used to be commit 3a7c2d9dfaf01e616adbc896dfc853a45c824170)
1996-07-30fix a bug that we've had for a long time where we don't handle EOFAndrew Tridgell1-135/+47
properly from clients, and end up looping like mad. At least I _hope_ this is fixed. (This used to be commit a7c7d7afe2ef81f4a74584ce9b71e54442f7e484)
1996-06-10a cleanup of the receive_smb() usage, adding timeouts in some placesAndrew Tridgell1-11/+8
also added paranoid code in the main process() loop of smbd to detect when smbd is looping uselessly. This should stop the "smbd is chewing lots of cpu" reports (This used to be commit 8e9dce34d50d673cb50531f0c4c7672ce2522cef)
1996-06-10got rid of a lot of redundent header files as we now globally generateAndrew Tridgell1-1/+0
prototypes automatically using "make proto". This is much less prone to error than the old method of manually adding prototypes (This used to be commit b551dc98f7cc194a5fc2e67a4ebae7fd67a01bbc)
1996-06-10moved some more locking routines to locking.c, and moved replacementAndrew Tridgell1-427/+0
routines for broken OSes from util.c to replace.c. (This used to be commit 3ee9d45426a9b3b584d1ffb9f81af26790a83b4c)
1996-06-07- added predict.c, moving the routines from util.cAndrew Tridgell1-129/+5
- added iface_count() and iface_n_ip() routines so its easy to loop over the local interface list - made readsize a normal loadparm global - check for null w in add_domain_entry() - set the deathtime to time()-1 for doamin entries with servertype==0 This allows servers that are shutting down to be removed - add the 0x1c name at startup if we are a WINS server. Previously we added it only if we were a master - loop over interfaces in add_my_domains(), so people don't have to have a lmhosts file to get lp_workgroup() on all interfaces - set add to True for find_workgroupstruct() in nmbsync, and check for null return - remove some ugly "errno = EBADF" bits. they just confused things. (This used to be commit 88b191b48836eeb7937f25b37d0bdd4a2276e5a7)
1996-06-06- added interface.c and removed all the references to myip, bcast_ipAndrew Tridgell1-217/+2
and Netmask, instead replacing them with calls to routines in interface.c - got rid of old MAXINT define - added code to ensure we only return one entry for each name in the ipc enum routines - added new_only option to add_netbios_entry() to prevent overwriting of important names - minor time handling fixup (This used to be commit 7ed71b73ae745da099072eee36fc2700d1d91407)
1996-06-05- changed some debug levels in clientutil.cAndrew Tridgell1-1/+1
- added dir_check_ftype() to clean up the file type checking a bit - added check for libc version >= 5 for setfsuid() for Linux - moved the AM_MASTER() and related macros to nameserv.h - added proper defines for the various netbios announce types - don't call the announce_backup() code, as I'm pretty sure its wrong it sent ANN_GetBackupListReq packets as broadcasts, they are supposed to be used only by clients to the master browser to find a list of available backup servers to remote a netserverenum to, I don't think nmbd should ever send one. - fixed a bug in the browse list writing - minor debug cleanups - put in the code to discard our own broadcasts (it won't work for multi-homed hosts though) - changed ELECTION_VERSION to 1 so we can be beaten by a NT 3.51 server by lowering the os level. - only do sync_browse_lists() if we are the master browser, otherwise we'll cause network overload - don't call tell_become_backup() as it appears to be badly broken, it should only be used when the machine being told has its MAINTAIN_LIST to to auto. Not calling it does no great harm anyway - fix a nasty bug where becomebackup was confused with reset browser! - make setbuffer() not get caught by the auto protototypes (This used to be commit cfbad9b08242962f41595273de08a7293fe432b1)
1996-06-04Did more integration of Lukes code ready for the first release.Andrew Tridgell1-5/+4
I've now got WINS registration working, and refresh working. Its looking pretty good so far, but needs lots of testing. (This used to be commit 045014aa57721b9701ca379bcab055b908773184)
1996-06-04a huge pile of changes :-)Andrew Tridgell1-11/+24
The biggest thing is the integration of Lukes new nmbd. Its still largely untested, so we will really need some feedback I've also added auto prototype generation and cleaned up a lot of minor things as a result (This used to be commit 0d8dcfa13c527ec2c8aca39ba49c09e4e694b26c)
1996-06-01- moved the uid handling to uid.cAndrew Tridgell1-30/+1
- added setfsuid() support (for Linux) - started adding some of Lukes changes, just the loadparm and ipc ones so far (This used to be commit 72543810ce3eb5ea7b141f957edf38b4c46b1ea4)
1996-05-31Lots of changes!Andrew Tridgell1-460/+7
- add faq info on NT printer handling - add "delete readonly" option to help rcs users - add stuff to man pages on new printer options - add "proxy name resolution" option - add "command string" -c option to smbclient (thanks Ken) - split time functions into time.c - rearrange the quotas stuff a bit and fix some bugs - complete rehash of the time handling code thanks to Paul Eggert - fix nmblookup output a bit - add plp print queue parsing from Bertrand Wallrich (This used to be commit 635b56f19c817527c52e9bbde31faa6a8a47777b)
1996-05-29handle errors from receive_smb better, and print error stringAndrew Tridgell1-6/+5
(This used to be commit 7814eca4b22f909e75c3321d9a157c2228198c5c)
1996-05-29cleaned up the way the max log size stuff works and fixed a potentialAndrew Tridgell1-33/+50
problem with varargs usage in Debug() (This used to be commit 8d5a3156ce42198b2f3ca8753e208b08572cafce)
1996-05-04fix a dst bug, we had a sign wrong in the calculation :-(Andrew Tridgell1-3/+3
(This used to be commit 2cf4d958f454465f05c54f865cb77fa5c4cc620a)
1996-05-04Initial version imported to CVS Samba Release Account1-0/+4510
(This used to be commit 291551d80711daab7b7581720bcd9a08d6096517)