char *newserver, *newshare;
const char *username;
const char *password;
+ const char *domain;
NTSTATUS status;
int flags = 0;
username = get_cmdline_auth_info_username(auth_info);
password = get_cmdline_auth_info_password(auth_info);
+ domain = get_cmdline_auth_info_domain(auth_info);
+ if ((domain == NULL) || (domain[0] == '\0')) {
+ domain = lp_workgroup();
+ }
status = cli_session_setup(c, username,
password, strlen(password),
password, strlen(password),
- lp_workgroup());
+ domain);
if (!NT_STATUS_IS_OK(status)) {
/* If a password was not supplied then
* try again with a null username. */
d_printf("Anonymous login successful\n");
status = cli_init_creds(c, "", lp_workgroup(), "");
} else {
- status = cli_init_creds(c, username, lp_workgroup(), password);
+ status = cli_init_creds(c, username, domain, password);
}
if (!NT_STATUS_IS_OK(status)) {
force_encrypt,
username,
password,
- lp_workgroup())) {
+ domain)) {
cli_shutdown(c);
return do_connect(ctx, newserver,
newshare, auth_info, false,
status = cli_cm_force_encryption(c,
username,
password,
- lp_workgroup(),
+ domain,
sharename);
if (!NT_STATUS_IS_OK(status)) {
cli_shutdown(c);