mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
examples: Add '-p', '--port' to smb2mount
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
455bbf1756
commit
6b8e599310
@ -26,7 +26,8 @@
|
|||||||
#include "clifuse.h"
|
#include "clifuse.h"
|
||||||
|
|
||||||
static struct cli_state *connect_one(const 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)
|
const char *server, int port,
|
||||||
|
const char *share)
|
||||||
{
|
{
|
||||||
struct cli_state *c = NULL;
|
struct cli_state *c = NULL;
|
||||||
NTSTATUS nt_status;
|
NTSTATUS nt_status;
|
||||||
@ -38,7 +39,7 @@ static struct cli_state *connect_one(const struct user_auth_info *auth_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nt_status = cli_full_connection(&c, lp_netbios_name(), server,
|
nt_status = cli_full_connection(&c, lp_netbios_name(), server,
|
||||||
NULL, 0,
|
NULL, port,
|
||||||
share, "?????",
|
share, "?????",
|
||||||
get_cmdline_auth_info_username(auth_info),
|
get_cmdline_auth_info_username(auth_info),
|
||||||
lp_workgroup(),
|
lp_workgroup(),
|
||||||
@ -73,6 +74,7 @@ int main(int argc, char *argv[])
|
|||||||
TALLOC_CTX *frame = talloc_stackframe();
|
TALLOC_CTX *frame = talloc_stackframe();
|
||||||
poptContext pc;
|
poptContext pc;
|
||||||
int opt, ret;
|
int opt, ret;
|
||||||
|
int port = 0;
|
||||||
char *unc, *mountpoint, *server, *share;
|
char *unc, *mountpoint, *server, *share;
|
||||||
struct cli_state *cli;
|
struct cli_state *cli;
|
||||||
|
|
||||||
@ -80,6 +82,8 @@ int main(int argc, char *argv[])
|
|||||||
POPT_AUTOHELP
|
POPT_AUTOHELP
|
||||||
POPT_COMMON_SAMBA
|
POPT_COMMON_SAMBA
|
||||||
POPT_COMMON_CREDENTIALS
|
POPT_COMMON_CREDENTIALS
|
||||||
|
{ "port", 'p', POPT_ARG_INT, &port, 'p', "Port to connect to",
|
||||||
|
"PORT" },
|
||||||
POPT_TABLEEND
|
POPT_TABLEEND
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,6 +100,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while ((opt = poptGetNextOpt(pc)) != -1) {
|
while ((opt = poptGetNextOpt(pc)) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
|
case 'p':
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown Option: %c\n", opt);
|
fprintf(stderr, "Unknown Option: %c\n", opt);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -137,7 +143,7 @@ int main(int argc, char *argv[])
|
|||||||
*share = 0;
|
*share = 0;
|
||||||
share++;
|
share++;
|
||||||
|
|
||||||
cli = connect_one(cmdline_auth_info, server, share);
|
cli = connect_one(cmdline_auth_info, server, port, share);
|
||||||
if (cli == NULL) {
|
if (cli == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user