From 15e84a9a09c5a86416e964a3258ee35718fbf45a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 24 Mar 2011 10:59:41 +1100 Subject: charcnv: removed the allow_badcharcnv and allow_bad_conv options to convert_string*() we shouldn't accept bad multi-byte strings, it just hides problems Autobuild-User: Andrew Tridgell Autobuild-Date: Thu Mar 24 01:47:26 CET 2011 on sn-devel-104 --- lib/tdr/tdr.c | 4 +- lib/util/charset/charcnv.c | 16 +- lib/util/charset/charset.h | 16 +- lib/util/charset/tests/iconv.c | 6 +- lib/util/charset/util_unistr.c | 42 +++-- libcli/auth/msrpc_parse.c | 4 +- libcli/auth/ntlm_check.c | 2 +- libcli/auth/smbencrypt.c | 3 +- libgpo/gpo_ini.c | 2 +- librpc/ndr/ndr_drsuapi.c | 2 +- librpc/ndr/ndr_string.c | 20 +-- source3/include/proto.h | 2 +- source3/lib/charcnv.c | 228 +++---------------------- source3/lib/dprintf.c | 2 +- source3/lib/eventlog/eventlog.c | 2 +- source3/lib/smbldap.c | 2 +- source3/lib/tldap_util.c | 9 +- source3/libsmb/clifile.c | 7 +- source3/libsmb/climessage.c | 6 +- source3/libsmb/clirap.c | 5 +- source3/libsmb/clitrans.c | 2 +- source3/passdb/pdb_ads.c | 5 +- source3/registry/reg_parse.c | 2 +- source3/rpc_server/lsa/srv_lsa_nt.c | 3 +- source3/smbd/mangle_hash2.c | 2 +- source3/smbd/message.c | 2 +- source3/smbd/smb2_create.c | 2 +- source3/smbd/smb2_find.c | 2 +- source3/smbd/smb2_ioctl.c | 2 +- source3/smbd/smb2_tcon.c | 2 +- source3/torture/utable.c | 4 +- source3/utils/ntlm_auth_diagnostics.c | 2 +- source3/web/cgi.c | 8 +- source4/dsdb/samdb/ldb_modules/password_hash.c | 6 +- source4/dsdb/samdb/ldb_modules/samldb.c | 2 +- source4/dsdb/schema/schema_syntax.c | 10 +- source4/kdc/kpasswdd.c | 4 +- source4/lib/registry/ldb.c | 5 +- source4/lib/registry/patchfile_dotreg.c | 4 +- source4/lib/registry/tests/generic.c | 6 +- source4/lib/registry/util.c | 4 +- source4/libcli/raw/rawfileinfo.c | 2 +- source4/libcli/raw/rawrequest.c | 8 +- source4/libcli/smb2/request.c | 5 +- source4/libnet/libnet_samdump.c | 2 +- source4/rpc_server/samr/samr_password.c | 6 +- source4/smb_server/smb/request.c | 4 +- source4/torture/basic/charset.c | 2 +- source4/torture/basic/utable.c | 4 +- source4/torture/rpc/forest_trust.c | 3 +- source4/torture/rpc/samlogon.c | 2 +- source4/torture/rpc/winreg.c | 3 +- 52 files changed, 152 insertions(+), 348 deletions(-) diff --git a/lib/tdr/tdr.c b/lib/tdr/tdr.c index ab016d0bc4..8ce238bf8b 100644 --- a/lib/tdr/tdr.c +++ b/lib/tdr/tdr.c @@ -163,7 +163,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, TDR_PULL_NEED_BYTES(tdr, el_size*length); - if (!convert_string_talloc(ctx, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), &ret, false)) { + if (!convert_string_talloc(ctx, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), &ret)) { return NT_STATUS_INVALID_PARAMETER; } @@ -183,7 +183,7 @@ NTSTATUS tdr_push_charset(struct tdr_push *tdr, const char **v, uint32_t length, required = el_size * length; TDR_PUSH_NEED_BYTES(tdr, required); - ret = convert_string(CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, false); + ret = convert_string(CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required); if (ret == -1) { return NT_STATUS_INVALID_PARAMETER; } diff --git a/lib/util/charset/charcnv.c b/lib/util/charset/charcnv.c index 7fed7555c5..1e1f2a350e 100644 --- a/lib/util/charset/charcnv.c +++ b/lib/util/charset/charcnv.c @@ -123,10 +123,9 @@ convert: * @returns the number of bytes occupied in the destination **/ _PUBLIC_ bool convert_string_convenience(struct smb_iconv_convenience *ic, - charset_t from, charset_t to, - void const *src, size_t srclen, - void *dest, size_t destlen, size_t *converted_size, - bool allow_badcharcnv) + charset_t from, charset_t to, + void const *src, size_t srclen, + void *dest, size_t destlen, size_t *converted_size) { size_t i_len, o_len; size_t retval; @@ -191,11 +190,10 @@ _PUBLIC_ bool convert_string_convenience(struct smb_iconv_convenience *ic, **/ _PUBLIC_ bool convert_string_talloc_convenience(TALLOC_CTX *ctx, - struct smb_iconv_convenience *ic, - charset_t from, charset_t to, - void const *src, size_t srclen, - void *dst, size_t *converted_size, - bool allow_badcharcnv) + struct smb_iconv_convenience *ic, + charset_t from, charset_t to, + void const *src, size_t srclen, + void *dst, size_t *converted_size) { void **dest = (void **)dst; smb_iconv_t descriptor; diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h index 943bfa4695..494a4ebc1a 100644 --- a/lib/util/charset/charset.h +++ b/lib/util/charset/charset.h @@ -155,14 +155,13 @@ ssize_t push_string(void *dest, const char *src, size_t dest_len, int flags); ssize_t pull_string(char *dest, const void *src, size_t dest_len, size_t src_len, int flags); bool convert_string_talloc(TALLOC_CTX *ctx, - charset_t from, charset_t to, - void const *src, size_t srclen, - void *dest, size_t *converted_size, - bool allow_badcharcnv); + charset_t from, charset_t to, + void const *src, size_t srclen, + void *dest, size_t *converted_size); size_t convert_string(charset_t from, charset_t to, - void const *src, size_t srclen, - void *dest, size_t destlen, bool allow_badcharcnv); + void const *src, size_t srclen, + void *dest, size_t destlen); ssize_t iconv_talloc(TALLOC_CTX *mem_ctx, smb_iconv_t cd, @@ -206,13 +205,12 @@ struct smb_iconv_convenience *smb_iconv_convenience_reinit(TALLOC_CTX *mem_ctx, bool convert_string_convenience(struct smb_iconv_convenience *ic, charset_t from, charset_t to, void const *src, size_t srclen, - void *dest, size_t destlen, size_t *converted_size, - bool allow_badcharcnv); + void *dest, size_t destlen, size_t *converted_size); bool convert_string_talloc_convenience(TALLOC_CTX *ctx, struct smb_iconv_convenience *ic, charset_t from, charset_t to, void const *src, size_t srclen, - void *dest, size_t *converted_size, bool allow_badcharcnv); + void *dest, size_t *converted_size); /* iconv */ smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode); int smb_iconv_close(smb_iconv_t cd); diff --git a/lib/util/charset/tests/iconv.c b/lib/util/charset/tests/iconv.c index a1a0d97a7e..9b48771b16 100644 --- a/lib/util/charset/tests/iconv.c +++ b/lib/util/charset/tests/iconv.c @@ -419,7 +419,7 @@ static bool test_string2key(struct torture_context *tctx) torture_comment(tctx, "converting random buffer\n"); - if (!convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)buf, len*2, (void**)&dest, &ret, false)) { + if (!convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)buf, len*2, (void**)&dest, &ret)) { torture_fail(tctx, "Failed to convert random buffer\n"); } @@ -429,7 +429,7 @@ static bool test_string2key(struct torture_context *tctx) torture_comment(tctx, "converting fixed buffer to UTF16\n"); - if (!convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF16, (void *)le1, 20, (void**)&munged1, &ret, false)) { + if (!convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF16, (void *)le1, 20, (void**)&munged1, &ret)) { torture_fail(tctx, "Failed to convert fixed buffer to UTF16_MUNGED\n"); } @@ -437,7 +437,7 @@ static bool test_string2key(struct torture_context *tctx) torture_comment(tctx, "converting fixed buffer to UTF8\n"); - if (!convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)le1, 20, (void**)&out1, &ret, false)) { + if (!convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)le1, 20, (void**)&out1, &ret)) { torture_fail(tctx, "Failed to convert fixed buffer to UTF8\n"); } diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c index ad2ba687f4..c59620ed32 100644 --- a/lib/util/charset/util_unistr.c +++ b/lib/util/charset/util_unistr.c @@ -370,7 +370,7 @@ static ssize_t push_ascii(void *dest, const char *src, size_t dest_len, int flag if (flags & (STR_TERMINATE | STR_TERMINATE_ASCII)) src_len++; - return convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len, false); + return convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len); } /** @@ -386,7 +386,7 @@ _PUBLIC_ bool push_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src, s { size_t src_len = strlen(src)+1; *dest = NULL; - return convert_string_talloc(ctx, CH_UNIX, CH_DOS, src, src_len, (void **)dest, converted_size, false); + return convert_string_talloc(ctx, CH_UNIX, CH_DOS, src, src_len, (void **)dest, converted_size); } @@ -420,7 +420,7 @@ static ssize_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t s } } - ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len, false); + ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len); if (dest_len) dest[MIN(ret, dest_len-1)] = 0; @@ -473,7 +473,7 @@ static ssize_t push_ucs2(void *dest, const char *src, size_t dest_len, int flags /* ucs2 is always a multiple of 2 bytes */ dest_len &= ~1; - ret = convert_string(CH_UNIX, CH_UTF16, src, src_len, dest, dest_len, false); + ret = convert_string(CH_UNIX, CH_UTF16, src, src_len, dest, dest_len); if (ret == (size_t)-1) { return 0; } @@ -497,7 +497,7 @@ _PUBLIC_ bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *s { size_t src_len = strlen(src)+1; *dest = NULL; - return convert_string_talloc(ctx, CH_UNIX, CH_UTF16, src, src_len, (void **)dest, converted_size, false); + return convert_string_talloc(ctx, CH_UNIX, CH_UTF16, src, src_len, (void **)dest, converted_size); } @@ -513,7 +513,7 @@ _PUBLIC_ bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src, si { size_t src_len = strlen(src)+1; *dest = NULL; - return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void **)dest, converted_size, false); + return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void **)dest, converted_size); } /** @@ -549,7 +549,7 @@ static size_t pull_ucs2(char *dest, const void *src, size_t dest_len, size_t src if (src_len != (size_t)-1) src_len &= ~1; - ret = convert_string(CH_UTF16, CH_UNIX, src, src_len, dest, dest_len, false); + ret = convert_string(CH_UTF16, CH_UNIX, src, src_len, dest, dest_len); if (dest_len) dest[MIN(ret, dest_len-1)] = 0; @@ -568,7 +568,7 @@ _PUBLIC_ bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src, s { size_t src_len = strlen(src)+1; *dest = NULL; - return convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, (void **)dest, converted_size, false); + return convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, (void **)dest, converted_size); } /** @@ -583,7 +583,7 @@ _PUBLIC_ bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *s { size_t src_len = utf16_len(src); *dest = NULL; - return convert_string_talloc(ctx, CH_UTF16, CH_UNIX, src, src_len, (void **)dest, converted_size, false); + return convert_string_talloc(ctx, CH_UTF16, CH_UNIX, src, src_len, (void **)dest, converted_size); } /** @@ -598,7 +598,7 @@ _PUBLIC_ bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src, si { size_t src_len = strlen(src)+1; *dest = NULL; - return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, (void **)dest, converted_size, false); + return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, (void **)dest, converted_size); } /** @@ -665,15 +665,13 @@ _PUBLIC_ ssize_t pull_string(char *dest, const void *src, size_t dest_len, size_ * @returns the number of bytes occupied in the destination **/ _PUBLIC_ size_t convert_string(charset_t from, charset_t to, - void const *src, size_t srclen, - void *dest, size_t destlen, - bool allow_badcharcnv) + void const *src, size_t srclen, + void *dest, size_t destlen) { size_t ret; if (!convert_string_convenience(get_iconv_convenience(), from, to, - src, srclen, - dest, destlen, &ret, - allow_badcharcnv)) + src, srclen, + dest, destlen, &ret)) return -1; return ret; } @@ -690,14 +688,12 @@ _PUBLIC_ size_t convert_string(charset_t from, charset_t to, **/ _PUBLIC_ bool convert_string_talloc(TALLOC_CTX *ctx, - charset_t from, charset_t to, - void const *src, size_t srclen, - void *dest, size_t *converted_size, - bool allow_badcharcnv) + charset_t from, charset_t to, + void const *src, size_t srclen, + void *dest, size_t *converted_size) { return convert_string_talloc_convenience(ctx, get_iconv_convenience(), - from, to, src, srclen, dest, - converted_size, - allow_badcharcnv); + from, to, src, srclen, dest, + converted_size); } diff --git a/libcli/auth/msrpc_parse.c b/libcli/auth/msrpc_parse.c index 7ac6fb57b2..1351dfaae7 100644 --- a/libcli/auth/msrpc_parse.c +++ b/libcli/auth/msrpc_parse.c @@ -264,7 +264,7 @@ bool msrpc_parse(TALLOC_CTX *mem_ctx, size_t pull_len; if (!convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, blob->data + ptr, len1, - ps, &pull_len, false)) { + ps, &pull_len)) { ret = false; goto cleanup; } @@ -300,7 +300,7 @@ bool msrpc_parse(TALLOC_CTX *mem_ctx, if (!convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, blob->data + ptr, len1, - ps, &pull_len, false)) { + ps, &pull_len)) { ret = false; goto cleanup; } diff --git a/libcli/auth/ntlm_check.c b/libcli/auth/ntlm_check.c index da16ce2fb0..9cbd49595f 100644 --- a/libcli/auth/ntlm_check.c +++ b/libcli/auth/ntlm_check.c @@ -322,7 +322,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, if (lm_response->length && (convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, lm_response->data, lm_response->length, - (void *)&unix_pw, NULL, false))) { + (void *)&unix_pw, NULL))) { if (E_deshash(unix_pw, client_lm.hash)) { lm_ok = true; } else { diff --git a/libcli/auth/smbencrypt.c b/libcli/auth/smbencrypt.c index f7c60e7de1..3274f113c2 100644 --- a/libcli/auth/smbencrypt.c +++ b/libcli/auth/smbencrypt.c @@ -596,8 +596,7 @@ bool decode_pw_buffer(TALLOC_CTX *ctx, &in_buffer[512 - byte_len], byte_len, (void *)pp_new_pwrd, - new_pw_len, - false)) { + new_pw_len)) { DEBUG(0, ("decode_pw_buffer: failed to convert incoming password\n")); return false; } diff --git a/libgpo/gpo_ini.c b/libgpo/gpo_ini.c index 7df56a81b0..a4bff0e86b 100644 --- a/libgpo/gpo_ini.c +++ b/libgpo/gpo_ini.c @@ -88,7 +88,7 @@ static NTSTATUS convert_file_from_ucs2(TALLOC_CTX *mem_ctx, } if (!convert_string_talloc(mem_ctx, CH_UTF16LE, CH_UNIX, data_in, n, - (void *)&data_out, &converted_size, false)) + (void *)&data_out, &converted_size)) { status = NT_STATUS_INVALID_BUFFER_SIZE; goto out; diff --git a/librpc/ndr/ndr_drsuapi.c b/librpc/ndr/ndr_drsuapi.c index 86ecdcb861..35216ff19d 100644 --- a/librpc/ndr/ndr_drsuapi.c +++ b/librpc/ndr/ndr_drsuapi.c @@ -109,7 +109,7 @@ static void _print_drsuapi_DsAttributeValue_str(struct ndr_print *ndr, const cha CH_UTF16, CH_UNIX, r->blob->data, r->blob->length, - (void **)&str, NULL, false)) { + (void **)&str, NULL)) { ndr_print_string(ndr, "string", "INVALID CONVERSION"); } else { ndr_print_string(ndr, "string", str); diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 610676cf78..402cf4e4ad 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -86,7 +86,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->data+ndr->offset, (len2 + c_len_term)*byte_mul, (void **)(void *)&as, - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion with flags 0x%x", flags); @@ -124,7 +124,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, (void **)(void *)&as, - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion with flags 0x%x", flags); @@ -163,7 +163,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, (void **)(void *)&as, - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion with flags 0x%x", flags); @@ -198,7 +198,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, ndr->data+ndr->offset, (len3 + c_len_term)*byte_mul, (void **)(void *)&as, - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion with flags 0x%x", flags); @@ -230,7 +230,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, CH_UNIX, ndr->data+ndr->offset, len3, (void **)(void *)&as, - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion with flags 0x%x", flags); @@ -249,7 +249,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, len1, (void **)(void *)&as, - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion with flags 0x%x", flags); @@ -274,7 +274,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, CH_UNIX, ndr->data+ndr->offset, len1, (void **)(void *)&as, - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion with flags 0x%x", flags); @@ -334,7 +334,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, s_len++; } if (!convert_string_talloc(ndr, CH_UNIX, chset, s, s_len, - (void **)(void *)&dest, &d_len, false)) + (void **)(void *)&dest, &d_len)) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character push conversion with flags 0x%x", flags); @@ -684,7 +684,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, length*byte_mul, discard_const_p(void *, var), - &converted_size, false)) + &converted_size)) { return ndr_pull_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -707,7 +707,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, NDR_PUSH_NEED_BYTES(ndr, required); ret = convert_string(CH_UNIX, chset, var, strlen(var), - ndr->data+ndr->offset, required, false); + ndr->data+ndr->offset, required); if (ret == -1) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); diff --git a/source3/include/proto.h b/source3/include/proto.h index d166813467..8e1bcc6417 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -415,7 +415,7 @@ void gfree_charcnv(void); void init_iconv(void); size_t convert_string(charset_t from, charset_t to, void const *src, size_t srclen, - void *dest, size_t destlen, bool allow_bad_conv); + void *dest, size_t destlen); size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen); char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s); char *strupper_talloc(TALLOC_CTX *ctx, const char *s); diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 1779c4fbf7..6addc90e22 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -88,7 +88,6 @@ void init_iconv(void) * @param srclen length of the source string in bytes * @param dest pointer to destination string (multibyte or singlebyte) * @param destlen maximal length allowed for string - * @param allow_bad_conv determines if a "best effort" conversion is acceptable (never returns errors) * @returns the number of bytes occupied in the destination * * Ensure the srclen contains the terminating zero. @@ -97,7 +96,7 @@ void init_iconv(void) static size_t convert_string_internal(charset_t from, charset_t to, void const *src, size_t srclen, - void *dest, size_t destlen, bool allow_bad_conv) + void *dest, size_t destlen) { size_t i_len, o_len; size_t retval; @@ -138,8 +137,6 @@ static size_t convert_string_internal(charset_t from, charset_t to, reason="Incomplete multibyte sequence"; if (!conv_silent) DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf)); - if (allow_bad_conv) - goto use_as_is; return (size_t)-1; case E2BIG: reason="No more room"; @@ -159,9 +156,6 @@ static size_t convert_string_internal(charset_t from, charset_t to, reason="Illegal multibyte sequence"; if (!conv_silent) DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf)); - if (allow_bad_conv) - goto use_as_is; - return (size_t)-1; default: if (!conv_silent) @@ -171,87 +165,6 @@ static size_t convert_string_internal(charset_t from, charset_t to, /* smb_panic(reason); */ } return destlen-o_len; - - use_as_is: - - /* - * Conversion not supported. This is actually an error, but there are so - * many misconfigured iconv systems and smb.conf's out there we can't just - * fail. Do a very bad conversion instead.... JRA. - */ - - { - if (o_len == 0 || i_len == 0) - return destlen - o_len; - - if (((from == CH_UTF16LE)||(from == CH_UTF16BE)) && - ((to != CH_UTF16LE)||(to != CH_UTF16BE))) { - /* Can't convert from utf16 any endian to multibyte. - Replace with the default fail char. - */ - if (i_len < 2) - return destlen - o_len; - if (i_len >= 2) { - *outbuf = lp_failed_convert_char(); - - outbuf++; - o_len--; - - inbuf += 2; - i_len -= 2; - } - - if (o_len == 0 || i_len == 0) - return destlen - o_len; - - /* Keep trying with the next char... */ - goto again; - - } else if (from != CH_UTF16LE && from != CH_UTF16BE && to == CH_UTF16LE) { - /* Can't convert to UTF16LE - just widen by adding the - default fail char then zero. - */ - if (o_len < 2) - return destlen - o_len; - - outbuf[0] = lp_failed_convert_char(); - outbuf[1] = '\0'; - - inbuf++; - i_len--; - - outbuf += 2; - o_len -= 2; - - if (o_len == 0 || i_len == 0) - return destlen - o_len; - - /* Keep trying with the next char... */ - goto again; - - } else if (from != CH_UTF16LE && from != CH_UTF16BE && - to != CH_UTF16LE && to != CH_UTF16BE) { - /* Failed multibyte to multibyte. Just copy the default fail char and - try again. */ - outbuf[0] = lp_failed_convert_char(); - - inbuf++; - i_len--; - - outbuf++; - o_len--; - - if (o_len == 0 || i_len == 0) - return destlen - o_len; - - /* Keep trying with the next char... */ - goto again; - - } else { - /* Keep compiler happy.... */ - return destlen - o_len; - } - } } /** @@ -262,7 +175,6 @@ static size_t convert_string_internal(charset_t from, charset_t to, * @param srclen length of the source string in bytes, or -1 for nul terminated. * @param dest pointer to destination string (multibyte or singlebyte) * @param destlen maximal length allowed for string - *NEVER* -1. - * @param allow_bad_conv determines if a "best effort" conversion is acceptable (never returns errors) * @returns the number of bytes occupied in the destination * * Ensure the srclen contains the terminating zero. @@ -273,7 +185,7 @@ static size_t convert_string_internal(charset_t from, charset_t to, size_t convert_string(charset_t from, charset_t to, void const *src, size_t srclen, - void *dest, size_t destlen, bool allow_bad_conv) + void *dest, size_t destlen) { /* * NB. We deliberately don't do a strlen here if srclen == -1. @@ -311,7 +223,7 @@ size_t convert_string(charset_t from, charset_t to, #ifdef BROKEN_UNICODE_COMPOSE_CHARACTERS goto general_case; #else - size_t ret = convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv); + size_t ret = convert_string_internal(from, to, p, slen, q, dlen); if (ret == (size_t)-1) { return ret; } @@ -351,7 +263,7 @@ size_t convert_string(charset_t from, charset_t to, #ifdef BROKEN_UNICODE_COMPOSE_CHARACTERS goto general_case; #else - size_t ret = convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv); + size_t ret = convert_string_internal(from, to, p, slen, q, dlen); if (ret == (size_t)-1) { return ret; } @@ -391,7 +303,7 @@ size_t convert_string(charset_t from, charset_t to, #ifdef BROKEN_UNICODE_COMPOSE_CHARACTERS goto general_case; #else - size_t ret = convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv); + size_t ret = convert_string_internal(from, to, p, slen, q, dlen); if (ret == (size_t)-1) { return ret; } @@ -412,7 +324,7 @@ size_t convert_string(charset_t from, charset_t to, #ifdef BROKEN_UNICODE_COMPOSE_CHARACTERS general_case: #endif - return convert_string_internal(from, to, src, srclen, dest, destlen, allow_bad_conv); + return convert_string_internal(from, to, src, srclen, dest, destlen); } /** @@ -434,7 +346,7 @@ size_t convert_string(charset_t from, charset_t to, */ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, void const *src, size_t srclen, void *dst, - size_t *converted_size, bool allow_bad_conv) + size_t *converted_size) { size_t i_len, o_len, destlen = (srclen * 3) / 2; @@ -516,8 +428,6 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, reason="Incomplete multibyte sequence"; if (!conv_silent) DEBUG(3,("convert_string_talloc: Conversion error: %s(%s)\n",reason,inbuf)); - if (allow_bad_conv) - goto use_as_is; break; case E2BIG: goto convert; @@ -525,8 +435,6 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, reason="Illegal multibyte sequence"; if (!conv_silent) DEBUG(3,("convert_string_talloc: Conversion error: %s(%s)\n",reason,inbuf)); - if (allow_bad_conv) - goto use_as_is; break; } if (!conv_silent) @@ -562,89 +470,6 @@ bool convert_string_talloc(TALLOC_CTX *ctx, charset_t from, charset_t to, *converted_size = destlen; return true; - - use_as_is: - - /* - * Conversion not supported. This is actually an error, but there are so - * many misconfigured iconv systems and smb.conf's out there we can't just - * fail. Do a very bad conversion instead.... JRA. - */ - - { - if (o_len == 0 || i_len == 0) - goto out; - - if (((from == CH_UTF16LE)||(from == CH_UTF16BE)) && - ((to != CH_UTF16LE)||(to != CH_UTF16BE))) { - /* Can't convert from utf16 any endian to multibyte. - Replace with the default fail char. - */ - - if (i_len < 2) - goto out; - - if (i_len >= 2) { - *outbuf = lp_failed_convert_char(); - - outbuf++; - o_len--; - - inbuf += 2; - i_len -= 2; - } - - if (o_len == 0 || i_len == 0) - goto out; - - /* Keep trying with the next char... */ - goto again; - - } else if (from != CH_UTF16LE && from != CH_UTF16BE && to == CH_UTF16LE) { - /* Can't convert to UTF16LE - just widen by adding the - default fail char then zero. - */ - if (o_len < 2) - goto out; - - outbuf[0] = lp_failed_convert_char(); - outbuf[1] = '\0'; - - inbuf++; - i_len--; - - outbuf += 2; - o_len -= 2; - - if (o_len == 0 || i_len == 0) - goto out; - - /* Keep trying with the next char... */ - goto again; - - } else if (from != CH_UTF16LE && from != CH_UTF16BE && - to != CH_UTF16LE && to != CH_UTF16BE) { - /* Failed multibyte to multibyte. Just copy the default fail char and - try again. */ - outbuf[0] = lp_failed_convert_char(); - - inbuf++; - i_len--; - - outbuf++; - o_len--; - - if (o_len == 0 || i_len == 0) - goto out; - - /* Keep trying with the next char... */ - goto again; - - } else { - /* Keep compiler happy.... */ - goto out; - } - } } size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen) @@ -661,7 +486,7 @@ size_t unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen) return srclen; } - size = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen, True); + size = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen); TALLOC_FREE(buffer); return size; } @@ -702,7 +527,7 @@ char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s) if (!convert_string_talloc(ctx, CH_UNIX, CH_UTF16LE, s, strlen(s)+1, (void *)&ubuf, - &converted_size, True)) + &converted_size)) { return NULL; } @@ -711,7 +536,7 @@ char *talloc_strdup_upper(TALLOC_CTX *ctx, const char *s) if (!convert_string_talloc(ctx, CH_UTF16LE, CH_UNIX, ubuf, converted_size, (void *)&out_buffer, - &converted_size2, True)) + &converted_size2)) { TALLOC_FREE(ubuf); return NULL; @@ -737,8 +562,7 @@ size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen) smb_ucs2_t *buffer = NULL; if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF16LE, src, srclen, - (void **)(void *)&buffer, &size, - True)) + (void **)(void *)&buffer, &size)) { smb_panic("failed to create UCS2 buffer"); } @@ -746,7 +570,7 @@ size_t unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen) TALLOC_FREE(buffer); return srclen; } - size = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen, True); + size = convert_string(CH_UTF16LE, CH_UNIX, buffer, size, dest, destlen); TALLOC_FREE(buffer); return size; } @@ -824,7 +648,7 @@ size_t push_ascii(void *dest, const char *src, size_t dest_len, int flags) src_len++; } - ret = convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len, True); + ret = convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len); if (ret == (size_t)-1 && (flags & (STR_TERMINATE | STR_TERMINATE_ASCII)) && dest_len > 0) { @@ -861,7 +685,7 @@ size_t push_ascii_nstring(void *dest, const char *src) for (i = 0; buffer[i] != 0 && (i < buffer_len); i++) { unsigned char mb[10]; /* Convert one smb_ucs2_t character at a time. */ - size_t mb_len = convert_string(CH_UTF16LE, CH_DOS, buffer+i, sizeof(smb_ucs2_t), mb, sizeof(mb), False); + size_t mb_len = convert_string(CH_UTF16LE, CH_DOS, buffer+i, sizeof(smb_ucs2_t), mb, sizeof(mb)); if ((mb_len != (size_t)-1) && (dest_len + mb_len <= MAX_NETBIOSNAME_LEN - 1)) { memcpy((char *)dest + dest_len, mb, mb_len); dest_len += mb_len; @@ -887,7 +711,7 @@ bool push_ascii_talloc(TALLOC_CTX *mem_ctx, char **dest, const char *src, size_t *dest = NULL; return convert_string_talloc(mem_ctx, CH_UNIX, CH_DOS, src, src_len, - (void **)dest, converted_size, True); + (void **)dest, converted_size); } /** @@ -925,7 +749,7 @@ size_t pull_ascii(char *dest, const void *src, size_t dest_len, size_t src_len, } } - ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len, True); + ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len); if (ret == (size_t)-1) { ret = 0; dest_len = 0; @@ -1005,7 +829,7 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx, /* src_len != -1 here. */ if (!convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, &dest, - &dest_len, True)) { + &dest_len)) { dest_len = 0; } @@ -1092,7 +916,7 @@ size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_t dest_ /* ucs2 is always a multiple of 2 bytes */ dest_len &= ~1; - ret = convert_string(CH_UNIX, CH_UTF16LE, src, src_len, dest, dest_len, True); + ret = convert_string(CH_UNIX, CH_UTF16LE, src, src_len, dest, dest_len); if (ret == (size_t)-1) { if ((flags & STR_TERMINATE) && dest && @@ -1141,7 +965,7 @@ bool push_ucs2_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src, *dest = NULL; return convert_string_talloc(ctx, CH_UNIX, CH_UTF16LE, src, src_len, - (void **)dest, converted_size, True); + (void **)dest, converted_size); } @@ -1180,7 +1004,7 @@ static size_t push_utf8(void *dest, const char *src, size_t dest_len, int flags) src_len++; } - ret = convert_string(CH_UNIX, CH_UTF8, src, src_len, dest, dest_len, True); + ret = convert_string(CH_UNIX, CH_UTF8, src, src_len, dest, dest_len); TALLOC_FREE(tmpbuf); return ret; } @@ -1208,7 +1032,7 @@ bool push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src, *dest = NULL; return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, - (void**)dest, converted_size, True); + (void**)dest, converted_size); } /** @@ -1261,7 +1085,7 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_ if (src_len != (size_t)-1) src_len &= ~1; - ret = convert_string(CH_UTF16LE, CH_UNIX, src, src_len, dest, dest_len, True); + ret = convert_string(CH_UTF16LE, CH_UNIX, src, src_len, dest, dest_len); if (ret == (size_t)-1) { ret = 0; dest_len = 0; @@ -1362,7 +1186,7 @@ size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx, src_len &= ~1; if (!convert_string_talloc(ctx, CH_UTF16LE, CH_UNIX, src, src_len, - (void *)&dest, &dest_len, True)) { + (void *)&dest, &dest_len)) { dest_len = 0; } @@ -1416,7 +1240,7 @@ bool pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const smb_ucs2_t *src, *dest = NULL; return convert_string_talloc(ctx, CH_UTF16LE, CH_UNIX, src, src_len, - (void **)dest, converted_size, True); + (void **)dest, converted_size); } /** @@ -1437,7 +1261,7 @@ bool pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src, *dest = NULL; return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, - (void **)dest, converted_size, True); + (void **)dest, converted_size); } @@ -1459,7 +1283,7 @@ bool pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src, *dest = NULL; return convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, - (void **)dest, converted_size, True); + (void **)dest, converted_size); } /** diff --git a/source3/lib/dprintf.c b/source3/lib/dprintf.c index 835d34076e..73bacdccbb 100644 --- a/source3/lib/dprintf.c +++ b/source3/lib/dprintf.c @@ -65,7 +65,7 @@ again: goto out; } - clen = convert_string(CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen, True); + clen = convert_string(CH_UNIX, CH_DISPLAY, p, ret, p2, maxlen); if (clen == -1) { ret = -1; goto out; diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c index c91258ef12..70062345a6 100644 --- a/source3/lib/eventlog/eventlog.c +++ b/source3/lib/eventlog/eventlog.c @@ -952,7 +952,7 @@ NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx, size_t len; if (!convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, t->sid.data, t->sid.length, - (void *)&sid_str, &len, false)) { + (void *)&sid_str, &len)) { return NT_STATUS_INVALID_SID; } if (len > 0) { diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index 568a7ee6b9..c094fbe255 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -276,7 +276,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { return False; } - if (convert_string(CH_UTF8, CH_UNIX,values[0], -1, value, max_len, False) == (size_t)-1) { + if (convert_string(CH_UTF8, CH_UNIX,values[0], -1, value, max_len) == (size_t)-1) { DEBUG(1, ("smbldap_get_single_attribute: string conversion of [%s] = [%s] failed!\n", attribute, values[0])); ldap_value_free(values); diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c index 7697a4326a..ae3dab38ab 100644 --- a/source3/lib/tldap_util.c +++ b/source3/lib/tldap_util.c @@ -78,7 +78,7 @@ char *tldap_talloc_single_attribute(struct tldap_message *msg, } if (!convert_string_talloc(mem_ctx, CH_UTF8, CH_UNIX, val.data, val.length, - &result, &len, false)) { + &result, &len)) { return NULL; } return result; @@ -197,8 +197,7 @@ bool tldap_add_mod_str(TALLOC_CTX *mem_ctx, bool ret; if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF8, str, - strlen(str), &utf8.data, &utf8.length, - false)) { + strlen(str), &utf8.data, &utf8.length)) { return false; } @@ -290,12 +289,12 @@ static int compare_utf8_blobs(const DATA_BLOB *d1, const DATA_BLOB *d2) int ret; if (!convert_string_talloc(talloc_tos(), CH_UTF8, CH_UNIX, d1->data, - d1->length, &s1, &s1len, false)) { + d1->length, &s1, &s1len)) { /* can't do much here */ return 0; } if (!convert_string_talloc(talloc_tos(), CH_UTF8, CH_UNIX, d2->data, - d2->length, &s2, &s2len, false)) { + d2->length, &s2, &s2len)) { /* can't do much here */ TALLOC_FREE(s1); return 0; diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 72f0e4b8eb..fcf31561be 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -58,7 +58,7 @@ static uint8_t *internal_bytes_push_str(uint8_t *buf, bool ucs2, if (!convert_string_talloc(talloc_tos(), CH_UNIX, ucs2 ? CH_UTF16LE : CH_DOS, str, str_len, &converted, - &converted_size, true)) { + &converted_size)) { return NULL; } @@ -445,8 +445,7 @@ NTSTATUS cli_posix_readlink_recv(struct tevent_req *req, struct cli_state *cli, state->data, state->num_data, &converted, - &converted_size, - true)) { + &converted_size)) { return NT_STATUS_NO_MEMORY; } @@ -5417,7 +5416,7 @@ NTSTATUS cli_shadow_copy_data_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, ret = convert_string_talloc( names, CH_UTF16LE, CH_UNIX, src, 2 * sizeof(SHADOW_COPY_LABEL), - &names[i], &converted_size, True); + &names[i], &converted_size); if (!ret) { TALLOC_FREE(names); return NT_STATUS_INVALID_NETWORK_RESPONSE; diff --git a/source3/libsmb/climessage.c b/source3/libsmb/climessage.c index 4c730c4b76..2c2921aa0c 100644 --- a/source3/libsmb/climessage.c +++ b/source3/libsmb/climessage.c @@ -47,12 +47,12 @@ static struct tevent_req *cli_message_start_send(TALLOC_CTX *mem_ctx, if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_DOS, username, strlen(username)+1, - &utmp, &ulen, true)) { + &utmp, &ulen)) { goto fail; } if (!convert_string_talloc(talloc_tos(), CH_UNIX, CH_DOS, host, strlen(host)+1, - &htmp, &hlen, true)) { + &htmp, &hlen)) { goto fail; } @@ -154,7 +154,7 @@ static struct tevent_req *cli_message_text_send(TALLOC_CTX *mem_ctx, SSVAL(&state->vwv, 0, grp); if (convert_string_talloc(talloc_tos(), CH_UNIX, CH_DOS, msg, msglen, - &tmp, &tmplen, true)) { + &tmp, &tmplen)) { msg = tmp; msglen = tmplen; } else { diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 1756c479b4..141db7131e 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -1039,7 +1039,7 @@ static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata, tmp_buf[nlen+1] = 0; if (!convert_string_talloc(streams, CH_UTF16, CH_UNIX, tmp_buf, - nlen+2, &vstr, &size, false)) + nlen+2, &vstr, &size)) { TALLOC_FREE(tmp_buf); goto fail; @@ -1285,8 +1285,7 @@ NTSTATUS cli_qpathinfo_alt_name(struct cli_state *cli, const char *fname, fstrin rdata + 4, len, &converted, - &converted_size, - true)) { + &converted_size)) { return NT_STATUS_NO_MEMORY; } fstrcpy(alt_name, converted); diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index 42632f394f..dab8c10c84 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -384,7 +384,7 @@ struct tevent_req *cli_trans_send( cli_ucs2(cli) ? CH_UTF16LE : CH_DOS, pipe_name, strlen(pipe_name) + 1, &state->pipe_name_conv, - &state->pipe_name_conv_len, true))) { + &state->pipe_name_conv_len))) { tevent_req_nterror(req, NT_STATUS_NO_MEMORY); return tevent_req_post(req, ev); } diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c index 654bc5de6f..dc728ee454 100644 --- a/source3/passdb/pdb_ads.c +++ b/source3/passdb/pdb_ads.c @@ -388,7 +388,7 @@ static bool pdb_ads_init_ads_from_sam(struct pdb_ads_state *state, ret &= convert_string_talloc(talloc_tos(), CH_UNIX, CH_UTF16LE, pw_quote, strlen(pw_quote), - &pw_utf16, &pw_utf16_len, false); + &pw_utf16, &pw_utf16_len); if (!ret) { goto fail; } @@ -1652,8 +1652,7 @@ static bool pdb_ads_dnblob2sid(struct pdb_ads_state *state, DATA_BLOB *dnblob, bool ret; if (!convert_string_talloc(talloc_tos(), CH_UTF8, CH_UNIX, - dnblob->data, dnblob->length, &dn, &len, - false)) { + dnblob->data, dnblob->length, &dn, &len)) { return false; } rc = pdb_ads_search_fmt(state, dn, TLDAP_SCOPE_BASE, diff --git a/source3/registry/reg_parse.c b/source3/registry/reg_parse.c index b76bcfe2a7..c03b39c29d 100644 --- a/source3/registry/reg_parse.c +++ b/source3/registry/reg_parse.c @@ -162,7 +162,7 @@ static bool act_val_sz(struct reg_parse* p, cbuf* value, bool cont) if (convert_string_talloc(p->valblob, CH_UNIX, CH_UTF16LE, src, strlen(src)+1, - &dst, &dlen, true)) + &dst, &dlen)) { cbuf_swapptr(p->valblob, &dst, dlen); } else { diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 061b481071..be8747b4d2 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -1647,8 +1647,7 @@ static NTSTATUS add_trusted_domain_user(TALLOC_CTX *mem_ctx, auth_struct->incoming.current.array[i].AuthInfo.clear.password, auth_struct->incoming.current.array[i].AuthInfo.clear.size, &dummy, - &dummy_size, - false)) { + &dummy_size)) { return NT_STATUS_UNSUCCESSFUL; } if (!pdb_set_plaintext_passwd(sam_acct, dummy)) { diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c index f0a4e34207..f93deab9db 100644 --- a/source3/smbd/mangle_hash2.c +++ b/source3/smbd/mangle_hash2.c @@ -633,7 +633,7 @@ static bool is_legal_name(const char *name) * for mb UNIX asian characters like Japanese (SJIS) here. * JRA. */ - if (convert_string(CH_UNIX, CH_UTF16LE, name, 2, mbc, 2, False) == 2) { + if (convert_string(CH_UNIX, CH_UTF16LE, name, 2, mbc, 2) == 2) { /* Was a good mb string. */ name += 2; continue; diff --git a/source3/smbd/message.c b/source3/smbd/message.c index 386aca1727..f2ca420bf9 100644 --- a/source3/smbd/message.c +++ b/source3/smbd/message.c @@ -73,7 +73,7 @@ static void msg_deliver(struct msg_state *state) if (!convert_string_talloc(talloc_tos(), CH_DOS, CH_UNIX, state->msg, talloc_get_size(state->msg), (void *)&msg, - &len, true)) { + &len)) { DEBUG(3, ("Conversion failed, delivering message in DOS " "codepage format\n")); msg = state->msg; diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index b191b74fcc..70f0dba404 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -212,7 +212,7 @@ NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req) in_name_buffer.data, in_name_buffer.length, &in_name_string, - &in_name_string_size, false); + &in_name_string_size); if (!ok) { return smbd_smb2_request_error(smb2req, NT_STATUS_ILLEGAL_CHARACTER); } diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c index 1ee493b906..fe5dee618e 100644 --- a/source3/smbd/smb2_find.c +++ b/source3/smbd/smb2_find.c @@ -107,7 +107,7 @@ NTSTATUS smbd_smb2_request_process_find(struct smbd_smb2_request *req) in_file_name_buffer.data, in_file_name_buffer.length, &in_file_name_string, - &in_file_name_string_size, false); + &in_file_name_string_size); if (!ok) { return smbd_smb2_request_error(req, NT_STATUS_ILLEGAL_CHARACTER); } diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c index 672965f470..5a42d59e9a 100644 --- a/source3/smbd/smb2_ioctl.c +++ b/source3/smbd/smb2_ioctl.c @@ -303,7 +303,7 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, in_file_name_buffer.data, in_file_name_buffer.length, &in_file_name_string, - &in_file_name_string_size, false); + &in_file_name_string_size); if (!ok) { tevent_req_nterror(req, NT_STATUS_ILLEGAL_CHARACTER); return tevent_req_post(req, ev); diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c index 01c7e01c65..39b8eb1ae7 100644 --- a/source3/smbd/smb2_tcon.c +++ b/source3/smbd/smb2_tcon.c @@ -81,7 +81,7 @@ NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req) in_path_buffer.data, in_path_buffer.length, &in_path_string, - &in_path_string_size, false); + &in_path_string_size); if (!ok) { return smbd_smb2_request_error(req, NT_STATUS_ILLEGAL_CHARACTER); } diff --git a/source3/torture/utable.c b/source3/torture/utable.c index e4d2dee6f3..b7789d35bc 100644 --- a/source3/torture/utable.c +++ b/source3/torture/utable.c @@ -51,7 +51,7 @@ bool torture_utable(int dummy) p = fname+strlen(fname); len = convert_string(CH_UTF16LE, CH_UNIX, &c2, 2, - p, sizeof(fname)-strlen(fname), True); + p, sizeof(fname)-strlen(fname)); p[len] = 0; fstrcat(fname,"_a_long_extension"); @@ -113,7 +113,7 @@ static char *form_name(int c) len = convert_string(CH_UTF16LE, CH_UNIX, &c2, 2, - p, sizeof(fname)-strlen(fname), True); + p, sizeof(fname)-strlen(fname)); p[len] = 0; return fname; } diff --git a/source3/utils/ntlm_auth_diagnostics.c b/source3/utils/ntlm_auth_diagnostics.c index 1b9b133e4f..41462c052b 100644 --- a/source3/utils/ntlm_auth_diagnostics.c +++ b/source3/utils/ntlm_auth_diagnostics.c @@ -479,7 +479,7 @@ static bool test_plaintext(enum ntlm_break break_which) CH_DOS, password, strlen(password)+1, &lm_response.data, - &lm_response.length, True)) { + &lm_response.length)) { DEBUG(0, ("convert_string_talloc failed!\n")); exit(1); } diff --git a/source3/web/cgi.c b/source3/web/cgi.c index e3356a2f7e..1c610dfd52 100644 --- a/source3/web/cgi.c +++ b/source3/web/cgi.c @@ -207,14 +207,14 @@ void cgi_load_variables(void) convert_string_talloc(frame, CH_UTF8, CH_UNIX, variables[i].name, strlen(variables[i].name), - &dest, &dest_len, True); + &dest, &dest_len); SAFE_FREE(variables[i].name); variables[i].name = SMB_STRDUP(dest ? dest : ""); dest = NULL; convert_string_talloc(frame, CH_UTF8, CH_UNIX, variables[i].value, strlen(variables[i].value), - &dest, &dest_len, True); + &dest, &dest_len); SAFE_FREE(variables[i].value); variables[i].value = SMB_STRDUP(dest ? dest : ""); TALLOC_FREE(frame); @@ -359,11 +359,11 @@ static bool cgi_handle_authorization(char *line) convert_string(CH_UTF8, CH_UNIX, line, -1, - user, sizeof(user), True); + user, sizeof(user)); convert_string(CH_UTF8, CH_UNIX, p+1, -1, - user_pass, sizeof(user_pass), True); + user_pass, sizeof(user_pass)); /* * Try and get the user from the UNIX password file. diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index 53d12d96df..470a2b05a3 100644 --- a/source4/dsdb/samdb/ldb_modules/password_hash.c +++ b/source4/dsdb/samdb/ldb_modules/password_hash.c @@ -1689,8 +1689,7 @@ static int setup_given_passwords(struct setup_password_fields_io *io, g->cleartext_utf8->data, g->cleartext_utf8->length, (void *)&cleartext_utf16_blob->data, - &cleartext_utf16_blob->length, - false)) { + &cleartext_utf16_blob->length)) { if (g->cleartext_utf8->length != 0) { talloc_free(cleartext_utf16_blob); ldb_asprintf_errstring(ldb, @@ -1717,8 +1716,7 @@ static int setup_given_passwords(struct setup_password_fields_io *io, g->cleartext_utf16->data, g->cleartext_utf16->length, (void *)&cleartext_utf8_blob->data, - &cleartext_utf8_blob->length, - false)) { + &cleartext_utf8_blob->length)) { if (g->cleartext_utf16->length != 0) { /* We must bail out here, the input wasn't even * a multiple of 2 bytes */ diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index f59aae8969..21341850d9 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -335,7 +335,7 @@ found: CH_UNIX, CH_UTF16, newpass, strlen(newpass), (void *)&newpass_utf16.data, - &newpass_utf16.length, false)) { + &newpass_utf16.length)) { ldb_asprintf_errstring(ldb, "samldb_rodc_add: " "failed to generate UTF16 password from random password"); diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 6d2700599d..88badc7136 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -1484,7 +1484,7 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(const struct dsdb_syntax_ctx *c CH_UTF16, CH_UNIX, in->value_ctr.values[i].blob->data, in->value_ctr.values[i].blob->length, - (void **)&str, NULL, false)) { + (void **)&str, NULL)) { return WERR_FOOBAR; } @@ -1524,7 +1524,7 @@ static WERROR dsdb_syntax_UNICODE_ldb_to_drsuapi(const struct dsdb_syntax_ctx *c if (!convert_string_talloc(blobs, CH_UNIX, CH_UTF16, in->values[i].data, in->values[i].length, - (void **)&blobs[i].data, &blobs[i].length, false)) { + (void **)&blobs[i].data, &blobs[i].length)) { return WERR_FOOBAR; } } @@ -1549,7 +1549,7 @@ static WERROR dsdb_syntax_UNICODE_validate_one_val(const struct dsdb_syntax_ctx val->data, val->length, (void **)&dst, - &size, false); + &size); TALLOC_FREE(dst); if (!ok) { return WERR_DS_INVALID_ATTRIBUTE_SYNTAX; @@ -2246,7 +2246,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_drsuapi_to_ldb(const struct dsdb_ if (!convert_string_talloc(out->values, CH_UTF16, CH_UNIX, in->value_ctr.values[i].blob->data+4, in->value_ctr.values[i].blob->length-4, - (void **)&str, NULL, false)) { + (void **)&str, NULL)) { return WERR_FOOBAR; } @@ -2289,7 +2289,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_ldb_to_drsuapi(const struct dsdb_ if (!convert_string_talloc(blobs, CH_UNIX, CH_UTF16, in->values[i].data, in->values[i].length, - (void **)&data, &ret, false)) { + (void **)&data, &ret)) { return WERR_FOOBAR; } diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index 117cab095d..8ac92cd478 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -242,7 +242,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc, CH_UTF8, CH_UTF16, (const char *)input->data, input->length, - (void **)&password.data, &pw_len, false)) { + (void **)&password.data, &pw_len)) { return false; } password.length = pw_len; @@ -282,7 +282,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc, CH_UTF8, CH_UTF16, (const char *)chpw.newpasswd.data, chpw.newpasswd.length, - (void **)&password.data, &pw_len, false)) { + (void **)&password.data, &pw_len)) { free_ChangePasswdDataMS(&chpw); return false; } diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index a6f00aa330..5244a2061b 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -65,7 +65,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, /* The data should be provided as UTF16 string */ convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, val->data, val->length, - (void **)&data->data, &data->length, false); + (void **)&data->data, &data->length); } else { data->data = NULL; data->length = 0; @@ -159,8 +159,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, /* The data is provided as UTF16 string */ ret2 = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, - (void **)&val->data, &val->length, - false); + (void **)&val->data, &val->length); if (ret2) { ret = ldb_msg_add_value(msg, "data", val, NULL); } else { diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index 8fac00ba44..073c12e345 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -79,8 +79,8 @@ static char *reg_val_dotreg_string(TALLOC_CTX *mem_ctx, uint32_t type, case REG_EXPAND_SZ: case REG_SZ: convert_string_talloc(mem_ctx, - CH_UTF16, CH_UNIX, data.data, data.length, - (void **)&ret, NULL, false); + CH_UTF16, CH_UNIX, data.data, data.length, + (void **)&ret, NULL); break; case REG_DWORD: case REG_DWORD_BIG_ENDIAN: diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index 68fcdd593d..2ef6f84700 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -91,7 +91,7 @@ static bool test_reg_val_data_string_sz(struct torture_context *ctx) { DATA_BLOB db; convert_string_talloc(ctx, CH_UTF8, CH_UTF16, - "bla", 3, (void **)&db.data, &db.length, false); + "bla", 3, (void **)&db.data, &db.length); torture_assert_str_equal(ctx, "bla", reg_val_data_string(ctx, REG_SZ, db), "sz failed"); @@ -128,7 +128,7 @@ static bool test_reg_val_description(struct torture_context *ctx) convert_string_talloc(ctx, CH_UTF8, CH_UTF16, "stationary traveller", strlen("stationary traveller"), - (void **)&data.data, &data.length, false); + (void **)&data.data, &data.length); torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller", reg_val_description(ctx, "camel", REG_SZ, data), "reg_val_description failed"); @@ -142,7 +142,7 @@ static bool test_reg_val_description_nullname(struct torture_context *ctx) convert_string_talloc(ctx, CH_UTF8, CH_UTF16, "west berlin", strlen("west berlin"), - (void **)&data.data, &data.length, false); + (void **)&data.data, &data.length); torture_assert_str_equal(ctx, " = REG_SZ : west berlin", reg_val_description(ctx, NULL, REG_SZ, data), "description with null name failed"); diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c index bbcc869e03..3bbfaf2454 100644 --- a/source4/lib/registry/util.c +++ b/source4/lib/registry/util.c @@ -37,7 +37,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, data.data, data.length, - (void **)&ret, NULL, false); + (void **)&ret, NULL); break; case REG_DWORD: case REG_DWORD_BIG_ENDIAN: @@ -162,7 +162,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, CH_UNIX, CH_UTF16, data_str, strlen(data_str)+1, (void **)&data->data, - &data->length, false); + &data->length); break; case REG_MULTI_SZ: case REG_EXPAND_SZ: diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 08598a2d64..5efa4dd337 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -64,7 +64,7 @@ NTSTATUS smbcli_parse_stream_info(DATA_BLOB blob, TALLOC_CTX *mem_ctx, } ret = convert_string_talloc(io->streams, CH_UTF16, CH_UNIX, - blob.data+ofs+24, nlen, &vstr, NULL, false); + blob.data+ofs+24, nlen, &vstr, NULL); if (!ret) { return NT_STATUS_ILLEGAL_CHARACTER; } diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index eb39fffeda..bf0268867f 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -586,7 +586,7 @@ static size_t smbcli_req_pull_ucs2(struct request_bufinfo *bufinfo, TALLOC_CTX * return 0; } - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, &ret_size, false); + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, &ret_size); if (!ret) { *dest = NULL; return 0; @@ -629,7 +629,7 @@ size_t smbcli_req_pull_ascii(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_ct src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, &ret_size, false); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, &ret_size); if (!ret) { *dest = NULL; @@ -783,7 +783,7 @@ size_t smbcli_blob_pull_ucs2(TALLOC_CTX* mem_ctx, src_len2 = utf16_len_n(src, src_len); - ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size, false); + ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size); if (!ret) { *dest = NULL; return 0; @@ -830,7 +830,7 @@ static size_t smbcli_blob_pull_ascii(TALLOC_CTX *mem_ctx, src_len2++; } - ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size, false); + ret = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, &ret_size); if (!ret) { *dest = NULL; diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index 358d13363f..bf96d05bea 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -705,7 +705,7 @@ NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *me } ret = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, - blob.data, blob.length, &vstr, NULL, false); + blob.data, blob.length, &vstr, NULL); data_blob_free(&blob); (*str) = (char *)vstr; if (!ret) { @@ -736,8 +736,7 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf, } ret = convert_string_talloc(buf->buffer, CH_UNIX, CH_UTF16, - str, strlen(str), (void **)&blob.data, &blob.length, - false); + str, strlen(str), (void **)&blob.data, &blob.length); if (!ret) { return NT_STATUS_ILLEGAL_CHARACTER; } diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c index ab58598f29..85473f3862 100644 --- a/source4/libnet/libnet_samdump.c +++ b/source4/libnet/libnet_samdump.c @@ -187,7 +187,7 @@ NTSTATUS libnet_SamDump(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, } if (!convert_string_talloc_convenience(mem_ctx, lpcfg_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX, s->secret.data, s->secret.length, - (void **)&secret_string, NULL, false)) { + (void **)&secret_string, NULL)) { r->out.error_string = talloc_asprintf(mem_ctx, "Could not convert secret for domain %s to a string", t->name); diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index 3cc682906b..45cc498e48 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -238,7 +238,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, CH_DOS, CH_UNIX, (const char *)new_password.data, new_password.length, - (void **)&new_pass, NULL, false)) { + (void **)&new_pass, NULL)) { DEBUG(3,("samr: failed to convert incoming password buffer to unix charset\n")); return NT_STATUS_WRONG_PASSWORD; } @@ -247,7 +247,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, CH_DOS, CH_UTF16, (const char *)new_password.data, new_password.length, - (void **)&new_unicode_password.data, &unicode_pw_len, false)) { + (void **)&new_unicode_password.data, &unicode_pw_len)) { DEBUG(3,("samr: failed to convert incoming password buffer to UTF16 charset\n")); return NT_STATUS_WRONG_PASSWORD; } @@ -401,7 +401,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call, CH_UTF16, CH_UNIX, (const char *)new_password.data, new_password.length, - (void **)&new_pass, NULL, false)) { + (void **)&new_pass, NULL)) { E_deshash(new_pass, new_lm_hash); E_old_pw_hash(new_nt_hash, lm_pwd->hash, lm_verifier.hash); if (memcmp(lm_verifier.hash, r->in.lm_verifier->hash, 16) != 0) { diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c index 65ed3d0af3..59a34a0b13 100644 --- a/source4/smb_server/smb/request.c +++ b/source4/smb_server/smb/request.c @@ -512,7 +512,7 @@ static size_t req_pull_ucs2(struct request_bufinfo *bufinfo, const char **dest, return src_len2 + alignment; } - ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, NULL, false); + ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, NULL); if (!ret) { *dest = NULL; @@ -561,7 +561,7 @@ static size_t req_pull_ascii(struct request_bufinfo *bufinfo, const char **dest, src_len2++; } - ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, NULL, false); + ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, NULL); if (!ret) { *dest = NULL; diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c index e09297ecaa..301efabf4f 100644 --- a/source4/torture/basic/charset.c +++ b/source4/torture/basic/charset.c @@ -55,7 +55,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx, } SSVAL(ucs_name, i*2, 0); - if (!convert_string_talloc_convenience(ucs_name, lpcfg_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, &i, false)) { + if (!convert_string_talloc_convenience(ucs_name, lpcfg_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, &i)) { torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n"); talloc_free(ucs_name); return NT_STATUS_NO_MEMORY; diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index ffa25650de..eaa3f39e9c 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -52,7 +52,7 @@ bool torture_utable(struct torture_context *tctx, p = fname+strlen(fname); len = convert_string(CH_UTF16, CH_UNIX, c2, 2, - p, sizeof(fname)-strlen(fname), false); + p, sizeof(fname)-strlen(fname)); p[len] = 0; strncat(fname,"_a_long_extension",sizeof(fname)-1); @@ -111,7 +111,7 @@ static char *form_name(int c) len = convert_string(CH_UTF16, CH_UNIX, c2, 2, - p, sizeof(fname)-strlen(fname), false); + p, sizeof(fname)-strlen(fname)); if (len == -1) return NULL; p[len] = 0; diff --git a/source4/torture/rpc/forest_trust.c b/source4/torture/rpc/forest_trust.c index 3ef3f1d819..060ac43910 100644 --- a/source4/torture/rpc/forest_trust.c +++ b/source4/torture/rpc/forest_trust.c @@ -436,8 +436,7 @@ static bool get_trust_domain_passwords_auth_blob(TALLOC_CTX *mem_ctx, if (!convert_string_talloc(mem_ctx, CH_UNIX, CH_UTF16, password, strlen(password), &auth_info_array[0].AuthInfo.clear.password, - &converted_size, - false)) { + &converted_size)) { return false; } diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 0ba0d2633f..e624f000f6 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -1192,7 +1192,7 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea if (!convert_string_talloc(samlogon_state->mem_ctx, CH_UNIX, CH_DOS, password, strlen(password)+1, - (void**)&dospw, NULL, false)) { + (void**)&dospw, NULL)) { DEBUG(0, ("convert_string_talloc failed!\n")); exit(1); } diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c index 8a9a5e48bc..55164cdadf 100644 --- a/source4/torture/rpc/winreg.c +++ b/source4/torture/rpc/winreg.c @@ -2771,8 +2771,7 @@ static bool test_symlink_keys(struct torture_context *tctx, convert_string_talloc(tctx, CH_UNIX, CH_UTF16, kernel_mode_path, strlen(kernel_mode_path), /* not NULL terminated */ - &blob.data, &blob.length, - false), + &blob.data, &blob.length), "failed to convert"); torture_assert(tctx, -- cgit