summaryrefslogtreecommitdiffstats
path: root/lib/util
Commit message (Collapse)AuthorAgeFilesLines
* lib/util make string_wrappers.h a public headerAndrew Bartlett2011-05-031-1/+1
| | | | | | | | | | This isn't a very good public header, but util.h includes it, so we don't have much choice in the short term. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue May 3 08:37:22 CEST 2011 on sn-devel-104
* lib/util Use lib/util/util_str.c in common, including strequal()Andrew Bartlett2011-05-032-3/+3
| | | | | | | | strequal() is now implemented in terms of strcasecmp_m() which is tested in smbtorture and which does not talloc() for ASCII or non-ASCII comparions, and has an ASCII fast-path. Andrew Bartlett
* lib/util Use compiler-checked safe string macros in top level code.Andrew Bartlett2011-05-032-35/+27
| | | | | | | This brings the 'safe' macros to the top level code, and removes duplication of the safe_strcpy() and safe_strcat() functions. Andrew Bartlett
* s4: fix arguments to safe_strcpy()Andrew Bartlett2011-05-031-5/+5
| | | | | | Found by the s3-derivied safe_strcpy() macro. Andrew Bartlett
* lib/util/charset Use push_string and talloc_strupper/strlower from common codeAndrew Bartlett2011-05-032-17/+10
| | | | | | | | | | | The only caller of push_string() (not to be confused with push_string_check()) in the common code was encode_pw_buffer(), and it didn't use the alignment or STR_UPPER flags. The talloc_strupper() and talloc_strlower() functions are tested in smbtorture, and are next_codepoint() based. Andrew Bartlett
* Remove strlower_m() and strupper_m() from source4 and common code.Andrew Bartlett2011-05-032-86/+0
| | | | | | | | | This function is problematic because a string may expand in size when changed into upper or lower case. This will then push characters off the end of the string in the s3 implementation, or panic in the former s4 implementation. Andrew Bartlett
* lib/util Move set_socket_options() into common code.Andrew Bartlett2011-05-032-0/+163
|
* lib/util Move more network utility functions from source3 into lib/utilAndrew Bartlett2011-05-034-1/+275
| | | | | | This will help with the merge of the interfaces layer. Andrew Bartlett
* lib/util Rename conv_str_size() -> conv_str_size_error()Andrew Bartlett2011-04-302-4/+2
|
* lib/util Re-merge the string_sub() and all_string_sub() from source3Andrew Bartlett2011-04-293-15/+46
| | | | Andrew Bartlett
* lib/util/charset Move strstr_m() to the top levelAndrew Bartlett2011-04-292-0/+84
|
* lib/util/charset Merge talloc-based pull and push charset functionsAndrew Bartlett2011-04-283-95/+151
| | | | | | These were copied from source3/lib/charcnv.c Andrew Bartlett
* lib/util/charset Add copyright headersAndrew Bartlett2011-04-281-1/+2
| | | | | Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Apr 28 04:13:44 CEST 2011 on sn-devel-104
* lib/util/charset Make fast path from UTF16 to '8 bit' charsets clearerAndrew Tridgell2011-04-281-14/+28
| | | | | | | | This breaks the fast path into handling for -1 and handling for specified lenghts, avoding branch operations on each character. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Add tests for srclen=-1 behaviour.Andrew Bartlett2011-04-281-0/+443
| | | | | | | | | This confirms that we do include a null terminator in all non-failed conversions. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset use convert_string.c in commonAndrew Bartlett2011-04-284-204/+5
| | | | | | | | This brings another layer of the charcnv library in common. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Fix string termination conditions for UTF16 stringsAndrew Bartlett2011-04-281-4/+4
| | | | | | | | | This punts partial UTF16 strings to iconv() to deal with, as it's not a fast path any longer if it's got an odd length. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* dynconfig: Have only one dynconfig.o in the common code.Andrew Bartlett2011-04-271-1/+1
|
* lib/util Define samba-util-common only for s3-wafAndrew Bartlett2011-04-261-24/+11
| | | | | | It causes too much trouble in the top level build. Andrew Bartlett
* lib/util: add RBVAL, RBVALS, RSBVAL and RSRBVALS macrosStefan Metzmacher2011-04-241-6/+11
| | | | | | They pull and push [u]int64_t values in big endian. metze
* Fix case of libUTIL_LDB.Jelmer Vernooij2011-04-231-6/+6
| | | | | Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Apr 23 18:52:06 CEST 2011 on sn-devel-104
* asn1: Fix Coverity ID 2299, CHECKED_RETURNVolker Lendecke2011-04-221-1/+5
|
* lib/util/charset Always set *converted_size even on failureAndrew Bartlett2011-04-201-4/+2
| | | | | | | | | The caller may wish to inspect the partially converted string. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Apr 20 05:17:48 CEST 2011 on sn-devel-104
* lib/util/charset create _handle functions for convert_string() et alAndrew Bartlett2011-04-201-29/+86
| | | | | | | | | | | | | | This is now API compatible with the existing code in lib/util/charset lazy_initialize_conv() is no longer called as init_iconv() is called when the smb.conf is processed, and get_conv_handle() will auto-init with defaults if required. load_case_tables_library() is no longer requried as all binaries and libraries already load these in their entry points, as otherwise all the other string functions would fail. Andrew Bartlett
* util: Build samba-util without unresolved symbols.Brad Hards2011-04-161-33/+60
| | | | | | | | | | This is useful for the Samba4 case where external users otherwise need to link to (private) libsamba-util-common. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Sat Apr 16 12:29:33 CEST 2011 on sn-devel-104
* lib/util Move alpha_strcpy() from s3 into common codeAndrew Bartlett2011-04-142-46/+51
| | | | | Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Apr 14 09:21:59 CEST 2011 on sn-devel-104
* s3-includes: include lib/util/debug.h headers in includes.h not smb.hGünther Deschner2011-04-141-0/+1
| | | | Guenther
* lib: Move next_token next to next_token_tallocVolker Lendecke2011-04-132-47/+46
| | | | Signed-off-by: Jeremy Allison <jra@samba.org>
* build: Bring DYNCONFIG into samba-util library to avoid symbol duplicationAndrew Bartlett2011-04-131-1/+1
| | | | | | | | | | When this was depended on directly as a subsystem, it ended up in multiple libraries. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Apr 13 08:39:35 CEST 2011 on sn-devel-104
* s3-charcnv: Move convert_string() et al to lib/util/charsetAndrew Bartlett2011-04-131-0/+467
| | | | | | | | | This is the first step to this being the common convert_string implementation. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Add many more charset testsAndrew Bartlett2011-04-131-15/+444
| | | | | | | | | This confirms that the behaviour of the convert_string() API (with the process-wide iconv handle). Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Add convert_string_error()Andrew Bartlett2011-04-132-0/+25
| | | | | | | | This adds an interface that matches the source3/ convert string code. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Make ASCII conversion validate it's inputAndrew Bartlett2011-04-131-4/+69
| | | | | | | | | We should not just strip the high bits off unicode strings being converted to ASCII, we need to actually fail the conversion. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Rename convert_string test to allow a 'non_handle' testAndrew Bartlett2011-04-131-3/+2
| | | | | | | | | A future commit will test (with a subset of tests) the varient of this function without _handle. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Add more tests for convert_string_error_handle()Andrew Bartlett2011-04-131-0/+101
| | | | | | | | | This helps define the semantics of this function very clearly, particularly for partial and invalid inputs. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Preserve 'pull' errors even when converting via UTF16Andrew Bartlett2011-04-131-3/+8
| | | | | | | | | | | | | | When we do not have a direct iconv handle between any two charsets, we must go iva UTF16. However, we should still return the same buffer and error code as if we were able to go direct - including the partial conversion and the error code. This is important for locating the invalid multibyte character in the stream, for example. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Add tests for convert_string_error_handleAndrew Bartlett2011-04-131-1/+68
| | | | | | | | | These confirm that the errno is set correctly and that we stop on a partial multibyte character Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Add expected values for upper/lower case testsAndrew Bartlett2011-04-131-0/+16
| | | | Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Fix and add public interface for convert_string_error_handleAndrew Bartlett2011-04-132-7/+14
| | | | | | | | | It makes much more sense for this to match the source3/ interface and return a bool. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util: Make string_replace from s3 commonAndrew Bartlett2011-04-132-10/+43
| | | | | | | | | The s4 implementation didn't do multibyte strings, so was only good for '/' which is known to be safe in all multibyte charsets. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util ucs2_align is identical, put it in commonAndrew Bartlett2011-04-132-7/+7
| | | | Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util Move simple string routines into common code.Andrew Bartlett2011-04-134-55/+82
| | | | Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Move source3/lib/util_unistr.c to the common code.Andrew Bartlett2011-04-133-1/+345
| | | | | | | | This file (largely) contains functions to deal with UTF16 strings. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util make UTIL_TDB a libraryAndrew Bartlett2011-04-131-2/+3
|
* lib: make asn1_util a private libraryAndrew Tridgell2011-04-061-4/+5
| | | | | | | this prevents symbol duplication of the asn1 symbols in the service and ntvfs subsystems Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* lib: moved data_blob.c into samba-util-commonAndrew Tridgell2011-04-061-2/+2
| | | | | | | this avoids a duplication of the data_blob symbols some binaries (eg. smbtorture) Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* debug: default debug to stderr Andrew Tridgell2011-04-041-1/+2
| | | | | | | if setup_logging() hasn't been called then default to sending debug to stderr Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* debug: Restore the s3-style check in check_log_size()Volker Lendecke2011-03-311-1/+6
| | | | | | | This has caused me considerable grief. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Mar 31 19:42:38 CEST 2011 on sn-devel-104
* lib/util/charset Add tests for strcasecmp_m(), talloc_strupper() et alAndrew Bartlett2011-03-314-15/+241
| | | | | | | | | | | | | | | | | | This adds tests for: strncasecmp_m strcasecmp_m strupper_talloc_n strlower_talloc strhaslower strhasupper The tests can certainly be improved with pre-calculated upper and lower case text, but this at least puts them though their paces. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Mar 31 14:24:22 CEST 2011 on sn-devel-104
* charconv: Use talloc_tos() in the S3 buildVolker Lendecke2011-03-311-1/+9
| | | | | | | | In S3 we put a talloc_pool on top of the stack so that an allocation from talloc_tos() normally is just a pointer increment. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Mar 31 09:14:01 CEST 2011 on sn-devel-104