summaryrefslogtreecommitdiff
path: root/source3/lib/charcnv.c
AgeCommit message (Collapse)AuthorFilesLines
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
2009-04-27s3-auth-charcnv: fix push_string(). Don't push to ucs2 and ascii after another.Günther Deschner1-1/+2
This fixes all kinds of encrypted passwords used in the shared auth code naturally. Andrew B., please check. Guenther
2009-04-23charcnv: Import push_codepoint().Jelmer Vernooij1-0/+61
2009-04-14Make Samba3 use the new common libcli/auth codeAndrew Bartlett1-0/+38
This is particuarly in the netlogon client (but not server at this stage)
2009-04-14s3:charcnv remove now unused malloc() based conversion functionsAndrew Bartlett1-39/+0
2009-04-14Convert Samba3 to use the common lib/util/charset APIAndrew Bartlett1-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
2009-04-14Solve some of the conflict between Samba3 and Samba4 push_stringAndrew Bartlett1-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.
2009-03-31Tidy up some convert_string_internal error cases, found by Andrew Bartlett.Jeremy Allison1-6/+19
Jeremy.
2009-03-08Revert accidental reintroduction of void ** bug.Jelmer Vernooij1-1/+1
2009-03-01Use common header file for character set handling in Samba 3 and Samba 4.Jelmer Vernooij1-1/+1
2009-01-12Even for srclen == 0 we have to return somethingVolker Lendecke1-0/+6
This fixes a regression reported by Corinna Vinschen <corinna@vinschen.de> Thanks, Volker
2008-10-16Fix bug 5826 - Directory/Filenames get truncated when 3.2.0 client acesses ↵Jeremy Allison1-13/+45
old server. There was some code in pull_ucs2_base_talloc() to cope with this case which hadn't been added to pull_ascii_base_talloc(). The older Samba returns non unicode names which is why you are seeing this codepath being executed. Unify the logic in pull_ascii_base_talloc() and pull_ucs2_base_talloc(). Jeremy.
2008-08-12Fix bug 5686 - libsmbclient segfaults with more than one SMBCCTX.Jeremy Allison1-3/+3
Here is a patch to allow many subsystems to be re-initialized. The only functional change I made was to remove the null context tracking, as the memory allocated here is designed to be left for the complete lifetime of the program. Freeing this early (when all smb contexts are destroyed) could crash other users of talloc. Jeremy. (This used to be commit 8c630efd25cf17aff59448ca05c1b44a41964b16)
2008-05-20Cleanup size_t return values in callers of convert_string_allocateTim Prouty1-124/+143
This patch is the second iteration of an inside-out conversion to cleanup functions in charcnv.c returning size_t == -1 to indicate failure. (This used to be commit 6b189dabc562d86dcaa685419d0cb6ea276f100d)
2008-04-11Cleanup size_t return values in convert_string_allocateTim Prouty1-58/+76
This patch is the first iteration of an inside-out conversion to cleanup functions in charcnv.c returning size_t == -1 to indicate failure. (This used to be commit 59124382d2894a1b194b48dd82bc5f956959eb48)
2008-04-10charcnv: add talloc_strdup_lower() - talloc variant of strdup_lower().Michael Adam1-0/+26
Michael (This used to be commit 5f6c730cbeddd1ac2f515bd985c08ceb4ca9bc47)
2008-02-01Ensure that convert_string_allocate() allocates 2 extraJeremy Allison1-6/+14
bytes and null terminates them to ensure NDR wire-reads of string types are always null terminated. Bug found by Volker after great pain :-). Jeremy. (This used to be commit aab736e6079729b3f3ab653674834e3f1305d456)
2008-01-09Fixup hot paths - add macro for toupper (c < 0x80).Jeremy Allison1-6/+12
This now matches 3.0.x on my micro-tests. Jeremy. (This used to be commit 329b924cba8225002ca40db26c45b31d141a0925)
2007-12-16Make init_doschar_table() staticVolker Lendecke1-1/+0
It's only called directly before init_valid_table() anyway, so move it there. (This used to be commit b6d1d2428866712a550a354732e2386b4f87b67b)
2007-12-06Remove pstrings from client/client.c by doing a large rewrite.Jeremy Allison1-4/+9
Mostly compiles.... Jeremy. (This used to be commit c87f3eba9aa52f4ab25d77e2167262bf5c43b1a6)
2007-12-04pull_ascii_pstring is gone.Jeremy Allison1-6/+0
Jeremy. (This used to be commit 288aacce4b56d159218be311019cb951e5a232fd)
2007-12-04Allow STR_TERMINATE and -1 src_len for pull_ucs2_base_talloc().Jeremy Allison1-1/+7
Jeremy. (This used to be commit 063358d87ac9a1d948c8d4b6358e926dd14bb3ac)