summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
AgeCommit message (Collapse)AuthorFilesLines
2004-03-13Modified fix for bugid #784. Based on a patch from moriyama@miraclelinux.com ↵Jeremy Allison1-1/+0
(MORIYAMA Masayuki). Don't use nstrings to hold workgroup and netbios names. The problem with them is that MB netbios and workgroup names in unix charset (particularly utf8) may be up to 3x bigger than the name when represented in dos charset (ie. cp932). So go back to using fstrings for these but translate into nstrings (ie. 16 byte length values) for transport on the wire. Jeremy. (This used to be commit b4ea493599ab414f7828b83f40a5a8b43479ff64)
2004-03-09Given how core this code is, I figure it should have it's own testsuite.Andrew Bartlett1-7/+11
Big thanks to tpot and mbp for showing how easy it can be to write a simple unit test, and for providing the STF. This also changes the strstr_m() code to use strstr_w() (avoiding duplication) and fixes it so that it passes the STF. (We now always restart before doing the unicode run, until sombody can show me why the testsuite is wrong). Andrew Bartlett (This used to be commit a893a324f37e6a171719db8ffffe66df31c2dbaa)
2004-03-09JRA's recent strstr_m work really badly broke our string_sub code.Andrew Bartlett1-2/+10
For example: strstr_m("%v foo bar", "%v") would fail... only strstr_m("foo %v", "%v") could work. I wonder what else this broke... Fix is to move to using strncmp() inside the strstr_m function. Tested on ASCII only. Andrew Bartlett (This used to be commit 44d304f84c4ba5a832d5e3848ae0d04d5438ac15)
2004-03-09Added strstr_m() function. Use in all places where we might run into mbJeremy Allison1-4/+74
(should fix the mb service name problem, can't remember the bugid). Jeremy. (This used to be commit 94a272b9a881ec0004c5da2a7242b0a818da5630)
2004-02-13Missed SAFE_FREE (typo).Jeremy Allison1-1/+2
Jeremy. (This used to be commit ac1d03c05bf6247541fbd6f0c3bd5b2e5b6a5212)
2004-02-13Added Andrew Bartlett's patch to use an allocated buffer for count_chars.Jeremy Allison1-2/+8
Jeremy. (This used to be commit cdbeb7d2ebcd4a298aabb3ed665560d219bb0d1c)
2004-02-04Fix final valgrind errors with #830. Catch mb conversion error that may notJeremy Allison1-2/+16
terminate correctly. Jeremy. (This used to be commit 49142c6352eb3645437ef86bcedca1b1895aef60)
2004-01-23Fix decoding of base64. We got the length wrong when the result was notVolker Lendecke1-0/+2
an exact multiple of 3. I also wrote a torture test and it survived some minutes of random stuff coded/decoded up to 16 MB data. But that would be a bit too embarassing to commit... :-) Volker (This used to be commit 6d22f0d8c36bea618ad0adf4eefc2f5a37cb3fda)
2004-01-07Fix for bug #922. Fast path not called for strlower_m() and strupper_m().Jeremy Allison1-2/+2
From ab@samba.org (Alexander Bokovoy). Jeremy. (This used to be commit fac9e6d7125fb9edfade3c92a3cd9e1f2c60cefd)
2003-12-25Fix bug 916 - do not perform a + -> space substitution for squid URL encodedAndrew Bartlett1-5/+0
strings, only form input in SWAT. Andrew Bartlett (This used to be commit 8d54f5fe0c5689660f37788916b37014754ce23e)
2003-11-22Ensure that items in a list of strings containing whitespaceGerald Carter1-1/+1
are written out surrounded by single quotes. This means that both double and single quotes are now used to surround strings in smb.conf. This is a slight change from the previous behavior but needed or else things like printer admin = +ntadmin, 'VALE\Domain, Admin' get written to smb.conf by SWAT. (This used to be commit 5bf91c79d620e34ac71d72c80f74e47754d49dcb)
2003-11-19Added useful information to debug lines.Rafal Szczesniak1-4/+4
Patch by metze. rafal (This used to be commit 2eef3c7bc182bb2c0c483190570ee1a297047ad2)
2003-11-18Useful debug message. Patch by metze.Rafal Szczesniak1-2/+4
rafal (This used to be commit 8b06364b53ea01ec7a21f3fbe86afad02fe21dd8)
2003-11-13Squelch some warnings with more casty-foo.Richard Sharpe1-2/+2
(This used to be commit d165a49d860443741e57458b8a819c6d54824fc5)
2003-11-03Fix more 64-bit printf warnings.Tim Potter1-2/+3
(This used to be commit 23443e3aa079710221557e18158d0ddb8ff48a36)
2003-09-13Fix for MacOS/X which uses STUPID BROKEN UNICODE COMPOSE CHARACTERS !Jeremy Allison1-3/+12
(rant off :-). Inspired by work from Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>. Also add MacOSX/Darwin configure fixes. Jerry - can we put this in 3.0 release ? :-). Jeremy. (This used to be commit f23acb4ca5feac8ad2acfa1baf7df31283aba3ea)
2003-09-12Fix from Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>. ReveredJeremy Allison1-1/+1
condition meant fast-path in strchr_m was not being used. Doh ! Jeremy. (This used to be commit f23c9d36b0cd4083722012e4a94df8295f29d04c)
2003-09-10Fix stupid typo bug causing CPU spin. Spotted by Markus Ungermann ↵Jeremy Allison1-0/+1
<ungermann@elzet80.de> Jeremy. (This used to be commit c5ed59b37be1bf779e0d0e61c31227b520430afd)
2003-09-05More tuning from cachegrind. Change most trim_string() calls to trim_char(0,Jeremy Allison1-2/+73
as that's what they do. Fix string_replace() to fast-path ascii. Jeremy. (This used to be commit f35e9a8b909d3c74be47083ccc4a4e91a14938db)
2003-09-05fix bug 397: use a variant of alloc_sub_basic() for string lists.Gerald Carter1-0/+30
(This used to be commit 62d5611df0cf86c267d7fe820822d4d019ae28bd)
2003-09-05Hand optimisatinos for strrchr_m using the properties we know about MBJeremy Allison1-11/+47
character sets and how we use this call. Jeremy. (This used to be commit a9709700eea3bb48ab4a79d74e0b8d22dc98576f)
2003-09-04Fastpath strchr_m for ASCII.Jeremy Allison1-0/+13
Jeremy. (This used to be commit b3176f2ec246441dd483dc9757a487535b1656e6)
2003-09-04Used cachegrind to track down some bottlenecks.Jeremy Allison1-1/+10
Removed calls to clobber_region when not compiling with developer as they were hiding speed problems. Added fast path to convert_string() when dealing with ascii -> ascii, ucs2-le to ascii and ascii to ucs2-le with values <= 0x7F. This gives a speedup of 22% on my nbench tests. Next I will do this on convert_string_allocate. Jeremy. (This used to be commit ef140d15ea0d76a3e7cdcadbfd3e917c210a9411)
2003-09-03Fix up overlapping memcpy -> memmove found by valgrind.Jeremy Allison1-1/+3
Jeremy. (This used to be commit e0c1460c6b6af2b83ea205d8abeb37c71ca1d4c1)
2003-08-25fix bug 289; make sure to reset the offset into a string when reallocating spaceGerald Carter1-1/+2
(This used to be commit 66dd20c7eaa66abdf99fa57475ccc4c9f978f1b5)
2003-08-15get rid of more compiler warningsHerb Lewis1-7/+7
(This used to be commit 398bd14fc6e2f8ab2f34211270e179b8928a6669)
2003-08-15get rid of const as these things really are not constHerb Lewis1-5/+5
(This used to be commit 61bea183a229cc11f25c4a7cb5341faad9833d7b)
2003-07-27Use push_ucs2_allocate(), rather than convert_string_allocate() directly.Andrew Bartlett1-37/+5
Remove strdup_upper/strdup_lower from their old file, now that they have been moved to charcnv.c Note that string_replace assumes that s is a pstring. (doco change only) Andrew Bartlett (This used to be commit 6c9056029bb3dfadb244f301598e12e69493fff9)
2003-07-25More printf portability fixes. Got caught out by some gcc'isms lastTim Potter1-1/+1
time. )-: (This used to be commit 59dae1da66a5eb7e128263bd578f167d8746e9f0)
2003-07-24More printf fixes - size_t is long on some architectures.Tim Potter1-1/+1
(This used to be commit ba4d334b822248d8ab929c9568533431603d967e)
2003-07-19Fix StrCaseCmp() to avoid calling smb_panic() on invalid multibyte strings.Andrew Bartlett1-11/+24
This fix results in - we no longer use fixed-size buffers in StrCaseCmp (previously limited to a pstring) - we return strcmp(s, t) if either of the strings is invalid - for non-ascii cases, we call iconv twice, not 4 times. The basic idea with this fix is that if a string is not valid in the currnet charset, then (unless it is byte-equivilant) it cannot be case-equivilant to any other string. This should address the majority of our smb_panic() cases on this matter. It will not fix them all - we still call unix_strupper(), aka strupper_m() elsewhere, but this was being called on every file in the directory when we performed unix_convert(). Tested with the stf unit tests for this routine. Andrew Bartlett (This used to be commit 9918fa73145a22b1d7adf001f0a9cf0e1bda4136)
2003-07-03Removed strupper/strlower macros that automatically map to ↵Jeremy Allison1-3/+3
strupper_m/strlower_m. I really want people to think about when they're using multibyte strings. Jeremy. (This used to be commit ff222716a08af65d26ad842ce4c2841cc6540959)
2003-07-02Added fix for Japanese case names in statcache - these can changeJeremy Allison1-0/+20
size on upper casing. Based on patch from monyo@home.monyo.com. Jeremy. (This used to be commit 72e382e99b92666acdaf50a040b14aa16d48b80d)
2003-06-25large change:Gerald Carter1-21/+38
*) consolidates the dc location routines again (dns and netbios) get_dc_list() or get_sorted_dc_list() is the authoritative means of locating DC's again. (also inludes a flag to get_dc_list() to define if this should be a DNS only lookup or not) (however, if you set "name resolve order = hosts wins" you could still get DNS queries for domain name IFF ldap_domain2hostlist() fails. The answer? Fix your DNS setup) *) enabled DOMAIN<0x1c> lookups to be funneled through resolve_hosts resulting in a call to ldap_domain2hostlist() if lp_security() == SEC_ADS *) enables name cache for winbind ADS backend *) enable the negative connection cache for winbind ADS backend *) removes some old dead code *) consolidates some duplicate code *) moves the internal_name_resolve() to use an IP/port pair to deal with SRV RR dns replies. The namecache code also supports the IP:port syntax now as well. *) removes 'ads server' and moves the functionality back into 'password server' (which can support "hostname:port" syntax now but works fine with defaults depending on the value of lp_security()) (This used to be commit d7f7fcda425bef380441509734eca33da943c091)
2003-05-12Add NT quota support. Patch from Stefan (metze) MetzemacherAlexander Bokovoy1-0/+22
1. Allows to change quota settings for shared mount points from Win2K and WinXP from Explorer properties tab 2. Disabled by default and when requested, will be probed and enabled only on Linux where it works 3. Was tested for approx. two weeks now on Linux by two independent QA teams, have not found any bugs so far Documentation to follow (This used to be commit 4bf022ce9e45be85609426762ba2644ac2031326)
2003-04-15merge in metze' smbcquotas patch from HEADGerald Carter1-3/+3
(This used to be commit b6a77048886151435a4a5eeb9a04be44d397c504)
2003-04-02Don't set zero length for the base64 decoded string (fixes swat auth).Andrew Bartlett1-2/+2
Andrew Bartlett (This used to be commit 7ab39cba6a97ddd0879dd968167fc7809f87de6e)
2003-03-24(merge from HEAD)Andrew Bartlett1-2/+22
NTLM Authentication: - 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 ec071ca3dcbd3881dc08e6a8d7ac2ff0bcd57664)
2003-03-19use strnlen to prevent coredumpsJim McDonough1-3/+3
(This used to be commit 5078436d83f0fdc568d6687809c7c70dea5fd382)
2003-03-18Merge mbp's HEAD changes.Jeremy Allison1-33/+71
Jeremy. (This used to be commit da1271a95fce7fd217555fb161d4669d0b9b80e2)
2003-03-18Merge in the developer string options from HEAD. We need to ensure 3.0Jeremy Allison1-47/+51
is as stable as possible in the string department and some pain now will help later :-). Jeremy. (This used to be commit 86e3eddac698d90f4666b8492b4603a4efbbd67b)
2003-03-17Merge from (earlier) HEAD - doxygen.Andrew Bartlett1-6/+8
I'm not merging the current HEAD string stuff quite yet. (This used to be commit 9b8d12e081462566043bb51e9c95605609572a54)
2003-02-24Merge doxygen, signed/unsigned, const and other small fixes from HEAD to 3.0.Andrew Bartlett1-122/+129
Andrew Bartlett (This used to be commit 9ef0d40c3f8aef52ab321dc065264c42065bc876)
2003-02-18base64_decode() with heimdal libs, so I've renamed it base64_decode_inplace().Jim McDonough1-1/+1
(This used to be commit d510ff85fb0dafddf3dea9412a09eeee6e70f0cb)
2003-02-07merge from headAndrew Tridgell1-2/+6
(This used to be commit fd3216dbcbaec7d64dd24fe2af6c4156935c47e9)
2003-01-28Merge from HEAD:Andrew Bartlett1-0/+94
- NTLMSSP over SPENGO (sesssion-setup-and-x) cleanup and code refactor. - also consequential changes to the NTLMSSP and SPNEGO parsing functions - and the client code that uses the same functions - Add ntlm_auth, a NTLMSSP authentication interface for use by applications like Squid and Apache. - also consquential changes to use common code for base64 encode/decode. - Winbind changes to support ntlm_auth (I don't want this program to need to read smb.conf, instead getting all it's details over the pipe). - nmbd changes for fstrcat() instead of fstrcpy(). Andrew Bartlett (This used to be commit fbb46da79cf322570a7e3318100c304bbf33409e)
2003-01-17Janitorial duty...Jeremy Allison1-4/+8
fix some undefined behaviour with increments in C. In theory a compiler could have produced complete crap for this code. (tridge). Jeremy. (This used to be commit 2b4335f06265940582f389f48dc4f87f452a2703)
2003-01-15*lots of small merges form HEADGerald Carter1-5/+17
*sync up configure.in *don't build torture tools in make all *make sure to remove torture tools as part of make clean (This used to be commit 0fb724b3216eeeb97e61ff12755ca3a31bcad6ef)
2003-01-04Merge from HEAD - whitespace :-)Andrew Bartlett1-1/+0
(This used to be commit 5fc90b6cf438480c9fcf8d01f0a319a52c5914cc)
2003-01-04Merge from HEAD - mimir's new gencache based namecache code.Andrew Bartlett1-0/+152
Andrew Bartlett (This used to be commit f79324f730c400342f445c931b0d75ff756d7cc7)