[vlc-devel] [PATCH] sftp: check symbolic links when readdir
Rémi Denis-Courmont
remi at remlab.net
Sun Feb 11 10:26:50 CET 2018
Le sunnuntaina 11. helmikuuta 2018, 6.05.08 EET Zhao Zhili a écrit :
> ---
> modules/access/sftp.c | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/modules/access/sftp.c b/modules/access/sftp.c
> index 1219f573a1..cd5182e319 100644
> --- a/modules/access/sftp.c
> +++ b/modules/access/sftp.c
> @@ -649,7 +649,36 @@ static int DirRead (stream_t *p_access,
> input_item_node_t *p_current_node) }
> free( psz_uri );
>
> - int i_type = LIBSSH2_SFTP_S_ISDIR( attrs.permissions ) ?
> ITEM_TYPE_DIRECTORY : ITEM_TYPE_FILE; + int i_type;
> + if( LIBSSH2_SFTP_S_ISDIR( attrs.permissions ) )
> + {
> + i_type = ITEM_TYPE_DIRECTORY;
> + }
> + else if( LIBSSH2_SFTP_S_ISLNK( attrs.permissions ) )
> + {
> + vlc_url_t url;
> +
> + if( vlc_UrlParseFixup( &url, psz_full_uri ) != 0 )
> + {
> + vlc_UrlClean( &url );
> + free(psz_full_uri);
> + break;
> + }
> + if( libssh2_sftp_stat( p_sys->sftp_session, url.psz_path,
> &attrs ) ) + {
> + msg_Warn( p_access, "Impossible to get information about
> symbolic link %s", url.psz_path ); + vlc_UrlClean( &url );
> + free( psz_full_uri );
> + continue;
> + }
> + vlc_UrlClean( &url );
> + i_type = LIBSSH2_SFTP_S_ISDIR( attrs.permissions ) ?
> ITEM_TYPE_DIRECTORY : ITEM_TYPE_FILE; + }
> + else
> + {
> + i_type = ITEM_TYPE_FILE;
> + }
> +
> i_ret = vlc_readdir_helper_additem( &rdh, psz_full_uri, NULL,
> psz_file, i_type, ITEM_NET );
> free( psz_full_uri );
Same problem as before, AFAICT.
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list