Bug 6482 - smbget does not accept -u/p/w options with -R
smbget does not accept -u/p/w options with -R
Status: RESOLVED FIXED
Product: Samba 3.3
Classification: Unclassified
Component: Client tools
3.3.4
x86 Linux
: P3 minor
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
: 8400 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-17 12:13 UTC by TAKAHASHI Motonobu
Modified: 2016-02-05 08:58 UTC (History)
3 users (show)

See Also:


Attachments
possible patch (1.79 KB, patch)
2015-12-30 22:29 UTC, Christian Ambach
no flags Details
Patch for 4.3.x and 4.2.x with cherry-pick information (1.87 KB, patch)
2016-01-28 20:43 UTC, Christian Ambach
asn: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description TAKAHASHI Motonobu 2009-06-17 12:13:05 UTC
smbget does not accept -u/p/w options with -R:
-----
samba32a:/home/local/Work/samba-3.3.4/source# /usr/local/samba/bin/smbget smb://w2k8srv1/temp/ -w w2k8ad1 -u administrator -p password -R
Using workgroup w2k8ad1, user administrator
Can't open directory smb://w2k8srv1/temp//Samba: Permission denied
Can't open directory smb://w2k8srv1/temp//TE: Permission denied
You don't have enough permissions to access smb://w2k8srv1/temp//test1.txt
You don't have enough permissions to access smb://w2k8srv1/temp//test2.txt
You don't have enough permissions to access smb://w2k8srv1/temp//test3.txt
You don't have enough permissions to access smb://w2k8srv1/temp//test4.txt
samba32a:/home/local/Work/samba-3.3.4/source# /usr/local/samba/bin/smbget smb://w2k8srv1/temp/test1.txt -w w2k8ad1 -u administrator -p password
Using workgroup w2k8ad1, user administrator
smb://w2k8srv1/temp/test1.txt
-----

Thus "smb://w2k8srv1/temp/test1.txt" works but "-R smb://w2k8srv1/temp" does not work.
Comment 1 TAKAHASHI Motonobu 2009-06-17 12:14:57 UTC
# /usr/local/samba/bin/smbget smb://administrator:password@w2k8srv1/temp -R

The above command works well
Comment 2 TAKAHASHI Motonobu 2011-03-28 16:01:52 UTC
Still not fixed at Samba 3.5.4.
Comment 3 Bastiaan 2015-08-27 09:54:03 UTC
Seems to be related to the USER environment variable, ref https://bugzilla.samba.org/show_bug.cgi?id=8400
Comment 4 Ivan Liu 2015-12-08 08:53:19 UTC
on samba 3.6
This issue could still be reproduced.
It is not related with the USER environment at all.
I could download the file like this:
smbget --workgroup=AP -R -u xxx -p xxx  smb://locmirror/PATH/file.zip
But it failed to work like this
smbget --workgroup=AP -R -u xxx -p xxx -R smb://locmirror/PATH

No matter I add the --keep-permissions arg or not, it still not work.
Comment 5 Ivan Liu 2015-12-08 08:56:23 UTC
This issue is now a well known issue for samba, even the man page of Ubuntu already lists this:
http://manpages.ubuntu.com/manpages/natty/man1/smbget.1.html:
BUGS
       Permission denied is returned in some cases where the cause of the
       error is unknown (such as an illegally formatted smb:// url or trying
       to get a directory without -R turned on).
Comment 6 Chris Hirsch 2015-12-18 21:19:00 UTC
4.1.17 has this the same "permission" problem.

smbget -r -R smb://user:pass@host/C/share

transfers files successfully. 

Basically if -u and -p are used then the "permission" problem shows. If the user/pass is passed in as part of the URI/SMB:// then all is ok.
Comment 7 Christian Ambach 2015-12-30 22:29:20 UTC
Created attachment 11753 [details]
possible patch

This patch helps in my testing. Can you give it a try?
Comment 8 Christian Ambach 2015-12-30 22:32:48 UTC
*** Bug 8400 has been marked as a duplicate of this bug. ***
Comment 9 Christian Ambach 2016-01-28 20:43:05 UTC
Created attachment 11798 [details]
Patch for 4.3.x and 4.2.x with cherry-pick information
Comment 10 Andreas Schneider 2016-02-01 10:51:20 UTC
Comment on attachment 11798 [details]
Patch for 4.3.x and 4.2.x with cherry-pick information

LGTM
Comment 11 Andreas Schneider 2016-02-01 10:52:07 UTC
Karolin, please add the patch to the relevant branches. Thanks!
Comment 12 Karolin Seeger 2016-02-02 10:59:37 UTC
(In reply to Andreas Schneider from comment #11)
Pushed to autobuild-v4-[2|3]-test.
Comment 13 Karolin Seeger 2016-02-04 07:57:31 UTC
(In reply to Karolin Seeger from comment #12)
Pushed to v4-3-test, re-trying autobuild-v4-2-test
Comment 14 Karolin Seeger 2016-02-05 08:58:06 UTC
(In reply to Karolin Seeger from comment #13)
Pushed to all branches.
Closing out bug report.

Thanks!