#include "source3/include/includes.h"
#include "popt.h"
-#include "popt_common.h"
+#include "popt_common_cmdline.h"
#include "client.h"
#include "libsmb/proto.h"
#include "clifuse.h"
-static struct cli_state *connect_one(struct user_auth_info *auth_info,
- const char *server, const char *share)
+static struct cli_state *connect_one(const struct user_auth_info *auth_info,
+ const char *server, int port,
+ const char *share)
{
struct cli_state *c = NULL;
NTSTATUS nt_status;
CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
}
- if (get_cmdline_auth_info_use_machine_account(auth_info) &&
- !set_cmdline_auth_info_machine_account_creds(auth_info)) {
- return NULL;
- }
-
- set_cmdline_auth_info_getpass(auth_info);
-
- nt_status = cli_full_connection(&c, lp_netbios_name(), server,
- NULL, 0,
+ nt_status = cli_full_connection_creds(&c, lp_netbios_name(), server,
+ NULL, port,
share, "?????",
- get_cmdline_auth_info_username(auth_info),
- lp_workgroup(),
- get_cmdline_auth_info_password(auth_info),
+ get_cmdline_auth_info_creds(auth_info),
flags,
get_cmdline_auth_info_signing_state(auth_info));
if (!NT_STATUS_IS_OK(nt_status)) {
}
if (get_cmdline_auth_info_smb_encrypt(auth_info)) {
- nt_status = cli_cm_force_encryption(
+ nt_status = cli_cm_force_encryption_creds(
c,
- get_cmdline_auth_info_username(auth_info),
- get_cmdline_auth_info_password(auth_info),
- lp_workgroup(),
+ get_cmdline_auth_info_creds(auth_info),
share);
if (!NT_STATUS_IS_OK(nt_status)) {
cli_shutdown(c);
{
const char **argv_const = discard_const_p(const char *, argv);
TALLOC_CTX *frame = talloc_stackframe();
- struct user_auth_info *auth_info;
poptContext pc;
int opt, ret;
+ int port = 0;
char *unc, *mountpoint, *server, *share;
struct cli_state *cli;
POPT_AUTOHELP
POPT_COMMON_SAMBA
POPT_COMMON_CREDENTIALS
+ { "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to",
+ "PORT" },
POPT_TABLEEND
};
lp_set_cmdline("client min protocol", "SMB2");
lp_set_cmdline("client max protocol", "SMB3_11");
- auth_info = user_auth_info_init(frame);
- if (auth_info == NULL) {
- exit(1);
- }
- popt_common_set_auth_info(auth_info);
-
lp_load_global(get_dyn_CONFIGFILE());
load_interfaces();
while ((opt = poptGetNextOpt(pc)) != -1) {
switch(opt) {
+ case 'p':
+ break;
default:
fprintf(stderr, "Unknown Option: %c\n", opt);
exit(1);
*share = 0;
share++;
- cli = connect_one(auth_info, server, share);
+ cli = connect_one(popt_get_cmdline_auth_info(), server, port, share);
if (cli == NULL) {
return -1;
}
return -1;
}
+ popt_free_cmdline_auth_info();
TALLOC_FREE(frame);
return 0;
}