summaryrefslogtreecommitdiffstats
path: root/source/lib/util_str.c
Commit message (Collapse)AuthorAgeFilesLines
* OHKAWA Yuichi (kuri@makino.ecei.tohoku.ac.jp) points out that usingAndrew Bartlett2003-04-021-2/+2
| | | | | | | decoded.length after it's been zero'ed out by data_blob_free() doesn't give you the original length... Andrew Bartlett
* NTLM Authentication:Andrew Bartlett2003-03-231-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
* use strnlen to prevent coredumpsJim McDonough2003-03-191-3/+3
|
* Step one of optimizations for StrCaseCmp:Martin Pool2003-03-181-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.
* Split "clobber" function and variables into its own file before itMartin Pool2003-03-181-39/+0
| | | | grows too much larger.
* Update comment: Valgrind 1.9.4 seems to always respect clientMartin Pool2003-03-181-1/+1
| | | | requests, without needing --client-perms=yes.
* global_globber_region_function/line ought to be recorded beforeMartin Pool2003-03-181-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.
* String handling parinoia fixes.Andrew Bartlett2003-03-151-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
* Remove valgrind_strlen function, hopefully no longer needed withMartin Pool2003-03-111-9/+0
| | | | recent Valgrind relases and clashing with -DVALGRIND.
* Clobber strings with 0xf1f1f1f1 before writing to them to check bufferMartin Pool2003-03-101-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.
* Doxygen janitor: add note that strequal is in fact case-insensitive.Martin Pool2003-02-281-6/+8
|
* base64_decode() with heimdal libs, so I've renamed it base64_decode_inplace().Jim McDonough2003-02-191-1/+1
|
* Doxygen janitor. No other changes.Martin Pool2003-02-181-120/+119
|
* Add comment explaining the -DDEVELOPER safe_strcpy overflow hack.Martin Pool2003-02-171-1/+5
|
* This is a very nice way to detect pstrcpy() into a malloc()ed string, butAndrew Bartlett2003-02-171-0/+2
| | | | | | it really is a developer hack... Andrew Bartlett
* This patch fixes one of my longest-standing pet hates with Samba :-).Andrew Bartlett2003-02-171-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
* make sure we don't run over the end of 'name' in unix_convert()Andrew Tridgell2003-02-071-2/+6
| | | | Thanks to Andrew Bartlett for spotting this.
* fix some undefined behaviour with increments in C. In theory aAndrew Tridgell2003-01-171-4/+8
| | | | compiler could have produced complete crap for this code.
* Updates to the NTLMSSP code again - moving the base64 decode fuctionality outAndrew Bartlett2003-01-161-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
* Doing a malloc(strlen(s)) then a pstrpcp(y, s) is just silly, make it a strdupAndrew Bartlett2003-01-151-3/+1
| | | | | | instead. Andrew Bartlett
* Accessing data after it's been free()ed really is a no-no...Andrew Bartlett2003-01-131-2/+16
| | | | Andrew Bartlett
* Add PRINTF_ATTRIBUTE() to a few more printf() style functions. Aids inAndrew Bartlett2003-01-021-2/+2
| | | | compiler-based argument checking.
* BIG patch...Andrew Bartlett2003-01-021-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
* Fixed auth module code. Added VALGRIND defines to reduce spurious warnings.Jeremy Allison2002-12-111-0/+9
| | | | Jeremy.
* removing inet_aton()Gerald Carter2002-11-271-1/+2
|
* Having waited for *way* too long, this is mimir's namecache and trusted domainAndrew Bartlett2002-11-261-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
* Add ntlm_auth, a new program to provide a stable interface to winbind'sAndrew Bartlett2002-11-241-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
* Removed global_myworkgroup, global_myname, global_myscope. Added liberalJeremy Allison2002-11-121-7/+8
| | | | | | dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy.
* Added const. Anal formatting fixup.Jeremy Allison2002-10-021-175/+222
| | | | Jeremy.
* Vance picked up a pile of typos etc at the CIFS confernce, and finally got themAndrew Bartlett2002-09-271-8/+8
| | | | | | off his laptop :-) Andrew Bartlett
* The idea of this function is not to touch the argument, so make it const too...Andrew Bartlett2002-08-171-1/+1
|
* Merge of netbios namecache code from APPLIANCE_HEAD.Tim Potter2002-08-161-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.
* found nasty bug in intl/lang_tdb.c tdb structure was not tested to not be ↵Simo Sorce2002-07-281-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.
* Add some const to try and get less warnings.Andrew Bartlett2002-07-201-2/+3
| | | | Andrew Bartlett
* Never ignore valgrind messages :-). Don't reference before the startJeremy Allison2002-07-191-1/+1
| | | | | of a string.... Jeremy.
* Previous fix was incorrect. len in string_sub and all_string_sub isJeremy Allison2002-07-181-4/+4
| | | | | | number of *bytes*. >= check was correct, the len=0 case needed changing to len = ls + 1. Jeremy.
* Fixed off-by-one in all_string_sub also.Jeremy Allison2002-07-181-1/+1
| | | | Jeremy.
* Formatting fixups.Jeremy Allison2002-07-181-66/+73
| | | | Jeremy.
* The previous code would not allow things like string_sub(str, "\\", "/", 0).Gerald Carter2002-07-181-1/+1
| | | | | | It complained about an overflow of 0 bytes. Jeremy please check since you modified this last.
* addedd new (t)alloc_sub_* functionsSimo Sorce2002-07-141-3/+3
| | | | | they will get a const string and return a (t)alloced epanded one. also modified passdb/* stuff to use this one.
* some support functions to ease the next commit.Simo Sorce2002-07-091-6/+96
|
* Address the string_sub problem by changing len = 0 to mean "no expand".Jeremy Allison2002-07-021-10/+22
| | | | | | Went through and checked all string_subs I could to ensure they're being used correctly. Jeremy.
* moved lp_list_* functions away from param/loadparm.c, put int lib/util_str.cSimo Sorce2002-06-141-0/+182
| | | | | and renamed to str_list_* as it is a better name. Elrond should be satisfied now :)
* nicer strndup() functionAndrew Tridgell2002-04-181-6/+6
|
* make suure we get the return value from the pull_*() functions rightAndrew Tridgell2002-04-171-1/+1
| | | | for both null terminated and buffer length terminated strings
* fixed the handling of STR_TERMINATEAndrew Tridgell2002-04-161-0/+12
|
* added strndup() for systems that don't have itAndrew Tridgell2002-04-111-0/+19
|
* this adds a completely new hash based mangling schemeAndrew Tridgell2002-04-111-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.
* Removed version number from file header.Tim Potter2002-01-301-2/+1
| | | | Changed "SMB/Netbios" to "SMB/CIFS" in file header.
* minor fixesSimo Sorce2002-01-251-3/+4
|