1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

s3:torture: Migrate pdbtest 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-12 12:53:08 +01:00 committed by Andrew Bartlett
parent a19b9a2d4b
commit de159c40c5
2 changed files with 17 additions and 7 deletions

View File

@ -22,7 +22,7 @@
#include "includes.h"
#include "popt_common.h"
#include "lib/cmdline/cmdline.h"
#include "passdb.h"
#include "../librpc/gen_ndr/drsblobs.h"
@ -563,11 +563,13 @@ int main(int argc, const char **argv)
poptContext pc;
static const char *backend = NULL;
static const char *unix_user = "nobody";
bool ok;
struct poptOption long_options[] = {
{"username", 'u', POPT_ARG_STRING, &unix_user, 0, "Unix user to use for testing", "USERNAME" },
{"backend", 'b', POPT_ARG_STRING, &backend, 0, "Backend to use if not default", "BACKEND[:SETTINGS]" },
POPT_AUTOHELP
POPT_COMMON_SAMBA
POPT_COMMON_VERSION
POPT_TABLEEND
};
@ -575,7 +577,19 @@ int main(int argc, const char **argv)
smb_init_locale();
pc = poptGetContext("pdbtest", argc, argv, long_options, 0);
ok = samba_cmdline_init(ctx,
SAMBA_CMDLINE_CONFIG_CLIENT,
true /* require_smbconf */);
if (!ok) {
TALLOC_FREE(ctx);
exit(1);
}
pc = samba_popt_get_context(getprogname(), argc, argv, long_options, 0);
if (pc == NULL) {
TALLOC_FREE(ctx);
exit(1);
}
poptSetOtherOptionHelp(pc, "backend[:settings] username");
@ -583,10 +597,6 @@ int main(int argc, const char **argv)
poptFreeContext(pc);
/* Load configuration */
lp_load_global(get_dyn_CONFIGFILE());
setup_logging("pdbtest", DEBUG_STDOUT);
if (backend == NULL) {
backend = lp_passdb_backend();
}

View File

@ -1301,7 +1301,7 @@ bld.SAMBA3_BINARY('pdbtest',
deps='''
talloc
pdb
popt_samba3
CMDLINE_S3
AUTH_COMMON
auth
''',