mirror of
https://github.com/samba-team/samba.git
synced 2025-02-22 05:57:43 +03:00
s3: client tools. Remove direct access to struct user_auth_info *cmdline_auth_info.
Only access through utility functions. Remove all the local pointer aliases that were just being set to cmdline_auth_info in the client tools. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
1a8f410ece
commit
bec0cd2ee2
@ -143,7 +143,7 @@ int main(int argc, char *argv[])
|
||||
*share = 0;
|
||||
share++;
|
||||
|
||||
cli = connect_one(cmdline_auth_info, server, port, share);
|
||||
cli = connect_one(popt_get_cmdline_auth_info(), server, port, share);
|
||||
if (cli == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -108,9 +108,6 @@ struct cli_state *cli;
|
||||
static char CLI_DIRSEP_CHAR = '\\';
|
||||
static char CLI_DIRSEP_STR[] = { '\\', '\0' };
|
||||
|
||||
/* Authentication for client connections. */
|
||||
struct user_auth_info *auth_info;
|
||||
|
||||
/* Accessor functions for directory paths. */
|
||||
static char *fileselection;
|
||||
static const char *client_get_fileselection(void)
|
||||
@ -304,7 +301,7 @@ static int do_dskattr(void)
|
||||
TALLOC_CTX *ctx = talloc_tos();
|
||||
NTSTATUS status;
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli,
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(), cli,
|
||||
client_get_cur_dir(), &targetcli,
|
||||
&targetpath);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
@ -405,8 +402,8 @@ static int do_cd(const char *new_dir)
|
||||
new_cd = clean_name(ctx, new_cd);
|
||||
client_set_cur_dir(new_cd);
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, new_cd,
|
||||
&targetcli, &targetpath);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, new_cd, &targetcli, &targetpath);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("cd %s: %s\n", new_cd, nt_errstr(status));
|
||||
client_set_cur_dir(saved_dir);
|
||||
@ -857,9 +854,9 @@ NTSTATUS do_list(const char *mask,
|
||||
|
||||
/* check for dfs */
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli,
|
||||
head, &targetcli,
|
||||
&targetpath);
|
||||
status = cli_resolve_path(ctx, "",
|
||||
popt_get_cmdline_auth_info(),
|
||||
cli, head, &targetcli, &targetpath);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("do_list: [%s] %s\n", head,
|
||||
nt_errstr(status));
|
||||
@ -900,8 +897,9 @@ NTSTATUS do_list(const char *mask,
|
||||
}
|
||||
} else {
|
||||
/* check for dfs */
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask,
|
||||
&targetcli, &targetpath);
|
||||
status = cli_resolve_path(ctx, "",
|
||||
popt_get_cmdline_auth_info(), cli, mask,
|
||||
&targetcli, &targetpath);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
status = cli_list(targetcli, targetpath, attribute,
|
||||
do_list_helper, targetcli);
|
||||
@ -1085,8 +1083,8 @@ static int do_get(const char *rname, const char *lname_in, bool reget)
|
||||
}
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, rname, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, rname, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("Failed to open %s: %s\n", rname, nt_errstr(status));
|
||||
return 1;
|
||||
@ -1483,8 +1481,8 @@ static bool do_mkdir(const char *name)
|
||||
char *targetname = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, name, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, name, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("mkdir %s: %s\n", name, nt_errstr(status));
|
||||
return false;
|
||||
@ -1572,8 +1570,9 @@ static int cmd_mkdir(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask,
|
||||
&targetcli, &targetname);
|
||||
status = cli_resolve_path(ctx, "",
|
||||
popt_get_cmdline_auth_info(), cli, mask,
|
||||
&targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return 1;
|
||||
}
|
||||
@ -1881,8 +1880,8 @@ static int do_put(const char *rname, const char *lname, bool reput)
|
||||
struct push_state state;
|
||||
NTSTATUS status;
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, rname,
|
||||
&targetcli, &targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, rname, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("Failed to open %s: %s\n", rname, nt_errstr(status));
|
||||
return 1;
|
||||
@ -2463,8 +2462,8 @@ static int cmd_wdel(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, mask, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("cmd_wdel %s: %s\n", mask, nt_errstr(status));
|
||||
return 1;
|
||||
@ -2503,8 +2502,8 @@ static int cmd_open(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, mask, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("open %s: %s\n", mask, nt_errstr(status));
|
||||
return 1;
|
||||
@ -2570,7 +2569,8 @@ static int cmd_posix_encrypt(void)
|
||||
} else {
|
||||
bool auth_requested = false;
|
||||
|
||||
creds = get_cmdline_auth_info_creds(auth_info);
|
||||
creds = get_cmdline_auth_info_creds(
|
||||
popt_get_cmdline_auth_info());
|
||||
|
||||
auth_requested = cli_credentials_authentication_requested(creds);
|
||||
if (!auth_requested) {
|
||||
@ -2624,8 +2624,8 @@ static int cmd_posix_open(void)
|
||||
}
|
||||
mode = (mode_t)strtol(buf, (char **)NULL, 8);
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, mask, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("posix_open %s: %s\n", mask, nt_errstr(status));
|
||||
return 1;
|
||||
@ -2679,8 +2679,8 @@ static int cmd_posix_mkdir(void)
|
||||
}
|
||||
mode = (mode_t)strtol(buf, (char **)NULL, 8);
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, mask, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("posix_mkdir %s: %s\n", mask, nt_errstr(status));
|
||||
return 1;
|
||||
@ -2717,8 +2717,8 @@ static int cmd_posix_unlink(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, mask, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("posix_unlink %s: %s\n", mask, nt_errstr(status));
|
||||
return 1;
|
||||
@ -2756,8 +2756,8 @@ static int cmd_posix_rmdir(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, mask, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("posix_rmdir %s: %s\n", mask, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3058,8 +3058,8 @@ static int cmd_rmdir(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, mask, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, mask, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("rmdir %s: %s\n", mask, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3109,8 +3109,8 @@ static int cmd_link(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, oldname, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, oldname, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("link %s: %s\n", oldname, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3156,8 +3156,8 @@ static int cmd_readlink(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, name, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, name, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("readlink %s: %s\n", name, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3210,8 +3210,9 @@ static int cmd_symlink(void)
|
||||
return 1;
|
||||
}
|
||||
/* New name must be present in share namespace. */
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, newname,
|
||||
&newcli, &newname);
|
||||
status = cli_resolve_path(ctx, "",
|
||||
popt_get_cmdline_auth_info(), cli, newname,
|
||||
&newcli, &newname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("link %s: %s\n", oldname, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3262,8 +3263,8 @@ static int cmd_chmod(void)
|
||||
|
||||
mode = (mode_t)strtol(buf, NULL, 8);
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("chmod %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3419,8 +3420,8 @@ static int cmd_getfacl(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("stat %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3587,8 +3588,8 @@ static int cmd_geteas(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("stat %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3644,8 +3645,8 @@ static int cmd_setea(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("stat %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3690,8 +3691,8 @@ static int cmd_stat(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("stat %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3798,8 +3799,8 @@ static int cmd_chown(void)
|
||||
if (!src) {
|
||||
return 1;
|
||||
}
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("chown %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3862,15 +3863,15 @@ static int cmd_rename(void)
|
||||
replace = true;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetsrc);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetsrc);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("rename %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, dest, &targetcli,
|
||||
&targetdest);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, dest, &targetcli, &targetdest);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("rename %s: %s\n", dest, nt_errstr(status));
|
||||
return 1;
|
||||
@ -3950,15 +3951,15 @@ static int cmd_scopy(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetsrc);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetsrc);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("scopy %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, dest, &targetcli,
|
||||
&targetdest);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, dest, &targetcli, &targetdest);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("scopy %s: %s\n", dest, nt_errstr(status));
|
||||
return 1;
|
||||
@ -4080,8 +4081,8 @@ static int cmd_hardlink(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, src, &targetcli,
|
||||
&targetname);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, src, &targetcli, &targetname);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
d_printf("hardlink %s: %s\n", src, nt_errstr(status));
|
||||
return 1;
|
||||
@ -4738,7 +4739,7 @@ static int cmd_show_connect( void )
|
||||
char *targetpath;
|
||||
NTSTATUS status;
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli,
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(), cli,
|
||||
client_get_cur_dir(), &targetcli,
|
||||
&targetpath);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
@ -5148,7 +5149,7 @@ static int process_command_string(const char *cmd_in)
|
||||
|
||||
status = cli_cm_open(talloc_tos(), NULL,
|
||||
have_ip ? dest_ss_str : desthost,
|
||||
service, auth_info,
|
||||
service, popt_get_cmdline_auth_info(),
|
||||
true, smb_encrypt,
|
||||
max_protocol, port, name_type,
|
||||
&cli);
|
||||
@ -5328,8 +5329,8 @@ static char **remote_completion(const char *text, int len)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
status = cli_resolve_path(ctx, "", auth_info, cli, dirmask, &targetcli,
|
||||
&targetpath);
|
||||
status = cli_resolve_path(ctx, "", popt_get_cmdline_auth_info(),
|
||||
cli, dirmask, &targetcli, &targetpath);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto cleanup;
|
||||
}
|
||||
@ -5577,8 +5578,9 @@ static int process(const char *base_directory)
|
||||
|
||||
status = cli_cm_open(talloc_tos(), NULL,
|
||||
have_ip ? dest_ss_str : desthost,
|
||||
service, auth_info, true, smb_encrypt,
|
||||
max_protocol, port, name_type, &cli);
|
||||
service, popt_get_cmdline_auth_info(),
|
||||
true, smb_encrypt, max_protocol, port,
|
||||
name_type, &cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return 1;
|
||||
}
|
||||
@ -5613,8 +5615,9 @@ static int do_host_query(const char *query_host)
|
||||
|
||||
status = cli_cm_open(talloc_tos(), NULL,
|
||||
have_ip ? dest_ss_str : query_host,
|
||||
"IPC$", auth_info, true, smb_encrypt,
|
||||
max_protocol, port, name_type, &cli);
|
||||
"IPC$", popt_get_cmdline_auth_info(),
|
||||
true, smb_encrypt, max_protocol, port,
|
||||
name_type, &cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return 1;
|
||||
}
|
||||
@ -5646,9 +5649,9 @@ static int do_host_query(const char *query_host)
|
||||
cli_shutdown(cli);
|
||||
status = cli_cm_open(talloc_tos(), NULL,
|
||||
have_ip ? dest_ss_str : query_host,
|
||||
"IPC$", auth_info, true, smb_encrypt,
|
||||
max_protocol, NBT_SMB_PORT, name_type,
|
||||
&cli);
|
||||
"IPC$", popt_get_cmdline_auth_info(),
|
||||
true, smb_encrypt, max_protocol,
|
||||
NBT_SMB_PORT, name_type, &cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
cli = NULL;
|
||||
}
|
||||
@ -5682,8 +5685,9 @@ static int do_tar_op(const char *base_directory)
|
||||
|
||||
status = cli_cm_open(talloc_tos(), NULL,
|
||||
have_ip ? dest_ss_str : desthost,
|
||||
service, auth_info, true, smb_encrypt,
|
||||
max_protocol, port, name_type, &cli);
|
||||
service, popt_get_cmdline_auth_info(),
|
||||
true, smb_encrypt, max_protocol,
|
||||
port, name_type, &cli);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
@ -5818,10 +5822,11 @@ int main(int argc,char *argv[])
|
||||
|
||||
/* if the service has already been retrieved then check if we have also a password */
|
||||
if (service_opt
|
||||
&& (!get_cmdline_auth_info_got_pass(cmdline_auth_info))
|
||||
&& (!get_cmdline_auth_info_got_pass(
|
||||
popt_get_cmdline_auth_info()))
|
||||
&& poptPeekArg(pc)) {
|
||||
set_cmdline_auth_info_password(cmdline_auth_info,
|
||||
poptGetArg(pc));
|
||||
set_cmdline_auth_info_password(
|
||||
popt_get_cmdline_auth_info(), poptGetArg(pc));
|
||||
}
|
||||
|
||||
|
||||
@ -5920,9 +5925,9 @@ int main(int argc,char *argv[])
|
||||
|
||||
/* if the service has already been retrieved then check if we have also a password */
|
||||
if (service_opt
|
||||
&& !get_cmdline_auth_info_got_pass(cmdline_auth_info)
|
||||
&& !get_cmdline_auth_info_got_pass(popt_get_cmdline_auth_info())
|
||||
&& poptPeekArg(pc)) {
|
||||
set_cmdline_auth_info_password(cmdline_auth_info,
|
||||
set_cmdline_auth_info_password(popt_get_cmdline_auth_info(),
|
||||
poptGetArg(pc));
|
||||
}
|
||||
|
||||
@ -5964,8 +5969,8 @@ int main(int argc,char *argv[])
|
||||
|
||||
/* Ensure we have a password (or equivalent). */
|
||||
popt_common_credentials_post();
|
||||
auth_info = cmdline_auth_info;
|
||||
smb_encrypt = get_cmdline_auth_info_smb_encrypt(auth_info);
|
||||
smb_encrypt = get_cmdline_auth_info_smb_encrypt(
|
||||
popt_get_cmdline_auth_info());
|
||||
|
||||
max_protocol = lp_client_max_protocol();
|
||||
|
||||
@ -5993,7 +5998,7 @@ int main(int argc,char *argv[])
|
||||
|
||||
rc = do_host_query(qhost);
|
||||
} else if (message) {
|
||||
rc = do_message_op(auth_info);
|
||||
rc = do_message_op(popt_get_cmdline_auth_info());
|
||||
} else if (process(base_directory)) {
|
||||
rc = 1;
|
||||
}
|
||||
|
@ -48,7 +48,6 @@ extern const struct poptOption popt_common_dynconfig[];
|
||||
#define POPT_COMMON_DEBUGLEVEL { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debuglevel, 0, "Common samba debugging:", NULL },
|
||||
#define POPT_COMMON_OPTION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_option, 0, "Common samba commandline config:", NULL },
|
||||
|
||||
extern struct user_auth_info *cmdline_auth_info;
|
||||
struct user_auth_info *popt_get_cmdline_auth_info(void);
|
||||
void popt_free_cmdline_auth_info(void);
|
||||
|
||||
|
@ -221,7 +221,7 @@ struct poptOption popt_common_option[] = {
|
||||
* -C --use-ccache
|
||||
*/
|
||||
|
||||
struct user_auth_info *cmdline_auth_info;
|
||||
static struct user_auth_info *cmdline_auth_info;
|
||||
|
||||
struct user_auth_info *popt_get_cmdline_auth_info(void)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "../libcli/security/security_descriptor.h"
|
||||
#include "../libcli/registry/util_reg.h"
|
||||
#include "libsmb/libsmb.h"
|
||||
#include "popt_common.h"
|
||||
|
||||
#define RPCCLIENT_PRINTERNAME(_printername, _cli, _arg) \
|
||||
{ \
|
||||
@ -3495,8 +3496,6 @@ done:
|
||||
/****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
extern struct user_auth_info *rpcclient_auth_info;
|
||||
|
||||
static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
|
||||
TALLOC_CTX *mem_ctx, int argc,
|
||||
const char **argv)
|
||||
@ -3519,13 +3518,18 @@ static WERROR cmd_spoolss_printercmp(struct rpc_pipe_client *cli,
|
||||
/* first get the connection to the remote server */
|
||||
|
||||
nt_status = cli_full_connection(&cli_server2, lp_netbios_name(), argv[2],
|
||||
NULL, 0,
|
||||
"IPC$", "IPC",
|
||||
get_cmdline_auth_info_username(rpcclient_auth_info),
|
||||
lp_workgroup(),
|
||||
get_cmdline_auth_info_password(rpcclient_auth_info),
|
||||
get_cmdline_auth_info_use_kerberos(rpcclient_auth_info) ? CLI_FULL_CONNECTION_USE_KERBEROS : 0,
|
||||
get_cmdline_auth_info_signing_state(rpcclient_auth_info));
|
||||
NULL, 0,
|
||||
"IPC$", "IPC",
|
||||
get_cmdline_auth_info_username(
|
||||
popt_get_cmdline_auth_info()),
|
||||
lp_workgroup(),
|
||||
get_cmdline_auth_info_password(
|
||||
popt_get_cmdline_auth_info()),
|
||||
get_cmdline_auth_info_use_kerberos(
|
||||
popt_get_cmdline_auth_info()) ?
|
||||
CLI_FULL_CONNECTION_USE_KERBEROS : 0,
|
||||
get_cmdline_auth_info_signing_state(
|
||||
popt_get_cmdline_auth_info()));
|
||||
|
||||
if ( !NT_STATUS_IS_OK(nt_status) )
|
||||
return WERR_GEN_FAILURE;
|
||||
|
@ -50,7 +50,6 @@ static unsigned int timeout = 0;
|
||||
static enum dcerpc_transport_t default_transport = NCACN_NP;
|
||||
|
||||
struct messaging_context *rpcclient_msg_ctx;
|
||||
struct user_auth_info *rpcclient_auth_info;
|
||||
struct cli_state *rpcclient_cli_state;
|
||||
struct netlogon_creds_cli_context *rpcclient_netlogon_creds;
|
||||
static const char *rpcclient_netlogon_domain;
|
||||
@ -1013,7 +1012,6 @@ out_free:
|
||||
|
||||
poptFreeContext(pc);
|
||||
popt_burn_cmdline_password(argc, argv);
|
||||
rpcclient_auth_info = cmdline_auth_info;
|
||||
|
||||
nt_status = messaging_init_client(talloc_autofree_context(),
|
||||
samba_tevent_context_init(talloc_autofree_context()),
|
||||
@ -1120,7 +1118,8 @@ out_free:
|
||||
}
|
||||
}
|
||||
|
||||
signing_state = get_cmdline_auth_info_signing_state(rpcclient_auth_info);
|
||||
signing_state = get_cmdline_auth_info_signing_state(
|
||||
popt_get_cmdline_auth_info());
|
||||
switch (signing_state) {
|
||||
case SMB_SIGNING_OFF:
|
||||
lp_set_cmdline("client ipc signing", "no");
|
||||
@ -1130,18 +1129,20 @@ out_free:
|
||||
break;
|
||||
}
|
||||
|
||||
if (get_cmdline_auth_info_use_kerberos(rpcclient_auth_info)) {
|
||||
if (get_cmdline_auth_info_use_kerberos(popt_get_cmdline_auth_info())) {
|
||||
flags |= CLI_FULL_CONNECTION_USE_KERBEROS |
|
||||
CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
|
||||
}
|
||||
if (get_cmdline_auth_info_use_ccache(rpcclient_auth_info)) {
|
||||
if (get_cmdline_auth_info_use_ccache(popt_get_cmdline_auth_info())) {
|
||||
flags |= CLI_FULL_CONNECTION_USE_CCACHE;
|
||||
}
|
||||
if (get_cmdline_auth_info_use_pw_nt_hash(rpcclient_auth_info)) {
|
||||
if (get_cmdline_auth_info_use_pw_nt_hash(
|
||||
popt_get_cmdline_auth_info())) {
|
||||
flags |= CLI_FULL_CONNECTION_USE_NT_HASH;
|
||||
}
|
||||
|
||||
rpcclient_netlogon_domain = get_cmdline_auth_info_domain(rpcclient_auth_info);
|
||||
rpcclient_netlogon_domain = get_cmdline_auth_info_domain(
|
||||
popt_get_cmdline_auth_info());
|
||||
if (rpcclient_netlogon_domain == NULL ||
|
||||
rpcclient_netlogon_domain[0] == '\0')
|
||||
{
|
||||
@ -1151,9 +1152,12 @@ out_free:
|
||||
nt_status = cli_full_connection(&cli, lp_netbios_name(), host,
|
||||
opt_ipaddr ? &server_ss : NULL, opt_port,
|
||||
"IPC$", "IPC",
|
||||
get_cmdline_auth_info_username(rpcclient_auth_info),
|
||||
get_cmdline_auth_info_domain(rpcclient_auth_info),
|
||||
get_cmdline_auth_info_password(rpcclient_auth_info),
|
||||
get_cmdline_auth_info_username(
|
||||
popt_get_cmdline_auth_info()),
|
||||
get_cmdline_auth_info_domain(
|
||||
popt_get_cmdline_auth_info()),
|
||||
get_cmdline_auth_info_password(
|
||||
popt_get_cmdline_auth_info()),
|
||||
flags,
|
||||
SMB_SIGNING_IPC_DEFAULT);
|
||||
|
||||
@ -1163,11 +1167,14 @@ out_free:
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (get_cmdline_auth_info_smb_encrypt(rpcclient_auth_info)) {
|
||||
if (get_cmdline_auth_info_smb_encrypt(popt_get_cmdline_auth_info())) {
|
||||
nt_status = cli_cm_force_encryption(cli,
|
||||
get_cmdline_auth_info_username(rpcclient_auth_info),
|
||||
get_cmdline_auth_info_password(rpcclient_auth_info),
|
||||
get_cmdline_auth_info_domain(rpcclient_auth_info),
|
||||
get_cmdline_auth_info_username(
|
||||
popt_get_cmdline_auth_info()),
|
||||
get_cmdline_auth_info_password(
|
||||
popt_get_cmdline_auth_info()),
|
||||
get_cmdline_auth_info_domain(
|
||||
popt_get_cmdline_auth_info()),
|
||||
"IPC$");
|
||||
if (!NT_STATUS_IS_OK(nt_status)) {
|
||||
result = 1;
|
||||
@ -1205,8 +1212,9 @@ out_free:
|
||||
result = 0;
|
||||
|
||||
while((cmd=next_command(&p)) != NULL) {
|
||||
NTSTATUS cmd_result = process_cmd(rpcclient_auth_info, cli,
|
||||
binding, cmd);
|
||||
NTSTATUS cmd_result = process_cmd(
|
||||
popt_get_cmdline_auth_info(),
|
||||
cli, binding, cmd);
|
||||
SAFE_FREE(cmd);
|
||||
result = NT_STATUS_IS_ERR(cmd_result);
|
||||
}
|
||||
@ -1227,7 +1235,8 @@ out_free:
|
||||
}
|
||||
|
||||
if (line[0] != '\n')
|
||||
process_cmd(rpcclient_auth_info, cli, binding, line);
|
||||
process_cmd(popt_get_cmdline_auth_info(), cli,
|
||||
binding, line);
|
||||
SAFE_FREE(line);
|
||||
}
|
||||
|
||||
|
@ -921,7 +921,7 @@ int main(int argc, char *argv[])
|
||||
share++;
|
||||
|
||||
if (!test_args) {
|
||||
cli = connect_one(cmdline_auth_info, server, share);
|
||||
cli = connect_one(popt_get_cmdline_auth_info(), server, share);
|
||||
if (!cli) {
|
||||
exit(EXIT_FAILED);
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ static struct cli_state *cli_ipc;
|
||||
static struct rpc_pipe_client *global_pipe_hnd;
|
||||
static struct policy_handle pol;
|
||||
static bool got_policy_hnd;
|
||||
static struct user_auth_info *smbcquotas_auth_info;
|
||||
|
||||
static struct cli_state *connect_one(const char *share);
|
||||
|
||||
@ -523,7 +522,7 @@ static struct cli_state *connect_one(const char *share)
|
||||
NTSTATUS nt_status;
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (get_cmdline_auth_info_use_kerberos(smbcquotas_auth_info)) {
|
||||
if (get_cmdline_auth_info_use_kerberos(popt_get_cmdline_auth_info())) {
|
||||
flags |= CLI_FULL_CONNECTION_USE_KERBEROS |
|
||||
CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
|
||||
|
||||
@ -532,20 +531,25 @@ static struct cli_state *connect_one(const char *share)
|
||||
nt_status = cli_full_connection(&c, lp_netbios_name(), server,
|
||||
NULL, 0,
|
||||
share, "?????",
|
||||
get_cmdline_auth_info_username(smbcquotas_auth_info),
|
||||
get_cmdline_auth_info_username(
|
||||
popt_get_cmdline_auth_info()),
|
||||
lp_workgroup(),
|
||||
get_cmdline_auth_info_password(smbcquotas_auth_info),
|
||||
get_cmdline_auth_info_password(
|
||||
popt_get_cmdline_auth_info()),
|
||||
flags,
|
||||
get_cmdline_auth_info_signing_state(smbcquotas_auth_info));
|
||||
get_cmdline_auth_info_signing_state(
|
||||
popt_get_cmdline_auth_info()));
|
||||
if (!NT_STATUS_IS_OK(nt_status)) {
|
||||
DEBUG(0,("cli_full_connection failed! (%s)\n", nt_errstr(nt_status)));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (get_cmdline_auth_info_smb_encrypt(smbcquotas_auth_info)) {
|
||||
if (get_cmdline_auth_info_smb_encrypt(popt_get_cmdline_auth_info())) {
|
||||
nt_status = cli_cm_force_encryption(c,
|
||||
get_cmdline_auth_info_username(smbcquotas_auth_info),
|
||||
get_cmdline_auth_info_password(smbcquotas_auth_info),
|
||||
get_cmdline_auth_info_username(
|
||||
popt_get_cmdline_auth_info()),
|
||||
get_cmdline_auth_info_password(
|
||||
popt_get_cmdline_auth_info()),
|
||||
lp_workgroup(),
|
||||
share);
|
||||
if (!NT_STATUS_IS_OK(nt_status)) {
|
||||
@ -675,10 +679,10 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" },
|
||||
if (todo == 0)
|
||||
todo = USER_QUOTA;
|
||||
|
||||
smbcquotas_auth_info = cmdline_auth_info;
|
||||
if (!fix_user) {
|
||||
username_str = talloc_strdup(
|
||||
frame, get_cmdline_auth_info_username(smbcquotas_auth_info));
|
||||
frame, get_cmdline_auth_info_username(
|
||||
popt_get_cmdline_auth_info()));
|
||||
if (!username_str) {
|
||||
exit(EXIT_PARSE_ERROR);
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Now do our stuff */
|
||||
|
||||
if (!print_tree(cmdline_auth_info)) {
|
||||
if (!print_tree(popt_get_cmdline_auth_info())) {
|
||||
TALLOC_FREE(frame);
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user