Add one use of popt_set_cmdline_credentials().
Fix 80 column limits when cmdline_credentials changes
to popt_get_cmdline_credentials().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
if (ldb_set_opaque(ldb, "sessionInfo", system_session(cmdline_lp_ctx))) {
return ldb_operr(ldb);
}
- if (ldb_set_opaque(ldb, "credentials", cmdline_credentials)) {
+ if (ldb_set_opaque(ldb, "credentials",
+ popt_get_cmdline_credentials())) {
return ldb_operr(ldb);
}
if (ldb_set_opaque(ldb, "loadparm", cmdline_lp_ctx)) {
struct wbcAuthErrorInfo *error = NULL;
wbcErr ret;
- ret = wbcAuthenticateUser(cli_credentials_get_username(cmdline_credentials), correct_password);
+ ret = wbcAuthenticateUser(cli_credentials_get_username(
+ popt_get_cmdline_credentials()), correct_password);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
- "wbcAuthenticateUser of %s failed",
- cli_credentials_get_username(cmdline_credentials));
+ "wbcAuthenticateUser of %s failed",
+ cli_credentials_get_username(popt_get_cmdline_credentials()));
ZERO_STRUCT(params);
- params.account_name = cli_credentials_get_username(cmdline_credentials);
+ params.account_name =
+ cli_credentials_get_username(popt_get_cmdline_credentials());
params.level = WBC_AUTH_USER_LEVEL_PLAIN;
params.password.plaintext = correct_password;
static bool test_wbc_authenticate_user(struct torture_context *tctx)
{
- return test_wbc_authenticate_user_int(tctx, cli_credentials_get_password(cmdline_credentials));
+ return test_wbc_authenticate_user_int(tctx,
+ cli_credentials_get_password(popt_get_cmdline_credentials()));
}
static bool test_wbc_change_password(struct torture_context *tctx)
{
wbcErr ret;
- const char *oldpass = cli_credentials_get_password(cmdline_credentials);
+ const char *oldpass =
+ cli_credentials_get_password(popt_get_cmdline_credentials());
const char *newpass = "Koo8irei%$";
struct samr_CryptPassword new_nt_password;
params.new_password.response.nt_data = new_nt_password.data;
params.level = WBC_CHANGE_PASSWORD_LEVEL_RESPONSE;
- params.account_name = cli_credentials_get_username(cmdline_credentials);
- params.domain_name = cli_credentials_get_domain(cmdline_credentials);
+ params.account_name =
+ cli_credentials_get_username(popt_get_cmdline_credentials());
+ params.domain_name =
+ cli_credentials_get_domain(popt_get_cmdline_credentials());
ret = wbcChangeUserPasswordEx(¶ms, NULL, NULL, NULL);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
return false;
}
- ret = wbcChangeUserPassword(cli_credentials_get_username(cmdline_credentials), newpass,
- cli_credentials_get_password(cmdline_credentials));
+ ret = wbcChangeUserPassword(
+ cli_credentials_get_username(popt_get_cmdline_credentials()),
+ newpass,
+ cli_credentials_get_password(popt_get_cmdline_credentials()));
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
"wbcChangeUserPassword for %s failed", params.account_name);
- return test_wbc_authenticate_user_int(tctx, cli_credentials_get_password(cmdline_credentials));
+ return test_wbc_authenticate_user_int(tctx,
+ cli_credentials_get_password(popt_get_cmdline_credentials()));
}
static bool test_wbc_logon_user(struct torture_context *tctx)
"%s", "wbcLogonUser succeeded for NULL where it should "
"have failed");
- params.username = cli_credentials_get_username(cmdline_credentials);
- params.password = cli_credentials_get_password(cmdline_credentials);
+ params.username =
+ cli_credentials_get_username(popt_get_cmdline_credentials());
+ params.password =
+ cli_credentials_get_password(popt_get_cmdline_credentials());
ret = wbcAddNamedBlob(¶ms.num_blobs, ¶ms.blobs,
"foo", 0, discard_const_p(uint8_t, "bar"), 4);
strlen("S-1-2-3-4")+1);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
"%s", "wbcAddNamedBlob failed");
- params.password = cli_credentials_get_password(cmdline_credentials);
+ params.password =
+ cli_credentials_get_password(popt_get_cmdline_credentials());
ret = wbcLogonUser(¶ms, &info, &error, &policy);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_AUTH_ERROR,
"wbcLogonUser for %s should have failed with "
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
"%s", "wbcInterfaceDetails failed");
- ret = wbcLookupName(iface->netbios_domain, cli_credentials_get_username(cmdline_credentials), &sid,
- &sidtype);
+ ret = wbcLookupName(iface->netbios_domain,
+ cli_credentials_get_username(popt_get_cmdline_credentials()),
+ &sid,
+ &sidtype);
wbcFreeMemory(iface);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
- "wbcLookupName for %s failed", cli_credentials_get_username(cmdline_credentials));
+ "wbcLookupName for %s failed",
+ cli_credentials_get_username(popt_get_cmdline_credentials()));
ret = wbcSidToString(&sid, &sidstr);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
"%s", "wbcAddNamedBlob failed");
wbcFreeMemory(sidstr);
- params.password = cli_credentials_get_password(cmdline_credentials);
+ params.password =
+ cli_credentials_get_password(popt_get_cmdline_credentials());
ret = wbcLogonUser(¶ms, &info, &error, &policy);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
"wbcLogonUser for %s failed", params.username);
uint32_t num_groups;
gid_t *groups;
- ret = wbcGetGroups(cli_credentials_get_username(cmdline_credentials), &num_groups, &groups);
+ ret = wbcGetGroups(
+ cli_credentials_get_username(popt_get_cmdline_credentials()),
+ &num_groups,
+ &groups);
torture_assert_wbc_equal(tctx, ret, WBC_ERR_SUCCESS,
- "wbcGetGroups for %s failed", cli_credentials_get_username(cmdline_credentials));
+ "wbcGetGroups for %s failed",
+ cli_credentials_get_username(popt_get_cmdline_credentials()));
wbcFreeMemory(groups);
return true;
}
* each connection, but for now, we just use the same one for both.
*/
ret = smbcli_full_connection(NULL, &cli, host, ports, share,
- NULL /* devtype */,
- socket_options,
- cmdline_credentials, resolve_ctx,
- ev, options,
- session_options,
- gensec_settings);
+ NULL /* devtype */,
+ socket_options,
+ popt_get_cmdline_credentials(),
+ resolve_ctx,
+ ev, options,
+ session_options,
+ gensec_settings);
if (!NT_STATUS_IS_OK(ret)) {
fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
int total_len = 0;
int grp_id;
- if (!smbcli_message_start(cli->tree, desthost, cli_credentials_get_username(cmdline_credentials), &grp_id)) {
+ if (!smbcli_message_start(cli->tree,
+ desthost,
+ cli_credentials_get_username(
+ popt_get_cmdline_credentials()),
+ &grp_id)) {
d_printf("message start: %s\n", smbcli_errstr(cli->tree));
return;
}
status = dcerpc_pipe_connect(mem_ctx, &p, binding,
&ndr_table_srvsvc,
- cmdline_credentials, ev_ctx,
+ popt_get_cmdline_credentials(), ev_ctx,
lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Failed to connect to %s - %s\n",
}
if (poptPeekArg(pc)) {
- cli_credentials_set_password(cmdline_credentials, poptGetArg(pc), CRED_SPECIFIED);
+ cli_credentials_set_password(popt_get_cmdline_credentials(),
+ poptGetArg(pc), CRED_SPECIFIED);
}
/*init_names(); */
if (!do_connect(ctx, ev_ctx, lpcfg_resolve_context(cmdline_lp_ctx),
desthost, lpcfg_smb_ports(cmdline_lp_ctx), service,
lpcfg_socket_options(cmdline_lp_ctx),
- cmdline_credentials, &smb_options, &smb_session_options,
+ popt_get_cmdline_credentials(),
+ &smb_options, &smb_session_options,
lpcfg_gensec_settings(ctx, cmdline_lp_ctx)))
return 1;
const char *arg, const void *data)
{
if (reason == POPT_CALLBACK_REASON_PRE) {
- cmdline_credentials = cli_credentials_init(talloc_autofree_context());
+ popt_set_cmdline_credentials(
+ cli_credentials_init(talloc_autofree_context()));
return;
}
if (reason == POPT_CALLBACK_REASON_POST) {
- cli_credentials_guess(cmdline_credentials, cmdline_lp_ctx);
+ cli_credentials_guess(popt_get_cmdline_credentials(),
+ cmdline_lp_ctx);
if (!dont_ask) {
- cli_credentials_set_cmdline_callbacks(cmdline_credentials);
+ cli_credentials_set_cmdline_callbacks(
+ popt_get_cmdline_credentials());
}
if (machine_account_pending) {
- cli_credentials_set_machine_account(cmdline_credentials, cmdline_lp_ctx);
+ cli_credentials_set_machine_account(
+ popt_get_cmdline_credentials(), cmdline_lp_ctx);
}
return;
{
char *lp;
- cli_credentials_parse_string(cmdline_credentials, arg, CRED_SPECIFIED);
+ cli_credentials_parse_string(
+ popt_get_cmdline_credentials(), arg, CRED_SPECIFIED);
/* This breaks the abstraction, including the const above */
if ((lp=strchr_m(arg,'%'))) {
lp[0]='\0';
break;
case OPT_PASSWORD:
- cli_credentials_set_password(cmdline_credentials, arg, CRED_SPECIFIED);
+ cli_credentials_set_password(popt_get_cmdline_credentials(),
+ arg, CRED_SPECIFIED);
/* Try to prevent this showing up in ps */
memset(discard_const(arg),0,strlen(arg));
break;
case 'A':
- cli_credentials_parse_file(cmdline_credentials, arg, CRED_SPECIFIED);
+ cli_credentials_parse_file(popt_get_cmdline_credentials(),
+ arg, CRED_SPECIFIED);
break;
case 'P':
}
}
- cli_credentials_set_kerberos_state(cmdline_credentials,
+ cli_credentials_set_kerberos_state(
+ popt_get_cmdline_credentials(),
use_kerberos
? CRED_MUST_USE_KERBEROS
: CRED_DONT_USE_KERBEROS);
case OPT_SIMPLE_BIND_DN:
{
- cli_credentials_set_bind_dn(cmdline_credentials, arg);
+ cli_credentials_set_bind_dn(popt_get_cmdline_credentials(),
+ arg);
break;
}
case OPT_KRB5_CCACHE:
{
const char *error_string;
- if (cli_credentials_set_ccache(cmdline_credentials, cmdline_lp_ctx, arg, CRED_SPECIFIED,
+ if (cli_credentials_set_ccache(
+ popt_get_cmdline_credentials(), cmdline_lp_ctx,
+ arg, CRED_SPECIFIED,
&error_string) != 0) {
fprintf(stderr, "Error reading krb5 credentials cache: '%s' %s", arg, error_string);
exit(1);
{
uint32_t gensec_features;
- gensec_features = cli_credentials_get_gensec_features(cmdline_credentials);
+ gensec_features = cli_credentials_get_gensec_features(
+ popt_get_cmdline_credentials());
gensec_features |= GENSEC_FEATURE_SIGN;
- cli_credentials_set_gensec_features(cmdline_credentials,
+ cli_credentials_set_gensec_features(
+ popt_get_cmdline_credentials(),
gensec_features);
break;
}
{
uint32_t gensec_features;
- gensec_features = cli_credentials_get_gensec_features(cmdline_credentials);
+ gensec_features = cli_credentials_get_gensec_features(
+ popt_get_cmdline_credentials());
gensec_features |= GENSEC_FEATURE_SEAL;
- cli_credentials_set_gensec_features(cmdline_credentials,
+ cli_credentials_set_gensec_features(
+ popt_get_cmdline_credentials(),
gensec_features);
break;
}
poptPrintUsage(pc, stderr, 0);
return NULL;
case REG_LOCAL:
- error = reg_open_samba(mem_ctx, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials);
+ error = reg_open_samba(mem_ctx, &ctx, ev_ctx, lp_ctx, NULL,
+ popt_get_cmdline_credentials());
break;
case REG_REMOTE:
- error = reg_open_remote(mem_ctx, &ctx, NULL, cmdline_credentials, lp_ctx,
+ error = reg_open_remote(mem_ctx, &ctx, NULL,
+ popt_get_cmdline_credentials(), lp_ctx,
remote_host, ev_ctx);
break;
case REG_NULL:
ev_ctx = s4_event_context_init(NULL);
if (remote) {
- h = reg_common_open_remote (remote, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
+ h = reg_common_open_remote (remote, ev_ctx, cmdline_lp_ctx,
+ popt_get_cmdline_credentials());
} else {
- h = reg_common_open_local (cmdline_credentials, ev_ctx, cmdline_lp_ctx);
+ h = reg_common_open_local (popt_get_cmdline_credentials(),
+ ev_ctx, cmdline_lp_ctx);
}
if (h == NULL)
if (remote != NULL) {
ctx->registry = reg_common_open_remote(remote, ev_ctx,
- cmdline_lp_ctx, cmdline_credentials);
+ cmdline_lp_ctx,
+ popt_get_cmdline_credentials());
} else if (file != NULL) {
- ctx->current = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
+ ctx->current = reg_common_open_file(file, ev_ctx,
+ cmdline_lp_ctx,
+ popt_get_cmdline_credentials());
if (ctx->current == NULL)
return 1;
ctx->registry = ctx->current->context;
ctx->predef = NULL;
ctx->root = ctx->current;
} else {
- ctx->registry = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
+ ctx->registry = reg_common_open_local(
+ popt_get_cmdline_credentials(),
+ ev_ctx, cmdline_lp_ctx);
}
if (ctx->registry == NULL)
ev_ctx = s4_event_context_init(NULL);
if (remote != NULL) {
- h = reg_common_open_remote(remote, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
+ h = reg_common_open_remote(remote, ev_ctx, cmdline_lp_ctx,
+ popt_get_cmdline_credentials());
} else if (file != NULL) {
- start_key = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
+ start_key = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx,
+ popt_get_cmdline_credentials());
} else {
- h = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
+ h = reg_common_open_local(popt_get_cmdline_credentials(),
+ ev_ctx, cmdline_lp_ctx);
}
if (h == NULL && start_key == NULL)
parse_args(argc, argv, &args);
- wmi_init(&ctx, cmdline_credentials);
+ wmi_init(&ctx, popt_get_cmdline_credentials());
if (!args.ns)
args.ns = "root\\cimv2";
parse_args(argc, argv, &args);
- wmi_init(&ctx, cmdline_credentials);
+ wmi_init(&ctx, popt_get_cmdline_credentials());
result = WBEM_ConnectServer(ctx, args.hostname, "root\\cimv2", 0, 0, 0, 0, 0, 0, &pWS);
WERR_CHECK("WBEM_ConnectServer.");
lpcfg_gensec_settings(tctx, tctx->lp_ctx)),
"gensec client start");
- gensec_set_credentials(gensec_security, cmdline_credentials);
+ gensec_set_credentials(gensec_security, popt_get_cmdline_credentials());
gensec_want_feature(gensec_security, GENSEC_FEATURE_SIGN);
gensec_want_feature(gensec_security, GENSEC_FEATURE_SEAL);
lpcfg_gensec_settings(tctx, tctx->lp_ctx)),
"Failed to start GENSEC for NTLMSSP");
- gensec_set_credentials(gensec_security, cmdline_credentials);
+ gensec_set_credentials(gensec_security, popt_get_cmdline_credentials());
gensec_want_feature(gensec_security, GENSEC_FEATURE_SIGN);
gensec_want_feature(gensec_security, GENSEC_FEATURE_SEAL);
#include "libcli/composite/composite.h"
#include "param/param.h"
#include "torture/basic/proto.h"
+#include "lib/cmdline/popt_common.h"
-extern struct cli_credentials *cmdline_credentials;
-
static bool wait_lock(struct smbcli_state *c, int fnum, uint32_t offset, uint32_t len)
{
while (NT_STATUS_IS_ERR(smbcli_lock(c->tree, fnum, offset, len, -1, WRITE_LOCK))) {
smb->in.socket_options = lpcfg_socket_options(tctx->lp_ctx);
smb->in.called_name = strupper_talloc(mem_ctx, host);
smb->in.service_type=NULL;
- smb->in.credentials=cmdline_credentials;
+ smb->in.credentials=popt_get_cmdline_credentials();
smb->in.fallback_to_anonymous=false;
smb->in.gensec_settings = lpcfg_gensec_settings(mem_ctx, tctx->lp_ctx);
smb->in.workgroup=workgroup;
status = gensec_set_target_service(gensec_client_context, "dns");
torture_assert_ntstatus_ok(tctx, status, "gensec_set_target_service failed");
- status = gensec_set_credentials(gensec_client_context, cmdline_credentials);
+ status = gensec_set_credentials(gensec_client_context,
+ popt_get_cmdline_credentials());
torture_assert_ntstatus_ok(tctx, status, "gensec_set_credentials (client) failed");
status = gensec_start_mech_by_sasl_name(gensec_client_context, mech);
torture_assert_ntstatus_ok(tctx, status, "gensec_update (client) failed");
}
- torture_assert_int_equal(tctx, dlz_ssumatch(cli_credentials_get_username(cmdline_credentials),
- lpcfg_dnsdomain(tctx->lp_ctx),
- "127.0.0.1", "type", "key",
- client_to_server.length,
- client_to_server.data,
- dbdata),
- ISC_TRUE,
- "Failed to check key for update rights samba_dlz");
+ torture_assert_int_equal(tctx, dlz_ssumatch(
+ cli_credentials_get_username(
+ popt_get_cmdline_credentials()),
+ lpcfg_dnsdomain(tctx->lp_ctx),
+ "127.0.0.1", "type", "key",
+ client_to_server.length,
+ client_to_server.data,
+ dbdata),
+ ISC_TRUE,
+ "Failed to check key for update rights samba_dlz");
dlz_destroy(dbdata);
status = gensec_set_target_service(gensec_client_context, "dns");
torture_assert_ntstatus_ok(tctx, status, "gensec_set_target_service failed");
- status = gensec_set_credentials(gensec_client_context, cmdline_credentials);
+ status = gensec_set_credentials(gensec_client_context,
+ popt_get_cmdline_credentials());
torture_assert_ntstatus_ok(tctx, status, "gensec_set_credentials (client) failed");
status = gensec_start_mech_by_sasl_name(gensec_client_context, "GSS-SPNEGO");
torture_assert_ntstatus_ok(tctx, status, "gensec_update (client) failed");
}
- torture_assert_int_equal(tctx, dlz_ssumatch(cli_credentials_get_username(cmdline_credentials),
- name,
- "127.0.0.1",
- expected1->records[0].type,
- "key",
- client_to_server.length,
- client_to_server.data,
- dbdata),
- ISC_TRUE,
- "Failed to check key for update rights samba_dlz");
+ torture_assert_int_equal(tctx, dlz_ssumatch(
+ cli_credentials_get_username(
+ popt_get_cmdline_credentials()),
+ name,
+ "127.0.0.1",
+ expected1->records[0].type,
+ "key",
+ client_to_server.length,
+ client_to_server.data,
+ dbdata),
+ ISC_TRUE,
+ "Failed to check key for update rights samba_dlz");
/*
* We test the following:
}
/* ctx->admin ...*/
- ctx->admin.credentials = cmdline_credentials;
+ ctx->admin.credentials = popt_get_cmdline_credentials();
our_bind_info28 = &ctx->admin.drsuapi.our_bind_info28;
our_bind_info28->supported_extensions = 0xFFFFFFFF;
ctx->admin.drsuapi.req.out.bind_handle = &ctx->admin.drsuapi.bind_handle;
/* ctx->new_dc ...*/
- ctx->new_dc.credentials = cmdline_credentials;
+ ctx->new_dc.credentials = popt_get_cmdline_credentials();
our_bind_info28 = &ctx->new_dc.drsuapi.our_bind_info28;
our_bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_BASE;
}
/* populate test suite context */
- ctx->creds = cmdline_credentials;
+ ctx->creds = popt_get_cmdline_credentials();
ctx->dsa_bind.server_binding = server_binding;
ctx->ldap_url = talloc_asprintf(ctx, "ldap://%s",
int expected_principal_flags;
char *got_principal_string;
char *assertion_message;
- const char *password = cli_credentials_get_password(cmdline_credentials);
+ const char *password = cli_credentials_get_password(
+ popt_get_cmdline_credentials());
krb5_context k5_context;
struct torture_krb5_context *test_context;
bool ok;
torture_assert_int_equal(tctx, k5ret, 0, assertion_message);
client_to_server = data_blob_const(enc_ticket.data, enc_ticket.length);
torture_assert(tctx,
- test_accept_ticket(tctx, cmdline_credentials,
+ test_accept_ticket(tctx,
+ popt_get_cmdline_credentials(),
expected_unparse_principal_string,
client_to_server),
"test_accept_ticket failed - failed to accept the ticket we just created");
test_data->test_name = name;
test_data->real_realm
- = strupper_talloc(test_data, cli_credentials_get_realm(cmdline_credentials));
- test_data->real_domain = cli_credentials_get_domain(cmdline_credentials);
- test_data->username = cli_credentials_get_username(cmdline_credentials);
- test_data->real_username = cli_credentials_get_username(cmdline_credentials);
+ = strupper_talloc(test_data,
+ cli_credentials_get_realm(
+ popt_get_cmdline_credentials()));
+ test_data->real_domain = cli_credentials_get_domain(
+ popt_get_cmdline_credentials());
+ test_data->username = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
+ test_data->real_username = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
test_data->canonicalize = (i & TEST_CANONICALIZE) != 0;
test_data->enterprise = (i & TEST_ENTERPRISE) != 0;
test_data->upper_realm = (i & TEST_UPPER_REALM) != 0;
static bool torture_krb5_as_req_cmdline(struct torture_context *tctx)
{
- return torture_krb5_as_req_creds(tctx, cmdline_credentials, TORTURE_KRB5_TEST_PLAIN);
+ return torture_krb5_as_req_creds(tctx, popt_get_cmdline_credentials(),
+ TORTURE_KRB5_TEST_PLAIN);
}
static bool torture_krb5_as_req_pac_request(struct torture_context *tctx)
if (torture_setting_bool(tctx, "expect_rodc", false)) {
torture_skip(tctx, "This test needs further investigation in the RODC case against a Windows DC, in particular with non-cached users");
}
- return torture_krb5_as_req_creds(tctx, cmdline_credentials, TORTURE_KRB5_TEST_PAC_REQUEST);
+ return torture_krb5_as_req_creds(tctx, popt_get_cmdline_credentials(),
+ TORTURE_KRB5_TEST_PAC_REQUEST);
}
static bool torture_krb5_as_req_break_pw(struct torture_context *tctx)
{
- return torture_krb5_as_req_creds(tctx, cmdline_credentials, TORTURE_KRB5_TEST_BREAK_PW);
+ return torture_krb5_as_req_creds(tctx, popt_get_cmdline_credentials(),
+ TORTURE_KRB5_TEST_BREAK_PW);
}
static bool torture_krb5_as_req_clock_skew(struct torture_context *tctx)
{
- return torture_krb5_as_req_creds(tctx, cmdline_credentials, TORTURE_KRB5_TEST_CLOCK_SKEW);
+ return torture_krb5_as_req_creds(tctx, popt_get_cmdline_credentials(),
+ TORTURE_KRB5_TEST_CLOCK_SKEW);
}
static bool torture_krb5_as_req_aes(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_AES);
}
static bool torture_krb5_as_req_rc4(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_RC4);
}
static bool torture_krb5_as_req_aes_rc4(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_AES_RC4);
}
static bool torture_krb5_as_req_cmdline(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_PLAIN);
}
"RODC case against a Windows DC, in particular "
"with non-cached users");
}
- return torture_krb5_as_req_creds(tctx, cmdline_credentials, TORTURE_KRB5_TEST_PAC_REQUEST);
+ return torture_krb5_as_req_creds(tctx, popt_get_cmdline_credentials(),
+ TORTURE_KRB5_TEST_PAC_REQUEST);
}
#endif /* HAVE_KRB5_GET_INIT_CREDS_OPT_SET_PAC_REQUEST */
static bool torture_krb5_as_req_break_pw(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_BREAK_PW);
}
static bool torture_krb5_as_req_clock_skew(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_CLOCK_SKEW);
}
static bool torture_krb5_as_req_aes(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_AES);
}
static bool torture_krb5_as_req_rc4(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_RC4);
}
static bool torture_krb5_as_req_aes_rc4(struct torture_context *tctx)
{
return torture_krb5_as_req_creds(tctx,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
TORTURE_KRB5_TEST_AES_RC4);
}
}
ldb = ldb_wrap_connect(mem_ctx, tctx->ev, tctx->lp_ctx, url,
- NULL, cmdline_credentials, 0);
+ NULL, popt_get_cmdline_credentials(), 0);
/* "partitions[i]" are the partitions for which we search the parents */
for (i = 1; partitions[i] != NULL; i++) {
ret = false;
}
- if (!test_bind_sasl(torture, conn, cmdline_credentials)) {
+ if (!test_bind_sasl(torture, conn, popt_get_cmdline_credentials())) {
ret = false;
}
ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
torture_assert(torture, ldb, "Failed to make LDB connection to target");
torture_comment(tctx, "Connecting to: %s\n", url);
sctx->ldb = ldb_wrap_connect(sctx, tctx->ev, tctx->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
torture_assert(tctx, sctx->ldb, "Failed to create ldb connection");
ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
if (!ldb) goto failed;
ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
if (!ldb) goto failed;
torture_assert(torture, s, "libnet_vampire_cb_state_init");
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
ZERO_STRUCT(b);
b.in.domain_dns_name = torture_join_dom_dns_name(tj);
return false;
}
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
ZERO_STRUCT(r);
r.in.type = DOMAIN_LSA;
goto done;
}
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
mem_ctx = talloc_init("torture_domain_close_lsa");
status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc,
- cmdline_credentials, torture->ev, torture->lp_ctx);
+ popt_get_cmdline_credentials(),
+ torture->ev, torture->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
torture_comment(torture, "failed to connect to server: %s\n", nt_errstr(status));
ret = false;
mem_ctx = talloc_init("test_domainopen_lsa");
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
/* we're accessing domain controller so the domain name should be
passed (it's going to be resolved to dc name and address) instead
goto done;
}
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
mem_ctx = talloc_init("torture_domain_close_samr");
status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr,
goto done;
}
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
mem_ctx = talloc_init("torture_domain_close_samr");
int i;
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
domain_name.string = lpcfg_workgroup(torture->lp_ctx);
mem_ctx = talloc_init("torture group list");
mem_ctx = talloc_init("test_creategroup");
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
req.in.group_name = TEST_GROUPNAME;
req.in.domain_name = lpcfg_workgroup(torture->lp_ctx);
mem_ctx = talloc_init("test_lookup");
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
lookup.in.hostname = torture_setting_string(torture, "host", NULL);
if (lookup.in.hostname == NULL) {
mem_ctx = talloc_init("test_lookup_host");
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
lookup.in.hostname = torture_setting_string(torture, "host", NULL);
if (lookup.in.hostname == NULL) {
mem_ctx = talloc_init("test_lookup_pdc");
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
talloc_steal(ctx, mem_ctx);
bool ret = true;
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
mem_ctx = talloc_init("torture lookup sam name");
if (mem_ctx == NULL) return false;
struct libnet_context *ctx;
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
torture_comment(torture, "Testing connection to LSA interface\n");
goto done;
}
- libnetctx->cred = cmdline_credentials;
+ libnetctx->cred = popt_get_cmdline_credentials();
torture_comment(torture, "Testing libnet_ListShare\n");
torture_assert_ntstatus_ok(torture, status, "Failed to get binding");
libnetctx = libnet_context_init(torture->ev, torture->lp_ctx);
- libnetctx->cred = cmdline_credentials;
+ libnetctx->cred = popt_get_cmdline_credentials();
status = torture_rpc_connection(torture,
&p,
int i;
ctx = libnet_context_init(torture->ev, torture->lp_ctx);
- ctx->cred = cmdline_credentials;
+ ctx->cred = popt_get_cmdline_credentials();
domain_name.string = lpcfg_workgroup(torture->lp_ctx);
mem_ctx = talloc_init("torture user list");
ldb = ldb_wrap_connect(tmp_ctx,
tctx->ev, tctx->lp_ctx,
- url, NULL, cmdline_credentials, 0);
+ url, NULL, popt_get_cmdline_credentials(), 0);
torture_assert_goto(tctx, ldb != NULL, test_res, done, "Failed to make LDB connection");
ldb_ret = ldb_search(ldb, tmp_ctx, &ldb_res,
torture_assert(tctx, net_ctx != NULL, "Failed to create libnet_context");
/* Use command line credentials for testing */
- net_ctx->cred = cmdline_credentials;
+ net_ctx->cred = popt_get_cmdline_credentials();
if (rpc_connect) {
/* connect SAMR pipe */
}
libnetapi_set_username(ctx,
- cli_credentials_get_username(cmdline_credentials));
+ cli_credentials_get_username(popt_get_cmdline_credentials()));
libnetapi_set_password(ctx,
- cli_credentials_get_password(cmdline_credentials));
+ cli_credentials_get_password(popt_get_cmdline_credentials()));
*ctx_p = ctx;
/* yes, libsmbclient API frees the username when freeing the context, so
* have to pass malloced data here */
- smbc_setUser(ctx, strdup(cli_credentials_get_username(cmdline_credentials)));
+ smbc_setUser(ctx, strdup(cli_credentials_get_username(
+ popt_get_cmdline_credentials())));
*ctx_p = ctx;
*share = 0;
share++;
- cli_credentials_set_workstation(cmdline_credentials, "masktest", CRED_SPECIFIED);
+ cli_credentials_set_workstation(popt_get_cmdline_credentials(),
+ "masktest", CRED_SPECIFIED);
status = smbcli_full_connection(NULL, &c,
server,
ports,
share, NULL,
socket_options,
- cmdline_credentials, resolve_ctx, ev,
+ popt_get_cmdline_credentials(),
+ resolve_ctx, ev,
options, session_options,
gensec_settings);
io2.in.service_type = "A:";
io2.in.socket_options = lpcfg_socket_options(tctx->lp_ctx);
- io2.in.credentials = cmdline_credentials;
+ io2.in.credentials = popt_get_cmdline_credentials();
io2.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
io2.in.filename = fname;
lpcfg_smbcli_options(tctx->lp_ctx, &io2.in.options);
io1.in.called_name = torture_setting_string(tctx, "host", NULL);
io1.in.service = torture_setting_string(tctx, "share", NULL);
io1.in.service_type = "A:";
- io1.in.credentials = cmdline_credentials;
+ io1.in.credentials = popt_get_cmdline_credentials();
io1.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
io1.in.level = RAW_QFS_OBJECTID_INFORMATION;
io1.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx);
setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setup.in.credentials = cmdline_credentials;
+ setup.in.credentials = popt_get_cmdline_credentials();
setup.in.gensec_settings = gensec_settings;
status = smb_composite_sesssetup(session, &setup);
setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setup.in.credentials = cmdline_credentials;
+ setup.in.credentials = popt_get_cmdline_credentials();
torture_comment(tctx, "vuid1=%d vuid2=%d vuid3=%d\n", cli->session->vuid, session->vuid, vuid3);
setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setup.in.credentials = cmdline_credentials;
+ setup.in.credentials = popt_get_cmdline_credentials();
status = smb_composite_sesssetup(session3, &setup);
if (!NT_STATUS_EQUAL(status, NT_STATUS_LOGON_FAILURE)) {
setups[i].in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
setups[i].in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setups[i].in.credentials = cmdline_credentials;
+ setups[i].in.credentials = popt_get_cmdline_credentials();
setups[i].in.gensec_settings = gensec_settings;
sessions[i] = smbcli_session_init(cli->transport, tctx, false, options);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setup.in.credentials = cmdline_credentials;
+ setup.in.credentials = popt_get_cmdline_credentials();
setup.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx);
status = smb_composite_sesssetup(session1, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setup.in.credentials = cmdline_credentials;
+ setup.in.credentials = popt_get_cmdline_credentials();
setup.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx);
status = smb_composite_sesssetup(session2, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setup.in.credentials = cmdline_credentials;
+ setup.in.credentials = popt_get_cmdline_credentials();
setup.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx);
status = smb_composite_sesssetup(session, &setup);
setup.in.sesskey = cli->transport->negotiate.sesskey;
setup.in.capabilities = cli->transport->negotiate.capabilities;
setup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
- setup.in.credentials = cmdline_credentials;
+ setup.in.credentials = popt_get_cmdline_credentials();
setup.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx);
status = smb_composite_sesssetup(session, &setup);
CHECK_STATUS(status, NT_STATUS_OK);
io->in.called_name = state->called_name;
io->in.service = share;
io->in.service_type = state->service_type;
- io->in.credentials = cmdline_credentials;
+ io->in.credentials = popt_get_cmdline_credentials();
io->in.fallback_to_anonymous = false;
io->in.workgroup = lpcfg_workgroup(state->tctx->lp_ctx);
lpcfg_smbcli_options(state->tctx->lp_ctx, &io->in.options);
io->in.called_name = state->called_name;
io->in.service = share;
io->in.service_type = state->service_type;
- io->in.credentials = cmdline_credentials;
+ io->in.credentials = popt_get_cmdline_credentials();
io->in.fallback_to_anonymous = false;
io->in.workgroup = lpcfg_workgroup(state->tctx->lp_ctx);
io->in.gensec_settings = lpcfg_gensec_settings(state->mem_ctx, state->tctx->lp_ctx);
torture_setting_string(tctx, "host", NULL),
lpcfg_smb_ports(tctx->lp_ctx),
torture_setting_string(tctx, "share", NULL),
- NULL, lpcfg_socket_options(tctx->lp_ctx), cmdline_credentials,
+ NULL, lpcfg_socket_options(tctx->lp_ctx),
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(tctx->lp_ctx),
tctx->ev, &options, &session_options,
lpcfg_gensec_settings(tctx, tctx->lp_ctx));
ZERO_STRUCT(io);
io.in.sesskey = cli->transport->negotiate.sesskey;
io.in.capabilities = cli->transport->negotiate.capabilities;
- io.in.credentials = cmdline_credentials;
+ io.in.credentials = popt_get_cmdline_credentials();
io.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
io.in.gensec_settings = lpcfg_gensec_settings(tctx, tctx->lp_ctx);
status = smb_composite_sesssetup(cli->session, &io);
ZERO_STRUCT(io_sesssetup);
io_sesssetup.in.sesskey = cli->transport->negotiate.sesskey;
io_sesssetup.in.capabilities = cli->transport->negotiate.capabilities;
- io_sesssetup.in.credentials = cmdline_credentials;
+ io_sesssetup.in.credentials = popt_get_cmdline_credentials();
io_sesssetup.in.workgroup = lpcfg_workgroup(tctx->lp_ctx);
io_sesssetup.in.gensec_settings = lpcfg_gensec_settings(
tctx, tctx->lp_ctx);
struct smbcli_session_options session_options;
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
struct smbcli_state *cli = NULL;
enum credentials_use_kerberos use_kerberos;
char fname[256];
status = smbcli_full_connection(NULL, &cli,
host, lpcfg_smb_ports(tctx->lp_ctx), share,
- NULL, lpcfg_socket_options(tctx->lp_ctx), cmdline_credentials,
+ NULL, lpcfg_socket_options(tctx->lp_ctx),
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(tctx->lp_ctx),
tctx->ev, &options, &session_options,
lpcfg_gensec_settings(tctx, tctx->lp_ctx));
if (table == NULL) return false;
/* credentials */
- creds = cmdline_credentials;
+ creds = popt_get_cmdline_credentials();
/* send bind requests */
for (i = 0; i < torture_numasync; i++) {
struct dcerpc_pipe *p2;
struct dcerpc_binding_handle *b;
- const char *domain = cli_credentials_get_domain(cmdline_credentials);
+ const char *domain = cli_credentials_get_domain(
+ popt_get_cmdline_credentials());
torture_assert_ntstatus_ok(tctx,
torture_rpc_connection(tctx, &p2, &ndr_table_lsarpc),
/* we take a fake user*/
user = "guest";
} else {
- user = cli_credentials_get_username(cmdline_credentials);
+ user = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
}
torture_assert_ntstatus_ok(tctx,
dcerpc_pipe_connect_b(tctx, &lsa_p,
lsa_binding, &ndr_table_lsarpc,
- cmdline_credentials, tctx->ev, tctx->lp_ctx),
+ popt_get_cmdline_credentials(),
+ tctx->ev, tctx->lp_ctx),
"Opening LSA pipe");
lsa_b = lsa_p->binding_handle;
"decrypted data is not correct");
/* Not strictly correct all the time, but good enough for this test */
- caller_sid = get_user_sid(tctx, tctx, cli_credentials_get_username(cmdline_credentials));
+ caller_sid = get_user_sid(tctx, tctx,
+ cli_credentials_get_username(
+ popt_get_cmdline_credentials()));
torture_assert_sid_equal(tctx, &rc4payload.sid, caller_sid, "Secret saved with wrong SID");
struct dcerpc_pipe *p2;
struct dcerpc_binding_handle *b;
- const char *domain = cli_credentials_get_domain(cmdline_credentials);
+ const char *domain = cli_credentials_get_domain(
+ popt_get_cmdline_credentials());
torture_assert_ntstatus_ok(tctx,
torture_rpc_connection(tctx, &p2, &ndr_table_lsarpc),
/* we take a fake user*/
user = "guest";
} else {
- user = cli_credentials_get_username(cmdline_credentials);
+ user = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
}
torture_assert_ntstatus_ok(tctx,
dcerpc_pipe_connect_b(tctx, &lsa_p,
lsa_binding, &ndr_table_lsarpc,
- cmdline_credentials, tctx->ev, tctx->lp_ctx),
+ popt_get_cmdline_credentials(),
+ tctx->ev, tctx->lp_ctx),
"Opening LSA pipe");
lsa_b = lsa_p->binding_handle;
"decrypted data is not correct");
/* Not strictly correct all the time, but good enough for this test */
- caller_sid = get_user_sid(tctx, tctx, cli_credentials_get_username(cmdline_credentials));
+ caller_sid = get_user_sid(tctx, tctx,
+ cli_credentials_get_username(
+ popt_get_cmdline_credentials()));
torture_assert_sid_equal(tctx, &rc4payload.sid, caller_sid, "Secret saved with wrong SID");
torture_assert_ntstatus_ok(tctx,
dcerpc_pipe_connect_b(tctx, &p, binding,
&ndr_table_lsarpc,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
tctx->ev,
tctx->lp_ctx),
"failed to connect pipe");
return false;
}
- libnetctx->cred = cmdline_credentials;
+ libnetctx->cred = popt_get_cmdline_credentials();
i.name = sharename;
i.type = STYPE_DISKTREE;
return false;
}
- libnetctx->cred = cmdline_credentials;
+ libnetctx->cred = popt_get_cmdline_credentials();
r.in.share_name = sharename;
r.in.server_name = host;
}
/* ctx->admin ...*/
- ctx->admin.credentials = cmdline_credentials;
+ ctx->admin.credentials = popt_get_cmdline_credentials();
our_bind_info28 = &ctx->admin.drsuapi.our_bind_info28;
our_bind_info28->supported_extensions = 0xFFFFFFFF;
#include "librpc/gen_ndr/ndr_security.h"
#include "librpc/gen_ndr/ndr_srvsvc_c.h"
#include "librpc/gen_ndr/ndr_fsrvp_c.h"
+#include "lib/cmdline/popt_common.h"
#define FSHARE "fsrvp_share"
#define FNAME "testfss.dat"
TALLOC_CTX *tmp_ctx = talloc_new(tctx);
char *share_unc = talloc_asprintf(tmp_ctx, "\\\\%s\\%s",
dcerpc_server_name(p), FSHARE);
- extern struct cli_credentials *cmdline_credentials;
struct smb2_tree *tree_base;
struct smb2_tree *tree_snap;
struct smbcli_options options;
lpcfg_smb_ports(tctx->lp_ctx),
FSHARE,
lpcfg_resolve_context(tctx->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree_base,
tctx->ev,
&options,
lpcfg_smb_ports(tctx->lp_ctx),
sc_map->ShadowCopyShareName,
lpcfg_resolve_context(tctx->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree_snap,
tctx->ev,
&options,
TALLOC_CTX *tmp_ctx = talloc_new(tctx);
char *share_unc = talloc_asprintf(tmp_ctx, "\\\\%s\\%s\\",
dcerpc_server_name(p), FSHARE);
- extern struct cli_credentials *cmdline_credentials;
struct smb2_tree *tree_base;
struct smbcli_options options;
struct smb2_handle base_fh;
lpcfg_smb_ports(tctx->lp_ctx),
FSHARE,
lpcfg_resolve_context(tctx->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree_base,
tctx->ev,
&options,
struct torture_rpc_tcase *tcase = talloc_get_type(
tctx->active_tcase, struct torture_rpc_tcase);
struct torture_rpc_tcase_data *tcase_data;
- extern struct cli_credentials *cmdline_credentials;
*data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
- tcase_data->credentials = cmdline_credentials;
+ tcase_data->credentials = popt_get_cmdline_credentials();
status = torture_rpc_connection(tctx,
&(tcase_data->pipe),
struct dcerpc_binding_handle *b = p->binding_handle;
r.in.server_name = NULL;
- r.in.account_name = cli_credentials_get_username(cmdline_credentials);
+ r.in.account_name = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
r.in.workstation = TEST_MACHINE_NAME;
r.out.info = &info;
struct dcerpc_binding_handle *b = p->binding_handle;
r.in.server_name = NULL;
- r.in.account_name = cli_credentials_get_username(cmdline_credentials);
+ r.in.account_name = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
r.in.workstation = TEST_MACHINE_NAME;
r.out.info = &info;
flags |= CLI_CRED_NTLMv2_AUTH;
}
- cli_credentials_get_ntlm_username_domain(cmdline_credentials, tctx,
+ cli_credentials_get_ntlm_username_domain(popt_get_cmdline_credentials(),
+ tctx,
&ninfo.identity_info.account_name.string,
&ninfo.identity_info.domain_name.string);
names_blob = NTLMv2_generate_names_blob(tctx, cli_credentials_get_workstation(credentials),
cli_credentials_get_domain(credentials));
- status = cli_credentials_get_ntlm_response(cmdline_credentials, tctx,
- &flags,
- chal,
- NULL, /* server_timestamp */
- names_blob,
- &lm_resp, &nt_resp,
- NULL, NULL);
+ status = cli_credentials_get_ntlm_response(
+ popt_get_cmdline_credentials(), tctx,
+ &flags,
+ chal,
+ NULL, /* server_timestamp */
+ names_blob,
+ &lm_resp, &nt_resp,
+ NULL, NULL);
torture_assert_ntstatus_ok(tctx, status, "cli_credentials_get_ntlm_response failed");
ninfo.lm.data = lm_resp.data;
url = talloc_asprintf(tctx, "ldap://%s", dcerpc_server_name(p));
sam_ctx = ldb_wrap_connect(tctx, tctx->ev, tctx->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
torture_assert(tctx, sam_ctx, "Connection to the SAMDB on DC failed!");
url = talloc_asprintf(tctx, "ldap://%s", dcerpc_server_name(p));
sam_ctx = ldb_wrap_connect(tctx, tctx->ev, tctx->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
torture_assert(tctx, sam_ctx, "Connection to the SAMDB on DC failed!");
url = talloc_asprintf(tctx, "ldap://%s", dcerpc_server_name(p));
sam_ctx = ldb_wrap_connect(tctx, tctx->ev, tctx->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
torture_assert(tctx, sam_ctx, "Connection to the SAMDB on DC failed!");
url = talloc_asprintf(tctx, "ldap://%s", dcerpc_server_name(p));
sam_ctx = ldb_wrap_connect(tctx, tctx->ev, tctx->lp_ctx, url,
NULL,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0);
torture_assert(tctx, sam_ctx, "Connection to the SAMDB on DC failed!");
* we will get a new clean memory cache.
*/
client_creds = cli_credentials_shallow_copy(tmp_ctx,
- cmdline_credentials);
+ popt_get_cmdline_credentials());
torture_assert(tctx, client_creds, "Failed to copy of credentials");
if (!pkinit_in_use) {
/* Invalidate the gss creds container to allocate a new MEMORY ccache */
struct smb_krb5_context *smb_krb5_context;
krb5_error_code ret;
- ret = cli_credentials_get_krb5_context(cmdline_credentials, tctx->lp_ctx, &smb_krb5_context);
+ ret = cli_credentials_get_krb5_context(popt_get_cmdline_credentials(),
+ tctx->lp_ctx, &smb_krb5_context);
torture_assert_int_equal(tctx, ret, 0, "cli_credentials_get_krb5_context() failed");
if (smb_krb5_get_allowed_weak_crypto(smb_krb5_context->krb5_context) == FALSE) {
* we will get a new clean memory cache.
*/
client_creds = cli_credentials_shallow_copy(tmp_ctx,
- cmdline_credentials);
+ popt_get_cmdline_credentials());
torture_assert(tctx, client_creds, "Failed to copy of credentials");
server_creds = cli_credentials_shallow_copy(tmp_ctx,
status = dcerpc_pipe_connect_b(tctx,
p, binding, table,
- cmdline_credentials, tctx->ev, tctx->lp_ctx);
+ popt_get_cmdline_credentials(),
+ tctx->ev, tctx->lp_ctx);
if (NT_STATUS_IS_ERR(status)) {
torture_warning(tctx, "Failed to connect to remote server: %s %s\n",
}
status = dcerpc_pipe_connect_b(tctx, p, binding, table,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
tctx->ev, tctx->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
*p = NULL;
return false;
*data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
- tcase_data->credentials = cmdline_credentials;
+ tcase_data->credentials = popt_get_cmdline_credentials();
tcase_data->join_ctx = torture_join_domain(tctx, tcase->machine_name,
ACB_WSTRUST,
&tcase_data->credentials);
return false;
*data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
- tcase_data->credentials = cmdline_credentials;
+ tcase_data->credentials = popt_get_cmdline_credentials();
tcase_data->join_ctx = torture_join_domain(tctx, tcase->machine_name,
ACB_SVRTRUST,
&tcase_data->credentials);
struct torture_rpc_tcase_data *tcase_data;
*data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data);
- tcase_data->credentials = cmdline_credentials;
+ tcase_data->credentials = popt_get_cmdline_credentials();
status = torture_rpc_connection(tctx,
&(tcase_data->pipe),
lpcfg_smb_ports(torture->lp_ctx),
"IPC$", NULL,
lpcfg_socket_options(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(torture->lp_ctx),
torture->ev, &options, &session_options,
lpcfg_gensec_settings(torture, torture->lp_ctx));
lpcfg_smb_ports(torture->lp_ctx),
"IPC$", NULL,
lpcfg_socket_options(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(torture->lp_ctx),
torture->ev, &options, &session_options,
lpcfg_gensec_settings(torture, torture->lp_ctx));
ret = true;
- ret &= bindtest(torture, cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP,
+ ret &= bindtest(torture, cli, popt_get_cmdline_credentials(),
+ DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_INTEGRITY);
- ret &= bindtest(torture, cli, cmdline_credentials, DCERPC_AUTH_TYPE_NTLMSSP,
+ ret &= bindtest(torture, cli, popt_get_cmdline_credentials(),
+ DCERPC_AUTH_TYPE_NTLMSSP,
DCERPC_AUTH_LEVEL_PRIVACY);
- ret &= bindtest(torture, cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO,
+ ret &= bindtest(torture, cli, popt_get_cmdline_credentials(),
+ DCERPC_AUTH_TYPE_SPNEGO,
DCERPC_AUTH_LEVEL_INTEGRITY);
- ret &= bindtest(torture, cli, cmdline_credentials, DCERPC_AUTH_TYPE_SPNEGO,
+ ret &= bindtest(torture, cli, popt_get_cmdline_credentials(),
+ DCERPC_AUTH_TYPE_SPNEGO,
DCERPC_AUTH_LEVEL_PRIVACY);
done:
lpcfg_smb_ports(torture->lp_ctx),
"IPC$", NULL,
lpcfg_socket_options(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(torture->lp_ctx),
torture->ev, &options, &session_options,
lpcfg_gensec_settings(torture, torture->lp_ctx));
"join failed");
cli_credentials_set_domain(
- cmdline_credentials, cli_credentials_get_domain(wks_creds),
+ popt_get_cmdline_credentials(),
+ cli_credentials_get_domain(wks_creds),
CRED_SPECIFIED);
for (i=0; i<2; i++) {
for (j=0; j<2; j++) {
torture_assert(torture,
- schan(torture, cli, wks_creds, cmdline_credentials),
+ schan(torture, cli, wks_creds,
+ popt_get_cmdline_credentials()),
"schan failed");
}
}
"join failed");
cli_credentials_set_domain(
- cmdline_credentials, cli_credentials_get_domain(wks_creds),
+ popt_get_cmdline_credentials(),
+ cli_credentials_get_domain(wks_creds),
CRED_SPECIFIED);
torture_assert(tctx,
}
torture_assert(torture,
- test_join3(torture, false, cmdline_credentials, NULL, wks_name),
+ test_join3(torture, false, popt_get_cmdline_credentials(),
+ NULL, wks_name),
"join using anonymous bind on an authenticated smb connection failed");
/*
*/
torture_assert(torture,
- test_join3(torture, true, cmdline_credentials, NULL, wks_name),
+ test_join3(torture, true, popt_get_cmdline_credentials(),
+ NULL, wks_name),
"join using anonymous bind on an authenticated smb connection failed");
return true;
status = smbcli_full_connection(
torture, &cli, torture_setting_string(torture, "host", NULL),
lpcfg_smb_ports(torture->lp_ctx),
- "IPC$", NULL, lpcfg_socket_options(torture->lp_ctx), cmdline_credentials,
+ "IPC$", NULL, lpcfg_socket_options(torture->lp_ctx),
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(torture->lp_ctx), torture->ev, &options,
&session_options, lpcfg_gensec_settings(torture, torture->lp_ctx));
torture_assert_ntstatus_ok(torture, status, "smbcli_full_connection failed\n");
ZERO_STRUCT(userlevel1);
userlevel1.client = talloc_asprintf(
torture, "\\\\%s", lpcfg_netbios_name(torture->lp_ctx));
- userlevel1.user = cli_credentials_get_username(cmdline_credentials);
+ userlevel1.user = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
userlevel1.build = 2600;
userlevel1.major = 3;
userlevel1.minor = 0;
lpcfg_smb_ports(torture->lp_ctx),
"IPC$", NULL,
lpcfg_socket_options(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(torture->lp_ctx),
torture->ev, &options, &session_options,
lpcfg_gensec_settings(torture, torture->lp_ctx));
ZERO_STRUCT(io);
io.in.sesskey = cli->transport->negotiate.sesskey;
io.in.capabilities = cli->transport->negotiate.capabilities;
- io.in.credentials = cmdline_credentials;
+ io.in.credentials = popt_get_cmdline_credentials();
io.in.workgroup = lpcfg_workgroup(torture->lp_ctx);
io.in.gensec_settings = lpcfg_gensec_settings(torture, torture->lp_ctx);
lpcfg_smb_ports(torture->lp_ctx),
"IPC$", NULL,
lpcfg_socket_options(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(torture->lp_ctx),
torture->ev, &options, &session_options,
lpcfg_gensec_settings(torture, torture->lp_ctx));
ZERO_STRUCT(io);
io.in.sesskey = cli->transport->negotiate.sesskey;
io.in.capabilities = cli->transport->negotiate.capabilities;
- io.in.credentials = cmdline_credentials;
+ io.in.credentials = popt_get_cmdline_credentials();
io.in.workgroup = lpcfg_workgroup(torture->lp_ctx);
io.in.gensec_settings = lpcfg_gensec_settings(torture, torture->lp_ctx);
lpcfg_smb_ports(torture->lp_ctx),
"IPC$",
lpcfg_resolve_context(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree,
torture->ev,
&options,
/* smb re-auth again to the original user */
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(torture, status, ret, done,
"session reauth to anon failed");
lpcfg_smb_ports(torture->lp_ctx),
"IPC$",
lpcfg_resolve_context(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree,
torture->ev,
&options,
/* smb re-auth again to the original user */
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(torture, status, ret, done,
"session reauth to anon failed");
lpcfg_smb_ports(torture->lp_ctx),
"IPC$", NULL,
lpcfg_socket_options(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(torture->lp_ctx),
torture->ev, &options, &session_options,
lpcfg_gensec_settings(torture, torture->lp_ctx));
lpcfg_smb_ports(torture->lp_ctx),
"IPC$",
lpcfg_resolve_context(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree,
torture->ev,
&options,
lpcfg_smb_ports(torture->lp_ctx),
"IPC$",
lpcfg_resolve_context(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree,
torture->ev,
&options,
lpcfg_smb_ports(torture->lp_ctx),
"IPC$",
lpcfg_resolve_context(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree,
torture->ev,
&options,
lpcfg_smb_ports(torture->lp_ctx),
"IPC$",
lpcfg_resolve_context(torture->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
&tree,
torture->ev,
&options,
} usercreds[] = {
{
.comment = "domain\\user",
- .domain = cli_credentials_get_domain(cmdline_credentials),
- .username = cli_credentials_get_username(cmdline_credentials),
- .password = cli_credentials_get_password(cmdline_credentials),
+ .domain = cli_credentials_get_domain(
+ popt_get_cmdline_credentials()),
+ .username = cli_credentials_get_username(
+ popt_get_cmdline_credentials()),
+ .password = cli_credentials_get_password(
+ popt_get_cmdline_credentials()),
.network_login = true,
.expected_interactive_error = NT_STATUS_OK,
.expected_network_error = NT_STATUS_OK
},
{
.comment = "realm\\user",
- .domain = cli_credentials_get_realm(cmdline_credentials),
- .username = cli_credentials_get_username(cmdline_credentials),
- .password = cli_credentials_get_password(cmdline_credentials),
+ .domain = cli_credentials_get_realm(
+ popt_get_cmdline_credentials()),
+ .username = cli_credentials_get_username(
+ popt_get_cmdline_credentials()),
+ .password = cli_credentials_get_password(
+ popt_get_cmdline_credentials()),
.network_login = true,
.expected_interactive_error = NT_STATUS_OK,
.expected_network_error = NT_STATUS_OK
.comment = "user@domain",
.domain = NULL,
.username = talloc_asprintf(mem_ctx,
- "%s@%s",
- cli_credentials_get_username(cmdline_credentials),
- cli_credentials_get_domain(cmdline_credentials)
+ "%s@%s",
+ cli_credentials_get_username(
+ popt_get_cmdline_credentials()),
+ cli_credentials_get_domain(
+ popt_get_cmdline_credentials())
),
- .password = cli_credentials_get_password(cmdline_credentials),
+ .password = cli_credentials_get_password(
+ popt_get_cmdline_credentials()),
.network_login = false, /* works for some things, but not NTLMv2. Odd */
.expected_interactive_error = NT_STATUS_OK,
.expected_network_error = NT_STATUS_OK
.comment = "user@realm",
.domain = NULL,
.username = talloc_asprintf(mem_ctx,
- "%s@%s",
- cli_credentials_get_username(cmdline_credentials),
- cli_credentials_get_realm(cmdline_credentials)
+ "%s@%s",
+ cli_credentials_get_username(
+ popt_get_cmdline_credentials()),
+ cli_credentials_get_realm(
+ popt_get_cmdline_credentials())
),
- .password = cli_credentials_get_password(cmdline_credentials),
+ .password = cli_credentials_get_password(
+ popt_get_cmdline_credentials()),
.network_login = true,
.expected_interactive_error = NT_STATUS_OK,
.expected_network_error = NT_STATUS_OK
flags |= CLI_CRED_NTLMv2_AUTH;
}
- cli_credentials_get_ntlm_username_domain(cmdline_credentials, tctx,
- &ninfo.identity_info.account_name.string,
- &ninfo.identity_info.domain_name.string);
+ cli_credentials_get_ntlm_username_domain(popt_get_cmdline_credentials(),
+ tctx,
+ &ninfo.identity_info.account_name.string,
+ &ninfo.identity_info.domain_name.string);
generate_random_buffer(ninfo.challenge,
sizeof(ninfo.challenge));
names_blob = NTLMv2_generate_names_blob(tctx, cli_credentials_get_workstation(credentials),
cli_credentials_get_domain(credentials));
- status = cli_credentials_get_ntlm_response(cmdline_credentials, tctx,
- &flags,
- chal,
- NULL, /* server_timestamp */
- names_blob,
- &lm_resp, &nt_resp,
- NULL, NULL);
+ status = cli_credentials_get_ntlm_response(
+ popt_get_cmdline_credentials(),
+ tctx,
+ &flags,
+ chal,
+ NULL, /* server_timestamp */
+ names_blob,
+ &lm_resp, &nt_resp,
+ NULL, NULL);
torture_assert_ntstatus_ok(tctx, status,
"cli_credentials_get_ntlm_response failed");
s->nprocs = torture_setting_int(torture, "nprocs", 4);
s->conns = talloc_zero_array(s, struct torture_schannel_bench_conn, s->nprocs);
- s->user1_creds = cli_credentials_shallow_copy(s, cmdline_credentials);
+ s->user1_creds = cli_credentials_shallow_copy(s,
+ popt_get_cmdline_credentials());
tmp = torture_setting_string(s->tctx, "extra_user1", NULL);
if (tmp) {
cli_credentials_parse_string(s->user1_creds, tmp, CRED_SPECIFIED);
}
- s->user2_creds = cli_credentials_shallow_copy(s, cmdline_credentials);
+ s->user2_creds = cli_credentials_shallow_copy(s,
+ popt_get_cmdline_credentials());
tmp = torture_setting_string(s->tctx, "extra_user2", NULL);
if (tmp) {
cli_credentials_parse_string(s->user1_creds, tmp, CRED_SPECIFIED);
status = dcerpc_pipe_connect_b(torture, &p, binding,
&ndr_table_lsarpc,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
torture->ev,
torture->lp_ctx);
struct smb2_tree *tree;
struct smb2_handle job_h;
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
struct smbcli_options options;
TALLOC_CTX *mem_ctx = talloc_new(tctx);
/*
lpcfg_smb_ports(tctx->lp_ctx),
share_name, NULL,
lpcfg_socket_options(tctx->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(tctx->lp_ctx),
tctx->ev,
&smb_options,
&join->p,
dc_binding,
&ndr_table_samr,
- cmdline_credentials, NULL, tctx->lp_ctx);
+ popt_get_cmdline_credentials(),
+ NULL, tctx->lp_ctx);
} else {
status = torture_rpc_connection(tctx,
tj->libnet_r = libnet_r;
- libnet_ctx->cred = cmdline_credentials;
+ libnet_ctx->cred = popt_get_cmdline_credentials();
libnet_r->in.binding = dcerpc_binding_string(libnet_r, binding);
if (libnet_r->in.binding == NULL) {
talloc_free(tj);
return NT_STATUS_NO_MEMORY;
}
- ldb_set_opaque(ldb_ctx, "credentials", cmdline_credentials);
+ ldb_set_opaque(ldb_ctx, "credentials", popt_get_cmdline_credentials());
ldb_set_opaque(ldb_ctx, "loadparm", cmdline_lp_ctx);
rtn = ldb_connect(ldb_ctx, remote_ldb_url, 0, NULL);
torture_assert_ntstatus_ok(tctx,
dcerpc_pipe_connect_b(tctx, &s->clusapi.p, binding,
&ndr_table_clusapi,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
tctx->ev, tctx->lp_ctx),
"failed to connect dcerpc pipe");
struct wkssvc_NetrWkstaUserGetInfo r;
union wkssvc_NetrWkstaUserInfo info;
const char *dom = lpcfg_workgroup(tctx->lp_ctx);
- struct cli_credentials *creds = cmdline_credentials;
+ struct cli_credentials *creds = popt_get_cmdline_credentials();
const char *user = cli_credentials_get_username(creds);
int i;
struct dcerpc_binding_handle *b = p->binding_handle;
{
NTSTATUS status;
struct wkssvc_NetrUnjoinDomain r;
- struct cli_credentials *creds = cmdline_credentials;
+ struct cli_credentials *creds = popt_get_cmdline_credentials();
const char *user = cli_credentials_get_username(creds);
const char *admin_account = NULL;
struct dcerpc_binding_handle *b = p->binding_handle;
{
NTSTATUS status;
struct wkssvc_NetrJoinDomain r;
- struct cli_credentials *creds = cmdline_credentials;
+ struct cli_credentials *creds = popt_get_cmdline_credentials();
const char *user = cli_credentials_get_username(creds);
const char *admin_account = NULL;
struct dcerpc_binding_handle *b = p->binding_handle;
* stops the credentials system prompting when we use the "auth"
* command to display the current auth parameters.
*/
- cli_credentials_set_password(cmdline_credentials, "", CRED_GUESS_ENV);
+ cli_credentials_set_password(popt_get_cmdline_credentials(),
+ "", CRED_GUESS_ENV);
while (1) {
cline = smb_readline("torture> ", NULL, NULL);
const char * password;
const char * principal;
- username = cli_credentials_get_username(cmdline_credentials);
- principal = cli_credentials_get_principal(cmdline_credentials, tctx);
- domain = cli_credentials_get_domain(cmdline_credentials);
- realm = cli_credentials_get_realm(cmdline_credentials);
- password = cli_credentials_get_password(cmdline_credentials);
+ username = cli_credentials_get_username(
+ popt_get_cmdline_credentials());
+ principal = cli_credentials_get_principal(
+ popt_get_cmdline_credentials(), tctx);
+ domain = cli_credentials_get_domain(popt_get_cmdline_credentials());
+ realm = cli_credentials_get_realm(popt_get_cmdline_credentials());
+ password = cli_credentials_get_password(
+ popt_get_cmdline_credentials());
printf("Username: %s\n", username ? username : "");
printf("User Principal: %s\n", principal ? principal : "");
if (!strcmp(argv[0], "username")) {
result = cli_credentials_set_username(
- cmdline_credentials, argv[1], CRED_SPECIFIED);
+ popt_get_cmdline_credentials(),
+ argv[1], CRED_SPECIFIED);
} else if (!strcmp(argv[0], "principal")) {
result = cli_credentials_set_principal(
- cmdline_credentials, argv[1], CRED_SPECIFIED);
+ popt_get_cmdline_credentials(),
+ argv[1], CRED_SPECIFIED);
} else if (!strcmp(argv[0], "domain")) {
result = cli_credentials_set_domain(
- cmdline_credentials, argv[1], CRED_SPECIFIED);
+ popt_get_cmdline_credentials(),
+ argv[1], CRED_SPECIFIED);
} else if (!strcmp(argv[0], "realm")) {
result = cli_credentials_set_realm(
- cmdline_credentials, argv[1], CRED_SPECIFIED);
+ popt_get_cmdline_credentials(),
+ argv[1], CRED_SPECIFIED);
} else if (!strcmp(argv[0], "password")) {
result = cli_credentials_set_password(
- cmdline_credentials, argv[1], CRED_SPECIFIED);
+ popt_get_cmdline_credentials(),
+ argv[1], CRED_SPECIFIED);
} else {
shell_usage(command);
return;
struct smbcli_options options;
NTSTATUS status;
const char *host = torture_setting_string(tctx, "host", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
lpcfg_smbcli_options(tctx->lp_ctx, &options);
NTSTATUS status;
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
struct smbcli_options options;
lpcfg_smbcli_options(tctx->lp_ctx, &options);
{
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
NTSTATUS status;
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_handle _h;
torture_assert(tctx, session1_2 != NULL, "smb2_session_channel failed");
status = smb2_session_setup_spnego(session1_2,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
CHECK_STATUS(status, NT_STATUS_OK);
{
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
NTSTATUS status;
TALLOC_CTX *mem_ctx = talloc_new(tctx);
struct smb2_handle _h1;
torture_assert(tctx, session1_2 != NULL, "smb2_session_channel failed");
status = smb2_session_setup_spnego(session1_2,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
CHECK_STATUS(status, NT_STATUS_OK);
struct smb2_tree *tree;
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
NTSTATUS status;
int opcode;
struct smb2_request *req;
"oplock_level incorrect");
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
"smb2_getinfo_file failed");
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
/* re-authenticate as original user again */
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
/* re-authenticate as original user - again */
status = smb2_session_setup_spnego(tree->session,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
NTSTATUS expected;
enum credentials_use_kerberos krb_state;
- krb_state = cli_credentials_get_kerberos_state(cmdline_credentials);
+ krb_state = cli_credentials_get_kerberos_state(
+ popt_get_cmdline_credentials());
if (krb_state == CRED_MUST_USE_KERBEROS) {
torture_skip(tctx,
"Can't test failing session setup with kerberos.");
*/
broken_creds = cli_credentials_shallow_copy(mem_ctx,
- cmdline_credentials);
+ popt_get_cmdline_credentials());
torture_assert(tctx, (broken_creds != NULL), "talloc error");
corrupted_password = talloc_asprintf(mem_ctx, "%s%s",
struct smbcli_options options;
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
struct smb2_tree *tree = NULL;
enum credentials_use_kerberos use_kerberos;
char fname[256];
{
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
NTSTATUS status;
TALLOC_CTX *mem_ctx = talloc_new(tctx);
char fname[256];
torture_assert(tctx, session1_2 != NULL, "smb2_session_channel failed");
status = smb2_session_setup_spnego(session1_2,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
torture_assert(tctx, session2_1 != NULL, "smb2_session_channel failed");
status = smb2_session_setup_spnego(session2_1,
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
0 /* previous_session_id */);
torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
"smb2_session_setup_spnego failed");
{
NTSTATUS status;
struct smb2_session *session;
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
session = smb2_session_init(transport,
lpcfg_gensec_settings(tctx, tctx->lp_ctx),
NTSTATUS status;
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, "share", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
status = smb2_connect_ext(tctx,
host,
NTSTATUS status;
const char *host = torture_setting_string(tctx, "host", NULL);
const char *share = torture_setting_string(tctx, soption, NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
lpcfg_smbcli_options(tctx->lp_ctx, &options);
status = smbcli_full_connection(tctx, &cli, host,
lpcfg_smb_ports(tctx->lp_ctx),
share, NULL, lpcfg_socket_options(tctx->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(tctx->lp_ctx),
tctx->ev, &options, &session_options,
lpcfg_gensec_settings(tctx, tctx->lp_ctx));
struct ldb_context *ldb;
const char *addc, *host;
- cli = connect_to_server(torture, cmdline_credentials);
+ cli = connect_to_server(torture, popt_get_cmdline_credentials());
torture_assert(torture, cli, "connecting to server with authenticated credentials");
/* Test basic authenticated mapping. */
bool guest = whoami.mapping_flags & SMB_WHOAMI_GUEST;
torture_comment(torture, "checking whether we were logged in as guest... %s\n",
guest ? "YES" : "NO");
- torture_assert(torture, cli_credentials_is_anonymous(cmdline_credentials) == guest,
+ torture_assert(torture,
+ cli_credentials_is_anonymous(
+ popt_get_cmdline_credentials()) == guest,
"login did not credentials map to guest");
} else {
torture_comment(torture, "server does not support SMB_WHOAMI_GUEST flag\n");
if (addc) {
ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, talloc_asprintf(torture, "ldap://%s", addc),
- NULL, cmdline_credentials, 0);
+ NULL, popt_get_cmdline_credentials(), 0);
torture_assert(torture, ldb, "ldb connect failed");
/* We skip this testing if we could not contact the LDAP server */
lpcfg_smb_ports(tctx->lp_ctx),
sharename, NULL,
lpcfg_socket_options(tctx->lp_ctx),
- cmdline_credentials,
+ popt_get_cmdline_credentials(),
lpcfg_resolve_context(tctx->lp_ctx),
ev, &options, &session_options,
lpcfg_gensec_settings(tctx, tctx->lp_ctx));
struct smbcli_options options;
NTSTATUS status;
const char *host = torture_setting_string(tctx, "host", NULL);
- struct cli_credentials *credentials = cmdline_credentials;
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
lpcfg_smbcli_options(tctx->lp_ctx, &options);
status = gensec_set_target_hostname(gensec_client_context, cli_credentials_get_workstation(machine_credentials));
torture_assert_ntstatus_ok(tctx, status, "gensec_set_target_hostname (client) failed");
- status = gensec_set_credentials(gensec_client_context, cmdline_credentials);
+ status = gensec_set_credentials(gensec_client_context,
+ popt_get_cmdline_credentials());
torture_assert_ntstatus_ok(tctx, status, "gensec_set_credentials (client) failed");
if (sasl_mech) {