summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-04-16 14:13:57 -0700
committerJeremy Allison <jra@samba.org>2013-06-11 10:50:41 -0700
commit47471c82d0d5a024a0c64eab68adae1d482bd972 (patch)
tree84647e74884274d49b7fefe654e00753482e5a82
parentccb5c2d6930eeb7672af33833adb195d0c525547 (diff)
downloadsamba-47471c82d0d5a024a0c64eab68adae1d482bd972.tar.gz
samba-47471c82d0d5a024a0c64eab68adae1d482bd972.tar.bz2
samba-47471c82d0d5a024a0c64eab68adae1d482bd972.zip
Plumb the 'port' parameter into the connect code.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
-rw-r--r--source3/libsmb/libsmb_server.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 91859fa0b2..1fe8fd0b8f 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -239,6 +239,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
SMBCCTX *context,
bool connect_if_not_found,
const char *server,
+ uint16_t port,
const char *share,
char **pp_workgroup,
char **pp_username,
@@ -421,20 +422,22 @@ SMBC_server_internal(TALLOC_CTX *ctx,
flags |= CLI_FULL_CONNECTION_USE_NT_HASH;
}
- if (share == NULL || *share == '\0' || is_ipc) {
- /*
- * Try 139 first for IPC$
- */
- status = cli_connect_nb(server_n, NULL, NBT_SMB_PORT, 0x20,
+ if (port == 0) {
+ if (share == NULL || *share == '\0' || is_ipc) {
+ /*
+ * Try 139 first for IPC$
+ */
+ status = cli_connect_nb(server_n, NULL, NBT_SMB_PORT, 0x20,
smbc_getNetbiosName(context),
SMB_SIGNING_DEFAULT, flags, &c);
+ }
}
if (!NT_STATUS_IS_OK(status)) {
/*
* No IPC$ or 139 did not work
*/
- status = cli_connect_nb(server_n, NULL, 0, 0x20,
+ status = cli_connect_nb(server_n, NULL, port, 0x20,
smbc_getNetbiosName(context),
SMB_SIGNING_DEFAULT, flags, &c);
}
@@ -506,7 +509,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
*pp_workgroup)) {
cli_shutdown(c);
srv = SMBC_server_internal(ctx, context, connect_if_not_found,
- newserver, newshare, pp_workgroup,
+ newserver, port, newshare, pp_workgroup,
pp_username, pp_password, in_cache);
TALLOC_FREE(newserver);
TALLOC_FREE(newshare);
@@ -639,7 +642,7 @@ SMBC_server(TALLOC_CTX *ctx,
bool in_cache = false;
srv = SMBC_server_internal(ctx, context, connect_if_not_found,
- server, share, pp_workgroup,
+ server, port, share, pp_workgroup,
pp_username, pp_password, &in_cache);
if (!srv) {