1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r26271: Remove some more uses of global_loadparm.

(This used to be commit e9875fcd56)
This commit is contained in:
Jelmer Vernooij 2007-12-03 23:33:16 +01:00 committed by Stefan Metzmacher
parent 5b357ca877
commit da0f222f43
18 changed files with 60 additions and 43 deletions

View 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);
}
/**

View 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,

View 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;
}

View 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));
}

View 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));
}
}

View 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);
}

View 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);

View 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);

View 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;

View 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;

View 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;

View 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;

View 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;

View 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 */

View 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:

View 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;

View 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);

View 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;