r26271: Remove some more uses of global_loadparm.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 3 Dec 2007 22:33:16 +0000 (23:33 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:47:53 +0000 (05:47 +0100)
18 files changed:
source/auth/credentials/credentials_files.c
source/auth/credentials/credentials_krb5.c
source/cldap_server/netlogon.c
source/client/client.c
source/client/smbmount.c
source/dsdb/repl/drepl_service.c
source/dsdb/samdb/ldb_modules/proxy.c
source/lib/cmdline/popt_credentials.c
source/libcli/cldap/cldap.c
source/libcli/cldap/cldap.h
source/libnet/libnet_become_dc.c
source/libnet/libnet_site.c
source/libnet/libnet_unbecome_dc.c
source/librpc/rpc/dcerpc_connect.c
source/torture/ldap/cldap.c
source/torture/ldap/cldapbench.c
source/torture/rpc/dssync.c
source/torture/util_smb.c

index f3f73f7fb1c4d33d77514cca722b838527efd95b..1f4b46737165083451ac870fc6aab0e4557c9e2e 100644 (file)
@@ -335,7 +335,8 @@ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred)
        cred->machine_account_pending = false;
        filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER, 
                                       cli_credentials_get_domain(cred));
-       return cli_credentials_set_secrets(cred, global_loadparm, NULL, SECRETS_PRIMARY_DOMAIN_DN,
+       return cli_credentials_set_secrets(cred, global_loadparm, NULL, 
+                                          SECRETS_PRIMARY_DOMAIN_DN,
                                           filter);
 }
 
@@ -355,7 +356,8 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred)
        filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH,
                                       cli_credentials_get_realm(cred),
                                       cli_credentials_get_domain(cred));
-       return cli_credentials_set_secrets(cred, global_loadparm, NULL, SECRETS_PRINCIPALS_DN,
+       return cli_credentials_set_secrets(cred, global_loadparm, NULL, 
+                                          SECRETS_PRINCIPALS_DN,
                                           filter);
 }
 
@@ -377,8 +379,8 @@ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
                                 cli_credentials_get_realm(cred),
                                 cli_credentials_get_domain(cred),
                                 serviceprincipal);
-       return cli_credentials_set_secrets(cred, global_loadparm, NULL, SECRETS_PRINCIPALS_DN,
-                                          filter);
+       return cli_credentials_set_secrets(cred, global_loadparm, NULL, 
+                                          SECRETS_PRINCIPALS_DN, filter);
 }
 
 /**
index 7bfad689efc20445d6cc609c64328433272da9b1..b963b61f1fea51229bc9655b62714098e36bcf29 100644 (file)
@@ -141,7 +141,8 @@ int cli_credentials_set_ccache(struct cli_credentials *cred,
                return ENOMEM;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, global_loadparm, &ccc->smb_krb5_context);
+       ret = cli_credentials_get_krb5_context(cred, global_loadparm, 
+                                              &ccc->smb_krb5_context);
        if (ret) {
                talloc_free(ccc);
                return ret;
@@ -215,7 +216,8 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred, struct ccach
                return ENOMEM;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, global_loadparm, &ccc->smb_krb5_context);
+       ret = cli_credentials_get_krb5_context(cred, global_loadparm, 
+                                              &ccc->smb_krb5_context);
        if (ret) {
                talloc_free(ccc);
                return ret;
@@ -225,7 +227,8 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred, struct ccach
                return ENOMEM;
        }
 
-       ret = krb5_cc_resolve(ccc->smb_krb5_context->krb5_context, ccache_name, &ccc->ccache);
+       ret = krb5_cc_resolve(ccc->smb_krb5_context->krb5_context, ccache_name, 
+                             &ccc->ccache);
        if (ret) {
                DEBUG(1,("failed to generate a new krb5 ccache (%s): %s\n", 
                         ccache_name,
index db07c8d6180c3331942e6e3be00a86f2adb3a379..beb1767138a52923e8b012135f2e5f2775b7703d 100644 (file)
@@ -327,7 +327,7 @@ void cldapd_netlogon_request(struct cldap_socket *cldap,
        }
 
        if (domain_guid == NULL && domain == NULL) {
-               domain = lp_realm(global_loadparm);
+               domain = lp_realm(cldapd->task->lp_ctx);
        }
 
        if (version == -1) {
@@ -339,7 +339,7 @@ void cldapd_netlogon_request(struct cldap_socket *cldap,
 
        status = cldapd_netlogon_fill(cldapd, tmp_ctx, domain, domain_guid, 
                                      user, src->addr, 
-                                     version, global_loadparm, &netlogon);
+                                     version, cldapd->task->lp_ctx, &netlogon);
        if (!NT_STATUS_IS_OK(status)) {
                goto failed;
        }
index a2fe29fc60b73b1824095922b7c0f41ceff8b90d..6debaac2e90ceb4f4152ba6f9713923e7c7844af 100644 (file)
@@ -3066,7 +3066,7 @@ static int do_host_query(const char *query_host, const char *workgroup)
 /****************************************************************************
 handle a message operation
 ****************************************************************************/
-static int do_message_op(const char *netbios_name, const char *desthost, const char *destip, int name_type)
+static int do_message_op(const char *netbios_name, const char *desthost, const char *destip, int name_type, const char **name_resolve_order, int max_xmit, int max_mux)
 {
        struct nbt_name called, calling;
        const char *server_name;
@@ -3078,7 +3078,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
 
        server_name = destip ? destip : desthost;
 
-       if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, lp_name_resolve_order(global_loadparm), lp_max_xmit(global_loadparm), lp_maxmux(global_loadparm))) {
+       if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, name_resolve_order, max_xmit, max_mux)) {
                d_printf("Connection to %s failed\n", server_name);
                return 1;
        }
@@ -3223,7 +3223,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
        }
 
        if (message) {
-               return do_message_op(lp_netbios_name(global_loadparm), desthost, dest_ip, name_type);
+               return do_message_op(lp_netbios_name(global_loadparm), desthost, dest_ip, name_type, lp_name_resolve_order(global_loadparm), lp_max_xmit(global_loadparm), lp_maxmux(global_loadparm));
        }
        
 
index 8c0a6fcdf11b79b4f8da041ce9b1dd08076bd523..db16c6cf1ff98148d2ddf6b797a164920e80ff1b 100644 (file)
@@ -406,7 +406,9 @@ static void send_fs_socket(const char *the_service, const char *mount_point, str
                        CatchSignal(SIGUSR1, &usr1_handler);
                        pause();
                        DEBUG(2,("mount.smbfs[%d]: got signal, getting new socket\n", sys_getpid()));
-                       c = do_connection(the_service, lp_unicode(global_loadparm), lp_cli_maxprotocol(global_loadparm));
+                       c = do_connection(the_service, 
+                                         lp_unicode(global_loadparm), 
+                                         lp_cli_maxprotocol(global_loadparm));
                }
        }
 
index fe24314c110054dd3a9f33f4bc21cc4cb6aa0036..c3238a206f26ef4af1232eda58591eccafa002e2 100644 (file)
@@ -37,7 +37,8 @@ static WERROR dreplsrv_init_creds(struct dreplsrv_service *service)
 {
        NTSTATUS status;
 
-       status = auth_system_session_info(service, global_loadparm, &service->system_session_info);
+       status = auth_system_session_info(service, service->task->lp_ctx, 
+                                         &service->system_session_info);
        if (!NT_STATUS_IS_OK(status)) {
                return ntstatus_to_werror(status);
        }
index 435422ae17152e524b490485074c1bac2351d5ee..5f22982b8d292ecbdc678d259eeffa74980247a7 100644 (file)
@@ -129,7 +129,7 @@ static int load_proxy_info(struct ldb_module *module)
                ldb_oom(module->ldb);
                goto failed;
        }
-       cli_credentials_guess(creds, NULL);
+       cli_credentials_guess(creds, global_loadparm);
        cli_credentials_set_username(creds, username, CRED_SPECIFIED);
        cli_credentials_set_password(creds, password, CRED_SPECIFIED);
 
index d82cdc510096152a14b7281efae377960243d503..03142a7602081474127852f69be0ba5fb2f9e05d 100644 (file)
@@ -60,7 +60,7 @@ static void popt_common_credentials_callback(poptContext con,
        }
        
        if (reason == POPT_CALLBACK_REASON_POST) {
-               cli_credentials_guess(cmdline_credentials, NULL);
+               cli_credentials_guess(cmdline_credentials, global_loadparm);
 
                if (!dont_ask) {
                        cli_credentials_set_cmdline_callbacks(cmdline_credentials);
index 88421ad08d8c39f5c74e419f3448a0fe70a6b590..87a8957fbc6da302ad13fa25d620fb4e57c68e4f 100644 (file)
@@ -572,7 +572,7 @@ struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
        if (filter == NULL) goto failed;
 
        search.in.dest_address = io->in.dest_address;
-       search.in.dest_port    = lp_cldap_port(global_loadparm);
+       search.in.dest_port    = io->in.dest_port;
        search.in.filter       = filter;
        search.in.attributes   = attr;
        search.in.timeout      = 2;
index cdee775aa797072f2cd8da1046f5b1ed99be72ae..217ac0ff1b42d20831c22b06a101235b9d72e217 100644 (file)
@@ -73,6 +73,7 @@ struct cldap_request {
 struct cldap_socket {
        struct socket_context *sock;
        struct event_context *event_ctx;
+       struct loadparm_context *lp_ctx;
 
        /* the fd event */
        struct fd_event *fde;
@@ -151,6 +152,7 @@ NTSTATUS cldap_error_reply(struct cldap_socket *cldap,
 struct cldap_netlogon {
        struct {
                const char *dest_address;
+               uint16_t dest_port;
                const char *realm;
                const char *host;
                const char *user;
index 2673af8e0fdd0c04710c76ae5aa2a60e965588d3..e8b1632e732ea98a92be025fb343847687ea92da 100644 (file)
@@ -738,6 +738,7 @@ static void becomeDC_send_cldap(struct libnet_BecomeDC_state *s)
        struct cldap_request *req;
 
        s->cldap.io.in.dest_address     = s->source_dsa.address;
+       s->cldap.io.in.dest_port        = lp_cldap_port(global_loadparm);
        s->cldap.io.in.realm            = s->domain.dns_name;
        s->cldap.io.in.host             = s->dest_dsa.netbios_name;
        s->cldap.io.in.user             = NULL;
index 251cecb3b097a7a5dceb3d9b4026a37e9b0c8614..9351aef634627de6e20677cb3dbf07374e0b3ac0 100644 (file)
@@ -51,6 +51,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r)
        /* Resolve the site name. */
        ZERO_STRUCT(search);
        search.in.dest_address = r->in.dest_address;
+       search.in.dest_port = lp_cldap_port(global_loadparm);
        search.in.acct_control = -1;
        search.in.version = 6;
 
index 8b27d8571883c8c140432a572bef74d99b51235c..a7b962f2a8ecd780b9aa651b0823a774aeb3b199 100644 (file)
@@ -258,6 +258,7 @@ static void unbecomeDC_send_cldap(struct libnet_UnbecomeDC_state *s)
        struct cldap_request *req;
 
        s->cldap.io.in.dest_address     = s->source_dsa.address;
+       s->cldap.io.in.dest_port        = lp_cldap_port(global_loadparm);
        s->cldap.io.in.realm            = s->domain.dns_name;
        s->cldap.io.in.host             = s->dest_dsa.netbios_name;
        s->cldap.io.in.user             = NULL;
index d19dac9fe57a45bc4ddad312fe97c42c8f69f829..6c6441790b9bc8ead3f82b0668418e657c0d4516 100644 (file)
@@ -230,7 +230,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(TALLOC_C
                s->io.creds = cli_credentials_init(mem_ctx);
                if (composite_nomem(s->io.creds, c)) return c;
 
-               cli_credentials_guess(s->io.creds, NULL);
+               cli_credentials_guess(s->io.creds, global_loadparm);
        }
 
        /* send smb2 connect request */
index ddb966683f1afd80b15e5952a8fafb0df6e45e44..59def798452b10cfe30c51164c938e26221a18c5 100644 (file)
@@ -40,9 +40,9 @@
 /*
   test netlogon operations
 */
-static bool test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest)
+static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest)
 {
-       struct cldap_socket *cldap = cldap_socket_init(mem_ctx, NULL);
+       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL);
        NTSTATUS status;
        struct cldap_netlogon search, empty_search;
        union nbt_cldap_netlogon n1;
@@ -52,6 +52,7 @@ static bool test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest)
 
        ZERO_STRUCT(search);
        search.in.dest_address = dest;
+       search.in.dest_port = lp_cldap_port(tctx->lp_ctx);
        search.in.acct_control = -1;
        search.in.version = 6;
 
@@ -59,7 +60,7 @@ static bool test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest)
 
        printf("Trying without any attributes\n");
        search = empty_search;
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        n1 = search.out.netlogon;
@@ -72,7 +73,7 @@ static bool test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest)
        for (i=0;i<256;i++) {
                search.in.version = i;
                printf("Trying netlogon level %d\n", i);
-               status = cldap_netlogon(cldap, mem_ctx, &search);
+               status = cldap_netlogon(cldap, tctx, &search);
                CHECK_STATUS(status, NT_STATUS_OK);
        }
 
@@ -80,82 +81,82 @@ static bool test_cldap_netlogon(TALLOC_CTX *mem_ctx, const char *dest)
        for (i=0;i<31;i++) {
                search.in.version = (1<<i);
                printf("Trying netlogon level 0x%x\n", i);
-               status = cldap_netlogon(cldap, mem_ctx, &search);
+               status = cldap_netlogon(cldap, tctx, &search);
                CHECK_STATUS(status, NT_STATUS_OK);
        }
 
        search.in.version = 6;
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with User=NULL\n");
 
        search.in.user = NULL;
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with User=Administrator\n");
 
        search.in.user = "Administrator";
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with a GUID\n");
        search.in.realm       = NULL;
-       search.in.domain_guid = GUID_string(mem_ctx, &n1.logon5.domain_uuid);
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       search.in.domain_guid = GUID_string(tctx, &n1.logon5.domain_uuid);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with a incorrect GUID\n");
        guid = GUID_random();
        search.in.user        = NULL;
-       search.in.domain_guid = GUID_string(mem_ctx, &guid);
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       search.in.domain_guid = GUID_string(tctx, &guid);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_NOT_FOUND);
 
        printf("Trying with a AAC\n");
        search.in.acct_control = 0x180;
        search.in.realm = n1.logon5.dns_domain;
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with a bad AAC\n");
        search.in.acct_control = 0xFF00FF00;
        search.in.realm = n1.logon5.dns_domain;
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with a user only\n");
        search = empty_search;
        search.in.user = "Administrator";
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with just a bad username\n");
        search.in.user = "___no_such_user___";
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with just a bad domain\n");
        search = empty_search;
        search.in.realm = "___no_such_domain___";
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_NOT_FOUND);
 
        printf("Trying with a incorrect domain and correct guid\n");
-       search.in.domain_guid = GUID_string(mem_ctx, &n1.logon5.domain_uuid);
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       search.in.domain_guid = GUID_string(tctx, &n1.logon5.domain_uuid);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
        printf("Trying with a incorrect domain and incorrect guid\n");
-       search.in.domain_guid = GUID_string(mem_ctx, &guid);
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       search.in.domain_guid = GUID_string(tctx, &guid);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_NOT_FOUND);
 
        printf("Trying with a incorrect GUID and correct domain\n");
-       search.in.domain_guid = GUID_string(mem_ctx, &guid);
+       search.in.domain_guid = GUID_string(tctx, &guid);
        search.in.realm = n1.logon5.dns_domain;
-       status = cldap_netlogon(cldap, mem_ctx, &search);
+       status = cldap_netlogon(cldap, tctx, &search);
        CHECK_STATUS(status, NT_STATUS_OK);
 
 done:
index 21fe3849b13bf3931f6001e70b7b9e92b3737cb2..47b1348ef6cf4df7ff84ad22d23ff402c173fb7e 100644 (file)
@@ -63,6 +63,7 @@ static bool bench_cldap(struct torture_context *tctx, const char *address)
 
        ZERO_STRUCT(search);
        search.in.dest_address = address;
+       search.in.dest_port     = lp_cldap_port(tctx->lp_ctx);
        search.in.acct_control = -1;
        search.in.version = 6;
 
index 738a049e73d8ec12bbcacf76d9af9a4d85a06c7d..14164321b9491298160505abd39f18684eeb3eff 100644 (file)
@@ -284,6 +284,7 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
        
        ZERO_STRUCT(search);
        search.in.dest_address = ctx->drsuapi_binding->host;
+       search.in.dest_port = lp_cldap_port(tctx->lp_ctx);
        search.in.acct_control = -1;
        search.in.version = 6;
        status = cldap_netlogon(cldap, ctx, &search);
index 6e6acf220f29fbb2925e75cced729f247f274a74..65dfaec1ccdcead2e8b2219194a8b88060fe4099 100644 (file)
@@ -279,11 +279,12 @@ void *shm_setup(int size)
 }
 
 
-/*
+/**
   check that a wire string matches the flags specified 
   not 100% accurate, but close enough for testing
 */
-bool wire_bad_flags(struct smb_wire_string *str, int flags, struct smbcli_transport *transport)
+bool wire_bad_flags(struct smb_wire_string *str, int flags, 
+                   struct smbcli_transport *transport)
 {
        bool server_unicode;
        int len;