summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
AgeCommit message (Collapse)AuthorFilesLines
2012-12-21s3-lib: Fix push_ucs2() for-loop.Andreas Schneider1-2/+2
ret is a bool and size is what we are looking for here, else the statement can never be true. Jeremy please check! Found by Coverity. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
2012-08-22Remove align_string(). No longer used.Jeremy Allison1-11/+0
Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Aug 22 20:38:50 CEST 2012 on sn-devel-104
2012-08-09Check error returns from strupper_m() (in all reasonable places).Jeremy Allison1-1/+4
2012-02-18Fix a bunch of "unused variable" warnings.Jeremy Allison1-74/+0
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Feb 18 06:22:40 CET 2012 on sn-devel-104
2012-02-10s3-charcnv: Remove unused rpcstr_push()Andrew Bartlett1-8/+0
Found by callcatcher: http://www.skynet.ie/~caolan/Packages/callcatcher.html Andrew Bartlett
2012-02-10s3-charcnv: Remove unused pull_string_fnAndrew Bartlett1-35/+0
Found by callcatcher: http://www.skynet.ie/~caolan/Packages/callcatcher.html Andrew Bartlett
2011-07-19Second part of fix for bug 8310 - toupper_ascii() is broken on big-endian ↵Jeremy Allison1-1/+1
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
2011-06-09s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc()Andrew Bartlett1-2/+2
Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett
2011-05-31s3-param Move init_iconv() to loadparm.cAndrew Bartlett1-14/+0
This assists with some dependency loops Andrew Bartlett
2011-05-03lib/util/charset Use push_string and talloc_strupper/strlower from common codeAndrew Bartlett1-122/+0
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
2011-05-03s3-lib make push_ucs2() staticAndrew Bartlett1-1/+1
2011-04-28lib/util/charset Merge talloc-based pull and push charset functionsAndrew Bartlett1-115/+0
These were copied from source3/lib/charcnv.c Andrew Bartlett
2011-04-20lib/util/charset create _handle functions for convert_string() et alAndrew Bartlett1-12/+0
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
2011-04-14s3-lib Move unix_strlower and unix_strupper to their only users.Andrew Bartlett1-41/+0
2011-04-13s3-charcnv: Move convert_string() et al to lib/util/charsetAndrew Bartlett1-445/+1
This is the first step to this being the common convert_string implementation. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13lib/util ucs2_align is identical, put it in commonAndrew Bartlett1-7/+0
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13lib/util/charset Move source3/lib/util_unistr.c to the common code.Andrew Bartlett1-0/+39
This file (largely) contains functions to deal with UTF16 strings. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13s3-charcnv: make pull_ucs2 staticAndrew Bartlett1-1/+1
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-03-30Fix convert_string() to take a *converted_size arg. and return a bool.Jeremy Allison1-34/+40
Makes these interfaces much harder to misuse and easier to ensure error checking. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Mar 30 23:59:37 CEST 2011 on sn-devel-104
2011-03-30Change convert_string_internal() and convert_string_error() to bool return.Jeremy Allison1-51/+46
Move closer to makeing all convert_string_XXX functions return bool. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Mar 30 20:58:10 CEST 2011 on sn-devel-104
2011-03-30s3:lib make lazy_initialize_conv() staticAndrew Bartlett1-1/+1
2011-03-29charconv: Fix the slow-path character conversionsVolker Lendecke1-3/+3
This reverts a part of 0189087e257f. That one might have fixed the fast path, but it broke the slow path. convert_string_internal returns 0/-1 despite the size_t result type and the misleading comment. If you follow the path to smb_iconv and for example iconv_copy(), you will see that this routine returns 0 even after it copied something. How to check: Use German locale, and do an smbclient "allinfo" on a file modified in march (März in German). Notice the "ä". Before 0189087 this printed correctly, after 0189087 it cut off the fields after the M for März. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Tue Mar 29 19:17:41 CEST 2011 on sn-devel-104
2011-03-25Fix bug 8040 - smbclient segfaults when a Cyrillic netbios name or workgroup ↵Jeremy Allison1-2/+23
is configured. As discovered by David Disseldorp <ddiss@suse.de>, convert_string_talloc() doesn't always return consistent results for a zero length string. The API states an incoming string must *always* contain the terminating null, but unfotunately too much code expects passing in a zero source length to return a null terminated string, so at least ensure we return a correct null string in the required character set and return the correct length. Also ensure we cannot return a zero length for a converted string (we ensure that the returned buffer is always allocated and zero terminated anyway) as calling code depends on the fact that returning true from this function will *always* return a non-zero length (as it must include the terminating null). Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Mar 25 23:25:40 CET 2011 on sn-devel-104
2011-03-25s3-charcnv: fixed converted_size return in fast pathsAndrew Tridgell1-9/+20
2011-03-25s3-charcnv: removed unused functionAndrew Tridgell1-7/+0
lp_failed_convert_char() is not needed any more
2011-03-25lib/util/charset rename iconv_convenience to iconv_handleAndrew Bartlett1-7/+7
This better reflects what this structure is Andrew Bartlett
2011-03-25s3-charcnv: convert_string_internal() should not display errorsAndrew Tridgell1-31/+4
debug error display happens in the convert_string() outer function
2011-03-25s3-string: removed the conv_silent globalAndrew Tridgell1-29/+17
use convert_string_error() instead Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-03-25s3-charcnv Add convert_string_error()Andrew Bartlett1-18/+71
This function returns errors rather than printing them. Andrew Bartlett
2011-03-25s3-string: sec_len==-1 support is no longer neededAndrew Tridgell1-41/+20
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-03-25s3-lib: make pull_ucs2_base_talloc staticAndrew Tridgell1-6/+6
it is local to charcnv.c
2011-03-25s3-string: moved fstring functions into their own fileAndrew Tridgell1-105/+0
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-03-24s3-charcnv: remove unused labels.Günther Deschner1-6/+0
Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Thu Mar 24 23:54:25 CET 2011 on sn-devel-104
2011-03-24charcnv: removed the allow_badcharcnv and allow_bad_conv options to ↵Andrew Tridgell1-202/+26
convert_string*() we shouldn't accept bad multi-byte strings, it just hides problems Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Thu Mar 24 01:47:26 CET 2011 on sn-devel-104
2011-03-23s3-lib Remove the clobber_region() code.Andrew Bartlett1-68/+22
This code wrote to the full buffer in fstrcpy(), pstrcpy() and other fixed-length string manipulation functions. The hope of this code was to find out at run time if we were mixing up pstring and fstring etc, and to record where this came from. It has a runtime performance impact (particularly if compiled with --enable-developer). It is being removed because of the complexity it adds, and the distinct lack of bugs that this complexity has been credited in finding. The macro-based compile-time checking of string sizes remains. Andrew Bartlett
2011-03-14Fix bug #8005 - smbtorture4 BASE-TCONDEV fails when tested on SambaJeremy Allison1-2/+6
When pulling non-aligned ucs2 strings, we neglected to add in the pad byte to the buffer length we've eaten. This caused the device string in TCONX (which seems to be one of the few places that uses non-aligned ucs2 strings) to be incorrectly read. Volker please check. Jeremy.
2011-02-18lib/util/charset Add back setlocale(), but only when called from binariesAndrew Bartlett1-1/+1
When called from a library, we don't want to call this, as we may overwrite some of our calling program's context. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Feb 18 09:29:35 CET 2011 on sn-devel-104
2011-02-18lib/util/charcnv Move iconv handle setup in commonAndrew Bartlett1-290/+12
We now use the struct smb_iconv_convenience at the core of all our iconv code, and use global_iconv_convenience for the callers that don't specify one. Andrew Bartlett
2011-02-18s3-charcnv Don't genreate valid_table on the fly, rely on valid.datAndrew Bartlett1-9/+0
This file is always installed, and is only even required for the old, depricated mangle hash method. Andrew Bartlett
2011-02-18charset Remove use of {isupper,islower,toupper,tolower}_w functionsAndrew Bartlett1-1/+1
These now call the common _m functions that consider UTF16 code points. This removes the code which will make up a 'lame' table in memory, as this can just as correctly be handled by running the algorithm at runtime (which is to call toupper() and tolower() on characters < 128). When used, a top level waf build will always locate the correct table - in the build tree or outside - due to relinking the installed binary. Andrew Bartlett
2010-11-03s3:lib/charcnv: clarify comments in next_codepoint_ext()Michael Adam1-2/+2
(giving the unicod U+<hexnumber> notation of the codepoints referred to in the comments)
2010-11-03s3:lib/charcnv: rename a parameter for clarity in next_codepoint_ext()Michael Adam1-5/+5
2010-11-03s3:lib/charcnv: reformat comments in next_codepoint_ext()Michael Adam1-12/+18
2010-11-03s3:lib/charcnv: add next_codepoint_ext() that accepts input charset.Michael Adam1-11/+32
next_codepoint() takes as string in CH_UNIX encoding and returns the unicode codepoint of the next (possibly multibyte) character of the input string. The new next_codepoint_ext() function adds the encoding of the input string as a parameter. next_codepoint() now only calls next_codepoint_ext() with CH_UNIX als src_charset argument.
2009-07-25Use a switch statement in charset_name()Volker Lendecke1-8/+24
2009-07-16Replace short-lived NULL talloc contexts with talloc_tos().Jeremy Allison1-4/+4
Jeremy.
2009-06-10Make ctemp async. Fix the test to pass against W2K3.Jeremy Allison1-3/+1
Jeremy.
2009-06-08s3-charcnv: always talloc_free in convert_string_talloc() error path.Günther Deschner1-2/+1
Guenther
2009-06-08s3-charcnv: remove remaining malloc references in convert_string_talloc().Günther Deschner1-2/+2
Guenther
2009-05-02Fix a malloc/talloc mixupVolker Lendecke1-1/+1