[vlc-devel] [PATCH] Accept port specifications in smb2, now that the underlying library supports them.
Michael Young
mwy-cpjbvr at the-youngs.org
Mon Jun 3 15:04:25 CEST 2019
On 6/3/19 8:17 AM, Hugo Beauzée-Luyssen wrote:
> On Mon, Jun 3, 2019, at 1:31 PM, Michael Young wrote:
>> ---
>> modules/access/smb2.c | 10 ++--------
>> 1 file changed, 2 insertions(+), 8 deletions(-)
>>
>> diff --git a/modules/access/smb2.c b/modules/access/smb2.c
>> index 41864ccfa8..7374956dea 100644
>> --- a/modules/access/smb2.c
>> +++ b/modules/access/smb2.c
>> @@ -58,8 +58,6 @@
>>
>> #include "smb_common.h"
>>
>> -#define CIFS_PORT 445
>> -
>> static int Open(vlc_object_t *);
>> static void Close(vlc_object_t *);
>>
>> @@ -583,10 +581,6 @@ Open(vlc_object_t *p_obj)
>> if (vlc_UrlParseFixup(&sys->encoded_url, access->psz_url) != 0)
>> return VLC_ENOMEM;
>>
>> - if (sys->encoded_url.i_port != 0 && sys->encoded_url.i_port != CIFS_PORT)
>> - goto error;
>> - sys->encoded_url.i_port = 0;
>> -
>> sys->smb2 = smb2_init_context();
>> if (sys->smb2 == NULL)
>> {
>> @@ -598,10 +592,10 @@ Open(vlc_object_t *p_obj)
>> sys->encoded_url.psz_path = (char *) "/";
>>
>> char *resolved_host = vlc_smb2_resolve(access, sys->encoded_url.psz_host,
>> - CIFS_PORT);
>> + mwy-cpjbvr at the-youngs.org);
>>
>> /* smb2_* functions need a decoded url. Re compose the url from the
>> - * modified sys->encoded_url (without port and with the resolved host). */
>> + * modified sys->encoded_url (with the resolved host). */
>> char *url;
>> if (resolved_host != NULL)
>> {
>
> Hi,
>
> AFAICS there is no libsmb2 release including this feature, what happens when a port is provided to an old version of the library?
>
The host:port would be interpreted as a host name, and the open would fail.
It would be reasonable to transform the default port to an empty port specification with:
if (sys->encoded_url.i_port =)= CIFS_PORT) sys->encoded_url.i_port = 0;
in case it is provided explicitly. I don't see anything adding the port number if it's
not provided, but I may have missed something.
Where does videolan get the version of libsmb2 for its builds?
I can pick that up and verify the behavior.
Thanks for your help and consideration!
More information about the vlc-devel
mailing list