summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
AgeCommit message (Collapse)AuthorFilesLines
2003-03-23NTLM Authentication:Andrew Bartlett1-2/+22
- Add a 'privileged' mode to Winbindd. This is achieved by means of a directory under lockdir, that the admin can change the group access for. - This mode is now required to access with 'CRAP' authentication feature. - This *will* break the current SQUID helper, so I've fixed up our ntlm_auth replacement: - Update our NTLMSSP code to cope with 'datagram' mode, where we don't get a challenge. - Use this to make our ntlm_auth utility suitable for use in current Squid 2.5 servers. - Tested - works for Win2k clients, but not Win9X at present. NTLMSSP updates are needed. - Now uses fgets(), not x_fgets() to cope with Squid environment (I think somthing to do with non-blocking stdin). - Add much more robust connection code to wb_common.c - it will not connect to a server of a different protocol version, and it will automatically try and reconnect to the 'privileged' pipe if possible. - This could help with 'privileged' idmap operations etc in future. - Add a generic HEX encode routine to util_str.c, - fix a small line of dodgy C in StrnCpy_fn() - Correctly pull our 'session key' out of the info3 from th the DC. This is used in both the auth code, and in for export over the winbind pipe to ntlm_auth. - Given the user's challenge/response and access to the privileged pipe, allow external access to the 'session key'. To be used for MSCHAPv2 integration. Andrew Bartlett (This used to be commit dcdc75ebd89f504a0f6e3a3bc5b43298858d276b)
2003-03-19use strnlen to prevent coredumpsJim McDonough1-3/+3
(This used to be commit 1960a650c1546323708ed6bea615dc7215a97b4f)
2003-03-18Step one of optimizations for StrCaseCmp:Martin Pool1-7/+72
First of all, do a char-by-char walk through both buffers until we get to a non-ascii character, or a difference between the strings. This prefix can be directly compared without needing to call into iconv. This should be much faster for strings that are either all ascii, or differ near the start. (This used to be commit f7f692b2db4dd513068d6d8fed2792186933ddda)
2003-03-18Split "clobber" function and variables into its own file before itMartin Pool1-39/+0
grows too much larger. (This used to be commit 4bbddbfc6a97ebb11e299aa7bd07ebebeab42c65)
2003-03-18Update comment: Valgrind 1.9.4 seems to always respect clientMartin Pool1-1/+1
requests, without needing --client-perms=yes. (This used to be commit 412a8780c35ee9449c9682e3ef73afb2c4933285)
2003-03-18global_globber_region_function/line ought to be recorded beforeMartin Pool1-3/+15
clobbering the region, just in case clobbering causes us to crash immediately. (That might happen if we just shot ourselves in the stack and strcpy was not inlined.) Also, in DEVELOPER mode and when Valgrind is available, mark the clobbered region as uninitialized. This is an even stronger protection than clobbering with 0xf1. (This used to be commit 5653a42ae695f4b8f4c14d3184ca76523d38b51b)
2003-03-15String handling parinoia fixes.Andrew Bartlett1-42/+30
This patch enables the compile-time checking of strings assable by means of sizeof(). (Original code had the configure check reversed). This is extended to all safe_strcpy() users, push_string and pull_string, as well as the cli and srv derivitives. There is an attempt to cap strings at the end of the cli buffer, and clobber_region() of the speified length (when not -1 :-). Becouse of the way they are declared, the 'overmalloc a string' users of safe_strcpy() have been changed to use overmalloc_safe_strcpy() (which skips some of the checks). This whole ball of mud worked fine, until I pulled out my 'fix' for our statcache. When jeremy fixes that, we should be able to get back to testing this stuff. This patch also includes a 'marker' of the last caller to clobber_region (ie, the function that called pstrcpy() that called clobber_region) to assist in debugging problems that may have smashed the stack. This is printed at smb_panic() time. (Original idea and patch by metze). It also removes some unsused functions, and #if 0's some others that are unused but probably should be used in the near future. For now, this patch gives us some confidence on one class of trivial parsing error in our code. Andrew Bartlett (This used to be commit 31f4827acc2a2f00399a5528fc83a0dae5cebaf4)
2003-03-11Remove valgrind_strlen function, hopefully no longer needed withMartin Pool1-9/+0
recent Valgrind relases and clashing with -DVALGRIND. (This used to be commit 98479f1315cf8968152e1566966ac57e171008c3)
2003-03-10Clobber strings with 0xf1f1f1f1 before writing to them to check bufferMartin Pool1-8/+33
lengths are correct. Attempts to pstrcpy into an fstring or allocated string should fail in developer builds. This builds on abartlet's earlier overflow probe for safe_strcpy, but by clobbering the whole string with a nonzero value is more likely to find overflows on the stack. This is only used in -DDEVELOPER mode. Reviewed by abartlet, tpot. (This used to be commit 8d915e266cd8ccc8b27e9c7ea8e9d003d05f8182)
2003-02-28Doxygen janitor: add note that strequal is in fact case-insensitive.Martin Pool1-6/+8
(This used to be commit a4b9c5c2576c80a5f60d47d178b9b8c50d348893)
2003-02-19base64_decode() with heimdal libs, so I've renamed it base64_decode_inplace().Jim McDonough1-1/+1
(This used to be commit 8c69212eeb4a0ec144b960d76319fd4940b8c239)
2003-02-18Doxygen janitor. No other changes.Martin Pool1-120/+119
(This used to be commit fa38e7956c21b828ba208282ef0ac85c2b66ff22)
2003-02-17Add comment explaining the -DDEVELOPER safe_strcpy overflow hack.Martin Pool1-1/+5
(This used to be commit 90e1d8bdfa9ec0a4f3795d9a89db1d2324447b68)
2003-02-17This is a very nice way to detect pstrcpy() into a malloc()ed string, butAndrew Bartlett1-0/+2
it really is a developer hack... Andrew Bartlett (This used to be commit 3588ebb35b14422141d4070413185195b525038e)
2003-02-17This patch fixes one of my longest-standing pet hates with Samba :-).Andrew Bartlett1-3/+5
When we look see if a user is in a list, and we try to 'expand' an @group, we should lookup the user's own list of groups, rather than looking for all the members of a group. I'm sure this will fix some nasty performance issues, particularly on large domains etc. In particular, this avoids contacting winbind at all, if the group is not a winbind group. (This caused a deadlock on my winbind-on-PDC setup). The groups list always includes the user's primary group, as per the getgrouplist manpage, and my recent changes to our implementation. Andrew Bartlett (This used to be commit 9be21976f7662ebe6eb92fff7cecbdb352eca334)
2003-02-07make sure we don't run over the end of 'name' in unix_convert()Andrew Tridgell1-2/+6
Thanks to Andrew Bartlett for spotting this. (This used to be commit b4c210ccb05e71a8ddf1c25d028452dd5cd93c72)
2003-01-17fix some undefined behaviour with increments in C. In theory aAndrew Tridgell1-4/+8
compiler could have produced complete crap for this code. (This used to be commit 0e90da0810b60dd1c2b1ec46c1a2993856b919d3)
2003-01-16Updates to the NTLMSSP code again - moving the base64 decode fuctionality outAndrew Bartlett1-0/+94
of the SWAT code, and adding a base64 encoder. The main purpose of this patch is to add NTLMSSP support to 'ntlm_auth', for use with Squid. Unfortunetly the squid side doesn't quite support what we need yet. Changes to winbind to get us the info we need, and a couple of consequential changes/cleanups in the rest of the code. Andrew Bartlett (This used to be commit fe50ca8f54ded2e119bde08831785fbe0db2ee99)
2003-01-15Doing a malloc(strlen(s)) then a pstrpcp(y, s) is just silly, make it a strdupAndrew Bartlett1-3/+1
instead. Andrew Bartlett (This used to be commit c781e34d274f4185ec932cc59029d3f9a65e47c4)
2003-01-13Accessing data after it's been free()ed really is a no-no...Andrew Bartlett1-2/+16
Andrew Bartlett (This used to be commit 6e821285a4aacfc0031957b88ddbec73d7e1dc11)
2003-01-02Add PRINTF_ATTRIBUTE() to a few more printf() style functions. Aids inAndrew Bartlett1-2/+2
compiler-based argument checking. (This used to be commit 16fe928e68623a878b125910ff83df500a29d0ce)
2003-01-02BIG patch...Andrew Bartlett1-2/+2
This patch makes Samba compile cleanly with -Wwrite-strings. - That is, all string literals are marked as 'const'. These strings are always read only, this just marks them as such for passing to other functions. What is most supprising is that I didn't need to change more than a few lines of code (all in 'net', which got a small cleanup of net.h and extern variables). The rest is just adding a lot of 'const'. As far as I can tell, I have not added any new warnings - apart from making all of tdbutil.c's function const (so they warn for adding that const string to struct). Andrew Bartlett (This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d)
2002-12-11Fixed auth module code. Added VALGRIND defines to reduce spurious warnings.Jeremy Allison1-0/+9
Jeremy. (This used to be commit ff3a8d37289216a2cb808406044a7abef1e564d0)
2002-11-27removing inet_aton()Gerald Carter1-1/+2
(This used to be commit 08ac3610f9ef7e1c37541729441acfa13b48d34c)
2002-11-26Having waited for *way* too long, this is mimir's namecache and trusted domainAndrew Bartlett1-0/+111
cache code. This uses gencache, mimir's new caching code that stores at text-based cache of various data. Mimir has done a *lot* of work on this patch, and it is finally time to get it in CVS. Andrew Bartlett (This used to be commit 47f3bfe9564e7f3aff60cefaefd599e0abb30a31)
2002-11-24Add ntlm_auth, a new program to provide a stable interface to winbind'sAndrew Bartlett1-0/+41
authentication code. In particular, ntlm_auth is designed to replace the winbind authentication 'helpers' currently supplied by Squid. I have added support for the current plaintext password protocol used by Squid, and will add the real guts (NTLMSSP support) shortly. I'll merge this into 3.0 when I've got the interface more stable (error message format etc) and got the important NTLMSSP support added. Also move SWAT's URL decoding code into util_str.c, for use in both utilities. Andrew Bartlett (This used to be commit 82dbf838879e8a2d2d3f9dd5be6eda50b780b787)
2002-11-12Removed global_myworkgroup, global_myname, global_myscope. Added liberalJeremy Allison1-7/+8
dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit 82b8f749a36b42e22186297482aad2abb04fab8a)
2002-10-02Added const. Anal formatting fixup.Jeremy Allison1-175/+222
Jeremy. (This used to be commit ae4bf35f942de6025d3f364d599cca9720734a19)
2002-09-27Vance picked up a pile of typos etc at the CIFS confernce, and finally got themAndrew Bartlett1-8/+8
off his laptop :-) Andrew Bartlett (This used to be commit df8f0338fae01e5edc176708c2b798c67c2e8c36)
2002-08-17The idea of this function is not to touch the argument, so make it const too...Andrew Bartlett1-1/+1
(This used to be commit 8a63fe45058b15c15d79e15387e908564cfe5c2d)
2002-08-16Merge of netbios namecache code from APPLIANCE_HEAD.Tim Potter1-0/+12
Tridge suggested a generic caching mechanism for Samba to avoid the proliferation of little cache files hanging around limpet like in the locks directory. Someone should probably implement this at some stage. (This used to be commit dad31483b3bd1790356ef1e40ac62624a403bce8)
2002-07-28found nasty bug in intl/lang_tdb.c tdb structure was not tested to not be ↵Simo Sorce1-2/+3
null before close this one fixes swat not working with browsers that set more then one language. along the way implemented language priority in web/neg_lang.c with bubble sort also changet str_list_make to be able to use a different separator string Simo. (This used to be commit 69765e4faa8aaae74c97afc917891fc72d80703d)
2002-07-20Add some const to try and get less warnings.Andrew Bartlett1-2/+3
Andrew Bartlett (This used to be commit 2a3d821c77c7648de43b11dd951f6f16d7be5b3c)
2002-07-19Never ignore valgrind messages :-). Don't reference before the startJeremy Allison1-1/+1
of a string.... Jeremy. (This used to be commit 35f0fbd254c222d015bdc582277b90efbaade81e)
2002-07-18Previous fix was incorrect. len in string_sub and all_string_sub isJeremy Allison1-4/+4
number of *bytes*. >= check was correct, the len=0 case needed changing to len = ls + 1. Jeremy. (This used to be commit 06a4a6d30ade5ea4d123ae640393677c9a510763)
2002-07-18Fixed off-by-one in all_string_sub also.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 8b0e47fc1f00c76dfccb6c2b58188d9a5ae67c65)
2002-07-18Formatting fixups.Jeremy Allison1-66/+73
Jeremy. (This used to be commit 4aa922a1afdd538f51d5eff4cb7af2694a88c591)
2002-07-18The previous code would not allow things like string_sub(str, "\\", "/", 0).Gerald Carter1-1/+1
It complained about an overflow of 0 bytes. Jeremy please check since you modified this last. (This used to be commit a5aad760061e21635319a9b5628990cf59b827ed)
2002-07-14addedd new (t)alloc_sub_* functionsSimo Sorce1-3/+3
they will get a const string and return a (t)alloced epanded one. also modified passdb/* stuff to use this one. (This used to be commit d378ac1e2efb0efc9a0f983d69cf678ca6255fd5)
2002-07-09some support functions to ease the next commit.Simo Sorce1-6/+96
(This used to be commit 4be1c882be56ae0fe18bb134a1513e0e6f6965b0)
2002-07-02Address the string_sub problem by changing len = 0 to mean "no expand".Jeremy Allison1-10/+22
Went through and checked all string_subs I could to ensure they're being used correctly. Jeremy. (This used to be commit 17cae0d683be404be69554cd0e84117bdcc56c87)
2002-06-14moved lp_list_* functions away from param/loadparm.c, put int lib/util_str.cSimo Sorce1-0/+182
and renamed to str_list_* as it is a better name. Elrond should be satisfied now :) (This used to be commit 4ae260adb9505384fcccfb4c9929cb60a45f2e84)
2002-04-18nicer strndup() functionAndrew Tridgell1-6/+6
(This used to be commit 546764f3cbbefaad312386280dd2ebbbe5b4446d)
2002-04-17make suure we get the return value from the pull_*() functions rightAndrew Tridgell1-1/+1
for both null terminated and buffer length terminated strings (This used to be commit e8fbf853e0eed61bb7405be731f18fb2426f8dc4)
2002-04-16fixed the handling of STR_TERMINATEAndrew Tridgell1-0/+12
(This used to be commit dbc6b137a83cf9fe0558625dd32f92f15296fba6)
2002-04-11added strndup() for systems that don't have itAndrew Tridgell1-0/+19
(This used to be commit 7e92fb7453e4dbf1fe0c32c3dcc1e994cb95b5ea)
2002-04-11this adds a completely new hash based mangling schemeAndrew Tridgell1-0/+20
the hash for this scheme is *much* larger (approximately 31 bits) and the code is written to be very fast, correctly handling multibyte while not doing any actual multi-byte conversions in the vast majority of cases you can select this scheme using "mangling method = hash2", although I may make it the default if it works out well. (This used to be commit bb173c1a7e2408ced967ebac40b5e3f852ccd3a1)
2002-01-30Removed version number from file header.Tim Potter1-2/+1
Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2002-01-25minor fixesSimo Sorce1-3/+4
(This used to be commit 04f492980b73800b60dde764fdeb43f2eab79624)
2002-01-16Roll back PSTRING_SANCTIFY patch; just leave non-controversial typeMartin Pool1-2/+2
and constness changes. (This used to be commit cee0ec72746122c962e6c5278a736266a7f2c424)