Merge branch 'master' of git://git.samba.org/samba into convenience
authorJelmer Vernooij <jelmer@samba.org>
Sun, 1 Mar 2009 16:29:04 +0000 (17:29 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 1 Mar 2009 16:29:04 +0000 (17:29 +0100)
28 files changed:
lib/util/charset/charcnv.c
lib/util/charset/charset.h
lib/util/charset/tests/iconv.c
lib/util/charset/util_unistr.c
source3/include/includes.h
source3/include/proto.h
source3/include/smb.h
source4/auth/ntlm/ntlm_check.c
source4/dsdb/common/util.c
source4/dsdb/samdb/ldb_modules/password_hash.c
source4/dsdb/schema/schema_init.c
source4/dsdb/schema/schema_syntax.c
source4/kdc/kpasswdd.c
source4/lib/registry/ldb.c
source4/lib/registry/tests/generic.c
source4/lib/registry/util.c
source4/lib/tdr/tdr.c
source4/libcli/raw/rawfileinfo.c
source4/libcli/raw/rawrequest.c
source4/libcli/smb2/request.c
source4/libnet/libnet_samdump.c
source4/librpc/ndr/ndr_string.c
source4/rpc_server/samr/samr_password.c
source4/smb_server/smb/request.c
source4/torture/basic/charset.c
source4/torture/basic/utable.c
source4/torture/rpc/samlogon.c
source4/torture/rpc/spoolss_win.c

index 1f3b1ac846c7bf594d3ff4e174ef7b340da952c4..18be2bcac2a7cf10426c262c2793ce31245745c6 100644 (file)
@@ -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)
index f027beb8db8860115e60506a000c0661fbcaa019..3acdde30ad87f3e45bc05c441dff1b30a93caf80 100644 (file)
@@ -61,6 +61,7 @@ typedef struct smb_iconv_s {
        size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft,
                       char **outbuf, size_t *outbytesleft);
        void *cd_direct, *cd_pull, *cd_push;
+       char *from_name, *to_name;
 } *smb_iconv_t;
 
 /* string manipulation flags */
@@ -117,11 +118,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,
+size_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 +151,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);
index 1facea61368dd2b05066537124efa963b2a2c5dd..fbe7b103ab5ee3c5f333399a148e469f8433969e 100644 (file)
@@ -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");
        }
index 41b9c94cbb1ff5dd743382a8a4c1ad2327c9b78a..96c987393ff1dc9d1b69613a9e5c2987ddad6872 100644 (file)
@@ -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);
 }
 
 /**
@@ -950,13 +950,13 @@ _PUBLIC_ ssize_t pull_string(char *dest, const void *src, size_t dest_len, size_
  * @param destlen maximal length allowed for string
  * @returns the number of bytes occupied in the destination
  **/
-_PUBLIC_ ssize_t convert_string(charset_t from, charset_t to,
+_PUBLIC_ size_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);
 }
 
 
index 523a11e255da3c7b66d3a1d5ccc94c82d491b1f4..7f8c408265823021d14324e621c82ad84a8c91ab 100644 (file)
@@ -594,7 +594,7 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
 #include "trans2.h"
 #include "../libcli/util/error.h"
 #include "ntioctl.h"
-#include "charset.h"
+#include "../lib/util/charset/charset.h"
 #include "dynconfig.h"
 #include "util_getent.h"
 #include "debugparse.h"
index 5bae973c3d1531a07f2f54a833fb09c7962584b3..eeb6f1928deadccd9f13a073886b8e7e5efbee1e 100644 (file)
@@ -528,15 +528,6 @@ void gencache_iterate(void (*fn)(const char* key, const char *value, time_t time
 int gencache_lock_entry( const char *key );
 void gencache_unlock_entry( const char *key );
 
-/* The following definitions come from lib/iconv.c  */
-
-NTSTATUS smb_register_charset(struct charset_functions *funcs) ;
-size_t smb_iconv(smb_iconv_t cd, 
-                const char **inbuf, size_t *inbytesleft,
-                char **outbuf, size_t *outbytesleft);
-smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode);
-int smb_iconv_close (smb_iconv_t cd);
-
 /* The following definitions come from lib/interface.c  */
 
 bool ismyaddr(const struct sockaddr *ip);
index f02088731d75b08e7352bda9c9a21e87220f8ea8..189e370496d5bfc7ea6a3762f30979ebddab2bec 100644 (file)
@@ -167,10 +167,6 @@ typedef uint16 smb_ucs2_t;
 #define COPY_UCS2_CHAR(dest,src) (((unsigned char *)(dest))[0] = ((unsigned char *)(src))[0],\
                                ((unsigned char *)(dest))[1] = ((unsigned char *)(src))[1], (dest))
 
-/* Large data type for manipulating uint32 unicode codepoints */
-typedef uint32 codepoint_t;
-#define INVALID_CODEPOINT ((codepoint_t)-1)
-
 /* pipe string names */
 #define PIPE_LANMAN   "\\PIPE\\LANMAN"
 
@@ -1831,18 +1827,6 @@ struct unix_error_map {
 
 #define SAFE_NETBIOS_CHARS ". -_"
 
-/* generic iconv conversion structure */
-typedef struct _smb_iconv_t {
-       size_t (*direct)(void *cd, const char **inbuf, size_t *inbytesleft,
-                        char **outbuf, size_t *outbytesleft);
-       size_t (*pull)(void *cd, const char **inbuf, size_t *inbytesleft,
-                      char **outbuf, size_t *outbytesleft);
-       size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft,
-                      char **outbuf, size_t *outbytesleft);
-       void *cd_direct, *cd_pull, *cd_push;
-       char *from_name, *to_name;
-} *smb_iconv_t;
-
 /* The maximum length of a trust account password.
    Used when we randomly create it, 15 char passwords
    exceed NT4's max password length */
index a3ac7f3347881e96ab37b14e7e45945804523afd..5298432e617d341de74f9888072e4cd4ffe18122 100644 (file)
@@ -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 {
index b02a16229395f26938fe24ca8a0f8959cef42ad0..82f5b6ed1d46a56940800c66e0939776572414d6 100644 (file)
@@ -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 */
index da4c57463bcc6f6e7e8d516837c0b097d362b51b..f427e697b416f51e8a516797970f1d6b331d0131 100644 (file)
@@ -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) {
index 763872cf2ba18a79e1ba1c0424ad2481470d9da8..0e8ac5e105be96fb611e0a10384d3b5d891318a2 100644 (file)
@@ -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, \
index 4141026b7e03f7b4b16081a81f104e6e734df754..965b85a13a5c5b3603dc481ecbbe808ccf6b3442 100644 (file)
@@ -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;
                }
index 39817d922ba328ab342bfee394821b3f8f73bba5..85e248dceb23d1b4ba81f62f74f1c6498b2e3f81 100644 (file)
@@ -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;
index 1d238f4e23057bb7da9aad9053b71a7c8c741756..41fbd22335fddb520a3b13f8dbf16414fe9355bd 100644 (file)
@@ -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);
index f1fa5ad0b245fd5809f8ec07077dc6b8081d0cab..3a3c3e77474db5ff773f317529a0a0337e337bf4 100644 (file)
@@ -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");
index 38f994f386c4a2ff675170be85417c3fde2ed314..742c3dca2f837c0996936c1378399deaa2b4ff9e 100644 (file)
@@ -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: {
index 2d1d1ca7e19135ef3bab7b2c305a1b5d2d1ce7bc..93f1329ea9da957ae2839127ba857c02ac163982 100644 (file)
@@ -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;
index 34fa4365ca18ca17442d5c5cb4aca93174e5acef..b8f4e5116c49932d68c9c36fb0217cc91480cc69 100644 (file)
@@ -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;
                }
index 029d56428d4a4c9cbc60bd42d262f92d33cd25aa..5b461b47fdfdbba502dc93a63f7cb6f416ad8066 100644 (file)
@@ -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;
index e1d6b0e7a679e87f2f65c50b5df56e2355c6e7c8..19a2862d68c10deb727d41df05843e117afcd417 100644 (file)
@@ -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;
        }
index b35fef2c16c002b584fbd071cc36bbad09eca119..04a73c53fff53deaa4894a32e533c25326cd9fc7 100644 (file)
@@ -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);
index 1b5da2dcc2ea6a5a6241b11111d8228c0063f7b8..1ef1b0c13c646be36341831a528cfcb959f7c3fb 100644 (file)
@@ -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");
index ff8215a6734e19b3ae14378814a8531c5ec477e5..33a70fd4784522236bab099fd74ac7c64783b8eb 100644 (file)
@@ -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) {
index 444714fa5e426bd60904829edd0522907d03c3fd..377c5bf3ccdb6748f73d5238cf9d7f4142bbc2a5 100644 (file)
@@ -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;
index 0ae7f6036b4ec10227953fabe1ae91488e84f08b..33ab2c9768527cdd9f6bbed317b8d6994ac099a5 100644 (file)
@@ -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);
index f0700f73a01a280a512543bf2d6a6d194d86930c..ef0e4d44ed037a5d245d4b4cc6182eefb6e9ad08 100644 (file)
@@ -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;
 }
index db4657e83559d1962e5658ee58e2155df46a324e..7e1744ffabe56521c3dba8beea056f07485afb2a 100644 (file)
@@ -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);
        }
index 6ecace2ae67d59bad7e03fbbae63347c2c7f10e4..b09c62479c3b42be64efd3bf12858d9629de9477 100644 (file)
@@ -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;
 }