After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 698071 - gvfs-smb dont respect port in URI
gvfs-smb dont respect port in URI
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: smb backend
1.14.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
: 687713 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-04-15 17:48 UTC by Leonardo Amaral
Modified: 2014-03-24 07:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
smb: Add support for specifying custom port (16.12 KB, patch)
2013-04-30 14:39 UTC, Tomas Bzatek
committed Details | Review

Description Leonardo Amaral 2013-04-15 17:48:23 UTC
A attempt to do "gvfs-mount smb://leonardo@192.168.10.253:7777/" results this in tcpdump:

14:24:55.474939 IP betty.local.56187 > 192.168.10.253.netbios-ssn: Flags [S], seq 3672391142, win 14600, options [mss 1460,sackOK,TS val 110904158 ecr 0,nop,wscale 7], length 0
14:24:55.814397 IP betty.local.57215 > 192.168.10.253.microsoft-ds: Flags [S], seq 1134756601, win 14600, options [mss 1460,sackOK,TS val 110904243 ecr 0,nop,wscale 7], length 0

This is needed by http://codesector.com/droidnas and works ok with:

"sudo mount.cifs //192.168.10.253/SD\ Card /media/leonardo/celular -o user=leonardo,uid=1000,gid=1000,dirmode=0755,file_mode=0644,port=7777"

Version and compilation source:

gvfs-backends:
  Instalado: 1.14.2-0ubuntu0.1ppa8~quantal1
  Candidato: 1.14.2-0ubuntu0.1ppa8~quantal1
  Tabela de versão:
 *** 1.14.2-0ubuntu0.1ppa8~quantal1 0
        500 http://ppa.launchpad.net/langdalepl/gvfs-mtp/ubuntu/ quantal/main amd64 Packages
        100 /var/lib/dpkg/status
     1.14.2-0ubuntu0.1 0
        500 http://br.archive.ubuntu.com/ubuntu/ quantal-proposed/main amd64 Packages
     1.14.0-0ubuntu6 0
        500 http://br.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
Comment 1 Tomas Bzatek 2013-04-15 18:24:22 UTC
Yes, that's correct, libsmbclient doesn't allow us to control port we're trying to connect. Please complain at samba developers, we would like to see this supported as well.
Comment 2 Leonardo Amaral 2013-04-15 18:41:06 UTC
Tomas, Thanks a lot! I've filled a bug https://bugzilla.samba.org/show_bug.cgi?id=9796

A second (OFFTOPIC) comment about this bug: I want this fixed to allow DroidNAS to work in Ubuntu. Have some support in gvfs/nautilus to shares announced in Bonjour system? Cause DroidNAS announces this connection (to port 7777, since it does not requires root on Android) via Bonjour and Apple devices mount it ok.
Comment 3 Jeremy Allison 2013-04-15 22:54:41 UTC
Ok, what I want is for the gvfs developers to tell me exactly what interface you
want for this in libsmbclient.

I'm thinking of 2 extra calls:

uint16_t smbc_getPort(SMBCCTX *c)
void smbc_setPort(SMBCCTX *c, uint16_t port);

Does that work for you ?

Jeremy.
Comment 4 Tomas Bzatek 2013-04-16 13:49:44 UTC
Thanks for kicking in, Jeremy. The request has been hanging in Samba bugzilla for some time, see https://bugzilla.samba.org/show_bug.cgi?id=9452

(In reply to comment #3)
> I'm thinking of 2 extra calls:
> 
> uint16_t smbc_getPort(SMBCCTX *c)
> void smbc_setPort(SMBCCTX *c, uint16_t port);

Either that or by parsing the information out of URI passed in smbc_stat_fn for example. Your choice, it's equally easy on gvfs side.
Comment 5 Tomas Bzatek 2013-04-16 13:51:00 UTC
*** Bug 687713 has been marked as a duplicate of this bug. ***
Comment 6 Jeremy Allison 2013-04-18 21:16:38 UTC
Ok, I have uploaded a patch to samba-master to samba bug:

https://bugzilla.samba.org/show_bug.cgi?id=9796

that should fix this. It should fit directly into gvfs so you can pass in a smb://user@host:port/share/path and it should work. I also added the:

uint16_t smbc_getPort(SMBCCTX *c);
void smbc_setPort(SMBCCTX *c, uint16_t port);

Calls but please don't use these as these will be a Samba 4.1.0 and above only change. The url parsing fix should work without having to change the .so numbers as it isn't an ABI change.

Jeremy.
Comment 7 Jeremy Allison 2013-04-26 22:04:05 UTC
Ping - can you let me know if this fix works for you ? It works in my testing.

Not getting feedback from you is preventing me from getting this into master.

Jeremy.
Comment 8 Leonardo Amaral 2013-04-27 00:53:14 UTC
Im waiting for some src release
Comment 9 Jeremy Allison 2013-04-27 04:03:37 UTC
What source release are you waiting for ? This patch is available as a git-am source code patch attached to the samba bug report.

Jeremy.
Comment 10 SF 2013-04-27 12:59:17 UTC
I would like to test this as an end user, however, I will need also need a patch for gvfs-smb to try it.
Comment 11 Tomas Bzatek 2013-04-30 14:39:26 UTC
Created attachment 242922 [details] [review]
smb: Add support for specifying custom port

Proof of concept patch, untested, I'm unable to spend more time on this at the moment. Will ask somebody to actually test it. This patch basically adds the port argument in the URI.
Comment 12 Leonardo Amaral 2013-04-30 16:59:19 UTC
Someway to users test this side-by-side with a production environment w/o mess things?
Comment 13 Ondrej Holy 2013-05-28 14:44:41 UTC
(In reply to comment #7)
> Ping - can you let me know if this fix works for you ? It works in my testing.
> 
> Not getting feedback from you is preventing me from getting this into master.
> 
> Jeremy.

(In reply to comment #11)
> Created an attachment (id=242922) [details] [review]
> smb: Add support for specifying custom port
> 
> Proof of concept patch, untested, I'm unable to spend more time on this at the
> moment. Will ask somebody to actually test it. This patch basically adds the
> port argument in the URI.

I've test the patches today and it's worked for me.
Comment 14 Ondrej Holy 2013-05-28 14:46:45 UTC
(In reply to comment #12)
> Someway to users test this side-by-side with a production environment w/o mess
> things?

Probably there is no easy way to test it currently, you need to compile samba master with announced patch and also compile gvfs with attached patch.
Comment 15 Ondrej Holy 2013-05-28 14:49:59 UTC
Review of attachment 242922 [details] [review]:

It looks good.
Comment 16 Ondrej Holy 2013-05-28 14:58:25 UTC
commit ba7981734456b86787777c119821a17e7dbe5737
Comment 17 pingou67 2014-02-22 12:50:27 UTC
It doesn't seem to work with gvfs version 1.18.3.
Comment 18 pingou67 2014-02-22 15:05:13 UTC
More information, with this command:

gvfs-mount smb://user@localhost:1390/user

With a tcpdump we can see it try to resolv the name "localhost:1390" :

127.0.0.1.58163 > 127.0.1.1.53: [bad udp cksum 0xff3b -> 0xe0b2!] 58098+ A? localhost:1390. (32)
Comment 19 Jeremy Allison 2014-02-26 00:17:29 UTC
Upstream code went into Samba 4.1.0 and above, so if you're using this version of above of Samba it should work.

Jeremy.
Comment 20 Ross Lagerwall 2014-03-24 07:54:27 UTC
I can confirm that it does try to use the specified port when using gvfs 1.18.3 and Samba 4.1.6.