summaryrefslogtreecommitdiff
path: root/librpc/ndr/ndr_string.c
AgeCommit message (Collapse)AuthorFilesLines
2011-06-01Fix type mixing warnings.Jeremy Allison1-2/+2
2011-06-01librpc/ndr: Use converted_size to determine if NULL termination was sentAndrew Bartlett1-4/+10
This is better than doing a strlen() on the string, as that huristic only worked for ASCII strings. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Jun 1 01:42:22 CEST 2011 on sn-devel-104
2011-06-01librpc/ndr: add new LIBNDR_FLAG_STR_RAW8 for ndr_pull_stringSean Finney1-8/+38
Introduce a new flag, LIBNDR_FLAG_STR_RAW8, which indicates that libndr should not attempt to convert the corresponding byte sequence, and place the responsibility on the caller to do so later. This is needed in cases where the string is known to be 8-bit and either NULL terminated or of known length, but in an unspecified character set. For example, when pulling PT_STRING8 properties from an exchange server via libmapi + libndr, the codepage is neither known nor in the control of the caller, and is determined by subsequent properties requested from the server. Therefore the client would like to fetch all properties in one large batch, and convert the resulting strings locally. This commit also includes some (basic) tests of each of the flags' respective behaviors with the ndr push/pull string functions, in a new source4 torture test suite ndr.ndr_string. Signed-off-by: Sean Finney <seanius@seanius.net>
2011-06-01librpc/ndr: consolidate string conversion logic in ndr_pull_stringSean Finney1-171/+44
Reduce the amount of duplicate code in ndr_pull_string by moving the almost duplicate conversion calls and their corresponding NDR pulls and checks to a single location. In the place of the removed calls is logic allowing the conversion to be generalized, and and any specific pulls/checks that do not apply to the general case. This is similar to what has already been done in the switch statement for ndr_push_string. Signed-off-by: Sean Finney <seanius@seanius.net>
2011-03-30Fix convert_string() to take a *converted_size arg. and return a bool.Jeremy Allison1-6/+6
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-30This doesn't look like it has anything to do with character set conversion, ↵Jeremy Allison1-7/+10
but it does :-). Turns out one of the *really* significant differences between convert_string() in source4 and source3, is that the one in source3 will return 0 for byte length converted when called with dest_len = 0 whereas the one in source4 returns (size_t)-1 and sets errno to E2BIG. Allow the ndr_string code to cope with the (arguably correct) way that the source4 implementation works. This code only gets excercised in the print spooler tests, which aren't run in source4, which is why this bug has lasted for so long. You don't want to know how long it took me to find this :-). Jeremy.
2011-03-24charcnv: removed the allow_badcharcnv and allow_bad_conv options to ↵Andrew Tridgell1-10/+10
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
2010-11-03librpc/ndr: use new strlen_m_ext_term() in ndr_charset_length(): fix bug #7594Michael Adam1-2/+2
This fixes the calculation of needed space for destination unicode charset. Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Wed Nov 3 23:28:07 UTC 2010 on sn-devel-104
2010-10-05ndr: Handle the case of string array with all null terminated stringsMatthieu Patou1-4/+16
2010-08-30librpc/ndr: correctly implement ndr_charset_length()Stefan Metzmacher1-2/+14
Before we ignored the charset type. metze
2010-05-20librpc: finally merge ndr_string.c.Günther Deschner1-0/+720
Guenther