mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3:utils: Migrate smbcacls to new cmdline option parser
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
83eea54ff6
commit
e652f542e0
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "popt_common_cmdline.h"
|
||||
#include "lib/cmdline/cmdline.h"
|
||||
#include "rpc_client/cli_pipe.h"
|
||||
#include "../librpc/gen_ndr/ndr_lsa.h"
|
||||
#include "rpc_client/cli_lsarpc.h"
|
||||
@ -1572,6 +1572,7 @@ int main(int argc, char *argv[])
|
||||
struct cli_credentials *creds = NULL;
|
||||
char *targetfile = NULL;
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
|
||||
struct poptOption long_options[] = {
|
||||
POPT_AUTOHELP
|
||||
@ -1693,15 +1694,6 @@ int main(int argc, char *argv[])
|
||||
.val = 0,
|
||||
.descrip = "Domain SID for sddl",
|
||||
.argDescrip = "SID"},
|
||||
{
|
||||
.longName = "max-protocol",
|
||||
.shortName = 'm',
|
||||
.argInfo = POPT_ARG_STRING,
|
||||
.arg = NULL,
|
||||
.val = 'm',
|
||||
.descrip = "Set the max protocol level",
|
||||
.argDescrip = "LEVEL",
|
||||
},
|
||||
{
|
||||
.longName = "maximum-access",
|
||||
.shortName = 'x',
|
||||
@ -1713,6 +1705,8 @@ int main(int argc, char *argv[])
|
||||
POPT_COMMON_SAMBA
|
||||
POPT_COMMON_CONNECTION
|
||||
POPT_COMMON_CREDENTIALS
|
||||
POPT_LEGACY_S3
|
||||
POPT_COMMON_VERSION
|
||||
POPT_TABLEEND
|
||||
};
|
||||
|
||||
@ -1723,15 +1717,29 @@ int main(int argc, char *argv[])
|
||||
|
||||
smb_init_locale();
|
||||
|
||||
ok = samba_cmdline_init(frame,
|
||||
SAMBA_CMDLINE_CONFIG_CLIENT,
|
||||
false /* require_smbconf */);
|
||||
if (!ok) {
|
||||
DBG_ERR("Failed to init cmdline parser!\n");
|
||||
TALLOC_FREE(frame);
|
||||
exit(1);
|
||||
}
|
||||
/* set default debug level to 1 regardless of what smb.conf sets */
|
||||
setup_logging( "smbcacls", DEBUG_STDERR);
|
||||
lp_set_cmdline("log level", "1");
|
||||
|
||||
setlinebuf(stdout);
|
||||
|
||||
popt_common_credentials_set_ignore_missing_conf();
|
||||
|
||||
pc = poptGetContext("smbcacls", argc, argv_const, long_options, 0);
|
||||
pc = samba_popt_get_context(getprogname(),
|
||||
argc,
|
||||
argv_const,
|
||||
long_options,
|
||||
0);
|
||||
if (pc == NULL) {
|
||||
DBG_ERR("Failed to setup popt context!\n");
|
||||
TALLOC_FREE(frame);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
poptSetOtherOptionHelp(pc, "//server1/share1 filename\nACLs look like: "
|
||||
"'ACL:user:[ALLOWED|DENIED]/flags/permissions'");
|
||||
@ -1806,8 +1814,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
poptFreeContext(pc);
|
||||
popt_burn_cmdline_password(argc, argv);
|
||||
popt_common_credentials_post();
|
||||
samba_cmdline_burn(argc, argv);
|
||||
|
||||
string_replace(path,'/','\\');
|
||||
|
||||
@ -1824,7 +1831,7 @@ int main(int argc, char *argv[])
|
||||
*share = 0;
|
||||
share++;
|
||||
|
||||
creds = get_cmdline_auth_info_creds(popt_get_cmdline_auth_info());
|
||||
creds = samba_cmdline_get_creds();
|
||||
|
||||
/* Make connection to server */
|
||||
if (!test_args) {
|
||||
@ -1833,7 +1840,6 @@ int main(int argc, char *argv[])
|
||||
exit(EXIT_FAILED);
|
||||
}
|
||||
} else {
|
||||
popt_free_cmdline_auth_info();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -1886,7 +1892,6 @@ int main(int argc, char *argv[])
|
||||
result = cacl_dump(targetcli, targetfile, numeric);
|
||||
}
|
||||
|
||||
popt_free_cmdline_auth_info();
|
||||
TALLOC_FREE(frame);
|
||||
|
||||
return result;
|
||||
|
@ -74,7 +74,7 @@ bld.SAMBA3_BINARY('smbcacls',
|
||||
source='smbcacls.c ../lib/util_sd.c',
|
||||
deps='''
|
||||
talloc
|
||||
popt_samba3_cmdline
|
||||
CMDLINE_S3
|
||||
msrpc3
|
||||
libcli_lsa3
|
||||
krb5samba''')
|
||||
|
Loading…
Reference in New Issue
Block a user