summaryrefslogtreecommitdiff
path: root/source4/lib/util_str.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r4549: got rid of a lot more uses of plain talloc(), instead usingAndrew Tridgell1-4/+4
talloc_size() or talloc_array_p() where appropriate. also fixed a memory leak in pvfs_copy_file() (failed to free a memory context) (This used to be commit 89b74b53546e1570b11b3702f40bee58aed8c503)
2007-10-10r4262: a sniff from kukks showed that the FILE_ATTRIBUTE_NORMAL handling inAndrew Tridgell1-0/+1
pvfs was not correct. This should fix a xcopy bug on OS/2. (This used to be commit 7251f1fcdd8980e9c49a58e665374025e07bb8d0)
2007-10-10r3449: more include file reductionAndrew Tridgell1-0/+1
the ldb part isn't ideal, I will have to think of a better solution (This used to be commit 6b1f86aea8427a8e957b1aeb0ec2f507297f07cb)
2007-10-10r3210: split lib/replace.o into a separate build subsystem LIBREPLACE, andAndrew Tridgell1-33/+0
make the ldb tools depend on it. This should help the build of the ldb tools on platforms without strnlen() or strndup() (This used to be commit e6ddb9d8f3a218b22b0176a2525b5daaca7170e4)
2007-10-10r3073: Fix bug in the handling of null-terminated ASCII strings in RPC.Andrew Bartlett1-0/+18
Because we didn't count the null terminator, we would not move past it in the packet. Andrew Bartlett (This used to be commit 8b38bffc7098610c469ab61b7e0e6884f046f286)
2007-10-10r2932: character expansion in strlower_m or strupper_m is considered fatalAndrew Tridgell1-0/+4
(as it could cause a overflow). Print a message giving the character values involved in the expansion so it can be debugged if it happens. (This used to be commit 2a6f59f376a132fcbce8c8e9d1b38d8aae3e8561)
2007-10-10r2871: - got rid of the last bits of non-threadsafe data in util_str.oAndrew Tridgell1-15/+3
- switch the fallback case tables to use talloc - moved the used-once octal_string() inline in loadparm.c (This used to be commit b04202eaacc87d264d463f75673ee0e68cd54f94)
2007-10-10r2857: this commit gets rid of smb_ucs2_t, wpstring and fpstring, plus lots ↵Andrew Tridgell1-481/+150
of associated functions. The motivation for this change was to avoid having to convert to/from ucs2 strings for so many operations. Doing that was slow, used many static buffers, and was also incorrect as it didn't cope properly with unicode codepoints above 65536 (which could not be represented correctly as smb_ucs2_t chars) The two core functions that allowed this change are next_codepoint() and push_codepoint(). These functions allow you to correctly walk a arbitrary multi-byte string a character at a time without converting the whole string to ucs2. While doing this cleanup I also fixed several ucs2 string handling bugs. See the commit for details. The following code (which counts the number of occuraces of 'c' in a string) shows how to use the new interface: size_t count_chars(const char *s, char c) { size_t count = 0; while (*s) { size_t size; codepoint_t c2 = next_codepoint(s, &size); if (c2 == c) count++; s += size; } return count; } (This used to be commit 814881f0e50019196b3aa9fbe4aeadbb98172040)
2007-10-10r2671: we're getting too many errors caused by the talloc_realloc() API notAndrew Tridgell1-2/+3
taking a context (so when you pass a NULL pointer you end up with memory in a top level context). Fixed it by changing the API to take a context. The context is only used if the pointer you are reallocing is NULL. (This used to be commit 8dc23821c9f54b2f13049b5e608a0cafb81aa540)
2007-10-10r2632: a new approach to handling const errors. We have had huge numbers ofAndrew Tridgell1-2/+2
const warnings for a long time, and no real way to approach a solution. Some of them are unavoidable due to the way the C standard works (for example, any function that provides strchr() like functionality _must_ produce a const warning) I will be converting a bunch of places that currently produce const warnings to use the discard_const_p(). Some of these will be unavoidable const problems, some of them will be ones we will fix up over time. At least this change means we will no longer be swamped with const warnings, and we will easily be able to see when new problems emerge. (This used to be commit fec3288ad6ce58e8273e3f16e88037db49ecf046)
2007-10-10r2577: - I recently found out that charaters below 0x3F are guaranteed not toAndrew Tridgell1-45/+12
occur as secondary bytes in any multi-byte character set. This allows for a very simple optimisation in strchr_m() and strrchr_m(). It might be a good idea to pick this up for Samba3. - the horrible toktocliplist() is only used in clitar.c, so move it there, to prevent anyone else from being tempted to use it. (This used to be commit 663b7b75ddd838ce547425b07d7ce4d4606fb479)
2007-10-10r2552: Character set conversion and string handling updates.Andrew Bartlett1-152/+173
The intial motivation for this commit was to merge in some of the bugfixes present in Samba3's chrcnv and string handling code into Samba4. However, along the way I found a lot of unused functions, and decided to do a bit more... The strlen_m code now does not use a fixed buffer, but more work is needed to finish off other functions in str_util.c. These fixed length buffers hav caused very nasty, hard to chase down bugs at some sites. The strupper_m() function has a strupper_talloc() to replace it (we need to go around and fix more uses, but it's a start). Use of these new functions will avoid bugs where the upper or lowercase version of a string is a different length. I have removed the push_*_allocate functions, which are replaced by calls to push_*_talloc. Likewise, pstring and other 'fixed length' wrappers are removed, where possible. I have removed the first ('base pointer') argument, used by push_ucs2, as the Samba4 way of doing things ensures that this is always on an even boundary anyway. (It was used in only one place, in any case). (This used to be commit dfecb0150627b500cb026b8a4932fe87902ca392)
2007-10-10r2454: fixed the accelerated StrCaseCmp() so it compares in the right orderAndrew Tridgell1-2/+2
(This used to be commit 4b795cbf12108e56e5e84e3073c24ce6b625e3c3)
2007-10-10r2437: implemented a suggestion from abartlet that if we cannot convertAndrew Tridgell1-2/+5
strings to UTF16 in StrCaseCmp() that we fall back to a simpler comparison. (This used to be commit 2fa6ab9fe30aeacd7b1421fd83c409acf31c98aa)
2007-10-10r2430: got rid of StrnCaseCmp and added an accelerated version of StrCaseCmp()Andrew Tridgell1-29/+78
for places where known ascii strings are being compared we should just use strncasecmp() and other standard library functions (with replacements via lib/replace.c if needed) (This used to be commit 869b757bba729c9ecd720e3956958efc7541f353)
2007-10-10r2003: got rid of next_token_nr(), which involved some horrible globalsAndrew Tridgell1-22/+3
and nasy pointer tricks. this involved fixing some of the internals of smbclient (This used to be commit 126fec6169f9412932c82e7675840476132bce87)
2007-10-10r1983: a completely new implementation of tallocAndrew Tridgell1-1/+1
This version does the following: 1) talloc_free(), talloc_realloc() and talloc_steal() lose their (redundent) first arguments 2) you can use _any_ talloc pointer as a talloc context to allocate more memory. This allows you to create complex data structures where the top level structure is the logical parent of the next level down, and those are the parents of the level below that. Then destroy either the lot with a single talloc_free() or destroy any sub-part with a talloc_free() of that part 3) you can name any pointer. Use talloc_named() which is just like talloc() but takes the printf style name argument as well as the parent context and the size. The whole thing ends up being a very simple piece of code, although some of the pointer walking gets hairy. So far, I'm just using the new talloc() like the old one. The next step is to actually take advantage of the new interface properly. Expect some new commits soon that simplify some common coding styles in samba4 by using the new talloc(). (This used to be commit e35bb094c52e550b3105dd1638d8d90de71d854f)
2007-10-10r1820: added a strcmp_safe() that handles NULL pointers. Needed for theAndrew Tridgell1-0/+15
search torture test, as some servers return really bad entries. (This used to be commit c900ebb3ac18d77ab334d3bf5259b3bba547b09c)
2007-10-10r1758: Move and enhance the add_string_to_array function as per volker job ↵Simo Sorce1-0/+18
on trunk (This used to be commit 606caddeb95382287fa41a5017ca473d0301be6b)
2007-10-10r1422: StrnCaseCmp now needs to be non-static.Andrew Bartlett1-1/+1
Andrew Bartlett (This used to be commit 6709c7010df2912eec3dfc086343cb3cb7910459)
2007-10-10r1198: Merge the Samba 3.0 ntlm_auth, including the kerberos and SPENGO parts.Andrew Bartlett1-0/+16
I have moved the SPNEGO and Kerberos code into libcli/auth, and intend to refactor them into the same format as NTLMSSP. Andrew Bartlett (This used to be commit 58da78a7460d5d0a4abee7d7b84799c228e6bc0b)
2007-10-10r1048: - moved the schannel definitions into a separate schannel.idlAndrew Tridgell1-0/+34
- added server side support for schannel type 23. This allows WinXP to establish a schannel connection to Samba4 as an ADS DC - added client side support for schannel type 23, but disabled it as currently the client code has now way of getting the fully qualified domain name (which is needed) - report dcerpc faults in the server code in the log (This used to be commit 55e0b014fe14ca8811b55887208a1c3147ddb0d2)
2007-10-10r960: convert 'unsigned int' to uint_t in the most placesStefan Metzmacher1-1/+1
metze (This used to be commit 18062d2ed9fc9224c43143c10efbf2f6f1f5bbe0)
2007-10-10r943: change samba4 to use 'uint8_t' instead of 'unsigned char'Stefan Metzmacher1-10/+10
metze (This used to be commit b5378803fdcb3b3afe7c2932a38828e83470f61a)
2007-10-10r889: convert samba4 to use [u]int16_t instead of [u]int16Stefan Metzmacher1-2/+2
metze (This used to be commit af6f1f8a01bebbecd99bc8c066519e89966e65e3)
2007-10-10r874: This patch is a pile of work on NTLMSSP:Andrew Bartlett1-0/+56
Samba's NTLMSSP code is now fully talloc based, which should go a long way to cleaning up the memory leaks in this code. This also avoids a lot of extra copies of data, as we now allocate the 'return' blobs on a caller-supplied context. I have also been doing a lot of work towards NTLM2 signing and sealing. I have this working for sealing, but not for the verifier (MD5 integrity check on the stream) which is still incorrect. (I can aim a rpcecho sinkdata from a Win2k3 box to my server, and the data arrives intact, but the signature check fails. It does however match the test values I have...). The new torture test is cludged in - when we get a unit test suite back, I'll happliy put it in the 'right' place.... Andrew Bartlett (This used to be commit 399e2e2b1149b8d1c070aa7f0d5131c0b577d2b9)
2007-10-10r827: remove a few more unused functions that we are unlikely to use againAndrew Tridgell1-226/+1
(This used to be commit 121dd9ba0038f6e076c464cddad0b788fe6076fa)
2003-12-16removed some unused functionsAndrew Tridgell1-87/+0
(This used to be commit 09d17d705a6e378a7c1a40b29d2e091200b6d757)
2003-11-23Removed unused variable.Tim Potter1-2/+0
(This used to be commit 40ccaeefed1a3baea356254795c698794cb81384)
2003-11-23Add a strlen_m_term() function for returning the length of a stringTim Potter1-0/+15
including the termination. Using value(strlen_m((r->name)+1)*2) gives the wrong answer for the NULL string. (This used to be commit 7ae329e6630a07d29f83b6dd4572d26ab8a18c71)
2003-11-20 * fixed level2 of QueryUserInfoAndrew Tridgell1-2/+7
* added per-field testing of SetUserInfo * fixed strlen_m() (This used to be commit 26238b0f8a5752bb0f611c4aa492b964e419209a)
2003-11-15run LookupDomain on each domain returned from EnumDomains in samrAndrew Tridgell1-0/+20
(This used to be commit 947b9f8ced486d34ee6710a921fb985ea14e2bb1)
2003-08-15more fixes from the IRIX compiler (thanks herb!)Andrew Tridgell1-3/+0
(This used to be commit 02d068ba7d81d6db25122144981c63f74ad44025)
2003-08-13first public release of samba4 codeAndrew Tridgell1-0/+1619
(This used to be commit b0510b5428b3461aeb9bbe3cc95f62fc73e2b97f)