Pavel Shilovsky [Thu, 3 Sep 2020 16:58:46 +0000 (09:58 -0700)]
cifs-utils: bump version to 6.11
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Aurelien Aptel [Mon, 27 Jul 2020 08:34:44 +0000 (10:34 +0200)]
CVE-2020-14342: mount.cifs: fix shell command injection
A bug has been reported recently for the mount.cifs utility which is
part of the cifs-utils package. The tool has a shell injection issue
where one can embed shell commands via the username mount option. Those
commands will be run via popen() in the context of the user calling
mount.
The bug requires cifs-utils to be built with --with-systemd (enabled
by default if supported).
A quick test to check if the mount.cifs binary is vulnerable is to look
for popen() calls like so:
$ nm mount.cifs | grep popen
U popen@@GLIBC_2.2.5
If the user is allowed to run mount.cifs via sudo, he can obtain a root
shell.
sudo mount.cifs -o username='`sh`' //1 /mnt
If mount.cifs has the setuid bit, the command will still be run as the
calling user (no privilege escalation).
The bug was introduced in June 2012 with commit
4e264031d0da7d3f2
("mount.cifs: Use systemd's mechanism for getting password, if
present.").
Affected versions:
cifs-utils-5.6
cifs-utils-5.7
cifs-utils-5.8
cifs-utils-5.9
cifs-utils-6.0
cifs-utils-6.1
cifs-utils-6.2
cifs-utils-6.3
cifs-utils-6.4
cifs-utils-6.5
cifs-utils-6.6
cifs-utils-6.7
cifs-utils-6.8
cifs-utils-6.9
cifs-utils-6.10
Bug: https://bugzilla.samba.org/show_bug.cgi?id=14442
Reported-by: Vadim Lebedev <vadim@mbdsys.com>
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Pavel Shilovsky [Mon, 16 Dec 2019 23:34:56 +0000 (15:34 -0800)]
cifs-utils: bump version to 6.10
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Pavel Shilovsky [Mon, 16 Dec 2019 23:20:28 +0000 (15:20 -0800)]
Rename secdesc-ui.py to smb2-secdesc
Pavel Shilovsky [Sat, 14 Dec 2019 00:52:53 +0000 (16:52 -0800)]
Properly install mount.smb3 helper files
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Ronnie Sahlberg [Fri, 13 Dec 2019 00:30:00 +0000 (10:30 +1000)]
Install smb2-quota and its manpage
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Kenneth D'souza [Thu, 21 Nov 2019 15:10:56 +0000 (20:40 +0530)]
smb2-quota: Simplify code logic for quota entries.
This patch changes the program name from smb2quota to
smb2-quota and uses a simple code logic for quota entries.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Signed-off-by: Ronnie Sahlberg <lsahlberg@redhat.com>
Kenneth D'souza [Thu, 14 Nov 2019 17:55:51 +0000 (23:25 +0530)]
Add program name to error output instead of static mount.cifs
As we are supporting mount.smb3 to be invoked, the error output
should contain the called program and not mount.cifs
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Kenneth D'souza [Wed, 13 Nov 2019 17:01:26 +0000 (22:31 +0530)]
Add support for smb3 alias/fstype in mount.cifs.c
As we will slowly move towards smb3 filesystem,
supporting through "mount -t smb3" is important.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Aurelien Aptel [Mon, 14 Oct 2019 17:06:25 +0000 (19:06 +0200)]
smbinfo.rst: document new `keys` command
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Kenneth D'souza [Wed, 9 Oct 2019 06:01:51 +0000 (11:31 +0530)]
mount.cifs.rst: remove prefixpath mount option.
This option is deprecated and currently ignored since
kernel v3.10
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Kenneth D'souza [Tue, 24 Sep 2019 05:01:39 +0000 (10:31 +0530)]
smb2quota.rst: Add man page for smb2quota.py
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Kenneth D'souza [Tue, 24 Sep 2019 04:56:11 +0000 (10:26 +0530)]
smb2quota.py: Userspace helper to display quota information
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Pavel Shilovsky [Fri, 4 Oct 2019 00:29:00 +0000 (17:29 -0700)]
smbinfo: add bash completion support for setcompression
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Ronnie Sahlberg [Thu, 3 Oct 2019 23:29:02 +0000 (09:29 +1000)]
smbinfo: Add SETCOMPRESSION support
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Steve French [Thu, 19 Sep 2019 09:21:16 +0000 (04:21 -0500)]
smbinfo: print the security information needed to decrypt wireshark trace
CCM encryption
Session Id: e2 3e ea ae 00 00 00 00
Session Key: 65 7e 0e d5 3c 06 5a 06 50 a3 ef 96 c1 64 3d 1f
Server Encryption Key: 5e 42 a7 b5 57 75 d6 56 4a 5d 33 97 e6 45 07 76
Server Decryption Key: 1f 64 db a3 0f 24 e3 4d b6 31 00 ab 9a af 22 47
Signed-off-by: Steve French <stfrench@microsoft.com>
Paulo Alcantara (SUSE) [Thu, 19 Sep 2019 12:12:26 +0000 (09:12 -0300)]
mount.cifs: Fix invalid free
When attemping to chdir into non-existing directories, mount.cifs
crashes.
This patch fixes the following ASAN report:
$ ./mount.cifs //localhost/foo /mnt/invalid-dir -o ...
/mnt/bar -o username=foo,password=foo,vers=1.0
Couldn't chdir to /mnt/bar: No such file or directory
=================================================================
==11846==ERROR: AddressSanitizer: attempting free on address which was
not malloc()-ed: 0x7ffd86332e97 in thread T0
#0 0x7f0860ca01e7 in
__interceptor_free (/usr/lib64/libasan.so.5+0x10a1e7)
#1 0x557edece9ccb in
acquire_mountpoint (/home/paulo/src/cifs-utils/mount.cifs+0xeccb)
#2 0x557edecea63d in
main (/home/paulo/src/cifs-utils/mount.cifs+0xf63d)
#3 0x7f08609f0bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
#4 0x557edece27d9 in
_start (/home/paulo/src/cifs-utils/mount.cifs+0x77d9)
Address 0x7ffd86332e97 is located in stack of thread T0 at offset 8951
in frame
#0 0x557edece9ce0 in
main (/home/paulo/src/cifs-utils/mount.cifs+0xece0)
This frame has 2 object(s):
[48, 52) 'rc' (line 1959)
[64, 72) 'mountpoint' (line 1955) <== Memory access at offset 8951
overflows this variable
HINT: this may be a false positive if your program uses some custom
stack unwind mechanism, swapcontext or vfork
(longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: bad-free (/usr/lib64/libasan.so.5+0x10a1e7)
in __interceptor_free
==11846==ABORTING
Fixes: bf7f48f4c7dc ("mount.cifs.c: fix memory leaks in main func")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: David Mulder <dmulder@suse.com>
Paulo Alcantara (SUSE) [Thu, 5 Sep 2019 18:49:35 +0000 (15:49 -0300)]
mount.cifs: Fix double-free issue when mounting with setuid root
It can be easily reproduced with the following:
# chmod +s `which mount.cifs`
# echo "//localhost/share /mnt cifs \
users,username=foo,password=XXXX" >> /etc/fstab
# su - foo
$ mount /mnt
free(): double free detected in tcache 2
Child process terminated abnormally.
The problem was that check_fstab() already freed orgoptions pointer
and then we freed it again in main() function.
Fixes: bf7f48f4c7dc ("mount.cifs.c: fix memory leaks in main func")
Signed-off-by: Paulo Alcantara (SUSE) <paulo@paulo.ac>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
misku [Wed, 31 Jul 2019 11:12:24 +0000 (13:12 +0200)]
Zero fill the allocated memory for new `struct cifs_ntsd`
Fixes a bug where `sacloffset` may not be set at all later on and therefore it
can contain the original memory contents == trash.
misku [Wed, 31 Jul 2019 11:11:18 +0000 (13:11 +0200)]
Zero fill the allocated memory for a new ACE
Fixes a bug inside a call to `verify_ace_flag`. When a flag string (char*)
passed as a first parameter is "0x0", the final flag value (the second
parameter - the value of a pointer to uint8_t) is not modified at all
and contains the original memory contents == trash.
Jiawen Liu [Tue, 6 Aug 2019 02:35:29 +0000 (10:35 +0800)]
mount.cifs.c: fix memory leaks in main func
In mount.cifs module, orgoptions and mountpoint in the main func
point to the memory allocated by func realpath and strndup respectively.
However, they are not freed before the main func returns so that the
memory leaks occurred.
The memory leak problem is reported by LeakSanitizer tool.
LeakSanitizer url: "https://github.com/google/sanitizers"
Here I free the pointers orgoptions and mountpoint before main
func returns.
Fixes:
7549ad5e7126 ("memory leaks: caused by func realpath and strndup")
Signed-off-by: Jiawen Liu <liujiawen10@huawei.com>
Reported-by: Jin Du <dujin1@huawei.com>
Reviewed-by: Saisai Zhang <zhangsaisai@huawei.com>
Reviewed-by: Aurélien Aptel <aaptel@suse.com>
Pavel Shilovsky [Tue, 7 May 2019 22:52:30 +0000 (15:52 -0700)]
smbinfo: add bash completion support for getcompression
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Kenneth D'souza [Mon, 22 Apr 2019 05:53:41 +0000 (11:23 +0530)]
getcifsacl: Add support for -R(recursive) option.
Add support for -R option so we can list the ACLs of all files and
directories recursively.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Ronnie Sahlberg [Thu, 11 Apr 2019 02:23:06 +0000 (12:23 +1000)]
smbinfo: add GETCOMPRESSION support
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Pavel Shilovsky [Thu, 18 Apr 2019 19:32:02 +0000 (12:32 -0700)]
getcifsacl: Fix usage message to include multiple files
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Kenneth D'souza [Wed, 17 Apr 2019 11:27:05 +0000 (16:57 +0530)]
smbinfo: Add bash completion support for smbinfo.
This help us better populate options using <tab> <tab>.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Kenneth D'souza [Wed, 17 Apr 2019 17:19:09 +0000 (22:49 +0530)]
getcifsacl: Add support to accept more paths
Accept more than one path on the getcifsacl command line.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Kenneth D'souza [Wed, 17 Apr 2019 10:06:46 +0000 (15:36 +0530)]
smbinfo: Improve help usage and add -h option.
Call usage only for -h case. This avoids cluttering the screen with long
help output.
As we are adding more options to the utility, the end error is just hidden.
Call short_usage wherever necessary.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Ronnie Sahlberg [Tue, 9 Apr 2019 02:39:29 +0000 (12:39 +1000)]
secdesc-ui.py: a UI to view the security descriptors on SMB2+ shares
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Pavel Shilovsky [Tue, 9 Apr 2019 00:21:17 +0000 (17:21 -0700)]
Update authors list
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Pavel Shilovsky [Fri, 5 Apr 2019 17:03:41 +0000 (10:03 -0700)]
cifs-utils: bump version to 6.9
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Pavel Shilovsky [Fri, 5 Apr 2019 17:01:48 +0000 (10:01 -0700)]
smbinfo: use constant for input buffer length
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Pavel Shilovsky [Fri, 5 Apr 2019 16:40:29 +0000 (09:40 -0700)]
Fix authors and maintainers
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Pavel Shilovsky [Thu, 4 Apr 2019 16:25:30 +0000 (16:25 +0000)]
mount.cifs.rst: mention kernel version for snapshots
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Steve French [Thu, 4 Apr 2019 04:46:34 +0000 (23:46 -0500)]
Update man page for mount.cifs to add new options
Add description of "snapshot" and "handletimeout" mount
options and a security section noting that the use of
cifs is discouraged, and various minor updates.
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Pavel Shilovsky [Wed, 3 Apr 2019 22:42:10 +0000 (22:42 +0000)]
mount.cifs: detect GMT format of snapshot version
In order to provide an easy way to access snapshots a GMT
token string should be allowed as a "snapshot" mount option
argument, not SMB 100-nanoseconds time only. Detect if the
argument is in GMT format and convert it to SMB 100-nanoseconds
time before passing to the kernel.
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Pavel Shilovsky [Wed, 3 Apr 2019 19:24:33 +0000 (12:24 -0700)]
mount.cifs: add more options to help message
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Steve French [Wed, 3 Apr 2019 02:18:27 +0000 (21:18 -0500)]
mount.cifs Add various missing parms from the help text
When you type mount.cifs --help there were more than 40 mount parms
missing. Add 12 of the more common ones to what is displayed by help.
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Pavel Shilovsky [Tue, 2 Apr 2019 18:40:40 +0000 (11:40 -0700)]
smbinfo: make argument order consistent
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Steve French [Fri, 29 Mar 2019 08:05:55 +0000 (03:05 -0500)]
smbinfo: Add ability to query snapshots (previous versions)
"smbinfo list-snapshots"
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Steve French [Sat, 16 Mar 2019 20:42:40 +0000 (15:42 -0500)]
smbinfo: missing help for fsctl-getobjid
Add usage description for new option fsctl-getobjid
See section 2.1.3.1 of MS-FSCC
Signed-off-by: Steve French <stfrench@microsoft.com>
Pavel Shilovsky [Sat, 16 Mar 2019 19:34:13 +0000 (12:34 -0700)]
cifs.upcall: fix a compiler warning
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Ronnie Sahlberg [Fri, 15 Mar 2019 06:22:15 +0000 (16:22 +1000)]
smbinfo: add fsctl-getobjid support
This will print the ObjectID buffer for the object.
This is an example on how to fetch FSCTL data for an object using
the passthrough API.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Pavel Shilovsky [Sat, 9 Mar 2019 00:28:45 +0000 (16:28 -0800)]
smbinfo: fix code style
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Steve French [Sat, 2 Mar 2019 05:11:25 +0000 (23:11 -0600)]
setcifsacl: fix adding ACE when owner sid in unexpected location
If owner information is after the ACEs instead of before (e.g. Azure servers) in the ACL query
then we would get "invalid argument" returned on setcifsacl -a (adding an ACE).
This fixes that.
Signed-off-by: Steve French <stfrench@microsoft.com>
Ronnie Sahlberg [Fri, 1 Mar 2019 02:05:58 +0000 (12:05 +1000)]
smbinfo: decode the ACEs
Decode the most common ACE types and provide a [-V]erbose option
to show the individual mask bits by name.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Kenneth D'souza [Thu, 21 Feb 2019 05:09:25 +0000 (10:39 +0530)]
getcifsacl: Improve help usage and add -h option.
Call getcifsacl_usage only for -h and default case.
For others error out with appropriate message.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Kenneth D'souza [Tue, 19 Feb 2019 01:43:43 +0000 (07:13 +0530)]
getcifsacl: Do not go to parse_sec_desc if getxattr fails.
Add more to the error message by printing the filename and error.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Reviewed-by: Steve French <stfrench@microsoft.com>
Pavel Shilovsky [Fri, 15 Feb 2019 20:03:44 +0000 (12:03 -0800)]
mount.cifs.rst: update vers=3.1.1 option description
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Kenneth D'souza [Fri, 15 Feb 2019 02:22:48 +0000 (07:52 +0530)]
Update mount.cifs with vers=default mount option and SMBv3.0.2
Add vers=3.0.2 as a valid option for SMBv3.0.2 and explain behavior
of vers=default.
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Hank Leininger [Tue, 12 Feb 2019 01:42:51 +0000 (18:42 -0700)]
Added rst2man.py to the search list.
Gentoo Linux and (historically?) OSX install with the .py suffix.
Signed-off-by: Hank Leininger <hlein@korelogic.com>
Aurelien Aptel [Thu, 14 Feb 2019 11:15:44 +0000 (12:15 +0100)]
mount.cifs: be more verbose and helpful regarding mount errors
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Paulo Alcantara [Wed, 13 Feb 2019 18:09:41 +0000 (16:09 -0200)]
cifs: Allow DNS resolver key to expire
This patch introduces a new '--expire' option that allows the user to
set a timeout value for the dns resolver key -- which is typically
useful for hostnames that may get their ip addresses changed under
long running mounts.
The default timeout value is set to 10 minutes.
Signed-off-by: Paulo Alcantara <palcantara@suse.de>
Ronnie Sahlberg [Wed, 13 Feb 2019 05:47:37 +0000 (15:47 +1000)]
smbinfo: add FileFsFullSizeInformation
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Ronnie Sahlberg [Wed, 13 Feb 2019 05:47:36 +0000 (15:47 +1000)]
smbinfo: Update the usage text with the new infolevels
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Steve French [Tue, 29 Jan 2019 13:03:01 +0000 (07:03 -0600)]
smbinfo: update help text
Add description for fileallinfo query option.
Note that there are eight other recently added query options, but they
are mostly a subset a "fileallinfo" so could be of little value
(and may even be very confusing if we documented all nine in the
help text in smbinfo, instead of just this one). The man page
has a full description of them.
Signed-off-by: Steve French <stfrench@microsoft.com>
Ronnie Sahlberg [Tue, 29 Jan 2019 06:53:57 +0000 (16:53 +1000)]
smbinfo: Add more File*Information classes
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Aurelien Aptel [Thu, 24 Jan 2019 17:13:56 +0000 (18:13 +0100)]
smbinfo.rst: document kernel version
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Ronnie Sahlberg [Wed, 3 Oct 2018 00:42:03 +0000 (10:42 +1000)]
smbinfo: add a utility to display smb specific information about objects
For example
smbinfo secdesc <file> will print the security descriptor
smbinfo quota <file> will print the quotas for the volume
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Pavel Shilovsky [Fri, 17 Aug 2018 18:13:45 +0000 (11:13 -0700)]
mount.cifs.rst: document vers=3.02 mount option
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Pavel Shilovsky [Fri, 17 Aug 2018 18:08:58 +0000 (11:08 -0700)]
mount.cifs.rst: document vers=3 mount option
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Aurelien Aptel [Wed, 8 Aug 2018 09:38:16 +0000 (11:38 +0200)]
mount.cifs.rst: more cleanups
* remove duplicates (netbiosname, rdma)
* remove snapshot
* document nostrictsync, domain, domainauto better
* point to vers= when talking about version requirements
* typos
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Aurelien Aptel [Wed, 8 Aug 2018 09:38:15 +0000 (11:38 +0200)]
checkopts: report duplicated options in man page
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Alexander Bokovoy [Tue, 17 Jul 2018 10:12:44 +0000 (13:12 +0300)]
cifs-utils: support rst2man-3
Python3 version of rst2man is called rst2man-3
Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Aurélien Aptel [Tue, 10 Jul 2018 15:50:43 +0000 (17:50 +0200)]
mount.cifs.rst: document missing options, correct wrong ones
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Aurélien Aptel [Tue, 10 Jul 2018 15:50:42 +0000 (17:50 +0200)]
checkopts: add python script to cross check mount options
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Kenneth Dsouza [Fri, 13 Jul 2018 18:19:59 +0000 (23:49 +0530)]
manpage: update mount.cifs manpage with info about rdma option
Signed-off-by: Kenneth Dsouza <kdsouza@redhat.com>
Aurelien Aptel [Tue, 15 May 2018 08:40:48 +0000 (10:40 +0200)]
mount.cifs.rst: document new (no)handlecache mount option
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Steve French <smfrench@gmail.com>
Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com>
Aurelien Aptel [Tue, 15 May 2018 08:12:32 +0000 (10:12 +0200)]
docs: cleanup rst formating
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Steve French <smfrench@gmail.com>
Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com>
Pavel Shilovsky [Fri, 9 Mar 2018 18:56:57 +0000 (10:56 -0800)]
cifs-utils: bump version to 6.8
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Kenneth Dsouza [Mon, 29 Jan 2018 16:46:08 +0000 (22:16 +0530)]
update mount.cifs manpage with info about echo_interval option.
Adds information regarding reconnection time.
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
Ronnie Sahlberg [Tue, 23 Jan 2018 00:48:01 +0000 (11:48 +1100)]
cifscreds: check optind before accessing argv[optind]
Redhat bugzilla:
1278543
This fixes a segfault for some incorrect usage, for example
cifscreds -u test
Reviewed-by: Steve French <smfrench@gmail.com>
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Zhang Xianwei [Fri, 8 Dec 2017 07:11:45 +0000 (15:11 +0800)]
manpage: update mount.cifs manpage with info about incomplete options
This commit
a1f3acd40b265f134a97a739a6898b3958d206b9 modified mount
parameters, but not updated mount.cifs manpage. Fix it.
Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
Jeff Layton [Sun, 29 Oct 2017 10:51:50 +0000 (06:51 -0400)]
manpage: update mount.cifs manpage with info about default version being mounted
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Mon, 23 Oct 2017 17:46:33 +0000 (13:46 -0400)]
doc: convert pod files to rst
Aurelien did a big conversion of raw troff files into .pod docs in a
recent patch. That worked out pretty well, but I have some reservations
about using POD as a canonical format.
While it does make it pretty simple to write manpages, it's sort of an
obscure format, and is heavily associated with perl. Meanwhile, the
kernel is slowly moving to using ReStructured Text as its documentation
format. Given the simplicity of the cifs-utils manpages, I think we're
better suited to using rst as a canonical format, rather than pod.
This patch converts all of the .pod files in the code to .rst files,
and fixes the Makefile and autoconf to use the correct tools to turn
those into manpages.
The conversion was done with the pod2rst script, with some by-hand
modifications at the end to clean up the formatting and add the manual
section numbers. It's not perfect and could probably use a second pass
to clean up the warts in the formatting, but the content is all intact
and it should be readable.
Finally, convert the makefile rules to use standard SUFFIX rules
instead of the non-portable GNU make % style extension rules. We don't
really expect anyone to use anything other than GNU make here, but
this silences an automake warning.
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Aurelien Aptel [Fri, 29 Sep 2017 14:03:03 +0000 (16:03 +0200)]
man: generate all man pages from POD files when buidling
Move all man pages to easily editable POD files and generate troff
source when building.
Previous .in troff file are still preprocessed before final generation
to use configured path (.pod.in -> .pod -> troff). All temporary
files (.pod.in and troff sources) are properly deleted on clean.
Remove all troff file, no need to keep generated copies under source
control.
This commit does not change the content of the man pages but makes
future editing easier.
Adds a new --enable-man/--disable-man configure option to control the
generation and installation of man pages. The option is automatically
enabled if the system supports it. Explicitly enabling it will make the
configure script fail if pod2man is not installed.
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Shirish Pargaonkar [Wed, 30 Aug 2017 11:29:52 +0000 (06:29 -0500)]
cifs: setcifsacl - Send the actual (security descriptor) buffer size instead of the pre-allocated size
Some SMB servers such as HDS HNAS (Hitachi NAS) return error
NT Status: STATUS_INVALID_SECURITY_DESCR (0xc0000079)
during set cifs acl operation.
This happens due to mismatch in the size of actual security descriptor
being set versus the size of the security descriptor stated in the request.
Instead of sending allocated buffer size of a security descriptor,
send the actual size of the security descriptor during set cifs acl
operation.
Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Jeff Layton [Sun, 27 Aug 2017 10:01:12 +0000 (06:01 -0400)]
mount.cifs: add fallthrough comments on fmask/dmask option cases
...to silence a couple of compiler warnings.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Aurelien Aptel [Fri, 21 Apr 2017 14:59:50 +0000 (16:59 +0200)]
mount.cifs: document SMBv3.1.1 and new seal option
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Aurelien Aptel [Wed, 15 Feb 2017 17:10:09 +0000 (18:10 +0100)]
manpage: correct typos and spelling mistakes
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Thomas Witt [Wed, 15 Mar 2017 20:20:44 +0000 (20:20 +0000)]
mount.cifs: Remove data_blob.h include
data_blob.h includes talloc.h from libtalloc, but that is only marked as
a dependency for cifs.upcall. No symbols from that header are used by
cifs.mount, so remove it to avoid the libtalloc dependency
Signed-off-by: Thomas Witt <pyromaniac@exherbo.org>
Jeff Layton [Thu, 2 Mar 2017 16:51:05 +0000 (11:51 -0500)]
cifs-utils: bump version to 6.7
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 24 Feb 2017 15:48:57 +0000 (10:48 -0500)]
cifs.upcall: use a MEMORY: ccache when instantiating from a keytab
Using a more permanent ccache is potentially problematic when we're
instantiating a new one. We might be operating under different creds
than expected. Just use a MEMORY: ccache since we don't need it to
last longer than the life of the upcall anyway.
Reported-and-Tested-by: Chad William Seys <cwseys@physics.wisc.edu>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Thu, 23 Feb 2017 21:50:43 +0000 (16:50 -0500)]
cifs.upcall: don't do env scraping when uid is 0
Setuid programs triggering upcalls could trick the program here. Also,
the d_automount method is done with credentials overridden so if you
can end up with mismatched creds and env vars due to that as well.
It's a hack, but the only recourse I can see is to avoid doing this
when the uid is 0. That means we can't rely on finding root credcaches
in alternate locations using $KRB5CCNAME, but I think that's the best
we can do.
Reported-and-Tested-by: Chad William Seys <cwseys@physics.wisc.edu>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Thu, 23 Feb 2017 23:28:24 +0000 (18:28 -0500)]
cifs.upcall: unset $KRB5CCNAME when creating new credcache from keytab
We don't want to trust $KRB5CCNAME when creating or updating a new
credcache since we could be operating under the wrong credentials.
Always create new credcaches in the default location instead.
Reported-by: Chad William Seys <cwseys@physics.wisc.edu>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 24 Feb 2017 00:14:07 +0000 (19:14 -0500)]
data_blob: Eliminate _PUBLIC_
It's defined to nothing anyway.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 24 Feb 2017 00:09:12 +0000 (19:09 -0500)]
treewide: Eliminate SAFE_FREE
It just frees and then zeroes out the pointer. That's of dubious
value in the places where it's currently being used. Just use
free() instead.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 24 Feb 2017 00:21:56 +0000 (19:21 -0500)]
replace.h: remove it
Nothing uses it now.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Thu, 23 Feb 2017 23:58:17 +0000 (18:58 -0500)]
cifs.upcall: remove need for replace.h
Take just what we need from replace.h and move it to cifs.upcall.c.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Fri, 24 Feb 2017 01:56:27 +0000 (20:56 -0500)]
spengo.c/asn1.c: remove need for replace.h
Just need stdbool.h instead.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Thu, 23 Feb 2017 23:49:59 +0000 (18:49 -0500)]
data_blob: remove need for replace.h
We only need ZERO_STRUCT there.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Thu, 16 Feb 2017 14:55:45 +0000 (09:55 -0500)]
cifs.upcall: trim even more capabilities
We really only need CAP_DAC_READ_SEARCH, not CAP_DAC_OVERRIDE, and
only when we are going to probe the environ file.
Also, fix the non-libcap-ng trim_capabilities prototype.
Reviewed-by: Simo Sorce <simo@redhat.com>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Sat, 11 Feb 2017 13:38:46 +0000 (08:38 -0500)]
cifs.upcall: allow scraping of KRB5CCNAME out of initiating task's /proc/<pid>/environ file
Chad reported that he was seeing a regression in cifs-utils-6.6. Prior
to that, cifs.upcall was able to find credcaches in non-default FILE:
locations, but with the rework of that code, that ability was lost.
Unfortunately, the krb5 library design doesn't really take into account
the fact that we might need to find a credcache in a process that isn't
descended from the session.
When the kernel does an upcall, it passes several bits of info about the
task that initiated the upcall. One of those things is the PID (the
tgid, in particular). We can use that info to reach into the
/proc/<pid>/environ file for the process, and grab whatever value of
$KRB5CCNAME is there.
Then, after switching credentials, set $KRB5CCNAME in the environment
to the same value before opening the credcache, to hint to the krb5
libs where they ought to look.
This new behavior is on by default, but can be disabled by having
request-key pass a '-E' flag to cifs.upcall.
Reported-by: Chad William Seys <cwseys@physics.wisc.edu>
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Wed, 15 Feb 2017 15:00:45 +0000 (10:00 -0500)]
cifs.upcall: drop capabilities early in program
Much of cifs.upcall can and should be run without elevated privileges.
On entry into the program, drop as many capabilities as we can get away
with, and then always drop any remaining caps after calling setuid().
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Mon, 13 Feb 2017 13:33:02 +0000 (08:33 -0500)]
cifs.upcall: switch group IDs when handling an upcall
Currently, we leave the group ID alone, but in a later patch we'll be
changing cifs.upcall to scrape $KRB5CCNAME out of the originating
process. At that point, we want to be a little more careful with the
process credentials we'll be using.
After we get the uid, do a getpwuid and grab the default gid for the
user. Then use setgid to set it before calling setuid.
Signed-off-by: Jeff Layton <jlayton@samba.org>
Jeff Layton [Sun, 12 Feb 2017 14:36:12 +0000 (09:36 -0500)]
cifs.upcall: convert two flags from int to bool
Signed-off-by: Jeff Layton <jlayton@samba.org>
Sachin Prabhu [Wed, 4 Jan 2017 12:45:17 +0000 (07:45 -0500)]
manpage: document mfsymlinks in the mount.cifs man page
Information from the cifs README in the kernel sources is used.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Germano Percossi [Fri, 18 Nov 2016 18:54:52 +0000 (18:54 +0000)]
mount.cifs: Remove unneeded stdbool header include
Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Germano Percossi [Fri, 18 Nov 2016 18:54:51 +0000 (18:54 +0000)]
mount.cifs: Fixed command line parsing and aligned with kernel
The way token matching was done was consuming the parameters namespace
quickly. For example, anything starting with "dom" was interpreted with
domain, while it could have been a completely different word. The same
is true even for "ro".
Moreover, many perfectly valid options like "addr" where not accepted.
The cifs kernel module is very strict when it comes to names: 'dom' and
'domain' are valid while 'domai' is not, so the userspace tool needs to
comply otherwise it becomes very difficult to come up with new names for
options.
Now, checking is strict and as close as possible to kernel. When it is
not, it is just to avoid breaking compatibility with some users.
However, workg has been removed because it is too lazy and undocumented.
The only variable left without strict checking is 'x-' because the
intent is to ignore anything starting in that way
Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Germano Percossi [Fri, 18 Nov 2016 18:54:50 +0000 (18:54 +0000)]
mount.cifs: Accept empty domains on the command line
If we do not allow empty domains on the command line we are preventing
the kernel module from taking different actions if the domain has not
been specified at all or just passed empty.
In fact, with this fix the cifs module behaves differently once an empty
domain is passed: the find_domain_name function is not invoked when an
empty domain is passed.
It is possible to pass both 'domain=' or 'domain=""' even though the
kernel module will accept the former only when associated with the
sloppy option.
Signed-off-by: Germano Percossi <germano.percossi@citrix.com>