The branch, master has been updated
       via  07d03e2 s3:lib: fix const warnings in popt_common.c
       via  3dcc321 s3:auth: add some const to user_in_list()
       via  c6d3571 s3:auth: add missing auth_samba4_init() prototype
       via  d5326bc nsswitch: avoid some compiler warnings
       via  e36de87 auth: add missing includes to auth/wbc_auth_util.c
       via  6f6d2c7 s4:librpc/idl: add a uuid to sasl_helpers.idl
       via  aa018fd s4:librpc: remove unused allow_warnings=True from 
NDR_WINSREPL and NDR_WINSIF
       via  ef2e05e libcli/nbt: use NDR_SCALAR_PTR_PROTO() and fix the 
prototype of ndr_pull_wrepl_nbt_name()
       via  bade65d librpc/ndr: add NDR_SCALAR_PTR_PROTO() helper macro
       via  530e3db lib/smbconf: remove const warning
       via  3d4eb5c lib/param: fix const warnings
       via  3f0c7e8 lib/util/tests: avoid some compiler warnings
       via  c5db62c lib/util: add str_list_make_v3_const()
       via  94fadfc lib/ldb: remove unused 'allow_warnings=True'
       via  8ac49f9 lib/ldb: fix compiler warnings in ldb_tdb.c
       via  edc6a89 lib/ldb: fix compiler warnings in 
ldb_modules_list_from_string()
       via  e27a23e lib/texpect: fix compiler warnings
       via  0f0148e lib/texpect: make the code more portable by using 
"replace.h" and "system/wait.h"
       via  6ff9388 wafsamba: add -Werror=return-type for developer builds
       via  8ed8997 fsrvp: define FSRVP_E_SHADOWCOPYSET_ID_MISMATCH
      from  d04bfc6 ctdb-daemon: Improve error handling for running event 
scripts

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 07d03e277757510b6c1b142ca9cee0b1b755b7b6
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Feb 26 20:16:26 2014 +0100

    s3:lib: fix const warnings in popt_common.c
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Sat Nov 15 01:46:13 CET 2014 on sn-devel-104

commit 3dcc321daf569cf64715d47577105af7a48d10ba
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Feb 26 20:16:26 2014 +0100

    s3:auth: add some const to user_in_list()
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit c6d35716502e43cc4ba220bd5374eab8d73ae1b1
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Feb 26 20:16:26 2014 +0100

    s3:auth: add missing auth_samba4_init() prototype
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit d5326bca33a7e64cd86f2a86a8b95591ed712a77
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Feb 27 09:38:39 2014 +0100

    nsswitch: avoid some compiler warnings
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit e36de873e9fff543aefa06ee046dabd3d9b03c72
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu May 22 10:36:41 2014 +0200

    auth: add missing includes to auth/wbc_auth_util.c
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 6f6d2c7a4f732673d545cf03bffe658fd3172410
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 12:03:15 2014 +0100

    s4:librpc/idl: add a uuid to sasl_helpers.idl
    
    This makes it possible to use decode_saslauthd in ndrdump.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit aa018fda3dd28092031825a7edfc684b354e44fe
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 12:00:12 2014 +0100

    s4:librpc: remove unused allow_warnings=True from NDR_WINSREPL and 
NDR_WINSIF
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit ef2e05e4414b6292ef4921037ae96d4b831744be
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 11:57:41 2014 +0100

    libcli/nbt: use NDR_SCALAR_PTR_PROTO() and fix the prototype of 
ndr_pull_wrepl_nbt_name()
    
    This avoids compiler warnings in pidl generated code.
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit bade65dac3fed5fcb0f7f1cedec516b1e7ccab45
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 11:57:10 2014 +0100

    librpc/ndr: add NDR_SCALAR_PTR_PROTO() helper macro
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 530e3db70b5cf1f6e9dd4b70091a094505fa15f0
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Feb 27 09:31:42 2014 +0100

    lib/smbconf: remove const warning
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 3d4eb5c043eaaecf4bddc55e2fef12047cbb9981
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Feb 26 08:07:47 2014 +0100

    lib/param: fix const warnings
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 3f0c7e87947b4f086dcf421dd4209f6afa7d7f4a
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Feb 27 09:35:15 2014 +0100

    lib/util/tests: avoid some compiler warnings
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit c5db62c9a35668e105a8a2da045bfd33f2d91a81
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 10:59:49 2014 +0100

    lib/util: add str_list_make_v3_const()
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 94fadfc89bab0c28f5c126c653569c5f1b99a64e
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 11:56:25 2014 +0100

    lib/ldb: remove unused 'allow_warnings=True'
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 8ac49f9f05415a49619e160c468a3fa261b0320b
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 11:53:06 2014 +0100

    lib/ldb: fix compiler warnings in ldb_tdb.c
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit edc6a89398f1fff9de55e77e84b441bfab955869
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 11:52:37 2014 +0100

    lib/ldb: fix compiler warnings in ldb_modules_list_from_string()
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit e27a23e6aa27ae2a9b6ae2e2a2560943157aaa5c
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Sep 26 09:06:59 2014 +0200

    lib/texpect: fix compiler warnings
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Günther Deschner <g...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 0f0148e020b6f85447f26de17c2b0b002bcdf498
Author: Stefan Metzmacher <me...@samba.org>
Date:   Wed Oct 29 11:48:59 2014 +0100

    lib/texpect: make the code more portable by using "replace.h" and 
"system/wait.h"
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 6ff9388172909ce249fd6254703eee707d821731
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Nov 7 09:36:16 2014 +0100

    wafsamba: add -Werror=return-type for developer builds
    
    This avoids errors like this:
    
     ../source3/utils/status.c: In function ‘print_share_mode’:
     ../source3/utils/status.c:126:3: error: ‘return’ with no value, in function
     returning non-void [-Werror=return-type]
       return;
    
    Signed-off-by: Stefan Metzmacher <me...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 8ed899783d288c01f77f5139d3f5b6c26aa1fc7b
Author: David Disseldorp <dd...@samba.org>
Date:   Fri Nov 14 18:36:28 2014 +0100

    fsrvp: define FSRVP_E_SHADOWCOPYSET_ID_MISMATCH
    
    This was recently added to the [MS-FSRVP] specification with the errata
    http://msdn.microsoft.com/en-us/library/dn785066.aspx#BKMK_FSRVP
    
    Signed-off-by: David Disseldorp <dd...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 auth/wbc_auth_util.c                  |  2 ++
 buildtools/wafsamba/samba_autoconf.py |  2 ++
 lib/ldb/common/ldb_modules.c          |  4 +--
 lib/ldb/ldb_tdb/ldb_tdb.c             | 14 +++++++--
 lib/ldb/wscript                       |  2 --
 lib/param/loadparm.c                  | 23 +++++++--------
 lib/smbconf/smbconf.c                 |  2 +-
 lib/texpect/texpect.c                 | 24 +++++-----------
 lib/util/charset/tests/iconv.c        | 19 +++++++------
 lib/util/samba_util.h                 |  4 +++
 lib/util/tests/asn1_tests.c           | 22 +++++++--------
 lib/util/tests/strlist.c              | 53 ++++++++++++++++++++++++++---------
 lib/util/util_strlist.c               |  7 +++++
 libcli/nbt/libnbt.h                   |  2 +-
 libcli/nbt/nbtname.c                  |  2 +-
 librpc/idl/fsrvp.idl                  |  1 +
 librpc/ndr/libndr.h                   |  5 ++++
 nsswitch/pam_winbind.c                |  4 +--
 nsswitch/wbinfo.c                     |  7 +++--
 nsswitch/winbind_nss_linux.c          |  2 +-
 source3/auth/proto.h                  |  5 +++-
 source3/auth/user_util.c              |  4 +--
 source3/lib/popt_common.c             |  9 ++++--
 source3/rpcclient/cmd_fss.c           |  6 +++-
 source4/librpc/idl/sasl_helpers.idl   |  2 ++
 source4/librpc/wscript_build          |  3 --
 26 files changed, 143 insertions(+), 87 deletions(-)


Changeset truncated at 500 lines:

diff --git a/auth/wbc_auth_util.c b/auth/wbc_auth_util.c
index ebd24a9..1c50b18 100644
--- a/auth/wbc_auth_util.c
+++ b/auth/wbc_auth_util.c
@@ -21,6 +21,8 @@
 #include "libcli/security/security.h"
 #include "librpc/gen_ndr/netlogon.h"
 #include "nsswitch/libwbclient/wbclient.h"
+#include "librpc/gen_ndr/auth.h"
+#include "auth/auth_sam_reply.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
diff --git a/buildtools/wafsamba/samba_autoconf.py 
b/buildtools/wafsamba/samba_autoconf.py
index f60ce9d..c193873 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -671,6 +671,8 @@ def SAMBA_CONFIG_H(conf, path=None):
                         testflags=True)
         conf.ADD_CFLAGS('-Werror=declaration-after-statement 
-Wdeclaration-after-statement',
                         testflags=True)
+        conf.ADD_CFLAGS('-Werror=return-type -Wreturn-type',
+                        testflags=True)
 
         conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True)
         # This check is because for ldb_search(), a NULL format string
diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c
index 05a8d8a..91412a6 100644
--- a/lib/ldb/common/ldb_modules.c
+++ b/lib/ldb/common/ldb_modules.c
@@ -87,7 +87,7 @@ const char **ldb_modules_list_from_string(struct ldb_context 
*ldb, TALLOC_CTX *m
 
        if (modstr[0] == '\0') {
                modules[0] = NULL;
-               m = (const char **)modules;
+               m = discard_const_p(const char *, modules);
                return m;
        }
 
@@ -110,7 +110,7 @@ const char **ldb_modules_list_from_string(struct 
ldb_context *ldb, TALLOC_CTX *m
 
        modules[i + 1] = NULL;
 
-       m = (const char **)modules;
+       m = discard_const_p(const char *, modules);
 
        return m;
 }
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index d3c83f5..bcb8f0f 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -264,6 +264,7 @@ int ltdb_store(struct ldb_module *module, const struct 
ldb_message *msg, int flg
        void *data = ldb_module_get_private(module);
        struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
        TDB_DATA tdb_key, tdb_data;
+       struct ldb_val ldb_data;
        int ret = LDB_SUCCESS;
 
        tdb_key = ltdb_key(module, msg->dn);
@@ -272,12 +273,15 @@ int ltdb_store(struct ldb_module *module, const struct 
ldb_message *msg, int flg
        }
 
        ret = ldb_pack_data(ldb_module_get_ctx(module),
-                           msg, (struct ldb_val *)&tdb_data);
+                           msg, &ldb_data);
        if (ret == -1) {
                talloc_free(tdb_key.dptr);
                return LDB_ERR_OTHER;
        }
 
+       tdb_data.dptr = ldb_data.data;
+       tdb_data.dsize = ldb_data.length;
+
        ret = tdb_store(ltdb->tdb, tdb_key, tdb_data, flgs);
        if (ret != 0) {
                ret = ltdb_err_map(tdb_error(ltdb->tdb));
@@ -286,7 +290,7 @@ int ltdb_store(struct ldb_module *module, const struct 
ldb_message *msg, int flg
 
 done:
        talloc_free(tdb_key.dptr);
-       talloc_free(tdb_data.dptr);
+       talloc_free(ldb_data.data);
 
        return ret;
 }
@@ -673,6 +677,7 @@ int ltdb_modify_internal(struct ldb_module *module,
        void *data = ldb_module_get_private(module);
        struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
        TDB_DATA tdb_key, tdb_data;
+       struct ldb_val ldb_data;
        struct ldb_message *msg2;
        unsigned int i, j, k;
        int ret = LDB_SUCCESS, idx;
@@ -701,7 +706,10 @@ int ltdb_modify_internal(struct ldb_module *module,
                goto done;
        }
 
-       ret = ldb_unpack_data(ldb_module_get_ctx(module), (struct ldb_val 
*)&tdb_data, msg2);
+       ldb_data.data = tdb_data.dptr;
+       ldb_data.length = tdb_data.dsize;
+
+       ret = ldb_unpack_data(ldb_module_get_ctx(module), &ldb_data, msg2);
        free(tdb_data.dptr);
        if (ret == -1) {
                ret = LDB_ERR_OTHER;
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 027c8cb..cb6b5c8 100755
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -153,7 +153,6 @@ def build(bld):
                           pc_files='ldb.pc',
                           vnum=VERSION,
                           private_library=private_library,
-                          allow_warnings=True,
                           manpages='man/ldb.3',
                           abi_directory='ABI',
                           abi_match = abi_match)
@@ -255,7 +254,6 @@ def build(bld):
                             'common/ldb.c',
                             deps='tevent tdb',
                             includes='include',
-                            allow_warnings=True,
                             cflags=['-DLDB_MODULESDIR=\"%s\"' % modules_dir])
 
         LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index d1e36df..b9a3e20 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -414,8 +414,10 @@ const char **lpcfg_parm_string_list(TALLOC_CTX *mem_ctx,
 {
        const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
 
-       if (value != NULL)
-               return (const char **)str_list_make(mem_ctx, value, separator);
+       if (value != NULL) {
+               char **l = str_list_make(mem_ctx, value, separator);
+               return discard_const_p(const char *, l);
+       }
 
        return NULL;
 }
@@ -905,8 +907,8 @@ void copy_service(struct loadparm_service *pserviceDest,
                                case P_CMDLIST:
                                case P_LIST:
                                        TALLOC_FREE(*((char ***)dest_ptr));
-                                       *(const char * const **)dest_ptr = 
(const char * const *)str_list_copy(pserviceDest,
-                                                                               
  *(const char * * const *)src_ptr);
+                                       *(char ***)dest_ptr = 
str_list_copy(pserviceDest,
+                                                                           
*discard_const_p(const char **, src_ptr));
                                        break;
                                default:
                                        break;
@@ -1287,8 +1289,8 @@ bool handle_netbios_aliases(struct loadparm_context 
*lp_ctx, struct loadparm_ser
                            const char *pszParmValue, char **ptr)
 {
        TALLOC_FREE(lp_ctx->globals->netbios_aliases);
-       lp_ctx->globals->netbios_aliases = (const char 
**)str_list_make_v3(lp_ctx->globals->ctx,
-                                                                          
pszParmValue, NULL);
+       lp_ctx->globals->netbios_aliases = 
str_list_make_v3_const(lp_ctx->globals->ctx,
+                                                                 pszParmValue, 
NULL);
 
        if (lp_ctx->s3_fns) {
                return 
lp_ctx->s3_fns->set_netbios_aliases(lp_ctx->globals->netbios_aliases);
@@ -1502,9 +1504,8 @@ static bool set_variable_helper(TALLOC_CTX *mem_ctx, int 
parmnum, void *parm_ptr
 
                case P_CMDLIST:
                        TALLOC_FREE(*(char ***)parm_ptr);
-                       *(const char * const **)parm_ptr
-                               = (const char * const 
*)str_list_make_v3(mem_ctx,
-                                                                        
pszParmValue, NULL);
+                       *(char ***)parm_ptr = str_list_make_v3(mem_ctx,
+                                                       pszParmValue, NULL);
                        break;
 
                case P_LIST:
@@ -1537,7 +1538,7 @@ static bool set_variable_helper(TALLOC_CTX *mem_ctx, int 
parmnum, void *parm_ptr
                                                          pszParmName, 
pszParmValue));
                                                return false;
                                        }
-                                       *(const char * const **)parm_ptr = 
(const char * const *) new_list;
+                                       *(char ***)parm_ptr = new_list;
                                        break;
                                }
                        }
@@ -2001,7 +2002,7 @@ static bool is_default(void *base_structure, int i)
                case P_CMDLIST:
                case P_LIST:
                        return str_list_equal((const char * const 
*)parm_table[i].def.lvalue,
-                                             *(const char ***)def_ptr);
+                                             *(const char * const **)def_ptr);
                case P_STRING:
                case P_USTRING:
                        return strequal(parm_table[i].def.svalue,
diff --git a/lib/smbconf/smbconf.c b/lib/smbconf/smbconf.c
index 27d36ca..4129ea5 100644
--- a/lib/smbconf/smbconf.c
+++ b/lib/smbconf/smbconf.c
@@ -286,7 +286,7 @@ sbcErr smbconf_create_set_share(struct smbconf_ctx *ctx,
        }
 
        err = smbconf_set_includes(ctx, service->name, num_includes,
-                                  (const char **)includes);
+                                  discard_const_p(const char *, includes));
        if (!SBC_ERROR_IS_OK(err)) {
                goto cancel;
        }
diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
index ac88979..d788081 100644
--- a/lib/texpect/texpect.c
+++ b/lib/texpect/texpect.c
@@ -31,20 +31,10 @@
  * SUCH DAMAGE.
  */
 
-#include "config.h"
+#include "replace.h"
+#include "system/filesys.h"
+#include "system/wait.h"
 
-#ifndef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 #ifdef HAVE_PTY_H
 #include <pty.h>
 #endif
@@ -60,9 +50,7 @@
 #endif /* STREAMPTY */
 
 #include <popt.h>
-#include <errno.h>
 #include <err.h>
-#include <signal.h>
 
 struct command {
        enum { CMD_EXPECT = 0, CMD_SEND, CMD_PASSWORD } type;
@@ -370,8 +358,9 @@ int main(int argc, const char **argv)
        pid_t pid;
        poptContext pc;
        const char *instruction_file;
+       const char **args;
        const char *program;
-       char* const *program_args;
+       char * const *program_args;
 
        pc = poptGetContext("texpect",
                            argc,
@@ -389,7 +378,8 @@ int main(int argc, const char **argv)
        }
 
        instruction_file = poptGetArg(pc);
-       program_args = poptGetArgs(pc);
+       args = poptGetArgs(pc);
+       program_args = (char * const *)discard_const_p(char *, args);
        program = program_args[0];
 
        if (opt_verbose) {
diff --git a/lib/util/charset/tests/iconv.c b/lib/util/charset/tests/iconv.c
index 06ace9b..30161d3 100644
--- a/lib/util/charset/tests/iconv.c
+++ b/lib/util/charset/tests/iconv.c
@@ -102,8 +102,10 @@ static unsigned int get_codepoint(char *buf, size_t size, 
const char *charset)
        memset(out, 0, sizeof(out));
 
        ret = iconv(cd, &buf, &size_in, &ptr_out, &size_out);
-
        iconv_close(cd);
+       if (ret == (size_t) -1) {
+               return (unsigned int)-1;
+       }
 
        return out[0] | (out[1]<<8) | (out[2]<<16) | (out[3]<<24);
 }
@@ -132,7 +134,8 @@ static bool test_buffer(struct torture_context *test,
 {
        uint8_t buf1[1000], buf2[1000], buf3[1000];
        size_t outsize1, outsize2, outsize3;
-       char *ptr_in;
+       const char *ptr_in1;
+       char *ptr_in2;
        char *ptr_out;
        size_t size_in1, size_in2, size_in3;
        size_t ret1, ret2, ret3, len1, len2;
@@ -174,25 +177,25 @@ static bool test_buffer(struct torture_context *test,
        }
 
        /* internal convert to charset - placing result in buf1 */
-       ptr_in = (char *)inbuf;
+       ptr_in1 = (const char *)inbuf;
        ptr_out = (char *)buf1;
        size_in1 = size;
        outsize1 = sizeof(buf1);
 
        memset(ptr_out, 0, outsize1);
        errno = 0;
-       ret1 = smb_iconv(cd2, (const char **) &ptr_in, &size_in1, &ptr_out, 
&outsize1);
+       ret1 = smb_iconv(cd2, &ptr_in1, &size_in1, &ptr_out, &outsize1);
        errno1 = errno;
 
        /* system convert to charset - placing result in buf2 */
-       ptr_in = (char *)inbuf;
+       ptr_in2 = (char *)inbuf;
        ptr_out = (char *)buf2;
        size_in2 = size;
        outsize2 = sizeof(buf2);
        
        memset(ptr_out, 0, outsize2);
        errno = 0;
-       ret2 = iconv(cd, &ptr_in, &size_in2, &ptr_out, &outsize2);
+       ret2 = iconv(cd, &ptr_in2, &size_in2, &ptr_out, &outsize2);
        errno2 = errno;
 
        len1 = sizeof(buf1) - outsize1;
@@ -247,13 +250,13 @@ static bool test_buffer(struct torture_context *test,
 
        /* convert back to UTF-16, putting result in buf3 */
        size = size - size_in1;
-       ptr_in = (char *)buf1;
+       ptr_in1 = (const char *)buf1;
        ptr_out = (char *)buf3;
        size_in3 = len1;
        outsize3 = sizeof(buf3);
 
        memset(ptr_out, 0, outsize3);
-       ret3 = smb_iconv(cd3, (const char **) &ptr_in, &size_in3, &ptr_out, 
&outsize3);
+       ret3 = smb_iconv(cd3, &ptr_in1, &size_in3, &ptr_out, &outsize3);
 
        /* we only internally support the first 1M codepoints */
        if (outsize3 != sizeof(buf3) - size &&
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 41b3fc8..2f762ac 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -476,6 +476,10 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char 
*string,
        const char *sep);
 
 
+const char **str_list_make_v3_const(TALLOC_CTX *mem_ctx,
+                                   const char *string,
+                                   const char *sep);
+
 /* The following definitions come from lib/util/util_file.c  */
 
 
diff --git a/lib/util/tests/asn1_tests.c b/lib/util/tests/asn1_tests.c
index 2c68cb4..6dd7c64 100644
--- a/lib/util/tests/asn1_tests.c
+++ b/lib/util/tests/asn1_tests.c
@@ -111,47 +111,47 @@ static const struct {
        int value;
 } integer_tests[] = {
         {
-               .blob = {"\x02\x01\x00", 3},
+               .blob = { discard_const_p(uint8_t, "\x02\x01\x00"), 3},
                .value = 0
        },
        {
-               .blob = {"\x02\x01\x7f", 3},
+               .blob = { discard_const_p(uint8_t, "\x02\x01\x7f"), 3},
                .value = 127
        },
        {
-               .blob = {"\x02\x02\x00\x80", 4},
+               .blob = { discard_const_p(uint8_t, "\x02\x02\x00\x80"), 4},
                .value = 128
        },
        {
-               .blob = {"\x02\x02\x01\x00", 4},
+               .blob = { discard_const_p(uint8_t, "\x02\x02\x01\x00"), 4},
                .value = 256
        },
        {
-               .blob = {"\x02\x01\x80", 3},
+               .blob = { discard_const_p(uint8_t, "\x02\x01\x80"), 3},
                .value = -128
        },
        {
-               .blob = {"\x02\x02\xff\x7f", 4},
+               .blob = { discard_const_p(uint8_t, "\x02\x02\xff\x7f"), 4},
                .value = -129
        },
        {
-               .blob = {"\x02\x01\xff", 3},
+               .blob = { discard_const_p(uint8_t, "\x02\x01\xff"), 3},
                .value = -1
        },
        {
-               .blob = {"\x02\x02\xff\x01", 4},
+               .blob = { discard_const_p(uint8_t, "\x02\x02\xff\x01"), 4},
                .value = -255
        },
        {
-               .blob = {"\x02\x02\x00\xff", 4},
+               .blob = { discard_const_p(uint8_t, "\x02\x02\x00\xff"), 4},
                .value = 255
        },
        {
-               .blob = {"\x02\x04\x80\x00\x00\x00", 6},
+               .blob = { discard_const_p(uint8_t, "\x02\x04\x80\x00\x00\x00"), 
6},
                .value = 0x80000000
        },
        {
-               .blob = {"\x02\x04\x7f\xff\xff\xff", 6},
+               .blob = { discard_const_p(uint8_t, "\x02\x04\x7f\xff\xff\xff"), 
6},
                .value = 0x7fffffff
        }
 };
diff --git a/lib/util/tests/strlist.c b/lib/util/tests/strlist.c
index 7df01d3..1718499 100644
--- a/lib/util/tests/strlist.c
+++ b/lib/util/tests/strlist.c
@@ -111,7 +111,8 @@ static bool test_lists_shell(struct torture_context *tctx, 
const void *data)
        ret1 = str_list_make_shell(mem_ctx, element->list_as_string, 
element->separators);
        
        torture_assert(tctx, ret1, "str_list_make_shell() must not return 
NULL");
-       tmp = str_list_join_shell(mem_ctx, (const char **) ret1, 
element->separators ? *element->separators : ' ');
+       tmp = str_list_join_shell(mem_ctx, discard_const_p(const char *, ret1),
+                                 element->separators ? *element->separators : 
' ');
        ret2 = str_list_make_shell(mem_ctx, tmp, element->separators);
 
        if ((ret1 == NULL || ret2 == NULL) && ret2 != ret1) {
@@ -161,18 +162,22 @@ static bool test_list_copy(struct torture_context *tctx)
        const char *list[] = { "foo", "bar", NULL };
        const char *empty_list[] = { NULL };
        const char **null_list = NULL;
+       char **l;
 
-       result = (const char **)str_list_copy(tctx, list);
+       l = str_list_copy(tctx, list);
+       result = discard_const_p(const char *, l);
        torture_assert_int_equal(tctx, str_list_length(result), 2, "list 
length");
        torture_assert_str_equal(tctx, result[0], "foo", "element 0");
        torture_assert_str_equal(tctx, result[1], "bar", "element 1");
        torture_assert_str_equal(tctx, result[2], NULL, "element 2");
 
-       result = (const char **)str_list_copy(tctx, empty_list);
+       l = str_list_copy(tctx, empty_list);
+       result = discard_const_p(const char *, l);
        torture_assert_int_equal(tctx, str_list_length(result), 0, "list 
length");
        torture_assert_str_equal(tctx, result[0], NULL, "element 0");
 
-       result = (const char **)str_list_copy(tctx, null_list);
+       l = str_list_copy(tctx, null_list);
+       result = discard_const_p(const char *, l);
        torture_assert(tctx, result == NULL, "result NULL");
        
        return true;
@@ -262,9 +267,12 @@ static bool test_list_add(struct torture_context *tctx)
                "element_3",
                NULL
        };
-       result = (const char **) str_list_make(tctx, "element_0, element_1, 
element_2", NULL);
+       char **l;
+
+       l = str_list_make(tctx, "element_0, element_1, element_2", NULL);
+       result = discard_const_p(const char *, l);
        torture_assert(tctx, result, "str_list_make() must not return NULL");
-       result2 = str_list_add((const char **) result, "element_3");
+       result2 = str_list_add(result, "element_3");
        torture_assert(tctx, result2, "str_list_add() must not return NULL");
        torture_assert(tctx, str_list_equal(result2, list), 
                       "str_list_add() failed");
@@ -282,7 +290,10 @@ static bool test_list_add_const(struct torture_context 
*tctx)
                "element_3",
                NULL
        };
-       result = (const char **) str_list_make(tctx, "element_0, element_1, 
element_2", NULL);
+       char **l;
+
+       l = str_list_make(tctx, "element_0, element_1, element_2", NULL);
+       result = discard_const_p(const char *, l);
        torture_assert(tctx, result, "str_list_make() must not return NULL");
        result2 = str_list_add_const(result, "element_3");
        torture_assert(tctx, result2, "str_list_add_const() must not return 
NULL");
@@ -301,7 +312,10 @@ static bool test_list_remove(struct torture_context *tctx)
                "element_3",
                NULL
        };
-       result = (const char **) str_list_make(tctx, "element_0, element_1, 
element_2, element_3", NULL);
+       char **l;
+
+       l = str_list_make(tctx, "element_0, element_1, element_2, element_3", 
NULL);
+       result = discard_const_p(const char *, l);
        torture_assert(tctx, result, "str_list_make() must not return NULL");
        str_list_remove(result, "element_2");
        torture_assert(tctx, str_list_equal(result, list), 
@@ -358,7 +372,10 @@ static bool test_list_unique(struct torture_context *tctx)
                "element_2",
                NULL
        };


-- 
Samba Shared Repository

Reply via email to