GNOME Bugzilla – Bug 698071
gvfs-smb dont respect port in URI
Last modified: 2014-03-24 07:54:27 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
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.
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.
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.
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.
*** Bug 687713 has been marked as a duplicate of this bug. ***
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.
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.
Im waiting for some src release
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.
I would like to test this as an end user, however, I will need also need a patch for gvfs-smb to try it.
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.
Someway to users test this side-by-side with a production environment w/o mess things?
(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.
(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.
Review of attachment 242922 [details] [review]: It looks good.
commit ba7981734456b86787777c119821a17e7dbe5737
It doesn't seem to work with gvfs version 1.18.3.
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)
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.
I can confirm that it does try to use the specified port when using gvfs 1.18.3 and Samba 4.1.6.