unc: split out Windows support from smb
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 18 Mar 2018 17:23:53 +0000 (19:23 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 18 Mar 2018 17:31:19 +0000 (19:31 +0200)
Too many #ifdef's, not to mention different effective license.

configure.ac
modules/MODULES_LIST
modules/access/Makefile.am
modules/access/samba.c [new file with mode: 0644]
modules/access/smb.c [deleted file]
modules/access/unc.c [new file with mode: 0644]
po/POTFILES.in

index 3a53e04..52a2eb4 100644 (file)
@@ -1851,8 +1851,7 @@ PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0]
 dnl
 dnl  libsmbclient plugin
 dnl
-PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smb], [smbclient], (SMB/CIFS support), [auto])
-AS_IF([test "${SYS}" = "mingw32" -a "${enable_winstore_app}" != "yes"], [ VLC_ADD_PLUGIN([smb]) ])
+PKG_ENABLE_MODULES_VLC([SMBCLIENT], [smbc], [smbclient], (SMB/CIFS support), [auto])
 
 dnl
 dnl  liBDSM access module
index e625ed7..2c0cce5 100644 (file)
@@ -328,6 +328,7 @@ $Id$
  * rtp: rtp demux module
  * rtpvideo: encoder for raw video over RTP
  * rv32: RV32 image format conversion module
+ * samba: Samba / libsmbclient input
  * samplerate: Secret Rabbit Code (libsamplerate) audio resampler
  * sap: Interface module to read SAP/SDP announcements
  * sapi: Windows Text to Speech Synthetizer using the SAPI 5.1 API
@@ -354,7 +355,6 @@ $Id$
  * simple_channel_mixer: channel mixer
  * skins2: Skinnable interface, new generation
  * skiptags: APE & ID3 tags-skipping stream filter
- * smb: SMB shares access module
  * smf: Standard MIDI file demuxer
  * sndio: OpenBSD sndio audio output
  * soxr: SoX Resampler library audio filter
@@ -419,6 +419,7 @@ $Id$
  * udp: UDP Network access module
  * ugly_resampler: Ugly audio resampler
  * uleaddvaudio: codec for DV Audio from Ulead
+ * unc: Microsoft Windows networking / Universal Naming Convention
  * upnp: libupnp UPNP service discovery
  * v4l2: Video 4 Linux 2 input module
  * vaapi: VAAPI hardware-accelerated decoding with vout backend
index 956bfd0..d1578be 100644 (file)
@@ -341,15 +341,12 @@ libaccess_mms_plugin_la_CFLAGS = $(AM_CFLAGS)
 libaccess_mms_plugin_la_LIBADD = $(SOCKET_LIBS)
 access_LTLIBRARIES += libaccess_mms_plugin.la
 
-libsmb_plugin_la_SOURCES = access/smb.c access/smb_common.h
-libsmb_plugin_la_CFLAGS = $(AM_CFLAGS) $(SMBCLIENT_CFLAGS)
-libsmb_plugin_la_LIBADD = $(SMBCLIENT_LIBS)
-if HAVE_WIN32
-libsmb_plugin_la_LIBADD += -lmpr -lnetapi32
-endif
-libsmb_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(accessdir)'
-access_LTLIBRARIES += $(LTLIBsmb)
-EXTRA_LTLIBRARIES += libsmb_plugin.la
+libsmbc_plugin_la_SOURCES = access/samba.c access/smb_common.h
+libsmbc_plugin_la_CFLAGS = $(AM_CFLAGS) $(SMBCLIENT_CFLAGS)
+libsmbc_plugin_la_LIBADD = $(SMBCLIENT_LIBS)
+libsmbc_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(accessdir)'
+access_LTLIBRARIES += $(LTLIBsmbc)
+EXTRA_LTLIBRARIES += libsmbc_plugin.la
 
 libdsm_plugin_la_SOURCES = access/dsm/access.c access/dsm/sd.c access/smb_common.h
 libdsm_plugin_la_CFLAGS = $(AM_CFLAGS) $(DSM_CFLAGS)
@@ -366,6 +363,14 @@ libudp_plugin_la_SOURCES = access/udp.c
 libudp_plugin_la_LIBADD = $(SOCKET_LIBS) $(LIBPTHREAD)
 access_LTLIBRARIES += libudp_plugin.la
 
+libunc_plugin_la_SOURCES = access/unc.c access/smb_common.h
+libunc_plugin_la_LIBADD = -lmpr -lnetapi32
+if HAVE_WIN32
+if !HAVE_WINSTORE
+access_LTLIBRARIES += libunc_plugin.la
+endif
+endif
+
 libsftp_plugin_la_SOURCES = access/sftp.c
 libsftp_plugin_la_CFLAGS = $(AM_CFLAGS) $(SFTP_CFLAGS)
 libsftp_plugin_la_LIBADD = $(SFTP_LIBS)
diff --git a/modules/access/samba.c b/modules/access/samba.c
new file mode 100644 (file)
index 0000000..83b5204
--- /dev/null
@@ -0,0 +1,378 @@
+/*****************************************************************************
+ * samba.c: Samba / libsmbclient input module
+ *****************************************************************************
+ * Copyright (C) 2001-2015 VLC authors and VideoLAN
+ *
+ * Authors: Gildas Bazin <gbazin@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <libsmbclient.h>
+
+#include <vlc_common.h>
+#include <vlc_fs.h>
+#include <vlc_plugin.h>
+#include <vlc_access.h>
+#include <vlc_input_item.h>
+#include <vlc_url.h>
+#include <vlc_keystore.h>
+
+#include "smb_common.h"
+
+struct access_sys_t
+{
+    int i_smb;
+    uint64_t size;
+    vlc_url_t url;
+};
+
+/* Build an SMB URI
+ * smb://[[[domain;]user[:password@]]server[/share[/path[/file]]]] */
+static int smb_get_uri( stream_t *p_access, char **ppsz_uri,
+                        const char *psz_domain,
+                        const char *psz_user, const char *psz_pwd,
+                        const char *psz_server, const char *psz_share_path,
+                        const char *psz_name )
+{
+    assert(psz_server);
+#define PSZ_SHARE_PATH_OR_NULL psz_share_path ? psz_share_path : ""
+#define PSZ_NAME_OR_NULL psz_name ? "/" : "", psz_name ? psz_name : ""
+    (void) p_access;
+    if( psz_user )
+        return asprintf( ppsz_uri, "smb://%s%s%s%s%s@%s%s%s%s",
+                         psz_domain ? psz_domain : "", psz_domain ? ";" : "",
+                         psz_user, psz_pwd ? ":" : "",
+                         psz_pwd ? psz_pwd : "", psz_server,
+                         PSZ_SHARE_PATH_OR_NULL, PSZ_NAME_OR_NULL );
+    else
+        return asprintf( ppsz_uri, "smb://%s%s%s%s", psz_server,
+                         PSZ_SHARE_PATH_OR_NULL, PSZ_NAME_OR_NULL );
+}
+
+/*****************************************************************************
+ * Seek: try to go at the right place
+ *****************************************************************************/
+static int Seek( stream_t *p_access, uint64_t i_pos )
+{
+    access_sys_t *p_sys = p_access->p_sys;
+    int64_t      i_ret;
+
+    if( i_pos >= INT64_MAX )
+        return VLC_EGENERIC;
+
+    msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
+
+    i_ret = smbc_lseek( p_sys->i_smb, i_pos, SEEK_SET );
+    if( i_ret == -1 )
+    {
+        msg_Err( p_access, "seek failed (%s)", vlc_strerror_c(errno) );
+        return VLC_EGENERIC;
+    }
+
+    return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * Read:
+ *****************************************************************************/
+static ssize_t Read( stream_t *p_access, void *p_buffer, size_t i_len )
+{
+    access_sys_t *p_sys = p_access->p_sys;
+    int i_read;
+
+    i_read = smbc_read( p_sys->i_smb, p_buffer, i_len );
+    if( i_read < 0 )
+    {
+        msg_Err( p_access, "read failed (%s)", vlc_strerror_c(errno) );
+        i_read = 0;
+    }
+
+    return i_read;
+}
+
+/*****************************************************************************
+ * DirRead:
+ *****************************************************************************/
+static int DirRead (stream_t *p_access, input_item_node_t *p_node )
+{
+    access_sys_t *p_sys = p_access->p_sys;
+    int i_ret = VLC_SUCCESS;
+
+    struct vlc_readdir_helper rdh;
+    vlc_readdir_helper_init( &rdh, p_access, p_node );
+
+    struct smbc_dirent *p_entry;
+
+    while( i_ret == VLC_SUCCESS && ( p_entry = smbc_readdir( p_sys->i_smb ) ) )
+    {
+        char *psz_uri;
+        const char *psz_server = p_sys->url.psz_host;
+        const char *psz_path = p_sys->url.psz_path;
+        const char *psz_name = p_entry->name;
+        int i_type;
+
+        switch( p_entry->smbc_type )
+        {
+        case SMBC_SERVER:
+        case SMBC_WORKGROUP:
+            psz_server = p_sys->url.psz_host;
+            psz_path = NULL;
+            psz_name = NULL;
+        case SMBC_FILE_SHARE:
+        case SMBC_DIR:
+            i_type = ITEM_TYPE_DIRECTORY;
+            break;
+        case SMBC_FILE:
+            i_type = ITEM_TYPE_FILE;
+            break;
+        default:
+        case SMBC_PRINTER_SHARE:
+        case SMBC_COMMS_SHARE:
+        case SMBC_IPC_SHARE:
+        case SMBC_LINK:
+            continue;
+        }
+
+        char *psz_encoded_name = NULL;
+        if( psz_name != NULL
+         && ( psz_encoded_name = vlc_uri_encode( psz_name ) ) == NULL )
+        {
+            i_ret = VLC_ENOMEM;
+            break;
+        }
+        if( smb_get_uri( p_access, &psz_uri, NULL, NULL, NULL,
+                         psz_server, psz_path, psz_encoded_name ) < 0 )
+        {
+            free(psz_encoded_name);
+            i_ret = VLC_ENOMEM;
+            break;
+        }
+        free(psz_encoded_name);
+        i_ret = vlc_readdir_helper_additem( &rdh, psz_uri, NULL, p_entry->name,
+                                            i_type, ITEM_NET );
+        free( psz_uri );
+    }
+
+    vlc_readdir_helper_finish( &rdh, i_ret == VLC_SUCCESS );
+
+    return i_ret;
+}
+
+/*****************************************************************************
+ * Control:
+ *****************************************************************************/
+static int Control( stream_t *p_access, int i_query, va_list args )
+{
+    access_sys_t *sys = p_access->p_sys;
+
+    switch( i_query )
+    {
+    case STREAM_CAN_SEEK:
+    case STREAM_CAN_PAUSE:
+    case STREAM_CAN_CONTROL_PACE:
+        *va_arg( args, bool* ) = true;
+        break;
+
+    case STREAM_CAN_FASTSEEK:
+        *va_arg( args, bool* ) = false;
+        break;
+
+    case STREAM_GET_SIZE:
+        if( p_access->pf_readdir != NULL )
+            return VLC_EGENERIC;
+        *va_arg( args, uint64_t * ) = sys->size;
+        break;
+
+    case STREAM_GET_PTS_DELAY:
+        *va_arg( args, int64_t * ) = INT64_C(1000)
+            * var_InheritInteger( p_access, "network-caching" );
+        break;
+
+    case STREAM_SET_PAUSE_STATE:
+        /* Nothing to do */
+        break;
+
+    default:
+        return VLC_EGENERIC;
+    }
+
+    return VLC_SUCCESS;
+}
+
+static void smb_auth(const char *srv, const char *shr, char *wg, int wglen,
+                     char *un, int unlen, char *pw, int pwlen)
+{
+    VLC_UNUSED(srv);
+    VLC_UNUSED(shr);
+    VLC_UNUSED(wg);
+    VLC_UNUSED(wglen);
+    VLC_UNUSED(un);
+    VLC_UNUSED(unlen);
+    VLC_UNUSED(pw);
+    VLC_UNUSED(pwlen);
+    //wglen = unlen = pwlen = 0;
+}
+
+static int Open(vlc_object_t *obj)
+{
+    stream_t *access = (stream_t *)obj;
+    vlc_url_t url;
+    vlc_credential credential;
+    char *psz_decoded_path = NULL, *psz_uri = NULL, *psz_var_domain = NULL;
+    int fd;
+    uint64_t size;
+    bool is_dir;
+
+    if (smbc_init(smb_auth, 0))
+        return VLC_EGENERIC;
+
+    if (vlc_UrlParseFixup(&url, access->psz_url) != 0)
+    {
+        vlc_UrlClean(&url);
+        return VLC_EGENERIC;
+    }
+
+    if (url.psz_path != NULL)
+    {
+        psz_decoded_path = vlc_uri_decode_duplicate(url.psz_path);
+        if (psz_decoded_path == NULL)
+        {
+            vlc_UrlClean(&url);
+            return VLC_EGENERIC;
+        }
+    }
+
+    vlc_credential_init(&credential, &url);
+    psz_var_domain = var_InheritString(access, "smb-domain");
+    credential.psz_realm = psz_var_domain;
+    vlc_credential_get(&credential, access, "smb-user", "smb-pwd", NULL, NULL);
+
+    for (;;)
+    {
+        struct stat st;
+
+        if (smb_get_uri(access, &psz_uri, credential.psz_realm,
+                        credential.psz_username, credential.psz_password,
+                        url.psz_host, psz_decoded_path, NULL ) == -1 )
+        {
+            vlc_credential_clean(&credential);
+            free(psz_var_domain);
+            free(psz_decoded_path);
+            vlc_UrlClean(&url);
+            return VLC_ENOMEM;
+        }
+
+        if (smbc_stat(psz_uri, &st) == 0)
+        {
+            is_dir = S_ISDIR(st.st_mode) != 0;
+            size = st.st_size;
+            break;
+        }
+
+        /* smbc_stat() fails with servers or shares. Assume directory. */
+        is_dir = true;
+        size = 0;
+
+        if (errno != EACCES)
+            break;
+
+        errno = 0;
+        if (!vlc_credential_get(&credential, access, "smb-user",
+                                "smb-pwd", SMB_LOGIN_DIALOG_TITLE,
+                                SMB_LOGIN_DIALOG_TEXT, url.psz_host))
+            break;
+    }
+
+    vlc_credential_store(&credential, access);
+    vlc_credential_clean(&credential);
+    free(psz_var_domain);
+    free(psz_decoded_path);
+
+    /* Init access */
+    access_sys_t *sys = vlc_obj_calloc(obj, 1, sizeof (*sys));
+    if (unlikely(sys == NULL))
+    {
+        free(psz_uri);
+        vlc_UrlClean(&url);
+        return VLC_ENOMEM;
+    }
+
+    access->p_sys = sys;
+
+    if (is_dir)
+    {
+        sys->url = url;
+        access->pf_readdir = DirRead;
+        access->pf_control = access_vaDirectoryControlHelper;
+        fd = smbc_opendir(psz_uri);
+        if (fd < 0)
+            vlc_UrlClean(&sys->url);
+    }
+    else
+    {
+        access->pf_read = Read;
+        access->pf_control = Control;
+        access->pf_seek = Seek;
+        fd = smbc_open(psz_uri, O_RDONLY, 0);
+        vlc_UrlClean(&url);
+    }
+    free(psz_uri);
+
+    if (fd < 0)
+    {
+        msg_Err(obj, "cannot open %s: %s",
+                access->psz_location, vlc_strerror_c(errno));
+        return VLC_EGENERIC;
+    }
+
+    sys->size = size;
+    sys->i_smb = fd;
+
+    return VLC_SUCCESS;
+}
+
+static void Close(vlc_object_t *obj)
+{
+    stream_t *access = (stream_t *)obj;
+    access_sys_t *sys = access->p_sys;
+
+    vlc_UrlClean(&sys->url);
+
+    if (access->pf_readdir != NULL)
+        smbc_closedir(sys->i_smb);
+    else
+        smbc_close(sys->i_smb);
+}
+
+vlc_module_begin()
+    set_shortname("SMB")
+    set_description(N_("SMB input"))
+    set_help(N_("Samba (Windows network shares) input"))
+    set_capability("access", 0)
+    set_category(CAT_INPUT)
+    set_subcategory(SUBCAT_INPUT_ACCESS)
+    add_string("smb-user", NULL, SMB_USER_TEXT, SMB_USER_LONGTEXT, false)
+    add_password("smb-pwd", NULL, SMB_PASS_TEXT, SMB_PASS_LONGTEXT, false)
+    add_string("smb-domain", NULL, SMB_DOMAIN_TEXT, SMB_DOMAIN_LONGTEXT, false)
+    add_shortcut("smb")
+    set_callbacks(Open, Close)
+vlc_module_end()
diff --git a/modules/access/smb.c b/modules/access/smb.c
deleted file mode 100644 (file)
index 19dd3b3..0000000
+++ /dev/null
@@ -1,520 +0,0 @@
-/*****************************************************************************
- * smb.c: SMB input module
- *****************************************************************************
- * Copyright (C) 2001-2015 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Gildas Bazin <gbazin@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <assert.h>
-#include <errno.h>
-#ifdef _WIN32
-#   include <fcntl.h>
-#   include <sys/stat.h>
-#   include <io.h>
-#   include <windows.h>
-#   include <lm.h>
-#   define smbc_open(a,b,c) vlc_open(a,b,c)
-#   define smbc_stat(a,b) _stati64(a,b)
-#   define smbc_read read
-#   define smbc_lseek _lseeki64
-#   define smbc_close close
-#else
-#   include <libsmbclient.h>
-#endif
-
-#include <vlc_common.h>
-#include <vlc_fs.h>
-#include <vlc_plugin.h>
-#include <vlc_access.h>
-#include <vlc_input_item.h>
-#include <vlc_url.h>
-#include <vlc_keystore.h>
-#include <vlc_charset.h>
-
-#include "smb_common.h"
-
-struct access_sys_t
-{
-    int i_smb;
-    uint64_t size;
-    vlc_url_t url;
-};
-
-#ifdef _WIN32
-static void Win32AddConnection(stream_t *access, const char *server,
-                               const char *share, const char *user,
-                               const char *pwd, const char *domain)
-{
-    NETRESOURCE net_resource;
-    char remote_name[MAX_PATH];
-
-    VLC_UNUSED(domain);
-
-    memset(&net_resource, 0, sizeof (net_resource));
-    net_resource.dwType = RESOURCETYPE_DISK;
-
-    snprintf(remote_name, sizeof (remote_name), "\\\\%s\\%s", server,
-             (share != NULL) ? share + 1 /* skip leading '/' */: "");
-
-    /* remove trailings '/' */
-    char *delim = strchr(remote_name, '/');
-    if (delim != NULL)
-        *delim = '\0';
-
-    const char *msg;
-    net_resource.lpRemoteName = remote_name;
-
-    switch (WNetAddConnection2(&net_resource, pwd, user, 0))
-    {
-        case NO_ERROR:
-            msg = "connected to %s";
-            break;
-        case ERROR_ALREADY_ASSIGNED:
-        case ERROR_DEVICE_ALREADY_REMEMBERED:
-            msg = "already connected to %s";
-            break;
-        default:
-            msg = "failed to connect to %s";
-    }
-    msg_Dbg(access, msg, remote_name);
-}
-#endif // _WIN32
-
-/* Build an SMB URI
- * smb://[[[domain;]user[:password@]]server[/share[/path[/file]]]] */
-static int smb_get_uri( stream_t *p_access, char **ppsz_uri,
-                        const char *psz_domain,
-                        const char *psz_user, const char *psz_pwd,
-                        const char *psz_server, const char *psz_share_path,
-                        const char *psz_name )
-{
-    assert(psz_server);
-#define PSZ_SHARE_PATH_OR_NULL psz_share_path ? psz_share_path : ""
-#define PSZ_NAME_OR_NULL psz_name ? "/" : "", psz_name ? psz_name : ""
-#ifdef _WIN32
-    if( psz_user )
-        Win32AddConnection( p_access, psz_server, psz_share_path,
-                            psz_user, psz_pwd, psz_domain );
-    return asprintf( ppsz_uri, "//%s%s%s%s", psz_server, PSZ_SHARE_PATH_OR_NULL,
-                     PSZ_NAME_OR_NULL );
-#else
-    (void) p_access;
-    if( psz_user )
-        return asprintf( ppsz_uri, "smb://%s%s%s%s%s@%s%s%s%s",
-                         psz_domain ? psz_domain : "", psz_domain ? ";" : "",
-                         psz_user, psz_pwd ? ":" : "",
-                         psz_pwd ? psz_pwd : "", psz_server,
-                         PSZ_SHARE_PATH_OR_NULL, PSZ_NAME_OR_NULL );
-    else
-        return asprintf( ppsz_uri, "smb://%s%s%s%s", psz_server,
-                         PSZ_SHARE_PATH_OR_NULL, PSZ_NAME_OR_NULL );
-#endif
-}
-
-/*****************************************************************************
- * Seek: try to go at the right place
- *****************************************************************************/
-static int Seek( stream_t *p_access, uint64_t i_pos )
-{
-    access_sys_t *p_sys = p_access->p_sys;
-    int64_t      i_ret;
-
-    if( i_pos >= INT64_MAX )
-        return VLC_EGENERIC;
-
-    msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
-
-    i_ret = smbc_lseek( p_sys->i_smb, i_pos, SEEK_SET );
-    if( i_ret == -1 )
-    {
-        msg_Err( p_access, "seek failed (%s)", vlc_strerror_c(errno) );
-        return VLC_EGENERIC;
-    }
-
-    return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * Read:
- *****************************************************************************/
-static ssize_t Read( stream_t *p_access, void *p_buffer, size_t i_len )
-{
-    access_sys_t *p_sys = p_access->p_sys;
-    int i_read;
-
-    i_read = smbc_read( p_sys->i_smb, p_buffer, i_len );
-    if( i_read < 0 )
-    {
-        msg_Err( p_access, "read failed (%s)", vlc_strerror_c(errno) );
-        i_read = 0;
-    }
-
-    return i_read;
-}
-
-/*****************************************************************************
- * DirRead:
- *****************************************************************************/
-static int DirRead (stream_t *p_access, input_item_node_t *p_node )
-{
-    access_sys_t *p_sys = p_access->p_sys;
-    int i_ret = VLC_SUCCESS;
-
-    struct vlc_readdir_helper rdh;
-    vlc_readdir_helper_init( &rdh, p_access, p_node );
-
-#ifndef _WIN32
-    struct smbc_dirent *p_entry;
-
-    while( i_ret == VLC_SUCCESS && ( p_entry = smbc_readdir( p_sys->i_smb ) ) )
-    {
-        char *psz_uri;
-        const char *psz_server = p_sys->url.psz_host;
-        const char *psz_path = p_sys->url.psz_path;
-        const char *psz_name = p_entry->name;
-        int i_type;
-
-        switch( p_entry->smbc_type )
-        {
-        case SMBC_SERVER:
-        case SMBC_WORKGROUP:
-            psz_server = p_sys->url.psz_host;
-            psz_path = NULL;
-            psz_name = NULL;
-        case SMBC_FILE_SHARE:
-        case SMBC_DIR:
-            i_type = ITEM_TYPE_DIRECTORY;
-            break;
-        case SMBC_FILE:
-            i_type = ITEM_TYPE_FILE;
-            break;
-        default:
-        case SMBC_PRINTER_SHARE:
-        case SMBC_COMMS_SHARE:
-        case SMBC_IPC_SHARE:
-        case SMBC_LINK:
-            continue;
-        }
-
-        char *psz_encoded_name = NULL;
-        if( psz_name != NULL
-         && ( psz_encoded_name = vlc_uri_encode( psz_name ) ) == NULL )
-        {
-            i_ret = VLC_ENOMEM;
-            break;
-        }
-        if( smb_get_uri( p_access, &psz_uri, NULL, NULL, NULL,
-                         psz_server, psz_path, psz_encoded_name ) < 0 )
-        {
-            free(psz_encoded_name);
-            i_ret = VLC_ENOMEM;
-            break;
-        }
-        free(psz_encoded_name);
-        i_ret = vlc_readdir_helper_additem( &rdh, psz_uri, NULL, p_entry->name,
-                                            i_type, ITEM_NET );
-        free( psz_uri );
-    }
-#else
-    // Handle share listing from here. Directory browsing is handled by the
-    // usual filesystem module.
-    SHARE_INFO_1 *p_info;
-    DWORD i_share_enum_res;
-    DWORD i_nb_elem;
-    DWORD i_resume_handle = 0;
-    DWORD i_total_elements; // Unused, but needs to be passed
-    wchar_t *wpsz_host = ToWide( p_sys->url.psz_host );
-    if( wpsz_host == NULL )
-        return VLC_ENOMEM;
-    do
-    {
-        i_share_enum_res = NetShareEnum( wpsz_host, 1, (LPBYTE*)&p_info,
-                              MAX_PREFERRED_LENGTH, &i_nb_elem,
-                              &i_total_elements, &i_resume_handle );
-        if( i_share_enum_res == ERROR_SUCCESS ||
-            i_share_enum_res == ERROR_MORE_DATA )
-        {
-            for ( DWORD i = 0; i < i_nb_elem; ++i )
-            {
-                SHARE_INFO_1 *p_current = p_info + i;
-                if( p_current->shi1_type & STYPE_SPECIAL )
-                    continue;
-                char* psz_name = FromWide( p_current->shi1_netname );
-                if( psz_name == NULL )
-                {
-                    i_ret = VLC_ENOMEM;
-                    break;
-                }
-
-                char* psz_path;
-                if( smb_get_uri( p_access, &psz_path, NULL, NULL, NULL,
-                                 p_sys->url.psz_host, p_sys->url.psz_path,
-                                 psz_name ) < 0 )
-                {
-                    free( psz_name );
-                    i_ret = VLC_ENOMEM;
-                    break;
-                }
-                // We need to concatenate the scheme before, as the window version
-                // of smb_get_uri generates a path (and the other call site needs
-                // a path). The path is already prefixed by "//" so we just need
-                // to add "file:"
-                char* psz_uri;
-                if( asprintf( &psz_uri, "file:%s", psz_path ) < 0 )
-                {
-                    free( psz_name );
-                    free( psz_path );
-                    i_ret = VLC_ENOMEM;
-                    break;
-                }
-                free( psz_path );
-
-                i_ret = vlc_readdir_helper_additem( &rdh, psz_uri, NULL,
-                                    psz_name, ITEM_TYPE_DIRECTORY, ITEM_NET );
-                free( psz_name );
-                free( psz_uri );
-            }
-        }
-        NetApiBufferFree( p_info );
-    } while( i_share_enum_res == ERROR_MORE_DATA && i_ret == VLC_SUCCESS );
-
-    free( wpsz_host );
-#endif
-
-    vlc_readdir_helper_finish( &rdh, i_ret == VLC_SUCCESS );
-
-    return i_ret;
-}
-
-/*****************************************************************************
- * Control:
- *****************************************************************************/
-static int Control( stream_t *p_access, int i_query, va_list args )
-{
-    access_sys_t *sys = p_access->p_sys;
-
-    switch( i_query )
-    {
-    case STREAM_CAN_SEEK:
-    case STREAM_CAN_PAUSE:
-    case STREAM_CAN_CONTROL_PACE:
-        *va_arg( args, bool* ) = true;
-        break;
-
-    case STREAM_CAN_FASTSEEK:
-        *va_arg( args, bool* ) = false;
-        break;
-
-    case STREAM_GET_SIZE:
-        if( p_access->pf_readdir != NULL )
-            return VLC_EGENERIC;
-        *va_arg( args, uint64_t * ) = sys->size;
-        break;
-
-    case STREAM_GET_PTS_DELAY:
-        *va_arg( args, int64_t * ) = INT64_C(1000)
-            * var_InheritInteger( p_access, "network-caching" );
-        break;
-
-    case STREAM_SET_PAUSE_STATE:
-        /* Nothing to do */
-        break;
-
-    default:
-        return VLC_EGENERIC;
-    }
-
-    return VLC_SUCCESS;
-}
-
-#ifndef _WIN32
-static void smb_auth(const char *srv, const char *shr, char *wg, int wglen,
-                     char *un, int unlen, char *pw, int pwlen)
-{
-    VLC_UNUSED(srv);
-    VLC_UNUSED(shr);
-    VLC_UNUSED(wg);
-    VLC_UNUSED(wglen);
-    VLC_UNUSED(un);
-    VLC_UNUSED(unlen);
-    VLC_UNUSED(pw);
-    VLC_UNUSED(pwlen);
-    //wglen = unlen = pwlen = 0;
-}
-#endif
-
-static int Open(vlc_object_t *obj)
-{
-    stream_t *access = (stream_t *)obj;
-    vlc_url_t url;
-    vlc_credential credential;
-    char *psz_decoded_path = NULL, *psz_uri = NULL, *psz_var_domain = NULL;
-    int fd;
-    uint64_t size;
-    bool is_dir;
-
-#ifndef _WIN32
-    if (smbc_init(smb_auth, 0))
-        return VLC_EGENERIC;
-#endif
-
-    if (vlc_UrlParseFixup(&url, access->psz_url) != 0)
-    {
-        vlc_UrlClean(&url);
-        return VLC_EGENERIC;
-    }
-
-    if (url.psz_path != NULL)
-    {
-        psz_decoded_path = vlc_uri_decode_duplicate(url.psz_path);
-        if (psz_decoded_path == NULL)
-        {
-            vlc_UrlClean(&url);
-            return VLC_EGENERIC;
-        }
-    }
-
-    vlc_credential_init(&credential, &url);
-    psz_var_domain = var_InheritString(access, "smb-domain");
-    credential.psz_realm = psz_var_domain;
-    vlc_credential_get(&credential, access, "smb-user", "smb-pwd", NULL, NULL);
-
-    for (;;)
-    {
-        struct stat st;
-
-        if (smb_get_uri(access, &psz_uri, credential.psz_realm,
-                        credential.psz_username, credential.psz_password,
-                        url.psz_host, psz_decoded_path, NULL ) == -1 )
-        {
-            vlc_credential_clean(&credential);
-            free(psz_var_domain);
-            free(psz_decoded_path);
-            vlc_UrlClean(&url);
-            return VLC_ENOMEM;
-        }
-
-        if (smbc_stat(psz_uri, &st) == 0)
-        {
-            is_dir = S_ISDIR(st.st_mode) != 0;
-            size = st.st_size;
-            break;
-        }
-
-        /* smbc_stat() fails with servers or shares. Assume directory. */
-        is_dir = true;
-        size = 0;
-
-        if (errno != EACCES)
-            break;
-
-        errno = 0;
-        if (!vlc_credential_get(&credential, access, "smb-user",
-                                "smb-pwd", SMB_LOGIN_DIALOG_TITLE,
-                                SMB_LOGIN_DIALOG_TEXT, url.psz_host))
-            break;
-    }
-
-    vlc_credential_store(&credential, access);
-    vlc_credential_clean(&credential);
-    free(psz_var_domain);
-    free(psz_decoded_path);
-
-    /* Init access */
-    access_sys_t *sys = vlc_obj_calloc(obj, 1, sizeof (*sys));
-    if (unlikely(sys == NULL))
-    {
-        free(psz_uri);
-        vlc_UrlClean(&url);
-        return VLC_ENOMEM;
-    }
-
-    access->p_sys = sys;
-
-    if (is_dir)
-    {
-        sys->url = url;
-        access->pf_readdir = DirRead;
-        access->pf_control = access_vaDirectoryControlHelper;
-#ifndef _WIN32
-        fd = smbc_opendir(psz_uri);
-        if (fd < 0)
-            vlc_UrlClean(&sys->url);
-#endif
-    }
-    else
-    {
-        access->pf_read = Read;
-        access->pf_control = Control;
-        access->pf_seek = Seek;
-        fd = smbc_open(psz_uri, O_RDONLY, 0);
-        vlc_UrlClean(&url);
-    }
-    free(psz_uri);
-
-#ifndef _WIN32
-    if (fd < 0)
-    {
-        msg_Err(obj, "cannot open %s: %s",
-                access->psz_location, vlc_strerror_c(errno));
-        return VLC_EGENERIC;
-    }
-#endif
-
-    sys->size = size;
-    sys->i_smb = fd;
-
-    return VLC_SUCCESS;
-}
-
-static void Close(vlc_object_t *obj)
-{
-    stream_t *access = (stream_t *)obj;
-    access_sys_t *sys = access->p_sys;
-
-    vlc_UrlClean(&sys->url);
-
-#ifndef _WIN32
-    if (access->pf_readdir != NULL)
-        smbc_closedir(sys->i_smb);
-    else
-#endif
-        smbc_close(sys->i_smb);
-}
-
-vlc_module_begin()
-    set_shortname("SMB")
-    set_description(N_("SMB input"))
-    set_help(N_("Samba (Windows network shares) input"))
-    set_capability("access", 0)
-    set_category(CAT_INPUT)
-    set_subcategory(SUBCAT_INPUT_ACCESS)
-    add_string("smb-user", NULL, SMB_USER_TEXT, SMB_USER_LONGTEXT, false)
-    add_password("smb-pwd", NULL, SMB_PASS_TEXT, SMB_PASS_LONGTEXT, false)
-    add_string("smb-domain", NULL, SMB_DOMAIN_TEXT, SMB_DOMAIN_LONGTEXT, false)
-    add_shortcut("smb")
-    set_callbacks(Open, Close)
-vlc_module_end()
diff --git a/modules/access/unc.c b/modules/access/unc.c
new file mode 100644 (file)
index 0000000..c54c348
--- /dev/null
@@ -0,0 +1,385 @@
+/*****************************************************************************
+ * unc.c: Microsoft Windows Universal Naming Convention input module
+ *****************************************************************************
+ * Copyright (C) 2001-2015 VLC authors and VideoLAN
+ *
+ * Authors: Gildas Bazin <gbazin@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <io.h>
+#include <windows.h>
+#include <lm.h>
+
+#include <vlc_common.h>
+#include <vlc_fs.h>
+#include <vlc_plugin.h>
+#include <vlc_access.h>
+#include <vlc_input_item.h>
+#include <vlc_url.h>
+#include <vlc_keystore.h>
+#include <vlc_charset.h>
+
+#include "smb_common.h"
+
+struct access_sys_t
+{
+    int i_smb;
+    uint64_t size;
+    vlc_url_t url;
+};
+
+static void Win32AddConnection(stream_t *access, const char *server,
+                               const char *share, const char *user,
+                               const char *pwd, const char *domain)
+{
+    NETRESOURCE net_resource;
+    char remote_name[MAX_PATH];
+
+    VLC_UNUSED(domain);
+
+    memset(&net_resource, 0, sizeof (net_resource));
+    net_resource.dwType = RESOURCETYPE_DISK;
+
+    snprintf(remote_name, sizeof (remote_name), "\\\\%s\\%s", server,
+             (share != NULL) ? share + 1 /* skip leading '/' */: "");
+
+    /* remove trailings '/' */
+    char *delim = strchr(remote_name, '/');
+    if (delim != NULL)
+        *delim = '\0';
+
+    const char *msg;
+    net_resource.lpRemoteName = remote_name;
+
+    switch (WNetAddConnection2(&net_resource, pwd, user, 0))
+    {
+        case NO_ERROR:
+            msg = "connected to %s";
+            break;
+        case ERROR_ALREADY_ASSIGNED:
+        case ERROR_DEVICE_ALREADY_REMEMBERED:
+            msg = "already connected to %s";
+            break;
+        default:
+            msg = "failed to connect to %s";
+    }
+    msg_Dbg(access, msg, remote_name);
+}
+
+/* Build an SMB URI
+ * smb://[[[domain;]user[:password@]]server[/share[/path[/file]]]] */
+static int smb_get_uri( stream_t *p_access, char **ppsz_uri,
+                        const char *psz_domain,
+                        const char *psz_user, const char *psz_pwd,
+                        const char *psz_server, const char *psz_share_path,
+                        const char *psz_name )
+{
+    assert(psz_server);
+#define PSZ_SHARE_PATH_OR_NULL psz_share_path ? psz_share_path : ""
+#define PSZ_NAME_OR_NULL psz_name ? "/" : "", psz_name ? psz_name : ""
+    if( psz_user )
+        Win32AddConnection( p_access, psz_server, psz_share_path,
+                            psz_user, psz_pwd, psz_domain );
+    return asprintf( ppsz_uri, "//%s%s%s%s", psz_server, PSZ_SHARE_PATH_OR_NULL,
+                     PSZ_NAME_OR_NULL );
+}
+
+static int Seek( stream_t *p_access, uint64_t i_pos )
+{
+    access_sys_t *p_sys = p_access->p_sys;
+    int64_t      i_ret;
+
+    if( i_pos >= INT64_MAX )
+        return VLC_EGENERIC;
+
+    msg_Dbg( p_access, "seeking to %"PRId64, i_pos );
+
+    i_ret = lseek( p_sys->i_smb, i_pos, SEEK_SET );
+    if( i_ret == -1 )
+    {
+        msg_Err( p_access, "seek failed (%s)", vlc_strerror_c(errno) );
+        return VLC_EGENERIC;
+    }
+
+    return VLC_SUCCESS;
+}
+
+static ssize_t Read( stream_t *p_access, void *p_buffer, size_t i_len )
+{
+    access_sys_t *p_sys = p_access->p_sys;
+    int i_read;
+
+    i_read = read( p_sys->i_smb, p_buffer, i_len );
+    if( i_read < 0 )
+    {
+        msg_Err( p_access, "read failed (%s)", vlc_strerror_c(errno) );
+        i_read = 0;
+    }
+
+    return i_read;
+}
+
+static int DirRead(stream_t *p_access, input_item_node_t *p_node)
+{
+    access_sys_t *p_sys = p_access->p_sys;
+    int i_ret = VLC_SUCCESS;
+
+    struct vlc_readdir_helper rdh;
+    vlc_readdir_helper_init( &rdh, p_access, p_node );
+
+    // Handle share listing from here. Directory browsing is handled by the
+    // usual filesystem module.
+    SHARE_INFO_1 *p_info;
+    DWORD i_share_enum_res;
+    DWORD i_nb_elem;
+    DWORD i_resume_handle = 0;
+    DWORD i_total_elements; // Unused, but needs to be passed
+    wchar_t *wpsz_host = ToWide( p_sys->url.psz_host );
+    if( wpsz_host == NULL )
+        return VLC_ENOMEM;
+    do
+    {
+        i_share_enum_res = NetShareEnum( wpsz_host, 1, (LPBYTE*)&p_info,
+                              MAX_PREFERRED_LENGTH, &i_nb_elem,
+                              &i_total_elements, &i_resume_handle );
+        if( i_share_enum_res == ERROR_SUCCESS ||
+            i_share_enum_res == ERROR_MORE_DATA )
+        {
+            for ( DWORD i = 0; i < i_nb_elem; ++i )
+            {
+                SHARE_INFO_1 *p_current = p_info + i;
+                if( p_current->shi1_type & STYPE_SPECIAL )
+                    continue;
+                char* psz_name = FromWide( p_current->shi1_netname );
+                if( psz_name == NULL )
+                {
+                    i_ret = VLC_ENOMEM;
+                    break;
+                }
+
+                char* psz_path;
+                if( smb_get_uri( p_access, &psz_path, NULL, NULL, NULL,
+                                 p_sys->url.psz_host, p_sys->url.psz_path,
+                                 psz_name ) < 0 )
+                {
+                    free( psz_name );
+                    i_ret = VLC_ENOMEM;
+                    break;
+                }
+                // We need to concatenate the scheme before, as the window version
+                // of smb_get_uri generates a path (and the other call site needs
+                // a path). The path is already prefixed by "//" so we just need
+                // to add "file:"
+                char* psz_uri;
+                if( asprintf( &psz_uri, "file:%s", psz_path ) < 0 )
+                {
+                    free( psz_name );
+                    free( psz_path );
+                    i_ret = VLC_ENOMEM;
+                    break;
+                }
+                free( psz_path );
+
+                i_ret = vlc_readdir_helper_additem( &rdh, psz_uri, NULL,
+                                    psz_name, ITEM_TYPE_DIRECTORY, ITEM_NET );
+                free( psz_name );
+                free( psz_uri );
+            }
+        }
+        NetApiBufferFree( p_info );
+    } while( i_share_enum_res == ERROR_MORE_DATA && i_ret == VLC_SUCCESS );
+
+    free( wpsz_host );
+
+    vlc_readdir_helper_finish( &rdh, i_ret == VLC_SUCCESS );
+
+    return i_ret;
+}
+
+static int Control( stream_t *p_access, int i_query, va_list args )
+{
+    access_sys_t *sys = p_access->p_sys;
+
+    switch( i_query )
+    {
+    case STREAM_CAN_SEEK:
+    case STREAM_CAN_PAUSE:
+    case STREAM_CAN_CONTROL_PACE:
+        *va_arg( args, bool* ) = true;
+        break;
+
+    case STREAM_CAN_FASTSEEK:
+        *va_arg( args, bool* ) = false;
+        break;
+
+    case STREAM_GET_SIZE:
+        if( p_access->pf_readdir != NULL )
+            return VLC_EGENERIC;
+        *va_arg( args, uint64_t * ) = sys->size;
+        break;
+
+    case STREAM_GET_PTS_DELAY:
+        *va_arg( args, int64_t * ) = INT64_C(1000)
+            * var_InheritInteger( p_access, "network-caching" );
+        break;
+
+    case STREAM_SET_PAUSE_STATE:
+        /* Nothing to do */
+        break;
+
+    default:
+        return VLC_EGENERIC;
+    }
+
+    return VLC_SUCCESS;
+}
+
+static int Open(vlc_object_t *obj)
+{
+    stream_t *access = (stream_t *)obj;
+    vlc_url_t url;
+    vlc_credential credential;
+    char *psz_decoded_path = NULL, *psz_uri = NULL, *psz_var_domain = NULL;
+    int fd;
+    uint64_t size;
+    bool is_dir;
+
+    if (vlc_UrlParseFixup(&url, access->psz_url) != 0)
+    {
+        vlc_UrlClean(&url);
+        return VLC_EGENERIC;
+    }
+
+    if (url.psz_path != NULL)
+    {
+        psz_decoded_path = vlc_uri_decode_duplicate(url.psz_path);
+        if (psz_decoded_path == NULL)
+        {
+            vlc_UrlClean(&url);
+            return VLC_EGENERIC;
+        }
+    }
+
+    vlc_credential_init(&credential, &url);
+    psz_var_domain = var_InheritString(access, "smb-domain");
+    credential.psz_realm = psz_var_domain;
+    vlc_credential_get(&credential, access, "smb-user", "smb-pwd", NULL, NULL);
+
+    for (;;)
+    {
+        struct stat st;
+
+        if (smb_get_uri(access, &psz_uri, credential.psz_realm,
+                        credential.psz_username, credential.psz_password,
+                        url.psz_host, psz_decoded_path, NULL ) == -1 )
+        {
+            vlc_credential_clean(&credential);
+            free(psz_var_domain);
+            free(psz_decoded_path);
+            vlc_UrlClean(&url);
+            return VLC_ENOMEM;
+        }
+
+        if (stat(psz_uri, &st) == 0)
+        {
+            is_dir = S_ISDIR(st.st_mode) != 0;
+            size = st.st_size;
+            break;
+        }
+
+        /* stat() fails with servers or shares. Assume directory. */
+        is_dir = true;
+        size = 0;
+
+        if (errno != EACCES)
+            break;
+
+        errno = 0;
+        if (!vlc_credential_get(&credential, access, "smb-user",
+                                "smb-pwd", SMB_LOGIN_DIALOG_TITLE,
+                                SMB_LOGIN_DIALOG_TEXT, url.psz_host))
+            break;
+    }
+
+    vlc_credential_store(&credential, access);
+    vlc_credential_clean(&credential);
+    free(psz_var_domain);
+    free(psz_decoded_path);
+
+    /* Init access */
+    access_sys_t *sys = vlc_obj_calloc(obj, 1, sizeof (*sys));
+    if (unlikely(sys == NULL))
+    {
+        free(psz_uri);
+        vlc_UrlClean(&url);
+        return VLC_ENOMEM;
+    }
+
+    access->p_sys = sys;
+
+    if (is_dir)
+    {
+        sys->url = url;
+        access->pf_readdir = DirRead;
+        access->pf_control = access_vaDirectoryControlHelper;
+    }
+    else
+    {
+        access->pf_read = Read;
+        access->pf_control = Control;
+        access->pf_seek = Seek;
+        fd = open(psz_uri, O_RDONLY, 0);
+        vlc_UrlClean(&url);
+    }
+    free(psz_uri);
+
+    sys->size = size;
+    sys->i_smb = fd;
+
+    return VLC_SUCCESS;
+}
+
+static void Close(vlc_object_t *obj)
+{
+    stream_t *access = (stream_t *)obj;
+    access_sys_t *sys = access->p_sys;
+
+    vlc_UrlClean(&sys->url);
+    close(sys->i_smb);
+}
+
+vlc_module_begin()
+    set_shortname("UNC")
+    set_description(N_("UNC input"))
+    set_help(N_("Microsoft Windows networking (UNC) input"))
+    set_capability("access", 0)
+    set_category(CAT_INPUT)
+    set_subcategory(SUBCAT_INPUT_ACCESS)
+    add_string("smb-user", NULL, SMB_USER_TEXT, SMB_USER_LONGTEXT, false)
+    add_password("smb-pwd", NULL, SMB_PASS_TEXT, SMB_PASS_LONGTEXT, false)
+    add_string("smb-domain", NULL, SMB_DOMAIN_TEXT, SMB_DOMAIN_LONGTEXT, false)
+    add_shortcut("smb")
+    set_callbacks(Open, Close)
+vlc_module_end()
index abe9d6d..5c0f753 100644 (file)
@@ -205,6 +205,7 @@ modules/access/qtsound.m
 modules/access/rdp.c
 modules/access/rtp/rtp.c
 modules/access/rtsp/access.c
+modules/access/samba.c
 modules/access/satip.c
 modules/access/screen/screen.c
 modules/access/screen/wayland.c
@@ -212,12 +213,12 @@ modules/access/screen/xcb.c
 modules/access/sdp.c
 modules/access/sftp.c
 modules/access/shm.c
-modules/access/smb.c
 modules/access/smb_common.h
 modules/access/srt.c
 modules/access/tcp.c
 modules/access/timecode.c
 modules/access/udp.c
+modules/access/unc.c
 modules/access/v4l2/controls.c
 modules/access/v4l2/v4l2.c
 modules/access/vcd/vcd.c