summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-12-04getcifsacl: return error if input path doesn't existPavel Shilovsky1-9/+13
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2020-11-09Fix mount error when mount point has an extra trailing slash.Rohith Surabattula1-0/+9
2020-11-09mount.cifs: ignore comment mount optionMartin Schwenke1-0/+2
mount.cifs currently complains about the "comment" option: CIFS: Unknown mount option "comment=foo" mount(8) on Linux says: The command mount does not pass the mount options unbindable, runbindable, private, rprivate, slave, rslave, shared, rshared, auto, noauto, comment, x-*, loop, offset and sizelimit to the mount.<suffix> helpers. So if mount.cifs decides to re-read /etc/fstab it should ignore the comment option. A lot of online posts say to use comment=x-gvfs-show as an option to have a Linux file manager display a mountpoint for a user mountable filesystem. While the "comment=" part is superfluous when combined with an x-* option, the problem is still difficult to debug. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Aurelien Aptel <aaptel@suse.com>
2020-09-03setcifsacl: fix quoting of backslash in man pageBjoern Jacke1-4/+4
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
2020-09-03Separate binary names using comma in mount.cifs.rstSergio Durigan Junior1-3/+3
According to lexgrog(1), when a manpage refers to multiple programs their names should be separated using a comma and a whitespace. This helps silence a lintian warning when building cifs-utils on Debian. Signed-off-by: Sergio Durigan Junior <sergio.durigan@canonical.com>
2020-09-03cifs-utils: fix probabilistic compiling errorlizhe1-1/+1
When we compile cifs-utils, we may probabilistic encounter install error like: cd ***/sbin && ln -sf mount.cifs mount.smb3 ***/sbin: No such file or directory The reason of this problem is that if we compile cifs-utils using multithreading, target 'install-sbinPROGRAMS' may be built after target 'install-exec-hook' of the main Makefile. Target 'install-sbinPROGRAMS' will copy the executable file 'mount.cifs' to the $(ROOTSBINDIR), which target 'install-exec-hook' will do the 'ln' command on. This patch add the dependency of target 'install-exec-hook' to ensure the correct order of the compiling. Signed-off-by: lizhe <lizhe67@huawei.com>
2020-09-03cifs-utils: Don't create symlinks for mans if mans are disabledMikhail Novosyolov1-1/+3
2020-09-03cifs-utils: Respect DESTDIR when installing smb3 stuffMikhail Novosyolov1-4/+4
When make install is run during package building, DESTDIR parameter is passed, e.g.: $ rpm --eval %makeinstall_std make DESTDIR=/root/rpmbuild/BUILDROOT/%{name}-%{version}-%{release}-rosa2016.1.x86_64-buildroot install Without DESTDIR build scripts tried to create symlinks outside of the build root: make[3]: Entering directory '/tmp/abf/rpmbuild/BUILD/cifs-utils-6.10' (cd /sbin && ln -sf mount.cifs mount.smb3) ln: failed to create symbolic link 'mount.smb3': Permission denied The same fix was introduced in Arch Linux package when updating from 6.9 to 6.10: https://git.archlinux.org/svntogit/packages.git/commit/trunk/PKGBUILD?h=packages/cifs-utils&id=c75b246a762ea9b90db404dfebc6d35d5b16972f
2020-09-03mount.cifs.rst: add nolease mount optionPavel Shilovsky1-0/+6
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2020-09-03Add support for setting owner and group in ntsdBoris Protopopov3-49/+235
Extend setcifsacl utility to allow setting owner and group SIDs in the security descriptor in addition to setting ACLs. This is a user-friendly intefrace for setting owner and group SIDs that takes advantage of the recent extensions in the CIFS kernel client, and it complements setting raw values via setfattr. Signed-off-by: Boris Protopopov <boris.v.protopopov@gmail.com>
2020-09-03Convert owner and group SID offsets to LE formatBoris Protopopov1-2/+4
Convert owner and group SID offsets to LE format when writing to ntsd Signed-off-by: Boris Protopopov <boris.v.protopopov@gmail.com>
2020-09-03smbinfo: remove invalid arguments to ioctl methodRonnie Sahlberg1-2/+2
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
2020-09-03smbinfo: rewrite in pythonAurelien Aptel3-1298/+780
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
2020-09-03cifs-utils: bump version to 6.11cifs-utils-6.11Pavel Shilovsky1-1/+1
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2020-09-03CVE-2020-14342: mount.cifs: fix shell command injectionAurelien Aptel1-21/+75
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>
2019-12-16cifs-utils: bump version to 6.10cifs-utils-6.10Pavel Shilovsky1-1/+1
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-12-16Rename secdesc-ui.py to smb2-secdescPavel Shilovsky1-0/+0
2019-12-16Properly install mount.smb3 helper filesPavel Shilovsky1-0/+6
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-12-16Install smb2-quota and its manpageRonnie Sahlberg3-0/+12
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
2019-12-12smb2-quota: Simplify code logic for quota entries.Kenneth D'souza2-16/+11
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>
2019-12-12Add program name to error output instead of static mount.cifsKenneth D'souza1-28/+28
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>
2019-12-12Add support for smb3 alias/fstype in mount.cifs.cKenneth D'souza3-4/+20
As we will slowly move towards smb3 filesystem, supporting through "mount -t smb3" is important. Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
2019-12-12smbinfo.rst: document new `keys` commandAurelien Aptel1-0/+4
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
2019-12-12mount.cifs.rst: remove prefixpath mount option.Kenneth D'souza1-6/+0
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>
2019-10-04smb2quota.rst: Add man page for smb2quota.pyKenneth D'souza1-0/+70
Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
2019-10-04smb2quota.py: Userspace helper to display quota informationKenneth D'souza1-0/+195
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>
2019-10-03smbinfo: add bash completion support for setcompressionPavel Shilovsky1-1/+2
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-10-03smbinfo: Add SETCOMPRESSION supportRonnie Sahlberg2-1/+49
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
2019-10-03smbinfo: print the security information needed to decrypt wireshark traceSteve French1-1/+52
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>
2019-10-03mount.cifs: Fix invalid freePaulo Alcantara (SUSE)1-4/+4
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>
2019-10-03mount.cifs: Fix double-free issue when mounting with setuid rootPaulo Alcantara (SUSE)1-2/+4
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>
2019-08-07Zero fill the allocated memory for new `struct cifs_ntsd`misku1-1/+1
Fixes a bug where `sacloffset` may not be set at all later on and therefore it can contain the original memory contents == trash.
2019-08-07Zero fill the allocated memory for a new ACEmisku1-1/+1
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.
2019-08-07mount.cifs.c: fix memory leaks in main funcJiawen Liu1-1/+9
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>
2019-05-07smbinfo: add bash completion support for getcompressionPavel Shilovsky1-1/+2
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-05-07getcifsacl: Add support for -R(recursive) option.Kenneth D'souza2-5/+30
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>
2019-05-07smbinfo: add GETCOMPRESSION supportRonnie Sahlberg2-0/+50
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
2019-04-18getcifsacl: Fix usage message to include multiple filesPavel Shilovsky1-2/+2
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-04-18smbinfo: Add bash completion support for smbinfo.Kenneth D'souza1-0/+42
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>
2019-04-18getcifsacl: Add support to accept more pathsKenneth D'souza1-36/+44
Accept more than one path on the getcifsacl command line. Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
2019-04-17smbinfo: Improve help usage and add -h option.Kenneth D'souza2-6/+26
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>
2019-04-09secdesc-ui.py: a UI to view the security descriptors on SMB2+ sharesRonnie Sahlberg1-0/+436
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
2019-04-08Update authors listPavel Shilovsky1-0/+1
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-04-05cifs-utils: bump version to 6.9cifs-utils-6.9Pavel Shilovsky1-1/+1
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-04-05smbinfo: use constant for input buffer lengthPavel Shilovsky1-3/+3
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-04-05Fix authors and maintainersPavel Shilovsky3-5/+6
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
2019-04-05mount.cifs.rst: mention kernel version for snapshotsPavel Shilovsky1-1/+2
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Reviewed-by: Paulo Alcantara <palcantara@suse.de>
2019-04-05Update man page for mount.cifs to add new optionsSteve French1-38/+60
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>
2019-04-05mount.cifs: detect GMT format of snapshot versionPavel Shilovsky1-7/+47
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>
2019-04-05mount.cifs: add more options to help messagePavel Shilovsky1-5/+7
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Reviewed-by: Paulo Alcantara <palcantara@suse.de>