summaryrefslogtreecommitdiffstats
path: root/source3/lib/charcnv.c
Commit message (Collapse)AuthorAgeFilesLines
* Second part of fix for bug 8310 - toupper_ascii() is broken on big-endian ↵Jeremy Allison2011-07-191-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
* s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc()Andrew Bartlett2011-06-091-2/+2
| | | | | | | Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett
* s3-param Move init_iconv() to loadparm.cAndrew Bartlett2011-05-311-14/+0
| | | | | | This assists with some dependency loops Andrew Bartlett
* lib/util/charset Use push_string and talloc_strupper/strlower from common codeAndrew Bartlett2011-05-031-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
* s3-lib make push_ucs2() staticAndrew Bartlett2011-05-031-1/+1
|
* lib/util/charset Merge talloc-based pull and push charset functionsAndrew Bartlett2011-04-281-115/+0
| | | | | | These were copied from source3/lib/charcnv.c Andrew Bartlett
* lib/util/charset create _handle functions for convert_string() et alAndrew Bartlett2011-04-201-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
* s3-lib Move unix_strlower and unix_strupper to their only users.Andrew Bartlett2011-04-141-41/+0
|
* s3-charcnv: Move convert_string() et al to lib/util/charsetAndrew Bartlett2011-04-131-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>
* lib/util ucs2_align is identical, put it in commonAndrew Bartlett2011-04-131-7/+0
| | | | Signed-off-by: Andrew Tridgell <tridge@samba.org>
* lib/util/charset Move source3/lib/util_unistr.c to the common code.Andrew Bartlett2011-04-131-0/+39
| | | | | | | | This file (largely) contains functions to deal with UTF16 strings. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
* s3-charcnv: make pull_ucs2 staticAndrew Bartlett2011-04-131-1/+1
| | | | Signed-off-by: Andrew Tridgell <tridge@samba.org>
* Fix convert_string() to take a *converted_size arg. and return a bool.Jeremy Allison2011-03-301-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
* Change convert_string_internal() and convert_string_error() to bool return.Jeremy Allison2011-03-301-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
* s3:lib make lazy_initialize_conv() staticAndrew Bartlett2011-03-301-1/+1
|
* charconv: Fix the slow-path character conversionsVolker Lendecke2011-03-291-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
* Fix bug 8040 - smbclient segfaults when a Cyrillic netbios name or workgroup ↵Jeremy Allison2011-03-251-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
* s3-charcnv: fixed converted_size return in fast pathsAndrew Tridgell2011-03-251-9/+20
|
* s3-charcnv: removed unused functionAndrew Tridgell2011-03-251-7/+0
| | | | lp_failed_convert_char() is not needed any more
* lib/util/charset rename iconv_convenience to iconv_handleAndrew Bartlett2011-03-251-7/+7
| | | | | | This better reflects what this structure is Andrew Bartlett
* s3-charcnv: convert_string_internal() should not display errorsAndrew Tridgell2011-03-251-31/+4
| | | | debug error display happens in the convert_string() outer function
* s3-string: removed the conv_silent globalAndrew Tridgell2011-03-251-29/+17
| | | | | | use convert_string_error() instead Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* s3-charcnv Add convert_string_error()Andrew Bartlett2011-03-251-18/+71
| | | | | | This function returns errors rather than printing them. Andrew Bartlett
* s3-string: sec_len==-1 support is no longer neededAndrew Tridgell2011-03-251-41/+20
| | | | Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* s3-lib: make pull_ucs2_base_talloc staticAndrew Tridgell2011-03-251-6/+6
| | | | it is local to charcnv.c
* s3-string: moved fstring functions into their own fileAndrew Tridgell2011-03-251-105/+0
| | | | Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
* s3-charcnv: remove unused labels.Günther Deschner2011-03-241-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
* charcnv: removed the allow_badcharcnv and allow_bad_conv options to ↵Andrew Tridgell2011-03-241-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
* s3-lib Remove the clobber_region() code.Andrew Bartlett2011-03-231-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
* Fix bug #8005 - smbtorture4 BASE-TCONDEV fails when tested on SambaJeremy Allison2011-03-141-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.
* lib/util/charset Add back setlocale(), but only when called from binariesAndrew Bartlett2011-02-181-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
* lib/util/charcnv Move iconv handle setup in commonAndrew Bartlett2011-02-181-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
* s3-charcnv Don't genreate valid_table on the fly, rely on valid.datAndrew Bartlett2011-02-181-9/+0
| | | | | | | This file is always installed, and is only even required for the old, depricated mangle hash method. Andrew Bartlett
* charset Remove use of {isupper,islower,toupper,tolower}_w functionsAndrew Bartlett2011-02-181-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
* s3:lib/charcnv: clarify comments in next_codepoint_ext()Michael Adam2010-11-031-2/+2
| | | | | (giving the unicod U+<hexnumber> notation of the codepoints referred to in the comments)
* s3:lib/charcnv: rename a parameter for clarity in next_codepoint_ext()Michael Adam2010-11-031-5/+5
|
* s3:lib/charcnv: reformat comments in next_codepoint_ext()Michael Adam2010-11-031-12/+18
|
* s3:lib/charcnv: add next_codepoint_ext() that accepts input charset.Michael Adam2010-11-031-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.
* Use a switch statement in charset_name()Volker Lendecke2009-07-251-8/+24
|
* Replace short-lived NULL talloc contexts with talloc_tos().Jeremy Allison2009-07-161-4/+4
| | | | Jeremy.
* Make ctemp async. Fix the test to pass against W2K3.Jeremy Allison2009-06-101-3/+1
| | | | Jeremy.
* s3-charcnv: always talloc_free in convert_string_talloc() error path.Günther Deschner2009-06-081-2/+1
| | | | Guenther
* s3-charcnv: remove remaining malloc references in convert_string_talloc().Günther Deschner2009-06-081-2/+2
| | | | Guenther
* Fix a malloc/talloc mixupVolker Lendecke2009-05-021-1/+1
|
* s3-auth-charcnv: fix push_string(). Don't push to ucs2 and ascii after another.Günther Deschner2009-04-271-1/+2
| | | | | | | This fixes all kinds of encrypted passwords used in the shared auth code naturally. Andrew B., please check. Guenther
* charcnv: Import push_codepoint().Jelmer Vernooij2009-04-231-0/+61
|
* Make Samba3 use the new common libcli/auth codeAndrew Bartlett2009-04-141-0/+38
| | | | | This is particuarly in the netlogon client (but not server at this stage)
* s3:charcnv remove now unused malloc() based conversion functionsAndrew Bartlett2009-04-141-39/+0
|
* Convert Samba3 to use the common lib/util/charset APIAndrew Bartlett2009-04-141-205/+43
| | | | | | | | | | | | This removes calls to push_*_allocate() and pull_*_allocate(), as well as convert_string_allocate, as they are not in the common API To allow transition to a common charcnv in future, provide Samba4-like strupper functions in source3/lib/charcnv.c (the actual implementation remains distinct, but the API is now shared) Andrew Bartlett
* Solve some of the conflict between Samba3 and Samba4 push_stringAndrew Bartlett2009-04-141-5/+43
| | | | | | | | This renames push_string in Samba3 into push_string_base and push_string_check for the two different use cases. This should allow push_string to be imported from Samba4, using it's calling conventions.