[vlc-devel] [PATCH v3 3/4] smb2: support browsing IPv6 nodes

Pierre Lamot pierre at videolabs.io
Fri May 29 10:57:01 CEST 2020


  Url of items discovered when listing smb2 folders where ill-formed on IPv6
  hosts.
---
 modules/access/smb2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index 17063c8406..c98c66a857 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -326,7 +326,10 @@ vlc_smb2_get_url(vlc_url_t *url, const char *file)
     /* smb2://<psz_host><psz_path><file>?<psz_option> */
     struct vlc_memstream buf;
     vlc_memstream_open(&buf);
-    vlc_memstream_printf(&buf, "smb://%s", url->psz_host);
+    if (strchr(url->psz_host, ':') != NULL)
+        vlc_memstream_printf(&buf, "smb://[%s]", url->psz_host);
+    else
+        vlc_memstream_printf(&buf, "smb://%s", url->psz_host);
 
     if (url->psz_path != NULL)
     {
-- 
2.25.1



More information about the vlc-devel mailing list