1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

s3:utils: Migrate sharesec 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:
Andreas Schneider 2021-01-13 13:40:26 +01:00 committed by Andrew Bartlett
parent 4f81d8459a
commit b41a0cd199
2 changed files with 23 additions and 6 deletions

View File

@ -24,7 +24,7 @@
struct cli_state;
#include "includes.h"
#include "popt_common.h"
#include "lib/cmdline/cmdline.h"
#include "../libcli/security/security.h"
#include "passdb/machine_sid.h"
#include "util_sd.h"
@ -335,6 +335,7 @@ int main(int argc, const char *argv[])
int snum;
poptContext pc;
bool initialize_sid = False;
bool ok;
struct poptOption long_options[] = {
POPT_AUTOHELP
{
@ -430,6 +431,7 @@ int main(int argc, const char *argv[])
.argDescrip = "ACLS",
},
POPT_COMMON_SAMBA
POPT_COMMON_VERSION
POPT_TABLEEND
};
@ -438,14 +440,29 @@ int main(int argc, const char *argv[])
return -1;
}
/* set default debug level to 1 regardless of what smb.conf sets */
setup_logging( "sharesec", DEBUG_STDERR);
smb_init_locale();
ok = samba_cmdline_init(ctx,
SAMBA_CMDLINE_CONFIG_NONE,
false /* require_smbconf */);
if (!ok) {
DBG_ERR("Failed to init cmdline parser!\n");
TALLOC_FREE(ctx);
exit(1);
}
/* set default debug level to 1 regardless of what smb.conf sets */
lp_set_cmdline("log level", "1");
pc = poptGetContext("sharesec", argc, argv, long_options, 0);
pc = samba_popt_get_context(getprogname(),
argc,
argv,
long_options,
0);
if (pc == NULL) {
DBG_ERR("Failed to setup popt context!\n");
TALLOC_FREE(ctx);
exit(1);
}
poptSetOtherOptionHelp(pc, "sharename\n");

View File

@ -103,7 +103,7 @@ bld.SAMBA3_BINARY('sharesec',
talloc
msrpc3
libcli_lsa3
popt_samba3
CMDLINE_S3
cmdline_contexts
''')