summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/libsmb_internal.h1
-rw-r--r--source3/include/libsmbclient.h14
-rw-r--r--source3/libsmb/ABI/smbclient-0.1.0.sigs2
-rw-r--r--source3/libsmb/libsmb_context.c1
-rw-r--r--source3/libsmb/libsmb_path.c2
-rw-r--r--source3/libsmb/libsmb_setget.c19
-rw-r--r--source3/libsmb/wscript2
7 files changed, 39 insertions, 2 deletions
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index bd06b53e6c..7ce37d2645 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -244,6 +244,7 @@ struct SMBC_internal_data {
} smb;
#endif
+ uint16_t port;
};
/* Functions in libsmb_cache.c */
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index 61ff6a3b3b..5846e9bf44 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -76,6 +76,7 @@ extern "C" {
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
+#include <stdint.h>
#include <fcntl.h>
#include <utime.h>
@@ -507,6 +508,19 @@ void
smbc_setTimeout(SMBCCTX *c, int timeout);
+/**
+ * Get the TCP port used to connect (0 means default).
+ */
+uint16_t
+smbc_getPort(SMBCCTX *c);
+
+/**
+ * Set the TCP port used to connect (0 means default).
+ */
+void
+smbc_setPort(SMBCCTX *c, uint16_t port);
+
+
/***********************************
* Getters and setters for OPTIONS *
diff --git a/source3/libsmb/ABI/smbclient-0.1.0.sigs b/source3/libsmb/ABI/smbclient-0.1.0.sigs
index bbd7700aed..3dea59c42f 100644
--- a/source3/libsmb/ABI/smbclient-0.1.0.sigs
+++ b/source3/libsmb/ABI/smbclient-0.1.0.sigs
@@ -67,6 +67,7 @@ smbc_getOptionUseKerberos: smbc_bool (SMBCCTX *)
smbc_getOptionUserData: void *(SMBCCTX *)
smbc_getServerCacheData: struct smbc_server_cache *(SMBCCTX *)
smbc_getTimeout: int (SMBCCTX *)
+smbc_getPort: uint16_t (SMBCCTX *)
smbc_getUser: char *(SMBCCTX *)
smbc_getWorkgroup: char *(SMBCCTX *)
smbc_getdents: int (unsigned int, struct smbc_dirent *, int)
@@ -151,6 +152,7 @@ smbc_setOptionUseKerberos: void (SMBCCTX *, smbc_bool)
smbc_setOptionUserData: void (SMBCCTX *, void *)
smbc_setServerCacheData: void (SMBCCTX *, struct smbc_server_cache *)
smbc_setTimeout: void (SMBCCTX *, int)
+smbc_setPort: void (SMBCCTX *, uint16_t)
smbc_setUser: void (SMBCCTX *, char *)
smbc_setWorkgroup: void (SMBCCTX *, char *)
smbc_set_context: SMBCCTX *(SMBCCTX *)
diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c
index b529cbe7e3..6eb2996287 100644
--- a/source3/libsmb/libsmb_context.c
+++ b/source3/libsmb/libsmb_context.c
@@ -169,6 +169,7 @@ smbc_new_context(void)
smbc_setDebug(context, 0);
smbc_setTimeout(context, 20000);
+ smbc_setPort(context, 0);
smbc_setOptionFullTimeNames(context, False);
smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE);
diff --git a/source3/libsmb/libsmb_path.c b/source3/libsmb/libsmb_path.c
index b286691a21..6208f02951 100644
--- a/source3/libsmb/libsmb_path.c
+++ b/source3/libsmb/libsmb_path.c
@@ -239,7 +239,7 @@ SMBC_parse_path(TALLOC_CTX *ctx,
/* Ensure these returns are at least valid pointers. */
*pp_server = talloc_strdup(ctx, "");
- *p_port = 0;
+ *p_port = smbc_getPort(context);
*pp_share = talloc_strdup(ctx, "");
*pp_path = talloc_strdup(ctx, "");
*pp_user = talloc_strdup(ctx, "");
diff --git a/source3/libsmb/libsmb_setget.c b/source3/libsmb/libsmb_setget.c
index 60bbc8bc5e..0bd5290f4b 100644
--- a/source3/libsmb/libsmb_setget.c
+++ b/source3/libsmb/libsmb_setget.c
@@ -116,6 +116,25 @@ smbc_setTimeout(SMBCCTX *c, int timeout)
c->timeout = timeout;
}
+/**
+ * Get the TCP port used to connect.
+ */
+uint16_t
+smbc_getPort(SMBCCTX *c)
+{
+ return c->internal->port;
+}
+
+/**
+ * Set the TCP port used to connect.
+ */
+void
+smbc_setPort(SMBCCTX *c, uint16_t port)
+{
+ c->internal->port = port;
+}
+
+
/** Get whether to log to standard error instead of standard output */
smbc_bool
smbc_getOptionDebugToStderr(SMBCCTX *c)
diff --git a/source3/libsmb/wscript b/source3/libsmb/wscript
index c5444b09bb..9750ed3a20 100644
--- a/source3/libsmb/wscript
+++ b/source3/libsmb/wscript
@@ -27,5 +27,5 @@ def build(bld):
public_headers='../include/libsmbclient.h',
abi_directory='ABI',
abi_match='smbc_*',
- vnum='0.2.0',
+ vnum='0.2.1',
pc_files='smbclient.pc')