Merge branch 'v4-0-trivial' into v4-0-test
authorJelmer Vernooij <jelmer@samba.org>
Thu, 28 Feb 2008 17:27:29 +0000 (18:27 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 28 Feb 2008 17:27:29 +0000 (18:27 +0100)
70 files changed:
source/cldap_server/cldap_server.c
source/kdc/hdb-ldb.c
source/kdc/kdc.c
source/kdc/kdc.h
source/lib/appweb/mpr/miniMpr.c
source/lib/appweb/mpr/miniMpr.h
source/lib/registry/hive.c
source/lib/registry/hive.h
source/lib/registry/ldb.c
source/lib/registry/patchfile.c
source/lib/registry/patchfile.h
source/lib/registry/patchfile_dotreg.c
source/lib/registry/patchfile_preg.c
source/lib/registry/regf.c
source/lib/registry/tests/hive.c
source/lib/registry/tools/regdiff.c
source/libcli/cldap/cldap.c
source/libcli/cldap/cldap.h
source/libcli/finddcs.c
source/libcli/nbt/libnbt.h
source/libcli/nbt/nbtsocket.c
source/libcli/raw/clisession.c
source/libcli/raw/clisocket.c
source/libcli/raw/libcliraw.h
source/libcli/resolve/bcast.c
source/libcli/resolve/nbtlist.c
source/libcli/resolve/wins.c
source/libcli/smb_composite/sesssetup.c
source/libcli/swig/libcli_nbt.i
source/libcli/swig/libcli_nbt_wrap.c
source/libcli/wrepl/winsrepl.c
source/libcli/wrepl/winsrepl.h
source/libnet/libnet_become_dc.c
source/libnet/libnet_site.c
source/libnet/libnet_unbecome_dc.c
source/librpc/rpc/dcerpc.c
source/librpc/rpc/dcerpc_util.c
source/nbt_server/interfaces.c
source/ntvfs/common/notify.c
source/ntvfs/posix/pvfs_rename.c
source/ntvfs/posix/pvfs_resolve.c
source/ntvfs/posix/pvfs_xattr.c
source/ntvfs/sysdep/inotify.c
source/rpc_server/dcerpc_server.c
source/rpc_server/dcesrv_auth.c
source/scripting/ejs/ejsnet/net_ctx.c
source/scripting/ejs/smbcalls.c
source/scripting/ejs/smbcalls_auth.c
source/scripting/ejs/smbcalls_cli.c
source/scripting/ejs/smbcalls_config.c
source/scripting/ejs/smbcalls_creds.c
source/scripting/ejs/smbcalls_data.c
source/scripting/ejs/smbcalls_ldb.c
source/scripting/ejs/smbcalls_nbt.c
source/scripting/ejs/smbcalls_reg.c
source/scripting/ejs/smbcalls_rpc.c
source/scripting/ejs/smbcalls_sys.c
source/smb_server/smb/request.c
source/smb_server/smb_server.c
source/torture/ldap/cldap.c
source/torture/ldap/cldapbench.c
source/torture/nbt/query.c
source/torture/nbt/register.c
source/torture/nbt/wins.c
source/torture/nbt/winsbench.c
source/torture/nbt/winsreplication.c
source/torture/rpc/dssync.c
source/utils/nmblookup.c
source/winbind/wb_pam_auth.c
source/wrepl_server/wrepl_out_helpers.c

index 7858ee2cf0a13e54e48db48fb00ac0b557c70490..783e31d1ae622267ba55ed65a59f891d8157fb49 100644 (file)
@@ -92,7 +92,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_
        NTSTATUS status;
 
        /* listen for unicasts on the CLDAP port (389) */
-       cldapsock = cldap_socket_init(cldapd, cldapd->task->event_ctx);
+       cldapsock = cldap_socket_init(cldapd, cldapd->task->event_ctx, lp_iconv_convenience(cldapd->task->lp_ctx));
        NT_STATUS_HAVE_NO_MEMORY(cldapsock);
 
        socket_address = socket_address_from_strings(cldapsock, cldapsock->sock->backend_name, 
index ff226e5b46c0d05463ae79c7a858ed0a97be5e38..9a17e581e3f650f1646b5ac05e33e1eea9cdf0b8 100644 (file)
@@ -1168,8 +1168,8 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
 krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char *arg)
 {
        NTSTATUS nt_status;
-       /* The global kdc_mem_ctx, Disgusting, ugly hack, but it means one less private hook */
-       nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, global_loadparm
+       /* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */
+       nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, kdc_lp_ctx
                                       context, db, arg);
 
        if (NT_STATUS_IS_OK(nt_status)) {
index 52ee4758625ae975adae437d26892c27e44a006b..92a5dc26e0adb460e1cf49de6ca569c05e7c0369 100644 (file)
 #include "param/param.h"
 
 
-/* Disgusting hack to get a mem_ctx into the hdb plugin, when used as a keytab */
+/* Disgusting hack to get a mem_ctx and lp_ctx into the hdb plugin, when 
+ * used as a keytab */
 TALLOC_CTX *kdc_mem_ctx;
+struct loadparm_context *kdc_lp_ctx;
 
 /* hold all the info needed to send a reply */
 struct kdc_reply {
@@ -648,6 +650,7 @@ static void kdc_task_init(struct task_server *task)
        krb5_kdc_windc_init(kdc->smb_krb5_context->krb5_context);
 
        kdc_mem_ctx = kdc->smb_krb5_context;
+       kdc_lp_ctx = task->lp_ctx;
 
        /* start listening on the configured network interfaces */
        status = kdc_startup_interfaces(kdc, task->lp_ctx, ifaces);
index 3a1f9bd34efab3632df3f2694eb482e41d73501a..9be15115d13cd88f991cb33c93ffc197150f0e9e 100644 (file)
@@ -30,6 +30,7 @@ struct kdc_server;
 struct socket_address;
 
 extern TALLOC_CTX *kdc_mem_ctx;
+extern struct loadparm_context *kdc_lp_ctx;
 
 bool kpasswdd_process(struct kdc_server *kdc,
                      TALLOC_CTX *mem_ctx, 
index 949d64fcf11f0ed3751e7d01d3c19fecff0e9138..52b23608aa7e403846355e4be88c67c2b747f35b 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include       "miniMpr.h"
+#include "param/param.h"
 
 /************************************ Code ************************************/
 #if !BLD_APPWEB
@@ -49,6 +50,12 @@ void *mprMemCtx(void)
        return mpr_ctx;
 }
 
+/* return the loadparm context being used for all ejs variables */
+struct loadparm_context *mprLpCtx(void)
+{
+       return global_loadparm;
+}
+
 void mprFree(void *ptr)
 {
        talloc_free(ptr);
index 836fdab9f216ad81879bd7fb534e4a109c4b1cb8..15ce30c8df9d52eef3d723ee41d888fe197465dc 100644 (file)
@@ -272,6 +272,8 @@ extern int          mprMemcpy(char *dest, int destMax, const char *src, int nbytes);
 
 extern void mprSetCtx(void *ctx);
 extern void *mprMemCtx(void);
+struct loadparm_context;
+extern struct loadparm_context *mprLpCtx(void);
 
 /* This function needs to be provided by anyone using ejs */
 void ejs_exception(const char *reason);
index 5d56a30b3e14edaacfcaf4c80801cae9adaca9df..ad6a6421abb45e92c27f65f5c1514761f9704e3c 100644 (file)
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "hive.h"
 #include "system/filesys.h"
+#include "param/param.h"
 
 /** Open a registry file/host/etc */
 _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
@@ -52,7 +53,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
 
        if (!strncmp(peek, "regf", 4)) {
                close(fd);
-               return reg_open_regf_file(parent_ctx, location, lp_ctx, root);
+               return reg_open_regf_file(parent_ctx, location, lp_iconv_convenience(lp_ctx), root);
        } else if (!strncmp(peek, "TDB file", 8)) {
                close(fd);
                return reg_open_ldb_file(parent_ctx, location, session_info,
index 6d9a69c7c5dfcfac208132917e8d074460bdb7d6..87f335663d1e36cd2aff64dd95b8aa47ba76496a 100644 (file)
@@ -188,7 +188,7 @@ WERROR hive_key_flush(struct hive_key *key);
 WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
                          const char *location, struct hive_key **key);
 WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
-                         const char *location, struct loadparm_context *lp_ctx,
+                         const char *location, struct smb_iconv_convenience *iconv_convenience,
                          struct hive_key **key);
 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
                         struct auth_session_info *session_info,
@@ -200,6 +200,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
 WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
                            const char *location, struct hive_key **key);
 WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx,
+                           struct smb_iconv_convenience *iconv_convenience,
                            const char *location,
                            int major_version,
                            struct hive_key **key);
index 0c8a55396ee553e15e072f67d3cdb5ab5dab38c3..dfd368ea80d06c588a14a3d2eaf3c7a0491dc033 100644 (file)
@@ -36,7 +36,9 @@ struct ldb_key_data
        int subkey_count, value_count;
 };
 
-static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
+static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, 
+                                struct smb_iconv_convenience *iconv_convenience,
+                                struct ldb_message *msg,
                                 const char **name, uint32_t *type,
                                 DATA_BLOB *data)
 {
@@ -57,7 +59,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
        {
        case REG_SZ:
        case REG_EXPAND_SZ:
-               data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF8, CH_UTF16,
+               data->length = convert_string_talloc(mem_ctx, iconv_convenience, CH_UTF8, CH_UTF16,
                                                     val->data, val->length,
                                                     (void **)&data->data);
                break;
@@ -281,7 +283,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k,
        if (idx >= kd->value_count)
                return WERR_NO_MORE_ITEMS;
 
-       reg_ldb_unpack_value(mem_ctx, kd->values[idx],
+       reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), kd->values[idx],
                             name, data_type, data);
 
        return WERR_OK;
@@ -310,7 +312,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k,
        if (res->count == 0)
                return WERR_BADFILE;
 
-       reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data);
+       reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), res->msgs[0], NULL, data_type, data);
 
        return WERR_OK;
 }
@@ -607,7 +609,9 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
 
                        if (max_valbufsize != NULL) {
                                DATA_BLOB data;
-                               reg_ldb_unpack_value(mem_ctx, kd->values[i], NULL, 
+                               reg_ldb_unpack_value(mem_ctx, 
+                                                    lp_iconv_convenience(global_loadparm),
+                                                    kd->values[i], NULL, 
                                                     NULL, &data);
                                *max_valbufsize = MAX(*max_valbufsize, data.length);
                                talloc_free(data.data);
index a4579010cd0a5189d510c1f024c9f53e6024b3f2..687fd4b91b2c4e9da621616f77845bdb1135b323 100644 (file)
@@ -27,6 +27,7 @@
 
 
 _PUBLIC_ WERROR reg_preg_diff_load(int fd,
+                                  struct smb_iconv_convenience *iconv_convenience, 
                                   const struct reg_diff_callbacks *callbacks,
                                   void *callback_data);
 
@@ -273,6 +274,7 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1,
  * Load diff file
  */
 _PUBLIC_ WERROR reg_diff_load(const char *filename,
+                             struct smb_iconv_convenience *iconv_convenience,
                              const struct reg_diff_callbacks *callbacks,
                              void *callback_data)
 {
@@ -305,10 +307,10 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename,
 #endif
        if (strncmp(hdr, "PReg", 4) == 0) {
                /* Must be a GPO Registry.pol file */
-               return reg_preg_diff_load(fd, callbacks, callback_data);
+               return reg_preg_diff_load(fd, iconv_convenience, callbacks, callback_data);
        } else {
                /* Must be a normal .REG file */
-               return reg_dotreg_diff_load(fd, lp_iconv_convenience(global_loadparm), callbacks, callback_data);
+               return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data);
        }
 }
 
@@ -442,5 +444,6 @@ _PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx, const char *filenam
        callbacks.del_all_values = reg_diff_apply_del_all_values;
        callbacks.done = NULL;
 
-       return reg_diff_load(filename, &callbacks, ctx);
+       return reg_diff_load(filename, lp_iconv_convenience(global_loadparm), 
+                            &callbacks, ctx);
 }
index 08a977d9cdc65d6b9258c4d5990868bcdbe56273..9289390685296b030e3c4e91cd0e4568711559a6 100644 (file)
@@ -43,6 +43,7 @@ WERROR reg_generate_diff(struct registry_context *ctx1,
                         const struct reg_diff_callbacks *callbacks,
                         void *callback_data);
 WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
+                           struct smb_iconv_convenience *iconv_convenience,
                            struct reg_diff_callbacks **callbacks,
                            void **callback_data);
 WERROR reg_generate_diff_key(struct registry_key *oldkey,
index 46ea7c0008bce1f2be05449c0e8968e19317bd6f..6de642ecb810a0667cd012786e50be57bbdf0286 100644 (file)
@@ -101,6 +101,7 @@ static WERROR reg_dotreg_diff_del_all_values(void *callback_data,
  * Save registry diff
  */
 _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
+                                    struct smb_iconv_convenience *iconv_convenience,
                                     struct reg_diff_callbacks **callbacks,
                                     void **callback_data)
 {
@@ -109,7 +110,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename,
        data = talloc_zero(ctx, struct dotreg_data);
        *callback_data = data;
 
-       data->iconv_convenience = lp_iconv_convenience(global_loadparm);
+       data->iconv_convenience = iconv_convenience;
 
        if (filename) {
                data->fd = open(filename, O_CREAT, 0755);
index 9cc9a5dec2e69bc2fdabc41c9302ff5fed2e1437..0d39e67450f82baba5b003f9ed0fba50287fa891 100644 (file)
@@ -29,14 +29,14 @@ struct preg_data {
        int fd;
 };
 
-static WERROR preg_read_utf16(int fd, char *c)
+static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
 {
        uint16_t v;
 
        if (read(fd, &v, 2) < 2) {
                return WERR_GENERAL_FAILURE;
        }
-       push_codepoint(lp_iconv_convenience(global_loadparm), c, v);
+       push_codepoint(ic, c, v);
        return WERR_OK;
 }
 
@@ -123,6 +123,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
  * Load diff file
  */
 _PUBLIC_ WERROR reg_preg_diff_load(int fd,
+                                  struct smb_iconv_convenience *iconv_convenience, 
                                   const struct reg_diff_callbacks *callbacks,
                                   void *callback_data)
 {
@@ -162,7 +163,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
        while(1) {
                uint32_t value_type, length;
 
-               if (!W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr))) {
+               if (!W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr))) {
                        break;
                }
                if (*buf_ptr != '[') {
@@ -173,7 +174,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 
                /* Get the path */
                buf_ptr = buf;
-               while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+               while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
                       *buf_ptr != ';' && buf_ptr-buf < buf_size) {
                        buf_ptr++;
                }
@@ -181,7 +182,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 
                /* Get the name */
                buf_ptr = buf;
-               while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+               while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
                       *buf_ptr != ';' && buf_ptr-buf < buf_size) {
                        buf_ptr++;
                }
@@ -195,7 +196,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                }
                /* Read past delimiter */
                buf_ptr = buf;
-               if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+               if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
                    *buf_ptr == ';') && buf_ptr-buf < buf_size) {
                        DEBUG(0, ("Error in PReg file.\n"));
                        ret = WERR_GENERAL_FAILURE;
@@ -209,7 +210,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
                }
                /* Read past delimiter */
                buf_ptr = buf;
-               if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+               if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
                    *buf_ptr == ';') && buf_ptr-buf < buf_size) {
                        DEBUG(0, ("Error in PReg file.\n"));
                        ret = WERR_GENERAL_FAILURE;
@@ -227,7 +228,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd,
 
                /* Check if delimiter is in place (whine if it isn't) */
                buf_ptr = buf;
-               if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
+               if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
                    *buf_ptr == ']') && buf_ptr-buf < buf_size) {
                        DEBUG(0, ("Warning: Missing ']' in PReg file, expected ']', got '%c' 0x%x.\n",
                                *buf_ptr, *buf_ptr));
index 15b60745f05612dea2b5d9ebdd06b6d161743d03..cf3e564c0e2c6d1369dd33eb39a9d66eae445ec7 100644 (file)
@@ -1863,7 +1863,9 @@ static WERROR regf_save_hbin(struct regf_data *regf)
        return WERR_OK;
 }
 
-WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
+WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, 
+                           struct smb_iconv_convenience *iconv_convenience,
+                           const char *location,
                            int minor_version, struct hive_key **key)
 {
        struct regf_data *regf;
@@ -1874,7 +1876,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
 
        regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
 
-       regf->iconv_convenience = lp_iconv_convenience(global_loadparm);
+       regf->iconv_convenience = iconv_convenience;
 
        W_ERROR_HAVE_NO_MEMORY(regf);
 
@@ -1950,7 +1952,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location,
 }
 
 WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location, 
-                         struct loadparm_context *lp_ctx, struct hive_key **key)
+                         struct smb_iconv_convenience *iconv_convenience, struct hive_key **key)
 {
        struct regf_data *regf;
        struct regf_hdr *regf_hdr;
@@ -1959,7 +1961,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
 
        regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
 
-       regf->iconv_convenience = lp_iconv_convenience(lp_ctx);
+       regf->iconv_convenience = iconv_convenience;
 
        W_ERROR_HAVE_NO_MEMORY(regf);
 
index 4d27e83a74747375a245906f48b7e369318f5ad4..1dcb464d8015f2b808fc2af982a6bf1fd4c33cf0 100644 (file)
@@ -25,6 +25,7 @@
 #include "torture/torture.h"
 #include "librpc/gen_ndr/winreg.h"
 #include "system/filesys.h"
+#include "param/param.h"
 
 static bool test_del_nonexistant_key(struct torture_context *tctx,
                                     const void *test_data)
@@ -349,7 +350,8 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data)
 
        rmdir(dirname);
 
-       error = reg_create_regf_file(tctx, dirname, 5, &key);
+       error = reg_create_regf_file(tctx, lp_iconv_convenience(tctx->lp_ctx),
+                                    dirname, 5, &key);
        if (!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to create new regf file\n");
                return false;
index 406eaeea3df4f168697c4ce4f83f1bb72c88a1d8..c94380efd2b0be46febaedbb11a81f953df77b32 100644 (file)
@@ -126,7 +126,7 @@ int main(int argc, const char **argv)
 
        poptFreeContext(pc);
 
-       error = reg_dotreg_diff_save(ctx, outputfile, &callbacks,
+       error = reg_dotreg_diff_save(ctx, outputfile, lp_iconv_convenience(cmdline_lp_ctx), &callbacks,
                                     &callback_data);
        if (!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Problem saving registry diff to '%s': %s\n",
index 7c8d40e608addf2424d7114aafecb58c87ae6e30..d10eeb8ffd7e7e4f36bdc53aca76e7e4a4444e76 100644 (file)
@@ -241,7 +241,8 @@ static void cldap_socket_handler(struct event_context *ev, struct fd_event *fde,
   then operations will use that event context
 */
 struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx, 
-                                      struct event_context *event_ctx)
+                                      struct event_context *event_ctx,
+                                      struct smb_iconv_convenience *iconv_convenience)
 {
        struct cldap_socket *cldap;
        NTSTATUS status;
@@ -270,6 +271,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
 
        cldap->send_queue = NULL;
        cldap->incoming.handler = NULL;
+       cldap->iconv_convenience = iconv_convenience;
        
        return cldap;
 
@@ -618,7 +620,7 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
        data = search.out.response->attributes[0].values;
 
        ndr_err = ndr_pull_union_blob_all(data, mem_ctx, 
-                                         lp_iconv_convenience(global_loadparm),
+                                         req->cldap->iconv_convenience,
                                          &io->out.netlogon,
                                          io->in.version & 0xF,
                                          (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
@@ -714,7 +716,7 @@ NTSTATUS cldap_netlogon_reply(struct cldap_socket *cldap,
        DATA_BLOB blob;
 
        ndr_err = ndr_push_union_blob(&blob, tmp_ctx, 
-                                     lp_iconv_convenience(global_loadparm),
+                                     cldap->iconv_convenience,
                                      netlogon, version & 0xF,
                                     (ndr_push_flags_fn_t)ndr_push_nbt_cldap_netlogon);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
index 7a222e06524a8c015dc5fe38bc44409cd8d4f0fb..eb0191d0f4589bfad6e6fbb38a0578de8f80f587 100644 (file)
@@ -73,6 +73,7 @@ struct cldap_request {
 struct cldap_socket {
        struct socket_context *sock;
        struct event_context *event_ctx;
+       struct smb_iconv_convenience *iconv_convenience;
 
        /* the fd event */
        struct fd_event *fde;
@@ -111,7 +112,8 @@ struct cldap_search {
 };
 
 struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx, 
-                                      struct event_context *event_ctx);
+                                      struct event_context *event_ctx, 
+                                      struct smb_iconv_convenience *iconv_convenience);
 NTSTATUS cldap_set_incoming_handler(struct cldap_socket *cldap,
                                    void (*handler)(struct cldap_socket *, struct ldap_message *, 
                                                    struct socket_address *),
index 606809751eb5fd4ea83efd604298ee5d0531c856..67ba47ddc67d1e3d54ff8d1344f9f25aa1e150d5 100644 (file)
@@ -28,6 +28,7 @@
 #include "libcli/libcli.h"
 #include "libcli/resolve/resolve.h"
 #include "libcli/finddcs.h"
+#include "param/param.h"
 
 struct finddcs_state {
        struct composite_context *ctx;
@@ -195,7 +196,8 @@ static void fallback_node_status(struct finddcs_state *state)
        state->node_status.in.timeout = 1;
        state->node_status.in.retries = 2;
 
-       nbtsock = nbt_name_socket_init(state, state->ctx->event_ctx);
+       nbtsock = nbt_name_socket_init(state, state->ctx->event_ctx, 
+                                      lp_iconv_convenience(global_loadparm));
        if (composite_nomem(nbtsock, state->ctx)) return;
        
        name_req = nbt_name_status_send(nbtsock, &state->node_status);
index c95d99db5408b821d3dacd6a8b506ba86c7116d2..bc85d87b895fa6926e301cc9ce15ca38738590bf 100644 (file)
@@ -94,6 +94,7 @@ struct nbt_name_request {
 struct nbt_name_socket {
        struct socket_context *sock;
        struct event_context *event_ctx;
+       struct smb_iconv_convenience *iconv_convenience;
 
        /* a queue of requests pending to be sent */
        struct nbt_name_request *send_queue;
index 8bfe746294ef1d99f2ec2e7f835c37d91a752ce4..95a1643efc42e0068c9d7fc30f208c587573f6d5 100644 (file)
@@ -190,7 +190,7 @@ static void nbt_name_socket_recv(struct nbt_name_socket *nbtsock)
        }
 
        /* parse the request */
-       ndr_err = ndr_pull_struct_blob(&blob, packet, lp_iconv_convenience(global_loadparm), packet,
+       ndr_err = ndr_pull_struct_blob(&blob, packet, nbtsock->iconv_convenience, packet,
                                       (ndr_pull_flags_fn_t)ndr_pull_nbt_name_packet);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                status = ndr_map_error2ntstatus(ndr_err);
@@ -309,7 +309,8 @@ static void nbt_name_socket_handler(struct event_context *ev, struct fd_event *f
   then operations will use that event context
 */
 _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, 
-                                            struct event_context *event_ctx)
+                                            struct event_context *event_ctx,
+                                            struct smb_iconv_convenience *iconv_convenience)
 {
        struct nbt_name_socket *nbtsock;
        NTSTATUS status;
@@ -338,6 +339,7 @@ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
        nbtsock->num_pending = 0;
        nbtsock->incoming.handler = NULL;
        nbtsock->unexpected.handler = NULL;
+       nbtsock->iconv_convenience = iconv_convenience;
 
        nbtsock->fde = event_add_fd(nbtsock->event_ctx, nbtsock, 
                                    socket_get_fd(nbtsock->sock), 0,
@@ -395,7 +397,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
        talloc_set_destructor(req, nbt_name_request_destructor);        
 
        ndr_err = ndr_push_struct_blob(&req->encoded, req, 
-                                      lp_iconv_convenience(global_loadparm),
+                                      req->nbtsock->iconv_convenience,
                                       request,
                                       (ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed;
@@ -444,7 +446,7 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
        }
 
        ndr_err = ndr_push_struct_blob(&req->encoded, req, 
-                                      lp_iconv_convenience(global_loadparm),
+                                      req->nbtsock->iconv_convenience,
                                       request,
                                       (ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
index 55cb3ef305a8e8f250e57836c09ec4bebcf6fa9b..5a33d9cffc3faecf7a2194d2896acee0a7894674 100644 (file)
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "libcli/raw/libcliraw.h"
 #include "system/filesys.h"
+#include "param/param.h"
 
 #define SETUP_REQUEST_SESSION(cmd, wct, buflen) do { \
        req = smbcli_request_setup_session(session, cmd, wct, buflen); \
@@ -51,6 +52,9 @@ struct smbcli_session *smbcli_session_init(struct smbcli_transport *transport,
        }
        session->pid = (uint16_t)getpid();
        session->vuid = UID_FIELD_INVALID;
+       session->options.lanman_auth = lp_client_lanman_auth(global_loadparm);
+       session->options.ntlmv2_auth = lp_client_ntlmv2_auth(global_loadparm);
+       session->options.plaintext_auth = lp_client_plaintext_auth(global_loadparm);
        
        capabilities = transport->negotiate.capabilities;
 
index 8fcb8bb48c7e06692ec4f29247c3e774b2907a68..eaa02e10472782f5dfb59938bcbcac75ea504a3d 100644 (file)
@@ -33,6 +33,7 @@ struct sock_connect_state {
        const char *host_name;
        int num_ports;
        uint16_t *ports;
+       const char *socket_options;
        struct smbcli_socket *result;
 };
 
@@ -80,6 +81,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
        for (i=0;ports[i];i++) {
                state->ports[i] = atoi(ports[i]);
        }
+       state->socket_options = lp_socket_options(global_loadparm);
 
        ctx = socket_connect_multi_send(state, host_addr,
                                        state->num_ports, state->ports,
@@ -108,7 +110,7 @@ static void smbcli_sock_connect_recv_conn(struct composite_context *ctx)
        if (!composite_is_ok(state->ctx)) return;
 
        state->ctx->status =
-               socket_set_option(sock, lp_socket_options(global_loadparm), NULL);
+               socket_set_option(sock, state->socket_options, NULL);
        if (!composite_is_ok(state->ctx)) return;
 
 
index 7111649fc17450eb6f5f20b2c5d5228dad764593..0578a9eab1ab6c7a20452082324ca7e3a0e1ded2 100644 (file)
@@ -186,6 +186,12 @@ struct smbcli_session {
 
        /* the spnego context if we use extented security */
        struct gensec_security *gensec;
+
+       struct smbcli_session_options {
+               uint_t lanman_auth:1;
+               uint_t ntlmv2_auth:1;
+               uint_t plaintext_auth:1;
+       } options;
 };
 
 /* 
index c8d4ab2df3a77b97dc532b1e070ac0e350e37d2f..2e2eb05397fc64668320f5ef00abdab54fd650ed 100644 (file)
@@ -29,6 +29,7 @@
 struct resolve_bcast_data {
        struct interface *ifaces;
        uint16_t nbt_port;
+       int nbt_timeout;
 };
 
 /**
@@ -62,7 +63,7 @@ struct composite_context *resolve_name_bcast_send(TALLOC_CTX *mem_ctx,
        }
        address_list[count] = NULL;
 
-       c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, true, false);
+       c = resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, data->ifaces, data->nbt_port, data->nbt_timeout, true, false);
        talloc_free(address_list);
 
        return c;       
@@ -84,22 +85,25 @@ NTSTATUS resolve_name_bcast(struct nbt_name *name,
                            TALLOC_CTX *mem_ctx,
                            struct interface *ifaces,
                            uint16_t nbt_port,
+                           int nbt_timeout,
                            const char **reply_addr)
 {
        struct resolve_bcast_data *data = talloc(mem_ctx, struct resolve_bcast_data);
        struct composite_context *c;
        data->ifaces = talloc_reference(data, ifaces);
        data->nbt_port = nbt_port;
+       data->nbt_timeout = nbt_timeout;
        
        c = resolve_name_bcast_send(mem_ctx, NULL, data, name);
        return resolve_name_bcast_recv(c, mem_ctx, reply_addr);
 }
 
-bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port)
+bool resolve_context_add_bcast_method(struct resolve_context *ctx, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout)
 {
        struct resolve_bcast_data *data = talloc(ctx, struct resolve_bcast_data);
        data->ifaces = ifaces;
        data->nbt_port = nbt_port;
+       data->nbt_timeout = nbt_timeout;
        return resolve_context_add_method(ctx, resolve_name_bcast_send, resolve_name_bcast_recv, data);
 }
 
@@ -107,5 +111,5 @@ bool resolve_context_add_bcast_method_lp(struct resolve_context *ctx, struct loa
 {
        struct interface *ifaces;
        load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces);
-       return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx));
+       return resolve_context_add_bcast_method(ctx, ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
 }
index e1452c09d2cc8519d3d73359eeeb0359ad39e60f..887bdd7ecf7376568c5d32b5e95d453c7fb9164f 100644 (file)
@@ -102,6 +102,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
                                                    const char **address_list,
                                                    struct interface *ifaces,
                                                    uint16_t nbt_port,
+                                                   int nbt_timeout,
                                                    bool broadcast,
                                                    bool wins_lookup)
 {
@@ -140,7 +141,8 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
                return c;
        }
 
-       state->nbtsock = nbt_name_socket_init(state, event_ctx);
+       state->nbtsock = nbt_name_socket_init(state, event_ctx, 
+                                             lp_iconv_convenience(global_loadparm));
        if (composite_nomem(state->nbtsock, c)) return c;
 
        /* count the address_list size */
@@ -161,7 +163,7 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
 
                state->io_queries[i].in.broadcast   = broadcast;
                state->io_queries[i].in.wins_lookup = wins_lookup;
-               state->io_queries[i].in.timeout     = lp_parm_int(global_loadparm, NULL, "nbt", "timeout", 1);
+               state->io_queries[i].in.timeout     = nbt_timeout;
                state->io_queries[i].in.retries     = 2;
 
                state->queries[i] = nbt_name_query_send(state->nbtsock, &state->io_queries[i]);
@@ -201,12 +203,14 @@ NTSTATUS resolve_name_nbtlist(struct nbt_name *name,
                              const char **address_list,
                              struct interface *ifaces, 
                              uint16_t nbt_port,
+                             int nbt_timeout,
                              bool broadcast, bool wins_lookup,
                              const char **reply_addr)
 {
        struct composite_context *c = resolve_name_nbtlist_send(mem_ctx, NULL, 
                                                                name, address_list, 
                                                                ifaces, nbt_port,
+                                                               nbt_timeout,
                                                                broadcast, wins_lookup);
        return resolve_name_nbtlist_recv(c, mem_ctx, reply_addr);
 }
index 78624ad81aa4d0198fcfa6d661bdbaf4253416d7..3ec180f3322ca0c1f0698b9e95ca1899d85da6be 100644 (file)
@@ -29,6 +29,7 @@ struct resolve_wins_data {
        const char **address_list;
        struct interface *ifaces;
        uint16_t nbt_port;
+       int nbt_timeout;
 };
 
 /**
@@ -42,7 +43,7 @@ struct composite_context *resolve_name_wins_send(
 {
        struct resolve_wins_data *wins_data = talloc_get_type(userdata, struct resolve_wins_data);
        if (wins_data->address_list == NULL) return NULL;
-       return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, false, true);
+       return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, wins_data->address_list, wins_data->ifaces, wins_data->nbt_port, wins_data->nbt_timeout, false, true);
 }
 
 /*
@@ -62,6 +63,7 @@ NTSTATUS resolve_name_wins(struct nbt_name *name,
                            const char **address_list,
                            struct interface *ifaces,
                            uint16_t nbt_port,
+                           int nbt_timeout,
                            const char **reply_addr)
 {
        struct composite_context *c;
@@ -69,16 +71,18 @@ NTSTATUS resolve_name_wins(struct nbt_name *name,
        wins_data->address_list = address_list;
        wins_data->ifaces = ifaces;
        wins_data->nbt_port = nbt_port;
+       wins_data->nbt_timeout = nbt_timeout;
        c = resolve_name_wins_send(mem_ctx, NULL, wins_data, name);
        return resolve_name_wins_recv(c, mem_ctx, reply_addr);
 }
 
-bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port)
+bool resolve_context_add_wins_method(struct resolve_context *ctx, const char **address_list, struct interface *ifaces, uint16_t nbt_port, int nbt_timeout)
 {
        struct resolve_wins_data *wins_data = talloc(ctx, struct resolve_wins_data);
        wins_data->address_list = str_list_copy(wins_data, address_list);
        wins_data->ifaces = talloc_reference(wins_data, ifaces);
        wins_data->nbt_port = nbt_port;
+       wins_data->nbt_timeout = nbt_timeout;
        return resolve_context_add_method(ctx, resolve_name_wins_send, resolve_name_wins_recv,
                                          wins_data);
 }
@@ -87,5 +91,5 @@ bool resolve_context_add_wins_method_lp(struct resolve_context *ctx, struct load
 {
        struct interface *ifaces;
        load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces);
-       return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx));
+       return resolve_context_add_wins_method(ctx, lp_wins_server_list(lp_ctx), ifaces, lp_nbt_port(lp_ctx), lp_parm_int(lp_ctx, NULL, "nbt", "timeout", 1));
 }
index f5a976958d3a8cd304f75439def05b8478c67f64..75a2a579a26fd2e3db676ad99012a8e89fdac113 100644 (file)
@@ -226,11 +226,11 @@ static NTSTATUS session_setup_nt1(struct composite_context *c,
        DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, lp_iconv_convenience(global_loadparm), session->transport->socket->hostname, lp_workgroup(global_loadparm));
        DATA_BLOB session_key;
        int flags = CLI_CRED_NTLM_AUTH;
-       if (lp_client_lanman_auth(global_loadparm)) {
+       if (session->options.lanman_auth) {
                flags |= CLI_CRED_LANMAN_AUTH;
        }
 
-       if (lp_client_ntlmv2_auth(global_loadparm)) {
+       if (session->options.ntlmv2_auth) {
                flags |= CLI_CRED_NTLMv2_AUTH;
        }
 
@@ -263,7 +263,7 @@ static NTSTATUS session_setup_nt1(struct composite_context *c,
                set_user_session_key(session, &session_key);
                
                data_blob_free(&session_key);
-       } else if (lp_client_plaintext_auth(global_loadparm)) {
+       } else if (session->options.plaintext_auth) {
                state->setup.nt1.in.password1 = data_blob_talloc(state, password, strlen(password));
                state->setup.nt1.in.password2 = data_blob(NULL, 0);
        } else {
@@ -293,11 +293,11 @@ static NTSTATUS session_setup_old(struct composite_context *c,
        DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, lp_iconv_convenience(global_loadparm), session->transport->socket->hostname, lp_workgroup(global_loadparm));
        DATA_BLOB session_key;
        int flags = 0;
-       if (lp_client_lanman_auth(global_loadparm)) {
+       if (session->options.lanman_auth) {
                flags |= CLI_CRED_LANMAN_AUTH;
        }
 
-       if (lp_client_ntlmv2_auth(global_loadparm)) {
+       if (session->options.ntlmv2_auth) {
                flags |= CLI_CRED_NTLMv2_AUTH;
        }
 
@@ -324,7 +324,7 @@ static NTSTATUS session_setup_old(struct composite_context *c,
                set_user_session_key(session, &session_key);
                
                data_blob_free(&session_key);
-       } else if (lp_client_plaintext_auth(global_loadparm)) {
+       } else if (session->options.plaintext_auth) {
                state->setup.old.in.password = data_blob_talloc(state, password, strlen(password));
        } else {
                /* could match windows client and return 'cannot logon from this workstation', but it just confuses everybody */
index 827230b113912af612e2202525864cf2afbe853e..e4e366873f0798057ab08dc5ad2fffa85ccce611 100644 (file)
@@ -46,7 +46,8 @@
 
 /* Function prototypes */
 struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx, 
-                                            struct event_context *event_ctx);
+                                            struct event_context *event_ctx,
+                         struct smb_iconv_convenience *iconv_convenience);
 
 enum nbt_name_type {
        NBT_NAME_CLIENT=0x00,
index 6c1b5013592cf30b009a5d9dd6addf4a58af8330..f67e6dd0e3bf666bc86f3867abf6609b52a2cd00 100644 (file)
@@ -2469,12 +2469,13 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 #define SWIGTYPE_p_p_char swig_types[10]
 #define SWIGTYPE_p_short swig_types[11]
 #define SWIGTYPE_p_signed_char swig_types[12]
-#define SWIGTYPE_p_unsigned_char swig_types[13]
-#define SWIGTYPE_p_unsigned_int swig_types[14]
-#define SWIGTYPE_p_unsigned_long_long swig_types[15]
-#define SWIGTYPE_p_unsigned_short swig_types[16]
-static swig_type_info *swig_types[18];
-static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
+#define SWIGTYPE_p_smb_iconv_convenience swig_types[13]
+#define SWIGTYPE_p_unsigned_char swig_types[14]
+#define SWIGTYPE_p_unsigned_int swig_types[15]
+#define SWIGTYPE_p_unsigned_long_long swig_types[16]
+#define SWIGTYPE_p_unsigned_short swig_types[17]
+static swig_type_info *swig_types[19];
+static swig_module_info swig_module = {swig_types, 18, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2918,17 +2919,21 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self),
   PyObject *resultobj = 0;
   TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
   struct event_context *arg2 = (struct event_context *) 0 ;
+  struct smb_iconv_convenience *arg3 = (struct smb_iconv_convenience *) 0 ;
   struct nbt_name_socket *result = 0 ;
   void *argp2 = 0 ;
   int res2 = 0 ;
+  void *argp3 = 0 ;
+  int res3 = 0 ;
   PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
   char *  kwnames[] = {
-    (char *) "event_ctx", NULL 
+    (char *) "event_ctx",(char *) "iconv_convenience", NULL 
   };
   
   arg2 = event_context_init(NULL);
   arg1 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:nbt_name_socket_init",kwnames,&obj0)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:nbt_name_socket_init",kwnames,&obj0,&obj1)) SWIG_fail;
   if (obj0) {
     res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_event_context, 0 |  0 );
     if (!SWIG_IsOK(res2)) {
@@ -2936,7 +2941,14 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self),
     }
     arg2 = (struct event_context *)(argp2);
   }
-  result = (struct nbt_name_socket *)nbt_name_socket_init(arg1,arg2);
+  if (obj1) {
+    res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_smb_iconv_convenience, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "nbt_name_socket_init" "', argument " "3"" of type '" "struct smb_iconv_convenience *""'"); 
+    }
+    arg3 = (struct smb_iconv_convenience *)(argp3);
+  }
+  result = (struct nbt_name_socket *)nbt_name_socket_init(arg1,arg2,arg3);
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_socket, 0 |  0 );
   return resultobj;
 fail:
@@ -4135,6 +4147,7 @@ static swig_type_info _swigt__p_nbt_name_socket = {"_p_nbt_name_socket", "struct
 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_smb_iconv_convenience = {"_p_smb_iconv_convenience", "struct smb_iconv_convenience *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
@@ -4154,6 +4167,7 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_p_char,
   &_swigt__p_short,
   &_swigt__p_signed_char,
+  &_swigt__p_smb_iconv_convenience,
   &_swigt__p_unsigned_char,
   &_swigt__p_unsigned_int,
   &_swigt__p_unsigned_long_long,
@@ -4173,6 +4187,7 @@ static swig_cast_info _swigc__p_nbt_name_socket[] = {  {&_swigt__p_nbt_name_sock
 static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_short[] = {  {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_signed_char[] = {  {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_smb_iconv_convenience[] = {  {&_swigt__p_smb_iconv_convenience, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_long_long[] = {  {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
@@ -4192,6 +4207,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_p_char,
   _swigc__p_short,
   _swigc__p_signed_char,
+  _swigc__p_smb_iconv_convenience,
   _swigc__p_unsigned_char,
   _swigc__p_unsigned_int,
   _swigc__p_unsigned_long_long,
index d027e883960bb15e50df4465fb4ca99769fb553c..3e7793c0c7113750ad31765e518aed8d878b548e 100644 (file)
@@ -102,7 +102,7 @@ static NTSTATUS wrepl_finish_recv(void *private, DATA_BLOB packet_blob_in)
        blob.length = packet_blob_in.length - 4;
        
        /* we have a full request - parse it */
-       ndr_err = ndr_pull_struct_blob(&blob, req->packet, lp_iconv_convenience(global_loadparm), req->packet,
+       ndr_err = ndr_pull_struct_blob(&blob, req->packet, wrepl_socket->iconv_convenience, req->packet,
                                       (ndr_pull_flags_fn_t)ndr_pull_wrepl_packet);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -163,7 +163,8 @@ static int wrepl_socket_destructor(struct wrepl_socket *sock)
   operations will use that event context
 */
 struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx, 
-                                      struct event_context *event_ctx)
+                                      struct event_context *event_ctx,
+                                      struct smb_iconv_convenience *iconv_convenience)
 {
        struct wrepl_socket *wrepl_socket;
        NTSTATUS status;
@@ -178,6 +179,8 @@ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx,
        }
        if (!wrepl_socket->event.ctx) goto failed;
 
+       wrepl_socket->iconv_convenience = iconv_convenience;
+
        status = socket_create("ip", SOCKET_TYPE_STREAM, &wrepl_socket->sock, 0);
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
@@ -308,6 +311,14 @@ static void wrepl_connect_handler(struct composite_context *creq)
        composite_done(result);
 }
 
+const char *wrepl_best_ip(struct loadparm_context *lp_ctx, const char *peer_ip)
+{
+       struct interface *ifaces;
+       load_interfaces(lp_ctx, lp_interfaces(lp_ctx), &ifaces);
+       return iface_best_ip(ifaces, peer_ip);
+}
+
+
 /*
   connect a wrepl_socket to a WINS server
 */
@@ -331,12 +342,6 @@ struct composite_context *wrepl_connect_send(struct wrepl_socket *wrepl_socket,
        state->result           = result;
        state->wrepl_socket     = wrepl_socket;
 
-       if (!our_ip) {
-               struct interface *ifaces;
-               load_interfaces(state, lp_interfaces(global_loadparm), &ifaces);
-               our_ip = iface_best_ip(ifaces, peer_ip);
-       }
-
        us = socket_address_from_strings(state, wrepl_socket->sock->backend_name, 
                                         our_ip, 0);
        if (composite_nomem(us, result)) return result;
@@ -493,7 +498,7 @@ struct wrepl_request *wrepl_request_send(struct wrepl_socket *wrepl_socket,
        }
 
        wrap.packet = *packet;
-       ndr_err = ndr_push_struct_blob(&blob, req, lp_iconv_convenience(global_loadparm), &wrap, 
+       ndr_err = ndr_push_struct_blob(&blob, req, wrepl_socket->iconv_convenience, &wrap, 
                                       (ndr_push_flags_fn_t)ndr_push_wrepl_wrap);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                status = ndr_map_error2ntstatus(ndr_err);
index 52b0bee69e853d84f7f0f7af404ac7090e7550fd..f33e63119d574b5a6a1affe557d7f9e96f20c09f 100644 (file)
@@ -49,6 +49,8 @@ struct wrepl_socket {
 
        /* remember if we need to free the wrepl_socket at the end of wrepl_socket_dead() */
        bool free_skipped;
+
+       struct smb_iconv_convenience *iconv_convenience;
 };
 
 struct wrepl_send_ctrl {
index c9185c749b4bf0181b0a58437a6f1c2f07dfcfa4..c4f9cabb1166411c0284a3a119c7c7e9fc78b9c4 100644 (file)
@@ -747,7 +747,8 @@ static void becomeDC_send_cldap(struct libnet_BecomeDC_state *s)
        s->cldap.io.in.acct_control     = -1;
        s->cldap.io.in.version          = 6;
 
-       s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx);
+       s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx, 
+                                         lp_iconv_convenience(s->libnet->lp_ctx));
        if (composite_nomem(s->cldap.sock, c)) return;
 
        req = cldap_netlogon_send(s->cldap.sock, &s->cldap.io);
index 9db949486540f1625430721545b526f4b5db922a..dabd23a5bee7594249327f564ec0f4b7e3673fd5 100644 (file)
@@ -55,7 +55,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r)
        search.in.acct_control = -1;
        search.in.version = 6;
 
-       cldap = cldap_socket_init(tmp_ctx, NULL);
+       cldap = cldap_socket_init(tmp_ctx, NULL, lp_iconv_convenience(global_loadparm));
        status = cldap_netlogon(cldap, tmp_ctx, &search);
        if (!NT_STATUS_IS_OK(status)) {
                /*
index 415912e34dcd2573b832d43d31fbc0f8bfcd1ce3..5d346ac166fdd0c0df20c31f3fe049f8e81be822 100644 (file)
@@ -267,7 +267,8 @@ static void unbecomeDC_send_cldap(struct libnet_UnbecomeDC_state *s)
        s->cldap.io.in.acct_control     = -1;
        s->cldap.io.in.version          = 6;
 
-       s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx);
+       s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx,
+                                         lp_iconv_convenience(s->libnet->lp_ctx));
        if (composite_nomem(s->cldap.sock, c)) return;
 
        req = cldap_netlogon_send(s->cldap.sock, &s->cldap.io);
index b19a5d71604663dea2e386e401d5d3884c939b72..a379398f19772cc7b72c64c9e1038d1aafe35a64 100644 (file)
@@ -351,7 +351,7 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c,
        /* non-signed packets are simpler */
        if (!c->security_state.auth_info || 
            !c->security_state.generic_state) {
-               return ncacn_push_auth(blob, mem_ctx, pkt, c->security_state.auth_info);
+               return ncacn_push_auth(blob, mem_ctx, c->iconv_convenience, pkt, c->security_state.auth_info);
        }
 
        ndr = ndr_push_init_ctx(mem_ctx, c->iconv_convenience);
@@ -750,7 +750,7 @@ struct composite_context *dcerpc_bind_send(struct dcerpc_pipe *p,
        pkt.u.bind.auth_info = data_blob(NULL, 0);
 
        /* construct the NDR form of the packet */
-       c->status = ncacn_push_auth(&blob, c, &pkt,
+       c->status = ncacn_push_auth(&blob, c, p->conn->iconv_convenience, &pkt,
                                    p->conn->security_state.auth_info);
        if (!composite_is_ok(c)) return c;
 
@@ -813,7 +813,7 @@ NTSTATUS dcerpc_auth3(struct dcerpc_connection *c,
        pkt.u.auth3.auth_info = data_blob(NULL, 0);
 
        /* construct the NDR form of the packet */
-       status = ncacn_push_auth(&blob, mem_ctx, &pkt, c->security_state.auth_info);
+       status = ncacn_push_auth(&blob, mem_ctx, c->iconv_convenience, &pkt, c->security_state.auth_info);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -1646,7 +1646,7 @@ struct composite_context *dcerpc_alter_context_send(struct dcerpc_pipe *p,
        pkt.u.alter.auth_info = data_blob(NULL, 0);
 
        /* construct the NDR form of the packet */
-       c->status = ncacn_push_auth(&blob, mem_ctx, &pkt,
+       c->status = ncacn_push_auth(&blob, mem_ctx, p->conn->iconv_convenience, &pkt,
                                    p->conn->security_state.auth_info);
        if (!composite_is_ok(c)) return c;
 
index 4e5d049d660323293fe394e1c6db988aa5b7baa7..b8128baf43243bc584a3fcd14688346b5a5be49b 100644 (file)
@@ -50,13 +50,14 @@ const struct ndr_interface_call *dcerpc_iface_find_call(const struct ndr_interfa
    push a ncacn_packet into a blob, potentially with auth info
 */
 NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, 
+                        struct smb_iconv_convenience *iconv_convenience,
                          struct ncacn_packet *pkt,
                          struct dcerpc_auth *auth_info)
 {
        struct ndr_push *ndr;
        enum ndr_err_code ndr_err;
 
-       ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+       ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience);
        if (!ndr) {
                return NT_STATUS_NO_MEMORY;
        }
index 486acfbad535f8a24c7640c6b8f3c86a9d556068..e59475051b4b4c2b03613ef044f57d8966810f0b 100644 (file)
@@ -130,7 +130,7 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
                struct nbt_name_socket *bcast_nbtsock;
 
                /* listen for broadcasts on port 137 */
-               bcast_nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx);
+               bcast_nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx, lp_iconv_convenience(nbtsrv->task->lp_ctx));
                if (!bcast_nbtsock) {
                        talloc_free(iface);
                        return NT_STATUS_NO_MEMORY;
@@ -156,7 +156,8 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
        }
 
        /* listen for unicasts on port 137 */
-       iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx);
+       iface->nbtsock = nbt_name_socket_init(iface, nbtsrv->task->event_ctx, 
+                                             lp_iconv_convenience(nbtsrv->task->lp_ctx));
        if (!iface->nbtsock) {
                talloc_free(iface);
                return NT_STATUS_NO_MEMORY;
index 94d32488eb95487457690b1f7c69565889743381..23aa3fb6687290de637a9941ff64d4b6eb9357af 100644 (file)
@@ -45,6 +45,7 @@ struct notify_context {
        struct notify_array *array;
        int seqnum;
        struct sys_notify_context *sys_notify_ctx;
+       struct smb_iconv_convenience *iconv_convenience;
 };
 
 
@@ -107,6 +108,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
        notify->messaging_ctx = messaging_ctx;
        notify->list = NULL;
        notify->array = NULL;
+       notify->iconv_convenience = lp_iconv_convenience(lp_ctx);
        notify->seqnum = tdb_get_seqnum(notify->w->tdb);
 
        talloc_set_destructor(notify, notify_destructor);
@@ -171,7 +173,7 @@ static NTSTATUS notify_load(struct notify_context *notify)
        blob.data = dbuf.dptr;
        blob.length = dbuf.dsize;
 
-       ndr_err = ndr_pull_struct_blob(&blob, notify->array, lp_iconv_convenience(global_loadparm),
+       ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->iconv_convenience,
                                       notify->array,
                                       (ndr_pull_flags_fn_t)ndr_pull_notify_array);
        free(dbuf.dptr);
@@ -220,7 +222,7 @@ static NTSTATUS notify_save(struct notify_context *notify)
        tmp_ctx = talloc_new(notify);
        NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
 
-       ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), notify->array,
+       ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->iconv_convenience, notify->array,
                                       (ndr_push_flags_fn_t)ndr_push_notify_array);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
@@ -256,7 +258,7 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data
                return;
        }
 
-       ndr_err = ndr_pull_struct_blob(data, tmp_ctx, lp_iconv_convenience(global_loadparm), &ev,
+       ndr_err = ndr_pull_struct_blob(data, tmp_ctx, notify->iconv_convenience, &ev,
                                      (ndr_pull_flags_fn_t)ndr_pull_notify_event);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
@@ -555,7 +557,7 @@ static void notify_send(struct notify_context *notify, struct notify_entry *e,
 
        tmp_ctx = talloc_new(notify);
 
-       ndr_err = ndr_push_struct_blob(&data, tmp_ctx, lp_iconv_convenience(global_loadparm), &ev, (ndr_push_flags_fn_t)ndr_push_notify_event);
+       ndr_err = ndr_push_struct_blob(&data, tmp_ctx, notify->iconv_convenience, &ev, (ndr_push_flags_fn_t)ndr_push_notify_event);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
                return;
index 3c60c00247442829cb37443325772b74185ebc0c..185e35f8007268f58c28726b0217c05f244e5954 100644 (file)
@@ -134,12 +134,12 @@ static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx,
   resolve a wildcard rename pattern.
 */
 static const char *pvfs_resolve_wildcard(TALLOC_CTX *mem_ctx, 
+                                        struct smb_iconv_convenience *iconv_convenience,
                                         const char *fname, 
                                         const char *pattern)
 {
        const char *base1, *base2;
        const char *ext1, *ext2;
-       struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
        char *p;
 
        /* break into base part plus extension */
@@ -274,7 +274,7 @@ static NTSTATUS pvfs_rename_one(struct pvfs_state *pvfs,
        NTSTATUS status;
 
        /* resolve the wildcard pattern for this name */
-       fname2 = pvfs_resolve_wildcard(mem_ctx, fname1, fname2);
+       fname2 = pvfs_resolve_wildcard(mem_ctx, lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), fname1, fname2);
        if (fname2 == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
index cf74816391ebeebbe7abb08682448cf82807a804..2bfc47beffeef1029dff20c080f6fab87618f42b 100644 (file)
@@ -329,14 +329,15 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
   reduce a name that contains .. components or repeated \ separators
   return NULL if it can't be reduced
 */
-static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, const char **fname, uint_t flags)
+static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, 
+                                struct smb_iconv_convenience *iconv_convenience, 
+                                const char **fname, uint_t flags)
 {
        codepoint_t c;
        size_t c_size, len;
        int i, num_components, err_count;
        char **components;
        char *p, *s, *ret;
-       struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
 
        s = talloc_strdup(mem_ctx, *fname);
        if (s == NULL) return NT_STATUS_NO_MEMORY;
@@ -471,7 +472,7 @@ NTSTATUS pvfs_resolve_name(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx,
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD)) {
                /* it might contain .. components which need to be reduced */
-               status = pvfs_reduce_name(*name, &cifs_name, flags);
+               status = pvfs_reduce_name(*name, lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), &cifs_name, flags);
                if (!NT_STATUS_IS_OK(status)) {
                        return status;
                }
index 39090bf702af4b05e598b5bcb3180b1407116a31..b66d252a45a8bbe0775d17a5f4fa31f306545e5d 100644 (file)
@@ -140,7 +140,7 @@ _PUBLIC_ NTSTATUS pvfs_xattr_ndr_save(struct pvfs_state *pvfs,
        NTSTATUS status;
        enum ndr_err_code ndr_err;
 
-       ndr_err = ndr_push_struct_blob(&blob, mem_ctx, lp_iconv_convenience(global_loadparm), p, (ndr_push_flags_fn_t)push_fn);
+       ndr_err = ndr_push_struct_blob(&blob, mem_ctx, lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), p, (ndr_push_flags_fn_t)push_fn);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(mem_ctx);
                return ndr_map_error2ntstatus(ndr_err);
index 3fa710415b822c9829b848e9d9b523f69b345cf6..093c15abab6d3a2a9d16bac61a3ed30bfba747af 100644 (file)
@@ -244,11 +244,6 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde,
 static NTSTATUS inotify_setup(struct sys_notify_context *ctx)
 {
        struct inotify_private *in;
-
-       if (!lp_parm_bool(global_loadparm, NULL, "notify", "inotify", true)) {
-               return NT_STATUS_INVALID_SYSTEM_SERVICE;
-       }
-
        in = talloc(ctx, struct inotify_private);
        NT_STATUS_HAVE_NO_MEMORY(in);
        in->fd = inotify_init();
@@ -339,6 +334,10 @@ static NTSTATUS inotify_watch(struct sys_notify_context *ctx,
        /* maybe setup the inotify fd */
        if (ctx->private_data == NULL) {
                NTSTATUS status;
+               if (!lp_parm_bool(global_loadparm, NULL, "notify", "inotify", true)) {
+                       return NT_STATUS_INVALID_SYSTEM_SERVICE;
+               }
+
                status = inotify_setup(ctx);
                NT_STATUS_NOT_OK_RETURN(status);
        }
index b043424faabe64afc40ca0be29934780262484f7..6e53c7c8ae72b70669b5cce28e423e1ba88bbfd3 100644 (file)
@@ -462,7 +462,7 @@ static NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32_t fault_code
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = ncacn_push_auth(&rep->blob, call, &pkt, NULL);
+       status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -501,7 +501,7 @@ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason)
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = ncacn_push_auth(&rep->blob, call, &pkt, NULL);
+       status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -642,8 +642,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call)
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = ncacn_push_auth(&rep->blob, call, &pkt, 
-                                 call->conn->auth_state.auth_info);
+       status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, call->conn->auth_state.auth_info);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -787,8 +786,7 @@ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call)
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = ncacn_push_auth(&rep->blob, call, &pkt, 
-                                 call->conn->auth_state.auth_info);
+       status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, call->conn->auth_state.auth_info);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index dce775591ba3edff048a29937cf828c29b58b064..75b13bb82436b64b37379445827418f878483986 100644 (file)
@@ -402,7 +402,7 @@ bool dcesrv_auth_response(struct dcesrv_call_state *call,
 
        /* non-signed packets are simple */
        if (!dce_conn->auth_state.auth_info || !dce_conn->auth_state.gensec_security) {
-               status = ncacn_push_auth(blob, call, pkt, NULL);
+               status = ncacn_push_auth(blob, call, lp_iconv_convenience(dce_conn->dce_ctx->lp_ctx), pkt, NULL);
                return NT_STATUS_IS_OK(status);
        }
 
index 396718367ac1315106a1d3b1b7fee9a7396a171e..99be1c4ef8e10166c19a8972c6ea82e795bedbe6 100644 (file)
@@ -52,7 +52,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv)
        }
        ev = event_context_find(event_mem_ctx);
 
-       ctx = libnet_context_init(ev, global_loadparm);
+       ctx = libnet_context_init(ev, mprLpCtx());
        /* IF we generated a new event context, it will be under here,
         * and we need it to last as long as the libnet context, so
         * make it a child */
@@ -68,7 +68,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv)
                        talloc_free(ctx);
                        return -1;
                }
-               cli_credentials_set_conf(creds, global_loadparm);
+               cli_credentials_set_conf(creds, mprLpCtx());
                cli_credentials_set_anonymous(creds);
 
                mprCreds = mprCredentials(creds);
index 1f29fce00249e6bd1e18c32a052a6198c5c3837a..63a80e17db65a85fce6a17bba418f1f66538f5ee 100644 (file)
@@ -111,7 +111,7 @@ static int ejs_typeof_native(MprVarHandle eid, int argc, struct MprVar **argv)
 static int ejs_libinclude(int eid, int argc, char **argv)
 {
        int i, j;
-       const char **js_include = lp_js_include(global_loadparm);
+       const char **js_include = lp_js_include(mprLpCtx());
 
        if (js_include == NULL || js_include[0] == NULL) {
                ejsSetErrorMsg(eid, "js include path not set");
@@ -184,7 +184,7 @@ void smb_setup_ejs_functions(void (*exception_handler)(const char *))
        smb_setup_ejs_param();
         smb_setup_ejs_literal();
        
-       shared_init = load_samba_modules(NULL, global_loadparm, "smbcalls");
+       shared_init = load_samba_modules(NULL, mprLpCtx(), "smbcalls");
        
        run_init_functions(static_init);
        run_init_functions(shared_init);
index 89370890c8899b66e3bc3806770f858ecf862460..908a009159a09c4a0d118b3ba9401308c04d3940 100644 (file)
@@ -56,14 +56,14 @@ static int ejs_doauth(MprVarHandle eid,
        } else {
                /* Hope we can find the event context somewhere up there... */
                ev = event_context_find(tmp_ctx);
-               msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, global_loadparm), 
-                                           lp_iconv_convenience(global_loadparm), ev);
+               msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, mprLpCtx()), 
+                                           lp_iconv_convenience(mprLpCtx()), ev);
        }
 
        if (auth_types) {
-               nt_status = auth_context_create_methods(tmp_ctx, auth_types, ev, msg, global_loadparm, &auth_context);
+               nt_status = auth_context_create_methods(tmp_ctx, auth_types, ev, msg, mprLpCtx(), &auth_context);
        } else {
-               nt_status = auth_context_create(tmp_ctx, ev, msg, global_loadparm, &auth_context);
+               nt_status = auth_context_create(tmp_ctx, ev, msg, mprLpCtx(), &auth_context);
        }
        if (!NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(auth, "result", mprCreateBoolVar(false));
@@ -109,7 +109,7 @@ static int ejs_doauth(MprVarHandle eid,
                goto done;
        }
 
-       nt_status = auth_generate_session_info(tmp_ctx, global_loadparm, server_info, &session_info);
+       nt_status = auth_generate_session_info(tmp_ctx, mprLpCtx(), server_info, &session_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(auth, "report", mprString("Session Info generation failed"));
                mprSetPropertyValue(auth, "result", mprCreateBoolVar(false));
@@ -222,7 +222,7 @@ static int ejs_userAuth(MprVarHandle eid, int argc, struct MprVar **argv)
 static int ejs_system_session(MprVarHandle eid, int argc, struct MprVar **argv)
 {
        struct MprVar *obj = mprInitObject(eid, "session_info", argc, argv);
-       struct auth_session_info *session_info = system_session(mprMemCtx(), global_loadparm);
+       struct auth_session_info *session_info = system_session(mprMemCtx(), mprLpCtx());
 
        if (session_info == NULL) {
                return -1;
index 8295a0879fd462a60715a668e355a293fcb6f518..dbb36312da544ba8c5906ecae99645470d997a6f 100644 (file)
@@ -432,23 +432,23 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv)
        /* Set up credentials */
 
        creds = cli_credentials_init(NULL);
-       cli_credentials_set_conf(creds, global_loadparm);
+       cli_credentials_set_conf(creds, mprLpCtx());
        cli_credentials_parse_string(creds, argv[1], CRED_SPECIFIED);
 
        /* Do connect */
 
        io.in.dest_host              = hostname;
-       io.in.dest_ports             = lp_smb_ports(global_loadparm);
+       io.in.dest_ports             = lp_smb_ports(mprLpCtx());
        io.in.called_name            = strupper_talloc(mem_ctx, hostname);
        io.in.service                = sharename;
        io.in.service_type           = "?????";
        io.in.credentials            = creds;
        io.in.fallback_to_anonymous  = false;
-       io.in.workgroup              = lp_workgroup(global_loadparm);
-       lp_smbcli_options(global_loadparm, &io.in.options);
+       io.in.workgroup              = lp_workgroup(mprLpCtx());
+       lp_smbcli_options(mprLpCtx(), &io.in.options);
 
        result = smb_composite_connect(&io, mem_ctx, 
-                                      lp_resolve_context(global_loadparm), 
+                                      lp_resolve_context(mprLpCtx()), 
                                       NULL);
        tree = io.out.tree;
 
index 07e0f479daea07e16e52565d6012e7e2c3022fa7..eb673b3a2380452bacf306a7b4da9608426a1490 100644 (file)
@@ -36,8 +36,8 @@ static int ejs_lpServices(MprVarHandle eid, int argc, char **argv)
        const char **list = NULL;
        if (argc != 0) return -1;
        
-       for (i=0;i<lp_numservices(global_loadparm);i++) {
-               list = str_list_add(list, lp_servicename(lp_servicebynum(global_loadparm, i)));
+       for (i=0;i<lp_numservices(mprLpCtx());i++) {
+               list = str_list_add(list, lp_servicename(lp_servicebynum(mprLpCtx(), i)));
        }
        talloc_steal(mprMemCtx(), list);
        mpr_Return(eid, mprList("services", list));
@@ -68,7 +68,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
        if (argc == 2) {
                struct loadparm_service *service;
                /* its a share parameter */
-               service = lp_service(global_loadparm, argv[0]);
+               service = lp_service(mprLpCtx(), argv[0]);
                if (service == NULL) {
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
@@ -84,7 +84,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                                mpr_Return(eid, mprCreateUndefinedVar());
                                return 0;
                        }
-                       value = lp_get_parametric(global_loadparm, service, type, option);
+                       value = lp_get_parametric(mprLpCtx(), service, type, option);
                        if (value == NULL) {
                                mpr_Return(eid, mprCreateUndefinedVar());
                                return 0;
@@ -98,7 +98,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
                }
-               parm_ptr = lp_parm_ptr(global_loadparm, service, parm);
+               parm_ptr = lp_parm_ptr(mprLpCtx(), service, parm);
        } else if (strchr(argv[0], ':')) {
                /* its a global parametric option */
                const char *type = talloc_strndup(mprMemCtx(), 
@@ -109,7 +109,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
                }
-               value = lp_get_parametric(global_loadparm, NULL, type, option);
+               value = lp_get_parametric(mprLpCtx(), NULL, type, option);
                if (value == NULL) {
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
@@ -123,7 +123,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
                        mpr_Return(eid, mprCreateUndefinedVar());
                        return 0;
                }
-               parm_ptr = lp_parm_ptr(global_loadparm, NULL, parm);
+               parm_ptr = lp_parm_ptr(mprLpCtx(), NULL, parm);
        }
 
        if (parm == NULL || parm_ptr == NULL) {
@@ -166,7 +166,7 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
 */
 static int ejs_lpFilename(MprVarHandle eid, int argc, char **argv)
 {
-       mpr_ReturnString(eid, lp_configfile(global_loadparm));
+       mpr_ReturnString(eid, lp_configfile(mprLpCtx()));
        return 0;
 }
 
@@ -184,7 +184,7 @@ static int ejs_lpSet(MprVarHandle eid, int argc, char **argv)
                return -1;
        }
 
-       mpr_Return(eid, mprCreateBoolVar(lp_set_cmdline(global_loadparm, argv[0], argv[1])));
+       mpr_Return(eid, mprCreateBoolVar(lp_set_cmdline(mprLpCtx(), argv[0], argv[1])));
        return 0;
 }
 
@@ -196,9 +196,9 @@ static int ejs_lpSet(MprVarHandle eid, int argc, char **argv)
 static int ejs_lpReload(MprVarHandle eid, int argc, char **argv)
 {
        bool ret;
-       const char *filename = lp_configfile(global_loadparm);
+       const char *filename = lp_configfile(mprLpCtx());
 
-       ret = lp_load(global_loadparm, filename);
+       ret = lp_load(mprLpCtx(), filename);
        mpr_Return(eid, mprCreateBoolVar(ret));
        return 0;
 }
index 6dfff8f925ca48ae37e9f008f71a731545843e3b..fd73f0751fa0efc30254b051ffa654aaca63e6ff 100644 (file)
@@ -192,7 +192,7 @@ static int ejs_creds_set_machine_account(MprVarHandle eid, int argc, struct MprV
                return -1;
        }
        
-       if (NT_STATUS_IS_OK(cli_credentials_set_machine_account(creds, global_loadparm))) {
+       if (NT_STATUS_IS_OK(cli_credentials_set_machine_account(creds, mprLpCtx()))) {
                mpr_Return(eid, mprCreateBoolVar(true));
        } else {
                mpr_Return(eid, mprCreateBoolVar(false));
@@ -248,7 +248,7 @@ static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv
                return -1;
        }
 
-       cli_credentials_set_conf(creds, global_loadparm);
+       cli_credentials_set_conf(creds, mprLpCtx());
 
        return ejs_credentials_obj(obj, creds);
 }
index 3ea41d46fb4d3038d100815f68d991ce039afe51..19e1e173d605231c99af9c9898ca24f582f0d7be 100644 (file)
@@ -177,7 +177,7 @@ static int ejs_regToVar(MprVarHandle eid, int argc, struct MprVar **argv)
        case REG_EXPAND_SZ: {
                char *s;
                ssize_t len;
-               len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, 
+               len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(mprLpCtx()), CH_UTF16, CH_UNIX, 
                                            blob->data, blob->length, (void **)&s);
                if (len == -1) {
                        ejsSetErrorMsg(eid, "regToVar invalid REG_SZ string");
@@ -225,7 +225,7 @@ static int ejs_regToVar(MprVarHandle eid, int argc, struct MprVar **argv)
                        if (slen == 2 && b.length == 2 && SVAL(b.data, 0) == 0) {
                                break;
                        }
-                       len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, 
+                       len = convert_string_talloc(mprMemCtx(), lp_iconv_convenience(mprLpCtx()), CH_UTF16, CH_UNIX, 
                                                    b.data, slen, (void **)&s);
                        if (len == -1) {
                                ejsSetErrorMsg(eid, "regToVar invalid REG_MULTI_SZ string");
index 7599cbf4433ee31acb3613b7033dd0865eb9597b..f47920b9bb5fd04d306c40ff88fc7ddcfd625f84 100644 (file)
@@ -453,7 +453,7 @@ static int ejs_ldbConnect(MprVarHandle eid, int argc, char **argv)
 
        dbfile = argv[0];
 
-       ldb = ldb_wrap_connect(mprMemCtx(), global_loadparm, dbfile, 
+       ldb = ldb_wrap_connect(mprMemCtx(), mprLpCtx(), dbfile, 
                               session_info, creds,
                               0, (const char **)(argv+1));
        if (ldb == NULL) {
index c3679b1ec78b86fe06a798abfb5aa30c7143ba31..67a85414caf718fbf110c6203531487688e32da2 100644 (file)
@@ -70,7 +70,7 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
 
        result = 0;
 
-       nt_status = resolve_name(lp_resolve_context(global_loadparm), &name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
+       nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
 
        if (NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
index 30e5357cfba5390562e16ccf5ff96a796413fae4..e20d91ad2eeef7b5dec0566a6f4f78b4cdcd7711 100644 (file)
@@ -70,7 +70,7 @@ static int ejs_reg_open(MprVarHandle eid, int argc, struct MprVar **argv)
        struct registry_context *rctx;
        WERROR error;
 
-       error = reg_open_samba(mprMemCtx(), &rctx, global_loadparm, NULL, NULL);
+       error = reg_open_samba(mprMemCtx(), &rctx, mprLpCtx(), NULL, NULL);
        SMB_ASSERT(W_ERROR_IS_OK(error));
 
        mprSetPtrChild(reg, "registry", rctx);
index 44cfa16d7e875b78a51c0d54450b89ac46989236..d1e49b4348a97823eab5fc498e4ada7c17a07c3c 100644 (file)
@@ -79,9 +79,9 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv)
           allocate temporary server ids automatically */
        for (i=0;i<10000;i++) {
                p->msg_ctx = messaging_init(p, 
-                                           lp_messaging_path(p, global_loadparm),
+                                           lp_messaging_path(p, mprLpCtx()),
                                            cluster_id(EJS_ID_BASE, i), 
-                                           lp_iconv_convenience(global_loadparm),
+                                           lp_iconv_convenience(mprLpCtx()),
                                            ev);
                if (p->msg_ctx) break;
        }
@@ -161,7 +161,7 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
        ev = event_context_find(mprMemCtx());
 
        status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev,
-                                    global_loadparm);
+                                    mprLpCtx());
        if (!NT_STATUS_IS_OK(status)) goto done;
 
        /* callers don't allocate ref vars in the ejs interface */
index 72ddf90231c5272217966b500b64d23e2d8b39c9..00599a55bc70211dcc0619b95e2110e355009790 100644 (file)
@@ -36,7 +36,7 @@ static int ejs_sys_interfaces(MprVarHandle eid, int argc, struct MprVar **argv)
        struct MprVar ret = mprArray("interfaces");
        struct interface *ifaces;
 
-       load_interfaces(NULL, lp_interfaces(global_loadparm), &ifaces);
+       load_interfaces(NULL, lp_interfaces(mprLpCtx()), &ifaces);
 
        count = iface_count(ifaces);
        for (i=0;i<count;i++) {
index d7f3793f23dd8603f06d599d0a86eee114393a17..87073517ddcdf799d2d230fff8ba8a1935ec708a 100644 (file)
@@ -423,7 +423,7 @@ size_t req_push_str(struct smbsrv_request *req, uint8_t *dest, const char *str,
                dest = req->out.buffer + PTR_DIFF(dest, buf0);
        }
 
-       len = push_string(lp_iconv_convenience(global_loadparm), dest, str, len, flags);
+       len = push_string(lp_iconv_convenience(req->smb_conn->lp_ctx), dest, str, len, flags);
 
        grow_size = len + PTR_DIFF(dest, req->out.data);
 
index c031b5bd6558812e6db4d7a942f7515837be91cd..4f8e628f7414762761c1e10b2cac04d8d4a50c7b 100644 (file)
@@ -146,7 +146,7 @@ static void smbsrv_accept(struct stream_connection *conn)
        packet_set_fde(smb_conn->packet, conn->event.fde);
        packet_set_serialise(smb_conn->packet);
 
-       smb_conn->lp_ctx = global_loadparm;
+       smb_conn->lp_ctx = conn->lp_ctx;
        smb_conn->connection = conn;
        conn->private = smb_conn;
 
index 4e58059770f38da45c766b4632c5a08329e5c699..dbe9d2f9a44a044855b321300b86f442b62e35cc 100644 (file)
@@ -38,7 +38,7 @@
 */
 static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest)
 {
-       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
+       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        NTSTATUS status;
        struct cldap_netlogon search, empty_search;
        union nbt_cldap_netlogon n1;
@@ -244,7 +244,7 @@ static void cldap_dump_results(struct cldap_search *search)
 */
 static bool test_cldap_generic(struct torture_context *tctx, const char *dest)
 {
-       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
+       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        NTSTATUS status;
        struct cldap_search search;
        const char *attrs1[] = { "currentTime", "highestCommittedUSN", NULL };
index c57ed6d48a25feacadd2016b095b48c44601d07c..83e505e164ee0210b607d0304f17c6fe95e757ac 100644 (file)
@@ -51,7 +51,7 @@ static void request_handler(struct cldap_request *req)
 */
 static bool bench_cldap(struct torture_context *tctx, const char *address)
 {
-       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
+       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        int num_sent=0;
        struct timeval tv = timeval_current();
        bool ret = true;
index 78210a2a0714ef8f2f7781db9b97dc6e6342b780..1ba6172e5ce50db04b6fa4007766a00de76de9d8 100644 (file)
@@ -47,7 +47,8 @@ static void increment_handler(struct nbt_name_request *req)
 */
 static bool bench_namequery(struct torture_context *tctx)
 {
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
+                                                              lp_iconv_convenience(tctx->lp_ctx));
        int num_sent=0;
        struct result_struct *result;
        struct nbt_name_query io;
index 508c6b484040103d50690968a58fdf045e20b182..b9f06c479d0d7b6a2840f34623a1313f85b8eaed 100644 (file)
@@ -44,7 +44,8 @@ static bool nbt_register_own(struct torture_context *tctx)
 {
        struct nbt_name_register io;
        NTSTATUS status;
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
+                                                              lp_iconv_convenience(tctx->lp_ctx));
        struct socket_address *socket_address;
        struct nbt_name name;
        const char *address;
@@ -113,7 +114,8 @@ static bool nbt_refresh_own(struct torture_context *tctx)
 {
        struct nbt_name_refresh io;
        NTSTATUS status;
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
+                                                              lp_iconv_convenience(tctx->lp_ctx));
        const char *myaddress;
        struct socket_address *socket_address;
        struct nbt_name name;
index cf115fcd755e0bee43c818dfea513c201ff77597..059b2dc91922daa01da3515ffea7b669aac60609 100644 (file)
@@ -53,7 +53,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
        struct nbt_name_refresh_wins refresh;
        struct nbt_name_release release;
        NTSTATUS status;
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        const char *myaddress;
        struct socket_address *socket_address;
        struct interface *ifaces;
index 1488c17757eaf8e13b67a64a1a8953b741721c90..ea4abaf21b5a11c773d422825c3f6e14ca0e067e 100644 (file)
@@ -225,7 +225,7 @@ static void generate_request(struct nbt_name_socket *nbtsock, struct wins_state
 */
 static bool bench_wins(struct torture_context *tctx)
 {
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        int num_sent=0;
        struct timeval tv = timeval_current();
        bool ret = true;
index d96ed3e931e48a9ad39229b244d80ad095ae8fd3..470eee831003d9c20e66070ab2e530882e5d1977 100644 (file)
@@ -103,14 +103,14 @@ static bool test_assoc_ctx1(struct torture_context *tctx)
 
        torture_comment(tctx, "Test if assoc_ctx is only valid on the conection it was created on\n");
 
-       wrepl_socket1 = wrepl_socket_init(tctx, NULL);
-       wrepl_socket2 = wrepl_socket_init(tctx, NULL);
+       wrepl_socket1 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       wrepl_socket2 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
 
        torture_comment(tctx, "Setup 2 wrepl connections\n");
-       status = wrepl_connect(wrepl_socket1, lp_resolve_context(tctx->lp_ctx), NULL, address);
+       status = wrepl_connect(wrepl_socket1, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
 
-       status = wrepl_connect(wrepl_socket2, lp_resolve_context(tctx->lp_ctx), NULL, address);
+       status = wrepl_connect(wrepl_socket2, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
 
        torture_comment(tctx, "Send a start association request (conn1)\n");
@@ -186,10 +186,10 @@ static bool test_assoc_ctx2(struct torture_context *tctx)
 
        torture_comment(tctx, "Test if we always get back the same assoc_ctx\n");
 
-       wrepl_socket = wrepl_socket_init(tctx, NULL);
+       wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        
        torture_comment(tctx, "Setup wrepl connections\n");
-       status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, address);
+       status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
 
        torture_comment(tctx, "Send 1st start association request\n");
@@ -255,10 +255,10 @@ static bool test_wins_replication(struct torture_context *tctx)
 
        torture_comment(tctx, "Test one pull replication cycle\n");
 
-       wrepl_socket = wrepl_socket_init(tctx, NULL);
+       wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        
        torture_comment(tctx, "Setup wrepl connections\n");
-       status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, address);
+       status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
 
        torture_comment(tctx, "Send a start association request\n");
@@ -553,11 +553,11 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        if (!ctx) return NULL;
 
        ctx->address    = address;
-       ctx->pull       = wrepl_socket_init(ctx, NULL);
+       ctx->pull       = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        if (!ctx->pull) return NULL;
 
        torture_comment(tctx, "Setup wrepl conflict pull connection\n");
-       status = wrepl_connect(ctx->pull, lp_resolve_context(tctx->lp_ctx), NULL, ctx->address);
+       status = wrepl_connect(ctx->pull, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, ctx->address), ctx->address);
        if (!NT_STATUS_IS_OK(status)) return NULL;
 
        status = wrepl_associate(ctx->pull, &associate);
@@ -610,7 +610,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
 
        talloc_free(pull_table.out.partners);
 
-       ctx->nbtsock = nbt_name_socket_init(ctx, NULL);
+       ctx->nbtsock = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        if (!ctx->nbtsock) return NULL;
 
        load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -628,7 +628,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        status = socket_listen(ctx->nbtsock->sock, ctx->myaddr, 0, 0);
        if (!NT_STATUS_IS_OK(status)) return NULL;
 
-       ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL);
+       ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        if (!ctx->nbtsock_srv) return NULL;
 
        /* Make a port 137 version of ctx->myaddr */
@@ -645,13 +645,13 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        }
 
        if (ctx->myaddr2 && ctx->nbtsock_srv) {
-               ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL);
+               ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
                if (!ctx->nbtsock2) return NULL;
 
                status = socket_listen(ctx->nbtsock2->sock, ctx->myaddr2, 0, 0);
                if (!NT_STATUS_IS_OK(status)) return NULL;
 
-               ctx->nbtsock_srv2 = nbt_name_socket_init(ctx, ctx->nbtsock_srv->event_ctx);
+               ctx->nbtsock_srv2 = nbt_name_socket_init(ctx, ctx->nbtsock_srv->event_ctx, lp_iconv_convenience(tctx->lp_ctx));
                if (!ctx->nbtsock_srv2) return NULL;
 
                /* Make a port 137 version of ctx->myaddr2 */
@@ -722,9 +722,9 @@ static bool test_wrepl_update_one(struct torture_context *tctx,
        uint32_t assoc_ctx;
        NTSTATUS status;
 
-       wrepl_socket = wrepl_socket_init(ctx, NULL);
+       wrepl_socket = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
 
-       status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, ctx->address);
+       status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, ctx->address), ctx->address);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
 
        status = wrepl_associate(wrepl_socket, &associate);
index 4417285e04d3f4c748d1597d877b29770701f5e7..b28e429a75746c4a0b590c25c127070de3cf532e 100644 (file)
@@ -255,7 +255,7 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
        struct drsuapi_DsNameString names[1];
        bool ret = true;
 
-       struct cldap_socket *cldap = cldap_socket_init(ctx, NULL);
+       struct cldap_socket *cldap = cldap_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
        struct cldap_netlogon search;
        
        r.in.bind_handle                = &ctx->admin.drsuapi.bind_handle;
index 7eae9c7765e0376d1bc7f08cda8d9e9c021bd36c..fe03e0dbbeb23ddccf97969d05a7753e098160ae 100644 (file)
@@ -211,7 +211,7 @@ static bool process_one(struct loadparm_context *lp_ctx,
                node_name = talloc_strdup(tmp_ctx, name);
        }
 
-       nbtsock = nbt_name_socket_init(tmp_ctx, NULL);
+       nbtsock = nbt_name_socket_init(tmp_ctx, NULL, lp_iconv_convenience(lp_ctx));
        
        if (options.root_port) {
                all_zero_addr = socket_address_from_strings(tmp_ctx, nbtsock->sock->backend_name, 
index 0073e3fdf8ae7bbe1b3e8c3173f11b536df6e997..62744297c64614c681490837e8fe89d1cdb94457 100644 (file)
@@ -143,7 +143,7 @@ static void pam_auth_crap_recv_logon(struct composite_context *ctx)
        if (!composite_is_ok(state->ctx)) return;
 
        ndr_err = ndr_push_struct_blob(
-               &tmp_blob, state, lp_iconv_convenience(global_loadparm), 
+               &tmp_blob, state, lp_iconv_convenience(state->lp_ctx), 
                state->req->out.validation.sam3,
                (ndr_push_flags_fn_t)ndr_push_netr_SamInfo3);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
index f809095f223f500d211930bab34c89c16b40ebec..12605196ab6f11b2b472e232ab47bc0f161d7f52 100644 (file)
@@ -30,6 +30,7 @@
 #include "libcli/composite/composite.h"
 #include "libcli/wrepl/winsrepl.h"
 #include "libcli/resolve/resolve.h"
+#include "param/param.h"
 
 enum wreplsrv_out_connect_stage {
        WREPLSRV_OUT_CONNECT_STAGE_WAIT_SOCKET,
@@ -186,14 +187,14 @@ static struct composite_context *wreplsrv_out_connect_send(struct wreplsrv_partn
 
        wreplconn->service      = service;
        wreplconn->partner      = partner;
-       wreplconn->sock         = wrepl_socket_init(wreplconn, service->task->event_ctx);
+       wreplconn->sock         = wrepl_socket_init(wreplconn, service->task->event_ctx, lp_iconv_convenience(service->task->lp_ctx));
        if (!wreplconn->sock) goto failed;
 
        state->stage    = WREPLSRV_OUT_CONNECT_STAGE_WAIT_SOCKET;
        state->wreplconn= wreplconn;
        state->c_req    = wrepl_connect_send(wreplconn->sock,
                                             lp_resolve_context(service->task->lp_ctx),
-                                            partner->our_address,
+                                            partner->our_address?partner->our_address:wrepl_best_ip(service->task->lp_ctx, partner->address),
                                             partner->address);
        if (!state->c_req) goto failed;