summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/util/charset/charcnv.c11
-rw-r--r--lib/util/charset/charset.h8
-rw-r--r--lib/util/charset/tests/iconv.c6
-rw-r--r--lib/util/charset/util_unistr.c29
-rw-r--r--source4/auth/ntlm/ntlm_check.c2
-rw-r--r--source4/dsdb/common/util.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c6
-rw-r--r--source4/dsdb/schema/schema_init.c2
-rw-r--r--source4/dsdb/schema/schema_syntax.c8
-rw-r--r--source4/kdc/kpasswdd.c4
-rw-r--r--source4/lib/registry/ldb.c4
-rw-r--r--source4/lib/registry/tests/generic.c6
-rw-r--r--source4/lib/registry/util.c4
-rw-r--r--source4/lib/tdr/tdr.c4
-rw-r--r--source4/libcli/raw/rawfileinfo.c2
-rw-r--r--source4/libcli/raw/rawrequest.c8
-rw-r--r--source4/libcli/smb2/request.c4
-rw-r--r--source4/libnet/libnet_samdump.c2
-rw-r--r--source4/librpc/ndr/ndr_string.c20
-rw-r--r--source4/rpc_server/samr/samr_password.c6
-rw-r--r--source4/smb_server/smb/request.c4
-rw-r--r--source4/torture/basic/charset.c2
-rw-r--r--source4/torture/basic/utable.c4
-rw-r--r--source4/torture/rpc/samlogon.c2
-rw-r--r--source4/torture/rpc/spoolss_win.c2
25 files changed, 80 insertions, 72 deletions
diff --git a/lib/util/charset/charcnv.c b/lib/util/charset/charcnv.c
index 1f3b1ac846..18be2bcac2 100644
--- a/lib/util/charset/charcnv.c
+++ b/lib/util/charset/charcnv.c
@@ -240,7 +240,7 @@ convert:
_PUBLIC_ ssize_t 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)
+ void *dest, size_t destlen, bool allow_badcharcnv)
{
size_t i_len, o_len;
size_t retval;
@@ -248,6 +248,10 @@ _PUBLIC_ ssize_t convert_string_convenience(struct smb_iconv_convenience *ic,
char* outbuf = (char*)dest;
smb_iconv_t descriptor;
+ if (allow_badcharcnv) {
+ return -1;
+ }
+
if (srclen == (size_t)-1)
srclen = strlen(inbuf)+1;
@@ -305,10 +309,13 @@ _PUBLIC_ ssize_t 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)
+ void **dest, bool allow_badcharcnv)
{
smb_iconv_t descriptor;
+ if (allow_badcharcnv)
+ return (size_t)-1;
+
*dest = NULL;
if (src == NULL || srclen == (size_t)-1 || srclen == 0)
diff --git a/lib/util/charset/charset.h b/lib/util/charset/charset.h
index f027beb8db..82484b7805 100644
--- a/lib/util/charset/charset.h
+++ b/lib/util/charset/charset.h
@@ -117,11 +117,11 @@ ssize_t pull_string(char *dest, const void *src, size_t dest_len, size_t src_len
ssize_t convert_string_talloc(TALLOC_CTX *ctx,
charset_t from, charset_t to,
void const *src, size_t srclen,
- void **dest);
+ void **dest, bool allow_badcharcnv);
ssize_t convert_string(charset_t from, charset_t to,
void const *src, size_t srclen,
- void *dest, size_t destlen);
+ void *dest, size_t destlen, bool allow_badcharcnv);
ssize_t iconv_talloc(TALLOC_CTX *mem_ctx,
smb_iconv_t cd,
@@ -150,12 +150,12 @@ struct smb_iconv_convenience *smb_iconv_convenience_init(TALLOC_CTX *mem_ctx,
ssize_t 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);
+ void *dest, size_t destlen, bool allow_badcharcnv);
ssize_t 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);
+ void **dest, bool allow_badcharcnv);
/* 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 1facea6136..fbe7b103ab 100644
--- a/lib/util/charset/tests/iconv.c
+++ b/lib/util/charset/tests/iconv.c
@@ -418,7 +418,7 @@ static bool test_string2key(struct torture_context *tctx)
torture_comment(tctx, "converting random buffer\n");
- ret = convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)buf, len*2, (void**)&dest);
+ ret = convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)buf, len*2, (void**)&dest, false);
if (ret == -1) {
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");
- ret = convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF16, (void *)le1, 20, (void**)&munged1);
+ ret = convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF16, (void *)le1, 20, (void**)&munged1, false);
if (ret == -1) {
torture_fail(tctx, "Failed to convert fixed buffer to UTF16_MUNGED\n");
}
@@ -438,7 +438,7 @@ static bool test_string2key(struct torture_context *tctx)
torture_comment(tctx, "converting fixed buffer to UTF8\n");
- ret = convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)le1, 20, (void**)&out1);
+ ret = convert_string_talloc(mem_ctx, CH_UTF16MUNGED, CH_UTF8, (void *)le1, 20, (void**)&out1, false);
if (ret == -1) {
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 41b9c94cbb..e6c6c3f466 100644
--- a/lib/util/charset/util_unistr.c
+++ b/lib/util/charset/util_unistr.c
@@ -656,7 +656,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);
+ return convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len, false);
}
/**
@@ -672,7 +672,7 @@ _PUBLIC_ ssize_t push_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src
{
size_t src_len = strlen(src)+1;
*dest = NULL;
- return convert_string_talloc(ctx, CH_UNIX, CH_DOS, src, src_len, (void **)dest);
+ return convert_string_talloc(ctx, CH_UNIX, CH_DOS, src, src_len, (void **)dest, false);
}
@@ -706,7 +706,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);
+ ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len, false);
if (dest_len)
dest[MIN(ret, dest_len-1)] = 0;
@@ -759,7 +759,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);
+ ret = convert_string(CH_UNIX, CH_UTF16, src, src_len, dest, dest_len, false);
if (ret == (size_t)-1) {
return 0;
}
@@ -783,7 +783,7 @@ _PUBLIC_ ssize_t push_ucs2_talloc(TALLOC_CTX *ctx, void **dest, const char *src)
{
size_t src_len = strlen(src)+1;
*dest = NULL;
- return convert_string_talloc(ctx, CH_UNIX, CH_UTF16, src, src_len, dest);
+ return convert_string_talloc(ctx, CH_UNIX, CH_UTF16, src, src_len, dest, false);
}
@@ -799,7 +799,7 @@ _PUBLIC_ ssize_t push_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src)
{
size_t src_len = strlen(src)+1;
*dest = NULL;
- return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void **)dest);
+ return convert_string_talloc(ctx, CH_UNIX, CH_UTF8, src, src_len, (void **)dest, false);
}
/**
@@ -835,7 +835,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);
+ ret = convert_string(CH_UTF16, CH_UNIX, src, src_len, dest, dest_len, false);
if (dest_len)
dest[MIN(ret, dest_len-1)] = 0;
@@ -854,7 +854,7 @@ _PUBLIC_ ssize_t pull_ascii_talloc(TALLOC_CTX *ctx, char **dest, const char *src
{
size_t src_len = strlen(src)+1;
*dest = NULL;
- return convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, (void **)dest);
+ return convert_string_talloc(ctx, CH_DOS, CH_UNIX, src, src_len, (void **)dest, false);
}
/**
@@ -869,7 +869,7 @@ _PUBLIC_ ssize_t pull_ucs2_talloc(TALLOC_CTX *ctx, char **dest, const void *src)
{
size_t src_len = utf16_len(src);
*dest = NULL;
- return convert_string_talloc(ctx, CH_UTF16, CH_UNIX, src, src_len, (void **)dest);
+ return convert_string_talloc(ctx, CH_UTF16, CH_UNIX, src, src_len, (void **)dest, false);
}
/**
@@ -884,7 +884,7 @@ _PUBLIC_ ssize_t pull_utf8_talloc(TALLOC_CTX *ctx, char **dest, const char *src)
{
size_t src_len = strlen(src)+1;
*dest = NULL;
- return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, (void **)dest);
+ return convert_string_talloc(ctx, CH_UTF8, CH_UNIX, src, src_len, (void **)dest, false);
}
/**
@@ -952,11 +952,11 @@ _PUBLIC_ ssize_t pull_string(char *dest, const void *src, size_t dest_len, size_
**/
_PUBLIC_ ssize_t convert_string(charset_t from, charset_t to,
void const *src, size_t srclen,
- void *dest, size_t destlen)
+ void *dest, size_t destlen, bool allow_badcharcnv)
{
return convert_string_convenience(get_iconv_convenience(), from, to,
src, srclen,
- dest, destlen);
+ dest, destlen, allow_badcharcnv);
}
/**
@@ -972,10 +972,11 @@ _PUBLIC_ ssize_t convert_string(charset_t from, charset_t to,
_PUBLIC_ ssize_t convert_string_talloc(TALLOC_CTX *ctx,
charset_t from, charset_t to,
void const *src, size_t srclen,
- void **dest)
+ void **dest, bool allow_badcharcnv)
{
return convert_string_talloc_convenience(ctx, get_iconv_convenience(),
- from, to, src, srclen, dest);
+ from, to, src, srclen, dest,
+ allow_badcharcnv);
}
diff --git a/source4/auth/ntlm/ntlm_check.c b/source4/auth/ntlm/ntlm_check.c
index a3ac7f3347..5298432e61 100644
--- a/source4/auth/ntlm/ntlm_check.c
+++ b/source4/auth/ntlm/ntlm_check.c
@@ -323,7 +323,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) != -1)) {
+ (void **)&unix_pw, false) != -1)) {
if (E_deshash(unix_pw, client_lm.hash)) {
lm_ok = true;
} else {
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index b02a162293..82f5b6ed1d 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1693,7 +1693,7 @@ NTSTATUS samdb_set_password(struct ldb_context *ctx, TALLOC_CTX *mem_ctx,
if (convert_string_talloc_convenience(mem_ctx, lp_iconv_convenience(ldb_get_opaque(ctx, "loadparm")),
CH_UTF16, CH_UNIX,
new_password->data, new_password->length,
- (void **)&new_pass) != -1) {
+ (void **)&new_pass, false) != -1) {
/* possibly check password complexity */
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index da4c57463b..f427e697b4 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -1339,7 +1339,7 @@ static int setup_password_fields(struct setup_password_fields_io *io)
}
converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")),
CH_UTF8, CH_UTF16, io->n.cleartext_utf8->data, io->n.cleartext_utf8->length,
- (void **)&cleartext_utf16_str);
+ (void **)&cleartext_utf16_str, false);
if (converted_pw_len == -1) {
ldb_asprintf_errstring(ldb,
"setup_password_fields: "
@@ -1357,7 +1357,7 @@ static int setup_password_fields(struct setup_password_fields_io *io)
}
converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")),
CH_UTF16MUNGED, CH_UTF8, io->n.cleartext_utf16->data, io->n.cleartext_utf16->length,
- (void **)&cleartext_utf8_str);
+ (void **)&cleartext_utf8_str, false);
if (converted_pw_len == -1) {
/* We can't bail out entirely, as these unconvertable passwords are frustratingly valid */
io->n.cleartext_utf8 = NULL;
@@ -1383,7 +1383,7 @@ static int setup_password_fields(struct setup_password_fields_io *io)
char *cleartext_unix;
converted_pw_len = convert_string_talloc_convenience(io->ac, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")),
CH_UTF8, CH_UNIX, io->n.cleartext_utf8->data, io->n.cleartext_utf8->length,
- (void **)&cleartext_unix);
+ (void **)&cleartext_unix, false);
if (converted_pw_len != -1) {
lm_hash = talloc(io->ac, struct samr_Password);
if (!lm_hash) {
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 763872cf2b..0e8ac5e105 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -1190,7 +1190,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb
_ret = convert_string_talloc_convenience(mem_ctx, s->iconv_convenience, CH_UTF16, CH_UNIX, \
_a->value_ctr.values[0].blob->data, \
_a->value_ctr.values[0].blob->length, \
- (void **)discard_const(&(p)->elem)); \
+ (void **)discard_const(&(p)->elem), false); \
if (_ret == -1) { \
DEBUG(0,("%s: invalid data!\n", attr)); \
dump_data(0, \
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 4141026b7e..965b85a13a 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -795,7 +795,7 @@ static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(struct ldb_context *ldb,
CH_UTF16, CH_UNIX,
in->value_ctr.values[i].blob->data,
in->value_ctr.values[i].blob->length,
- (void **)&str);
+ (void **)&str, false);
if (ret == -1) {
return WERR_FOOBAR;
}
@@ -838,7 +838,7 @@ static WERROR dsdb_syntax_UNICODE_ldb_to_drsuapi(struct ldb_context *ldb,
ret = convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16,
in->values[i].data,
in->values[i].length,
- (void **)&blobs[i].data);
+ (void **)&blobs[i].data, false);
if (ret == -1) {
return WERR_FOOBAR;
}
@@ -1165,7 +1165,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_drsuapi_to_ldb(struct ldb_context
ret = convert_string_talloc_convenience(out->values, schema->iconv_convenience, CH_UTF16, CH_UNIX,
in->value_ctr.values[i].blob->data+4,
in->value_ctr.values[i].blob->length-4,
- (void **)&str);
+ (void **)&str, false);
if (ret == -1) {
return WERR_FOOBAR;
}
@@ -1209,7 +1209,7 @@ static WERROR dsdb_syntax_PRESENTATION_ADDRESS_ldb_to_drsuapi(struct ldb_context
ret = convert_string_talloc_convenience(blobs, schema->iconv_convenience, CH_UNIX, CH_UTF16,
in->values[i].data,
in->values[i].length,
- (void **)&data);
+ (void **)&data, false);
if (ret == -1) {
return WERR_FOOBAR;
}
diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c
index 39817d922b..85e248dceb 100644
--- a/source4/kdc/kpasswdd.c
+++ b/source4/kdc/kpasswdd.c
@@ -237,7 +237,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
CH_UTF8, CH_UTF16,
(const char *)input->data,
input->length,
- (void **)&password.data);
+ (void **)&password.data, false);
if (pw_len == -1) {
return false;
@@ -285,7 +285,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);
+ (void **)&password.data, false);
if (pw_len == -1) {
free_ChangePasswdDataMS(&chpw);
return false;
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index 1d238f4e23..41fbd22335 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -62,7 +62,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx,
if (val != NULL)
data->length = convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16,
val->data, val->length,
- (void **)&data->data);
+ (void **)&data->data, false);
else {
data->data = NULL;
data->length = 0;
@@ -108,7 +108,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8,
(void *)data.data,
data.length,
- (void **)&val.data);
+ (void **)&val.data, false);
ldb_msg_add_value(msg, "data", &val, NULL);
} else {
ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c
index f1fa5ad0b2..3a3c3e7747 100644
--- a/source4/lib/registry/tests/generic.c
+++ b/source4/lib/registry/tests/generic.c
@@ -54,7 +54,7 @@ static bool test_reg_val_data_string_sz(struct torture_context *ctx)
{
DATA_BLOB db;
db.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16,
- "bla", 3, (void **)&db.data);
+ "bla", 3, (void **)&db.data, false);
torture_assert_str_equal(ctx, "bla",
reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db),
"sz failed");
@@ -91,7 +91,7 @@ static bool test_reg_val_description(struct torture_context *ctx)
data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16,
"stationary traveller",
strlen("stationary traveller"),
- (void **)&data.data);
+ (void **)&data.data, false);
torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller",
reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), "camel", REG_SZ, data),
"reg_val_description failed");
@@ -105,7 +105,7 @@ static bool test_reg_val_description_nullname(struct torture_context *ctx)
data.length = convert_string_talloc_convenience(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UTF8, CH_UTF16,
"west berlin",
strlen("west berlin"),
- (void **)&data.data);
+ (void **)&data.data, false);
torture_assert_str_equal(ctx, "<No Name> = REG_SZ : west berlin",
reg_val_description(ctx, lp_iconv_convenience(ctx->lp_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 38f994f386..742c3dca2f 100644
--- a/source4/lib/registry/util.c
+++ b/source4/lib/registry/util.c
@@ -65,7 +65,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx,
case REG_SZ:
convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UTF16, CH_UNIX,
data.data, data.length,
- (void **)&ret);
+ (void **)&ret, false);
return ret;
case REG_BINARY:
ret = data_blob_hex_string(mem_ctx, &data);
@@ -125,7 +125,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx,
case REG_EXPAND_SZ:
data->length = convert_string_talloc_convenience(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16,
data_str, strlen(data_str),
- (void **)&data->data);
+ (void **)&data->data, false);
break;
case REG_DWORD: {
diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c
index 2d1d1ca7e1..93f1329ea9 100644
--- a/source4/lib/tdr/tdr.c
+++ b/source4/lib/tdr/tdr.c
@@ -153,7 +153,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v,
TDR_PULL_NEED_BYTES(tdr, el_size*length);
- ret = convert_string_talloc_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v));
+ ret = convert_string_talloc_convenience(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v), false);
if (ret == -1) {
return NT_STATUS_INVALID_PARAMETER;
@@ -175,7 +175,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_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required);
+ ret = convert_string_convenience(tdr->iconv_convenience, CH_UNIX, chset, *v, strlen(*v), tdr->data.data+tdr->data.length, required, false);
if (ret == -1) {
return NT_STATUS_INVALID_PARAMETER;
diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c
index 34fa4365ca..b8f4e5116c 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,
}
size = convert_string_talloc(io->streams,
CH_UTF16, CH_UNIX,
- blob.data+ofs+24, nlen, &vstr);
+ blob.data+ofs+24, nlen, &vstr, false);
if (size == -1) {
return NT_STATUS_ILLEGAL_CHARACTER;
}
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 029d56428d..5b461b47fd 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -585,7 +585,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 = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)dest, false);
if (ret == -1) {
*dest = NULL;
return 0;
@@ -627,7 +627,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 = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)dest, false);
if (ret == -1) {
*dest = NULL;
@@ -780,7 +780,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 = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, false);
if (ret == -1) {
*dest = NULL;
return 0;
@@ -826,7 +826,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 = convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, false);
if (ret == -1) {
*dest = NULL;
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index e1d6b0e7a6..19a2862d68 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -676,7 +676,7 @@ NTSTATUS smb2_pull_o16s16_string(struct smb2_request_buffer *buf, TALLOC_CTX *me
}
size = convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
- blob.data, blob.length, &vstr);
+ blob.data, blob.length, &vstr, false);
data_blob_free(&blob);
(*str) = (char *)vstr;
if (size == -1) {
@@ -707,7 +707,7 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf,
}
size = convert_string_talloc(buf->buffer, CH_UNIX, CH_UTF16,
- str, strlen(str), (void **)&blob.data);
+ str, strlen(str), (void **)&blob.data, false);
if (size == -1) {
return NT_STATUS_ILLEGAL_CHARACTER;
}
diff --git a/source4/libnet/libnet_samdump.c b/source4/libnet/libnet_samdump.c
index b35fef2c16..04a73c53ff 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, lp_iconv_convenience(ctx->lp_ctx), CH_UTF16, CH_UNIX,
s->secret.data, s->secret.length,
- (void **)&secret_string) == -1) {
+ (void **)&secret_string, false) == -1) {
r->out.error_string = talloc_asprintf(mem_ctx,
"Could not convert secret for domain %s to a string",
t->name);
diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c
index 1b5da2dcc2..1ef1b0c13c 100644
--- a/source4/librpc/ndr/ndr_string.c
+++ b/source4/librpc/ndr/ndr_string.c
@@ -85,7 +85,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
ndr->iconv_convenience, chset, CH_UNIX,
ndr->data+ndr->offset,
(len2 + c_len_term)*byte_mul,
- (void **)&as);
+ (void **)&as, false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -123,7 +123,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
chset, CH_UNIX,
ndr->data+ndr->offset,
(len1 + c_len_term)*byte_mul,
- (void **)&as);
+ (void **)&as, false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -162,7 +162,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
chset, CH_UNIX,
ndr->data+ndr->offset,
(len1 + c_len_term)*byte_mul,
- (void **)&as);
+ (void **)&as, false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -197,7 +197,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
chset, CH_UNIX,
ndr->data+ndr->offset,
(len3 + c_len_term)*byte_mul,
- (void **)&as);
+ (void **)&as, false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -230,7 +230,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
chset, CH_UNIX,
ndr->data+ndr->offset,
len3,
- (void **)&as);
+ (void **)&as, false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -250,7 +250,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
ndr->iconv_convenience, chset, CH_UNIX,
ndr->data+ndr->offset,
len1,
- (void **)&as);
+ (void **)&as, false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -276,7 +276,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
chset, CH_UNIX,
ndr->data+ndr->offset,
len1,
- (void **)&as);
+ (void **)&as, false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -334,7 +334,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags,
if (!(flags & LIBNDR_FLAG_STR_NOTERM)) {
s_len++;
}
- d_len = convert_string_talloc_convenience(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest);
+ d_len = convert_string_talloc_convenience(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest, false);
if (d_len == -1) {
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -673,7 +673,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags,
chset, CH_UNIX,
ndr->data+ndr->offset,
length*byte_mul,
- discard_const_p(void *, var));
+ discard_const_p(void *, var), false);
if (ret == -1) {
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
@@ -696,7 +696,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_convenience(ndr->iconv_convenience, CH_UNIX, chset,
var, strlen(var),
- ndr->data+ndr->offset, required);
+ ndr->data+ndr->offset, required, false);
if (ret == -1) {
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
"Bad character conversion");
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index ff8215a673..33a70fd478 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -255,7 +255,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) == -1) {
+ (void **)&new_pass, false) == -1) {
DEBUG(3,("samr: failed to convert incoming password buffer to unix charset\n"));
ldb_transaction_cancel(sam_ctx);
return NT_STATUS_WRONG_PASSWORD;
@@ -265,7 +265,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);
+ (void **)&new_unicode_password.data, false);
if (unicode_pw_len == -1) {
DEBUG(3,("samr: failed to convert incoming password buffer to UTF16 charset\n"));
ldb_transaction_cancel(sam_ctx);
@@ -433,7 +433,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) != -1) {
+ (void **)&new_pass, false) != -1) {
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 444714fa5e..377c5bf3cc 100644
--- a/source4/smb_server/smb/request.c
+++ b/source4/smb_server/smb/request.c
@@ -513,7 +513,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);
+ ret = convert_string_talloc(bufinfo->mem_ctx, CH_UTF16, CH_UNIX, src, src_len2, (void **)&dest2, false);
if (ret == -1) {
*dest = NULL;
@@ -562,7 +562,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);
+ ret = convert_string_talloc(bufinfo->mem_ctx, CH_DOS, CH_UNIX, src, src_len2, (void **)&dest2, false);
if (ret == -1) {
*dest = NULL;
diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c
index 0ae7f6036b..33ab2c9768 100644
--- a/source4/torture/basic/charset.c
+++ b/source4/torture/basic/charset.c
@@ -56,7 +56,7 @@ static NTSTATUS unicode_open(struct torture_context *tctx,
}
SSVAL(ucs_name, i*2, 0);
- i = convert_string_talloc_convenience(ucs_name, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname);
+ i = convert_string_talloc_convenience(ucs_name, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname, false);
if (i == -1) {
torture_comment(tctx, "Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n");
talloc_free(ucs_name);
diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c
index f0700f73a0..ef0e4d44ed 100644
--- a/source4/torture/basic/utable.c
+++ b/source4/torture/basic/utable.c
@@ -51,7 +51,7 @@ bool torture_utable(struct torture_context *tctx,
p = fname+strlen(fname);
len = convert_string_convenience(lp_iconv_convenience(tctx->lp_ctx), CH_UTF16, CH_UNIX,
c2, 2,
- p, sizeof(fname)-strlen(fname));
+ p, sizeof(fname)-strlen(fname), false);
p[len] = 0;
strncat(fname,"_a_long_extension",sizeof(fname)-1);
@@ -110,7 +110,7 @@ static char *form_name(struct smb_iconv_convenience *iconv_convenience, int c)
len = convert_string_convenience(iconv_convenience, CH_UTF16, CH_UNIX,
c2, 2,
- p, sizeof(fname)-strlen(fname));
+ p, sizeof(fname)-strlen(fname), false);
p[len] = 0;
return fname;
}
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index db4657e835..7e1744ffab 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -1175,7 +1175,7 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea
samlogon_state->iconv_convenience,
CH_UNIX, CH_DOS,
password, strlen(password)+1,
- (void**)&dospw)) == -1) {
+ (void**)&dospw, false)) == -1) {
DEBUG(0, ("convert_string_talloc failed!\n"));
exit(1);
}
diff --git a/source4/torture/rpc/spoolss_win.c b/source4/torture/rpc/spoolss_win.c
index 6ecace2ae6..b09c62479c 100644
--- a/source4/torture/rpc/spoolss_win.c
+++ b/source4/torture/rpc/spoolss_win.c
@@ -383,7 +383,7 @@ static bool test_EnumPrinterKey(struct torture_context *tctx,
convert_string_talloc_convenience(ctx, lp_iconv_convenience(tctx->lp_ctx), CH_UTF16,
CH_UNIX, epk.out.key_buffer, *epk.out.needed,
- (void**)&ctx->printer_keys);
+ (void**)&ctx->printer_keys, false);
return true;
}