summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
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)
1998-02-07A small raft of changes, I will sync up with 1.9.18 also.Jeremy Allison1-0/+4
chgpasswd.c: Fixed typo in debug message. includes.h: Fix include for aix. kanji.c: Added cap_to_sj as inverse of sj_to_cap. loadparm.c: local.h: password.c: Added code for "networkstation user login" parameter. - patch from Rob Nielsen <ran@adc.com>. printing.c: Added further aix printing fixes. reply.c: Changed access time fetch to a function. trans2.c: Changed access time fetch to a function. time.c: Changed access time fetch to a function. server.c: Made NT redirector workaround final. util.c: Added debug for write_socket failing. Jeremy. (This used to be commit a031404623c22d62f8de035be2239f609af08112)
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)
1998-01-22printing.c: Bug fix for lpng reporting.Jeremy Allison1-17/+36
server.c: Large fix for oplock deadlock bug. util.c: Fix for oplock deadlock bug. Jeremy. (This used to be commit 4cae830ab3a942b2f2868173a492d02f6332651d)
1998-01-17charcnv.c: Added codepage 866 support onto the file system. PatchJeremy Allison1-0/+1
from Max Khon <max@iclub.nsu.ru>. chgpasswd.c: Allow old RAP change password to work with encrypted passwords. Samba can now allow Windows 95/NT clients to securely change the Lanman password ! (But not the NT hash - that gets lost). ipc.c: smbdes.c: smbpass.c: Support for the above. server.c: #ifdef'ed out fix for NT redirector bug. util.c: Fix NIS bug with server name. Jeremy. (This used to be commit cd9fad92d0316e5a0007ba3c5668906dc2f011f1)
1997-12-26fixed a couple of illegal uses of scanf() in the nmbd wins code. TheyAndrew Tridgell1-1/+1
caused a core dump under IRIX when compiled with -64. In general you cannot assume things about variable sizes. In particular sizeof(time_t) may not equal sizeof(long) and sizeof(uint16) may not equal sizeof(short). There are probably other bugs like this. We'll need to check all format statements for use of %ld, %hx etc. In general these should not be used unless you have an explicit cast to the appropriate type. (This used to be commit 6ea907e78672558d470e9a819982940a9228e2fa)
1997-12-24Added SIGUSR1/SIGUSR2 handling.Jeremy Allison1-0/+47
Sending nmbd/smbd a SIGUSR1 will raise the debug level by one (capped at 10) sending a SIGUSR2 will lower it (lower limit at zero). Jeremy. (This used to be commit 6a3cb6f4b46129e4d799a24d34cdb9460ed8910f)
1997-12-23Fixes to compile under OpenBSD from "Todd T. Fries" <toddf@acm.org>Jeremy Allison1-1/+1
Jeremy. (This used to be commit 3c9292505914e2119fa7b1973c9fbbe1742262b2)
1997-12-20Fixed stupid bug in read_smb_len where I was calling itself - nowJeremy Allison1-1/+1
calling the correct fn. Jeremy. (This used to be commit c62aa0a7600269c2bb13b939857716a6ee0f34c1)
1997-12-20client.c:Jeremy Allison1-15/+64
clientgen.c: clientutil.c: clitar.c: Changed usage of receive_smb to new function client_receive_smb except for one use of receive_smb in client.c. This is the receive_smb used to discard packets received whilst in a keyboard wait state. util.c: Created new function client_receive_smb that ignores session keepalives just as the old receive_smb used to do. Created internal function read_smb_length_return_keepalive that is used internally by the changed receive_smb call. Changed read_smb_len to not use an internal buffer - it is never called with a null buffer so such code is redundant. Jeremy. (This used to be commit 1084fb46821cb96702da35439da4a8df9d255698)
1997-12-20loadparm.c: Added fix for veto oplock files bug from Charles Hoch ↵Jeremy Allison1-10/+8
<hoch@hplcgh.hpl.hp.com> server.c, util.c: Added fix for oplock break requests blocking due to server being blocked in read call. Bug found by Charles Hoch <hoch@hplcgh.hpl.hp.com>. Jeremy. (This used to be commit 209f894fdbcfbf7a7952b6228342b86e088a9582)
1997-12-20trans2.c: Forced trans2_findfirst to behave as NT does in error returns.Jeremy Allison1-1/+2
util.c: Applied fix from Branko Cibej <branko.cibej@hermes.si> where StrnCaseCmp tests one character too many. Jeremy. (This used to be commit cb771b2667070cff8d6cf86998a11ba2e4977690)
1997-12-03I'm slowly getting though the todo list :-)Andrew Tridgell1-3/+3
This change allows people to select the SYSLOG_FACILITY in local.h, or add it to the Makefile if they want to. (This used to be commit afe88facbfb85113105bf516e066b6c1e971f6b7)
1997-12-02dont try getpeername() when Client isn't initialisedAndrew Tridgell1-0/+8
(This used to be commit a32ca542ad294ecc3848ca511337a8cc994d67be)
1997-11-29use -1 not 0xffffffff in SIVALS() macrosAndrew Tridgell1-23/+1
use the same process_exists() code on all systems (it's probably faster anyway) (This used to be commit 901b95aa77ac1ecc45823c23fb4e1d9da8dc8318)
1997-11-29added a sent_oplock_break element to Files[] as a paranoia check so weAndrew Tridgell1-1/+1
can't sent a oplock break twice on the same file. changed some debug levels in the oplock code to level 0 so we can track down a bug zero the returned Files[] entry in find_free_file() don't try to overcome client bugs in the handling of non-encrypted passwords if in server level security mode added paranoid null termination of password buffers slight change to my ajt_panic() routine (This used to be commit e360c79c9cec681c4609783019749773d3e79386)
1997-11-03Rolling back the filesJeremy Allison1-41/+0
loadparm.c : to equivalent to version 1.67 reply.c : to equivalent to version 1.69 server.c : to equivalent to version 1.122 util.c : to equivalent to version 1.98 to remove the incorrect changes. proto.h: The usual. rpc_pipes/smbparse.c : Backeting stuff that SHOULD NOT BE IN THE none-NTDOMAIN build ! Jeremy. (This used to be commit 6064c9d80fd9fcc3ceec528494ba5e2591610098)
1997-11-02Christian Lademann's contribution: new capabilities in smb.conf.Luke Leighton1-0/+41
'<' and '|' characters indicate read file and execute command respectively, and feed the output into the parameter (!!!). '<$' and '|$' means run standard_sub_basic() on them. this is going to be fun to document in smb.conf.5.... also, Christian created a new "online" service parameter. services can be taken "off-line".... (This used to be commit 15f44d28916cdc1432bffdbb999c7cf7efd8fb86)
1997-10-29ipc.c ntclientpipe.c:Luke Leighton1-0/+47
response to Bind Acknowledgment needs a lookup table for the PIPE string (secondary address in RPC_HDR_BA structure). smbparse.c util.c : interesting problem, i think caused by us typecasting a uint16* buffer to char*. found on a SPARC. (This used to be commit 420408ee83902faa6cf871f26e93ad5efb483727)
1997-10-29called dump_data() from show_msg().Luke Leighton1-25/+6
(This used to be commit 89664898e2457de2986d515f6f476993ee1bbea2)
1997-10-29byteorder.h :Luke Leighton1-1/+1
added mode for printing debug array data as chars not uint8/16/32s. only really useful for (uint8) strings or (uint16) unicode strings lsaparse.c smbparse.c smb.h : rpc bind and rpc bind ack structures and parsing and creation functions. ipc.c pipes.c pipenetlog.c pipentlsa.c pipesrvsvc.c : using rpc bind / bind ack parsing routines instead of incorrect use of api_LsarpcTNP1 function. ntclient.c : creation of do_rpc_bind() function. THAT'S IT, FOLKS! (This used to be commit 21c89e2f17c51939fd6b53dddbe3072419eb0db2)
1997-10-24default server_name if NIS server is unavailable should be the localLuke Leighton1-2/+2
machine, not a NULL string. (This used to be commit 5b15b17fc6da0e2b496822638edf566dedf3efde)
1997-10-24nterr.c :Luke Leighton1-1/+1
added a structure that wraps nt errors as strings and enums, so we can do a smb_nt_error() function. Makefile ntclient.c : added ntclient.c, broken out nt domain stuff into a separate file. getting fed up of compile-times and size of client.c. fixed the do_lsa_req_chal() function. made it read the response, and return the challenge credentials received from the server. next stop: do_lsa_auth_2(). client.c : removed nt domain logon functions into a separate file. pipenetlog.c pipentlsa.c pipesrvsvc.c smbparse.c : i'd broken the offsets of the RPC_HDR while trying to sort out the nt client code. fixed it again. added some robustness stuff. util.c : the unistrn2() function was null-terminating the string at one character too many. (This used to be commit 39cec7f698c4461aee05cfbb213879fbd486117d)
1997-10-23playing about, trying to SMBopenX a \PIPE\NETLOGON (should be a SMBopen)Luke Leighton1-0/+3
and then send a LSA_REQ_CHAL down it. (This used to be commit 473f21071fad603865358821b83df6b58c9a06a5)
1997-10-22loadparm.c :Luke Leighton1-63/+20
added "domain other sids" parameter pipenetlog.c : using "domain other sids" parameter in SAM Logon response. using new name_to_rid() function for r_uid and r_gid. pipentlsa.c : minor mods to do with new name_to_rid() function. pipesrvsvc.c : in the "net share enum" response, allocate some more space for the buffer. there can be only 32 share entries in the response anyway. this needs to be dealt with. pipeutil.c : modified name_to_rid() function to use new parameters "domain admin users" and "domain guest users", but will otherwise do unix uid + 1000. moved make_dom_gids() here. proto.h: the usual. smb.h smbparse.c : renamed sid_no to sid_rev_num in DOM_SID, and gid to r_gid in DOM_GID. util.c : moved make_dom_gids() from here. created char *unistrn2(uint16* uni_buffer, int max_len) (This used to be commit ec60e48d7982240b7755d246b2f1e8989467f66f)
1997-10-21loadparm.c :Luke Leighton1-1/+38
added "domain admin users" parameter added "domain guest users" parameter these two complement the "domain groups" parameter. the "domain groups" parameter should be for your own groups, and well-known aliases. util.c : added ability to do "domain groups = power_users admin_users backup_ops" which are well-known RID aliases, not well-known RID groups. pipenetlog.c : combine the "domain admin users"; "domain guest users" and "domain groups" parameters to give an array of RID groups to include in the SAM Logon response. ipc.c smb.h : moved REALLOC() into smb.h added RID #defines. proto.h: usual. (This used to be commit f2554f231d1f59f30224adcc02b2b3ca4c24e0dd)
1997-10-20added "domain groups" parameter, allowing you to specify the groups thatLuke Leighton1-0/+28
the user belongs to. it would be nice to know exactly what the domain groups _are_.... (This used to be commit c6e37d8db0cd89a84a54a0cedfeacf50fb3f7a4c)
1997-10-20util.c password.c :Luke Leighton1-0/+54
added automount_server() function which, if -DAUTOMOUNT is in use, returns the server name of the NIS auto.map entry. otherwise, it returns local_server. added use of automount_server() for a new substitution %N for NIS home server. this defaults, via automount_server(), to the same functionality as %L if -DAUTOMOUNT is not used. removed vuser->home_share. moved code that grabbed the servername into the separate function automount_server(). loadparm.c : created "logon drive" (default of "") created "logon home" (default of "\\%N\%U") changed default of "logon path" from NULL to "\\%N\%U\profile". ipc.c pipenetlog.c : use lp_logon_drive(), lp_logon_home() and lp_logon_path() in their now easier-to-use form (don't have to check if *lp_logon_path() and manually substitute a default of \\%L\%U and do a standard_sub_basic() on the result, because the default automatically does this. (This used to be commit c6c28a4c3c9010ff9d5eac4bad091189a786d5a0)
1997-10-20casting cleanupsAndrew Tridgell1-1/+2
(This used to be commit ab849a97821c9e1f199eea8ea2ec477687bed947)
1997-10-19Makefile :Luke Leighton1-31/+47
added srvparse.o and pipesrvsvc.o smb.h : mods to the Net Share Enum stuff srvparse.c : Net Share Enum parsing support. more srvsvc pipe parsing to go here... pipenetlog.c util.c: modified standard_sub_basic() so that you can set a global boolean and use a different string for the %U username substitution. proto.h: the usual. (This used to be commit 22b86b6499b2680d16cb4180a736b4e750147409)
1997-10-17.cvsignore: Added make_smbcodepageJeremy Allison1-2/+2
interface.c: Added is_local_net(). locking.c: Added Fix for zero length share files from Gerald Werner <wernerg@mfldclin.edu> plus a race condition fix for the fix. nameannounce.c: Made function static. namedbresp.c: extern int ClientDGRAM removed - not used. namedbserver.c: extern int ClientDGRAM removed - not used. namedbsubnet.c: Added code to make sockets per subnet. namepacket.c: Added code to read from all sockets & filter. nameresp.c: extern int ClientDGRAM removed - not used. nameserv.c: Indentation tidyup :-). nameserv.h: Added sockets to struct subnet. nameservresp.c: Improved debug message. nmbd.c: Changed to terminte on listen_for_packets exiting. nmbsync.c: extern int ClientDGRAM & ClientNMB removed - not used. proto.h: The usual. util.c: Fixed debug message. Jeremy (jallison@whistle.com) (This used to be commit 6904c2de080b2a9702800e9e4126386ced20569d)
1997-10-17smbparse.c smb.h :Luke Leighton1-3/+3
uni_max_len and uni_str_len are the other way round, in UNIHDR. util.c : increased the show_msg() data size from 256 bytes to 512 bytes: the LSA SAM Logon response can be about 500 bytes long. pipenetlog.c : forgot to set the authoritative field to 1. (This used to be commit 71c6678cd7ffe30a5da27766cf99147e1921feae)
1997-10-13align_offset() adjusted pointer to wrong location. oops.Luke Leighton1-2/+3
(This used to be commit ba28678e3f673cd10d936f59ff0df6a852aca793)
1997-10-12added debugging macros (suitable eventually for use in tcpdump, hopefully)Luke Leighton1-0/+8
(This used to be commit 946d73cf838976b905550288cac3aea7c43959f6)
1997-10-11namelogon.c :Luke Leighton1-0/+38
added NTLOGON. (fixed the case 0:) namepacket.c: call to NTLOGON mailslot nameserv.h defines for NETLOGON and NTLOGON mailslot util.c: added andrew's dump_data() function. (This used to be commit 1eaad1c99463dcd42eb8ff4ea5686ad9ec6fc42e)
1997-10-10fixed the log wrapping bug.Andrew Tridgell1-12/+17
This is a very nasty bug that I think explains quite a few intermittent problems people have been having with Samba. It may be worth checking on other cases where errno can be overwritten by seemingly innocuous things (in this case a DEBUG() line) (This used to be commit 1448f528b60402170257c1cdf6831cc40b4c86c9)
1997-10-09credentials.c:Luke Leighton1-2/+26
use UTIME structure (defined and commented in smb.h to be time, secs, since 01jan1970) pipes.c: another sub-function. util.c: added char *unistr2(uint16 *buff) function. same as unistr except it takes uint16* instead of char*. smbparse.c smb.h: more structure sorting. proto.h: the usual. (This used to be commit 72a86f514f0c92b69499718e63f5dd73ebece56e)
1997-10-07I rewrote the name_mangle() and name_len().Christopher R. Hertel1-46/+65
The interface is the same, but I've simplified the code a bit and added a few comments. I tested the changes and the output is the same as that produced by the original (at least, it was in all of my tests). CRH (This used to be commit 707d0ec388c0045938f367e1d17919bfc8637fea)
1997-10-06client.c: Changed shadowed variable.Jeremy Allison1-5/+3
locking.c: Removed USE_OPLOCKS - now the default. params.c: Removed unused variable. proto.h: Updated. reply.c: Removed USE_OPLOCKS - now the default. server.c: Removed USE_OPLOCKS - now the default. smb.h: Removed USE_OPLOCKS - now the default. smbparse.c: Changed shadowed variable. status.c: Removed USE_OPLOCKS - now the default. util.c: Removed USE_OPLOCKS - now the default. Jeremy (jallison@whistle.com) (This used to be commit b93509846d6291771787af457500eec8984ee6bd)
1997-10-04proto.h:Luke Leighton1-0/+113
- recreated, as usual. smb.h: - added RPC_HDR structure - the 18 byte MSRPC header smbparse.c: - added smb_io_rpc_hdr() function to read/write the RPC_HDR structure. util.c: - added align2, align4, align_offset functions. - added skip_unicode_string, unistrcpy, unistrncpy functions. - modified unistrcpy and unistrncpy to return the number of unicode characters returned, effectively making skip_unicode_string redundant. (This used to be commit b0ad811cda3dcffed5b24104229813cdb17b014f)
1997-10-03locking.c: Fixed incorrect parameter count in debug statements. May explainJeremy Allison1-2/+6
solaris crashes. reply.c: Added NT specific error code. Put oplock break code in correct place in reply_lockingX. server.c: Removed unneeded error mapping stuff. Fixed race condition in oplock code. trans2.c: Added NT specific error code. util.c: Added paranoia check in interpret_addr. Some core dumps reported here. Upped fcntl debug levels. Andrew. Please check the NT specific error code handling (search for the string "/* Ugly - NT specific hack - but needed (JRA) */", this makes NT and 95 clients behave correctly here - please check your Visual Basic apps with this code. Jeremy (jallison@whistle.com). (This used to be commit 97ee4a5f69bd9cfbbc8710a1a04d80db0ee40104)
1997-10-03proto.h: Updated.Jeremy Allison1-2/+2
server.c: Updated after netbench observation. Oplocks must be broken *before* share modes are checked, not after. Netbench seems to be working now. smb.h: Added offsets for oplock break time fields. trans2.c: Upped debug messages. util.c: Upped debug messages. Jeremy (jallison@whistle.com) (This used to be commit bc4b70c566ed5fa926441fb64a0f756a6137d8d0)
1997-10-02Modified some debug messages, moved from 5 -> 8.Jeremy Allison1-7/+7
Jeremy (jallison@whistle.com) (This used to be commit cb83c74a6ccfc44721af65b75625a949782c758a)
1997-09-30dir.c: more pstrcpys.Jeremy Allison1-47/+164
local.h: Add OPLOCK_BREAK_TIMEOUT. password.c: Fix for paranoia password server security bug. proto.h: Updated. reply.c: Oplock changes. server.c: Massive oplock changes - nearly there.... smb.h: oplock definitions. util.c: Add local message processing queues for oplocks. Jeremy (jallison@whistle.com) (This used to be commit 92f1553db2cdf6f32881eb984a87050cf3e4760b)