NTSTATUS status, result;
TALLOC_CTX *frame = talloc_stackframe();
- status = cli_tree_connect(cli, "IPC$", "?????", "", 0);
+ status = cli_tree_connect(cli, "IPC$", "?????", NULL);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
if (!sd) return EXIT_PARSE_ERROR;
if (test_args) return EXIT_OK;
- old = get_secdesc(cli, filename);
+ if (mode != SMB_ACL_SET) {
+ /*
+ * Do not fetch old ACL when it will be overwritten
+ * completely with a new one.
+ */
+ old = get_secdesc(cli, filename);
- if (!old) {
- return EXIT_FAILED;
+ if (!old) {
+ return EXIT_FAILED;
+ }
}
/* the logic here is rather more complex than I would like */
/*****************************************************
Return a connection to a server.
*******************************************************/
-static struct cli_state *connect_one(struct user_auth_info *auth_info,
+static struct cli_state *connect_one(const struct user_auth_info *auth_info,
const char *server, const char *share)
{
struct cli_state *c = NULL;
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,
share, "?????",
TALLOC_CTX *frame = talloc_stackframe();
const char *owner_username = "";
char *server;
- struct user_auth_info *auth_info;
smb_init_locale();
setlinebuf(stdout);
-
- auth_info = user_auth_info_init(frame);
- if (auth_info == NULL) {
- exit(1);
- }
- popt_common_set_auth_info(auth_info);
+ popt_common_credentials_set_ignore_missing_conf();
pc = poptGetContext("smbcacls", argc, argv_const, long_options, 0);
return -1;
}
- lp_load_global(get_dyn_CONFIGFILE());
- load_interfaces();
-
filename = talloc_strdup(frame, poptGetArg(pc));
if (!filename) {
return -1;
poptFreeContext(pc);
popt_burn_cmdline_password(argc, argv);
+ popt_common_credentials_post();
string_replace(path,'/','\\');
share++;
if (!test_args) {
- cli = connect_one(auth_info, server, share);
+ cli = connect_one(popt_get_cmdline_auth_info(), server, share);
if (!cli) {
exit(EXIT_FAILED);
}
} else {
+ popt_free_cmdline_auth_info();
exit(0);
}
result = cacl_dump(cli, filename, numeric);
}
+ popt_free_cmdline_auth_info();
TALLOC_FREE(frame);
return result;