[vlc-devel] [PATCH 2/2] smb2: support browsing IPv6 nodes
Pierre Lamot
pierre at videolabs.io
Thu May 28 15:58:29 CEST 2020
Url of items discovered when listing smb2 folders where ill-formed on IPv6
hosts.
---
modules/access/smb2.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index d287493e4f..afa3e08d1c 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -324,7 +324,14 @@ vlc_smb2_get_url(vlc_url_t *url, const char *file)
{
/* smb2://<psz_host><psz_path><file>?<psz_option> */
char *buf;
- if (asprintf(&buf, "smb://%s%s%s%s%s%s", url->psz_host,
+ const char* fmt;
+
+ if (strchr(url->psz_host, ':') != NULL)
+ fmt = "smb://[%s]%s%s%s%s%s";
+ else
+ fmt = "smb://%s%s%s%s%s%s";
+
+ if (asprintf(&buf, fmt, url->psz_host,
url->psz_path != NULL ? url->psz_path : "",
url->psz_path != NULL && url->psz_path[0] != '\0' &&
url->psz_path[strlen(url->psz_path) - 1] != '/' ? "/" : "",
--
2.25.1
More information about the vlc-devel
mailing list