summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2021-01-13 14:49:07 +0100
committerAndrew Bartlett <abartlet@samba.org>2021-05-28 02:55:31 +0000
commitf2b80723d3803f4e21be17f91e5894a46ca39648 (patch)
tree8d232e096fb89243e2eee6fe047d81441439475c /examples
parent06a1861ca86dad4d9acd7301324c1c3267bb60f9 (diff)
downloadsamba-f2b80723d3803f4e21be17f91e5894a46ca39648.tar.gz
examples: Migrate smb2mount to new cmdline option parser
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/fuse/smb2mount.c29
-rw-r--r--examples/fuse/wscript_build2
2 files changed, 23 insertions, 8 deletions
diff --git a/examples/fuse/smb2mount.c b/examples/fuse/smb2mount.c
index c27f442ad76..7133927ad16 100644
--- a/examples/fuse/smb2mount.c
+++ b/examples/fuse/smb2mount.c
@@ -20,7 +20,7 @@
#include "source3/include/includes.h"
#include "popt.h"
-#include "popt_common_cmdline.h"
+#include "lib/cmdline/cmdline.h"
#include "client.h"
#include "libsmb/proto.h"
#include "clifuse.h"
@@ -57,6 +57,7 @@ int main(int argc, char *argv[])
char *unc, *mountpoint, *server, *share;
struct cli_state *cli;
struct cli_credentials *creds = NULL;
+ bool ok;
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -68,14 +69,29 @@ int main(int argc, char *argv[])
};
smb_init_locale();
- setup_logging(argv[0], DEBUG_STDERR);
+
+ 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);
+ }
lp_set_cmdline("client min protocol", "SMB2");
lp_set_cmdline("client max protocol", "SMB3_11");
- lp_load_global(get_dyn_CONFIGFILE());
- load_interfaces();
+ 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);
+ }
- pc = poptGetContext("smb2mount", argc, argv_const, long_options, 0);
poptSetOtherOptionHelp(pc, "//server1/share1 mountpoint");
while ((opt = poptGetNextOpt(pc)) != -1) {
@@ -108,7 +124,7 @@ int main(int argc, char *argv[])
}
poptFreeContext(pc);
- popt_burn_cmdline_password(argc, argv);
+ samba_cmdline_burn(argc, argv);
server = talloc_strdup(frame, unc+2);
if (!server) {
@@ -136,7 +152,6 @@ int main(int argc, char *argv[])
return -1;
}
- popt_free_cmdline_auth_info();
TALLOC_FREE(frame);
return 0;
}
diff --git a/examples/fuse/wscript_build b/examples/fuse/wscript_build
index 31341e4357d..ceef925f65c 100644
--- a/examples/fuse/wscript_build
+++ b/examples/fuse/wscript_build
@@ -3,5 +3,5 @@
if bld.env.HAVE_FUSE:
bld.SAMBA_BINARY('smb2mount',
source='smb2mount.c clifuse.c',
- deps='smbconf popt_samba3_cmdline libsmb fuse',
+ deps='smbconf CMDLINE_S3 libsmb fuse',
install=False)