summaryrefslogtreecommitdiffstats
path: root/lib/util/charset
Commit message (Collapse)AuthorAgeFilesLines
* lib: Fix blank line endingsVolker Lendecke2014-12-091-34/+34
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Fix a typoVolker Lendecke2014-12-091-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Simplify load_case_tables_library()Volker Lendecke2014-12-081-8/+9
| | | | | | | We don't really need a talloc context here Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/util/tests: avoid some compiler warningsStefan Metzmacher2014-11-141-8/+11
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* charset: Avoid compiler warnings with --enable-developerMartin Schwenke2014-09-191-2/+2
| | | | | | | | | | | | These: [ 44/309] Compiling ../lib/util/charset/util_unistr_w.c ../../lib/util/charset/util_unistr_w.c: In function ‘strlower_w’: ../../lib/util/charset/util_unistr_w.c:182:127: warning: right-hand operand of comma expression has no effect [-Wunused-value] COPY_UCS2_CHAR(s,&v); Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* lib: strings: Simplify strcasecmpVolker Lendecke2014-08-061-35/+13
| | | | | | | | | This makes us fallback to strcasecmp early if any INVALID_CODEPOINT appears. Without this patch we just continue to compare if both strings happen to have an INVALID_CODEPOINT in the same spot. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4: tests: Added local.charset test for Bug 10716 - smbd constantly crashes ↵Jeremy Allison2014-08-061-0/+12
| | | | | | | | when filename contains non-ascii character https://bugzilla.samba.org/show_bug.cgi?id=10716 Signed-off-by: Jeremy Allison <jra@samba.org>
* lib: strings: Fix the behavior of strncasecmp_m_handle() in the face of bad ↵Jeremy Allison2014-08-061-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | conversions. When either string has a bad conversion, we fall back to doing raw ascii byte comparisons using strcasecmp(). This is wrong - we should fall back to strncasecmp. The problem is we've already stepped past the character that failed the conversion, so we're not re-testing those characters for comparison. This can have the effect of causing strncasecmp_m_handle() to report that two strings are identical when they are not, if the failed conversion takes place at the end of the string. The correct behavior is to step back to the point of the string(s) that failed the conversion, and continue the test from there. This is a litle trickier than the previous fix, as it requires converting the incoming n variable from remaining characters to compare to remaining bytes to compare. As bytes are always the smallest character size (1 byte) then it's safe to convert the remaining characters to check by decrementing the source string by the last character length (in bytes) and incrementing the remaining bytes to scan by the same value, then calling strncasecmp() with the stepped back strings remaining. Signed-off-by: Jeremy Allison <jra@samba.org>
* lib: strings: Fix the behavior of strcasecmp_m_handle() in the face of bad ↵Jeremy Allison2014-08-061-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | conversions. When either string has a bad conversion, we fall back to doing raw ascii byte comparisons using strcasecmp(). The problem is we've already stepped past the character that failed the conversion, so we're not re-testing those characters for comparison. This can have the effect of causing strcasecmp_m_handle() to report that two strings are identical when they are not, if the failed conversion takes place at the end of the string. The correct behavior is to step back to the point of the string(s) that failed the conversion, and continue the test from there. Found by <lev@zadarastorage.com> when investigating bug 10716 - smbd constantly crashes when filename contains non-ascii character. Given the normal character set of utf-8, and an on disk filename of ISO-8859-1 of file-é on disk hex value: 66 69 6c 65 2d e9, an incoming open given the correct utf8 name of file-é will collide when it should not. Fixes: Bug 10716 - smbd constantly crashes when filename contains non-ascii character https://bugzilla.samba.org/show_bug.cgi?id=10716 Signed-off-by: Jeremy Allison <jra@samba.org>
* lib/util/tests: add missing #include "torture/local/proto.h"Stefan Metzmacher2014-04-021-0/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* iconv: Use a static buffer in iconf not to spoil the talloc_poolVolker Lendecke2013-12-141-15/+1
| | | | | | | | | | | This is a buffer that is strictly used like a stack variable. This patch makes it one and while there it fixes an error path memleak. In the "pull_failed" case we did not talloc_free(cvtbuf). With talloc_tos(), this does not really matter, but for code without this it does. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib/util/charset: We do not use fucntions from wchar.h any moreAndrew Bartlett2012-09-261-7/+1
| | | | | Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Sep 26 02:13:10 CEST 2012 on sn-devel-104
* lib/util/charset: Try to find iconv on HP-UXAndrew Bartlett2012-09-261-0/+3
|
* lib/util: Fix typo in comment.Jelmer Vernooij2012-06-151-1/+1
|
* charset: Remove unused strcmp_w()Andrew Bartlett2012-02-102-15/+0
| | | | | | | | Found by callcatcher. Found by callcatcher: http://www.skynet.ie/~caolan/Packages/callcatcher.html Andrew Bartlett
* charset: Remove unused iconv_talloc()Andrew Bartlett2012-02-103-120/+1
| | | | | | Found by callcatcher: http://www.skynet.ie/~caolan/Packages/callcatcher.html Andrew Bartlett
* charset/tests: Add prototypes for test functions.Jelmer Vernooij2012-02-072-0/+7
|
* lib/charset: Remove an unused variableVolker Lendecke2011-12-251-0/+2
| | | | | Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Dec 25 15:07:56 CET 2011 on sn-devel-104
* s3: Fix fn signatures in charset_macosx.cVolker Lendecke2011-12-252-6/+6
|
* lib/util/charset Remove unused header smb_common.hAndrew Bartlett2011-10-241-1/+0
| | | | | | | | This should fix a compile issue on hosts without gssapi/gssapi.h. Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>
* Fix const warnings.Jeremy Allison2011-10-141-4/+4
|
* build: Fix waf build on MacOS XAndrew Bartlett2011-09-231-1/+1
| | | | | | | | | | | The -framework CoreFoundation is required by the charset_macosxfs module The system/time.h header is required to access the replacement clock_gettime() Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Sep 23 10:58:02 CEST 2011 on sn-devel-104
* lib/util/charset: remove charset module loadingAndrew Bartlett2011-09-209-172/+105
| | | | | | | | | | | | | Now that the 'table' modules are gone, there is no reason for there to be charset modules at all. This builds the macosxfs and weird modules into the binary at the appropriate times, and changes the tests to test instead the difference between the remaining internal handlers and iconv(). Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Sep 20 06:27:06 CEST 2011 on sn-devel-104
* lib/util/charcnv: Remove broken internal CP850 and CP464 modulesAndrew Bartlett2011-09-204-364/+0
| | | | | | | | These modules are now known to be faulty, and Samba 3.6.0 didn't include support for them, so we now require a system iconv if you wish to support these character sets for the non-ASCII range. Andrew Bartlett
* lib/util/charset: the comparsion must be against our charset modulesAndrew Bartlett2011-09-101-2/+2
| | | | | | | | | There is little point testing this against the system iconv. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Sat Sep 10 15:45:42 CEST 2011 on sn-devel-104
* lib/util/charset Use name of ISO-8859-1 that matches our internal implementationAndrew Bartlett2011-09-101-44/+44
|
* lib/util/charset: Improve toture assertions in iconv testAndrew Bartlett2011-09-101-1/+14
|
* lib/util/charset Run charset sets with and without the system iconvAndrew Bartlett2011-09-103-14/+28
| | | | | | | | We need to know that we can load the samba-provided modules, and that they are correct. However, we must mark a number of tests as knownfail due to errors in our internal iconv modules. Andrew Bartlett
* lib/util/charset: add back loading of charset modulesAndrew Bartlett2011-09-102-34/+64
| | | | | | | | | | | | | | For autoconf builds these remain as modules, for waf builds they are built into the charset library. This is required to provide the CP850 charset when iconv is not available. The charset modules static for the waf builds because with proper shared libs, there isn't the same need for these to be in seperate .so files. The modules are also not produced if a system iconv is found, except for developers, to allow testing of both code paths. Andrew Bartlett
* Fix bug 8433, segfault in iconv.cVolker Lendecke2011-09-011-1/+0
| | | | | Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Sep 1 18:25:34 CEST 2011 on sn-devel-104
* charset: Make name lowercase everywhere.Jelmer Vernooij2011-07-231-5/+5
|
* Second part of fix for bug 8310 - toupper_ascii() is broken on big-endian ↵Jeremy Allison2011-07-192-0/+12
| | | | | | | | | | | | | | | systems. Re-add: smb_ucs2_t toupper_w(smb_ucs2_t v); and ensure it is called whenever we are operating on smb_ucs2_t variables. I'd like to make the definition of smb_ucs2_t incompatible with int and codepoint_t so they can't be mixed, but that's a patch for another time. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Tue Jul 19 23:48:05 CEST 2011 on sn-devel-104
* First part of fix for bug 8310 - toupper_ascii() is broken on big-endian systemsJeremy Allison2011-07-192-42/+0
| | | | | | | | | | Remove int toupper_ascii(int c); int tolower_ascii(int c); int isupper_ascii(int c); int islower_ascii(int c); and replace with their _m equivalents, as they are identical.
* lib: Allow NULL converted_size in convert_string_tallocVolker Lendecke2011-06-241-2/+6
|
* lib/util/charset: Remove autodetection of charset from LOCALEAndrew Bartlett2011-06-231-31/+0
| | | | | | | | | | | | | | | | In the past, our LOCALE would set the display charset of Samba. The display charset has now been removed. This patch removes the support code that detected the locale from the environment. We cannot safely have 'unix charset' follow the locale (at it creates files on disk and entries in databases that must not vary), so this code is unused. As an example, imagine a database is manipulated in the administrator's locale, and then read by smbd starting up in the system default locale. Or smbd restarted by the administrator rather than a startup script. Both of these situations could corrupt databases or filenames on disk. Andrew Bartlett
* lib/util/charset: Remove 'display charset'Andrew Bartlett2011-06-234-69/+60
| | | | | | | | | | | | | | | | | As discussed in 'CH_DISPLAY and gettext' on the samba-technical list: http://lists.samba.org/archive/samba-technical/2011-June/078190.html Setting this to a value other than 'unix charset' does not make sense, as any system where the filesytem charset does not equal the terminal charset will already have problems with programs as simple as 'ls'. It also means that our output could not be pasted as our input in interactive programs or onto our command line, as we never did translate in the DISPLAY -> UNIX direction. The d_printf() calls are retained in case we need to revisit this, and to support display_set_stderr(). Andrew Bartlett
* Fix numerous missing dependencies in WAF build scriptsSean Finney2011-05-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the recent consolidation of code between s3 and s4, a number of new dependencies have been implicitly introduced. For example, previous s3 code gained an implicit dependency on talloc after the charset related consolidation (lib/util/charset/charset.h now includes talloc.h). When building against the embedded version of talloc this isn't a problem since the paths are automatically added to the search path, but when building against the external libraries build failures will occur for all components that don't directly or indirectly include talloc as a dependency. Since charset.h is included from util.h, which in turn is included from includes.h, this means most of the codebase (s3 and s4) has such an undeclared dependency. Therefore, samba-util-common and samba-util have been added as dependencies to the s3 and s4 code respectively, for all cases where the source would otherwise fail to build. Additionally, a few other dependencies are added in specific wscript_build files to address similar dependency-related problems. https://bugzilla.samba.org/show_bug.cgi?id=8128 Signed-off-by: Sean Finney <seanius@seanius.net> Signed-off-by: Matthias Dieter Wallnöfer <mdw@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Wed May 25 19:22:13 CEST 2011 on sn-devel-104
* lib/util/charset: Remove unused strcasecmp_w and strncasecmp_wAndrew Bartlett2011-05-181-32/+0
| | | | | Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed May 18 17:22:15 CEST 2011 on sn-devel-104
* lib/util/charset use talloc_stackframe() rather than talloc_tos()Andrew Bartlett2011-05-181-12/+12
| | | | | | | This is common code, and we can't assume a talloc_stackframe() so we must create it. Andrew Bartlett
* lib/util/charset Don't allow invalid 'dos charset = utf8'Andrew Bartlett2011-05-181-0/+5
| | | | | | | No DOS client used UTF8, and this creates subtle, difficult to disagnose breakage of schannel (domain membership). Andrew Bartlett
* lib/util/charset: fix the toplevel MacOS X build.Günther Deschner2011-05-171-2/+3
| | | | | | | Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Tue May 17 16:16:59 CEST 2011 on sn-devel-104
* lib/util/charset Move built-in charset modules to the top levelAndrew Bartlett2011-05-136-1/+1028
| | | | | | | This removes the 'charset' subsystem and allows these modules to be used across the whole of Samba. Andrew Bartlett
* Fix many const compiler warnings.Jeremy Allison2011-05-052-4/+4
|
* Clean up some const and other compiler warnings.Jeremy Allison2011-05-052-6/+6
| | | | | Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu May 5 00:59:40 CEST 2011 on sn-devel-104
* 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/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>