Hello community, here is the log from the commit of package cifs-utils for openSUSE:Leap:15.2 checked in at 2020-03-02 17:21:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/cifs-utils (Old) and /work/SRC/openSUSE:Leap:15.2/.cifs-utils.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cifs-utils" Mon Mar 2 17:21:31 2020 rev:13 rq:780200 version:6.9 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/cifs-utils/cifs-utils.changes 2020-01-15 14:50:10.453406284 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.cifs-utils.new.26092/cifs-utils.changes 2020-03-02 17:21:34.158089036 +0100 @@ -1,0 +2,41 @@ +Mon Sep 9 12:56:24 UTC 2019 - Aurelien Aptel <[email protected]> + +- Fix double-free in mount.cifs; (bsc#1149164). + * add 0011-fix-doublefree.patch + +------------------------------------------------------------------- +Thu Aug 15 16:50:29 UTC 2019 - Aurelien Aptel <[email protected]> + +- Update to cifs-utils 6.9; (bsc#1132087); (bsc#1136031). + * adds fixes for Azure + * new smbinfo utility + * remove cifs-utils-6.8.tar.bz2 + * remove cifs-utils-6.8.tar.bz2.asc + * add cifs-utils-6.9.tar.bz2 + * add cifs-utils-6.9.tar.bz2.asc + * add 0001-smbinfo-Improve-help-usage-and-add-h-option.patch + * add 0002-smbinfo-Add-bash-completion-support-for-smbinfo.patch + * add 0003-getcifsacl-Add-support-to-accept-more-paths.patch + * add 0004-getcifsacl-Fix-usage-message-to-include-multiple-fil.patch + * add 0005-smbinfo-add-GETCOMPRESSION-support.patch + * add 0006-getcifsacl-Add-support-for-R-recursive-option.patch + * add 0007-smbinfo-add-bash-completion-support-for-getcompressi.patch + * add 0008-mount.cifs.c-fix-memory-leaks-in-main-func.patch + * add 0009-Zero-fill-the-allocated-memory-for-new-struct-cifs_n.patch + * add 0010-Zero-fill-the-allocated-memory-for-a-new-ACE.patch +- Remove backports that are already in 6.9; (fate#325270); (bsc#1130528); + * remove 0001-docs-cleanup-rst-formating.patch + * remove 0002-mount.cifs.rst-document-new-no-handlecache-mount-opt.patch + * remove 0003-manpage-update-mount.cifs-manpage-with-info-about-rd.patch + * remove 0004-checkopts-add-python-script-to-cross-check-mount-opt.patch + * remove 0005-mount.cifs.rst-document-missing-options-correct-wron.patch + * remove 0006-cifs-utils-support-rst2man-3.patch + * remove 0007-checkopts-report-duplicated-options-in-man-page.patch + * remove 0008-mount.cifs.rst-more-cleanups.patch + * remove 0009-mount.cifs.rst-document-vers-3-mount-option.patch + * remove 0010-mount.cifs.rst-document-vers-3.02-mount-option.patch + * remove allow-dns-resolver-key-to-expire.patch + * remove suse-document-new-vers-default-SMB2.1.patch +- Remove dependency workaround regarding python2/python3 + +------------------------------------------------------------------- Old: ---- 0001-docs-cleanup-rst-formating.patch 0002-mount.cifs.rst-document-new-no-handlecache-mount-opt.patch 0003-manpage-update-mount.cifs-manpage-with-info-about-rd.patch 0004-checkopts-add-python-script-to-cross-check-mount-opt.patch 0005-mount.cifs.rst-document-missing-options-correct-wron.patch 0006-cifs-utils-support-rst2man-3.patch 0007-checkopts-report-duplicated-options-in-man-page.patch 0008-mount.cifs.rst-more-cleanups.patch 0009-mount.cifs.rst-document-vers-3-mount-option.patch 0010-mount.cifs.rst-document-vers-3.02-mount-option.patch allow-dns-resolver-key-to-expire.patch cifs-utils-6.8.tar.bz2 cifs-utils-6.8.tar.bz2.asc suse-document-new-vers-default-SMB2.1.patch New: ---- 0001-smbinfo-Improve-help-usage-and-add-h-option.patch 0002-smbinfo-Add-bash-completion-support-for-smbinfo.patch 0003-getcifsacl-Add-support-to-accept-more-paths.patch 0004-getcifsacl-Fix-usage-message-to-include-multiple-fil.patch 0005-smbinfo-add-GETCOMPRESSION-support.patch 0006-getcifsacl-Add-support-for-R-recursive-option.patch 0007-smbinfo-add-bash-completion-support-for-getcompressi.patch 0008-mount.cifs.c-fix-memory-leaks-in-main-func.patch 0009-Zero-fill-the-allocated-memory-for-new-struct-cifs_n.patch 0010-Zero-fill-the-allocated-memory-for-a-new-ACE.patch 0011-fix-doublefree.patch cifs-utils-6.9.tar.bz2 cifs-utils-6.9.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cifs-utils.spec ++++++ --- /var/tmp/diff_new_pack.oVyd25/_old 2020-03-02 17:21:35.850092296 +0100 +++ /var/tmp/diff_new_pack.oVyd25/_new 2020-03-02 17:21:35.850092296 +0100 @@ -17,7 +17,7 @@ Name: cifs-utils -Version: 6.8 +Version: 6.9 Release: 0 Summary: Utilities for doing and managing mounts of the Linux CIFS filesystem License: GPL-3.0-or-later @@ -32,18 +32,17 @@ Source100: README.cifstab.migration Source1: cifs.init -Patch0: 0001-docs-cleanup-rst-formating.patch -Patch1: 0002-mount.cifs.rst-document-new-no-handlecache-mount-opt.patch -Patch2: 0003-manpage-update-mount.cifs-manpage-with-info-about-rd.patch -Patch3: 0004-checkopts-add-python-script-to-cross-check-mount-opt.patch -Patch4: 0005-mount.cifs.rst-document-missing-options-correct-wron.patch -Patch5: 0006-cifs-utils-support-rst2man-3.patch -Patch6: 0007-checkopts-report-duplicated-options-in-man-page.patch -Patch7: 0008-mount.cifs.rst-more-cleanups.patch -Patch8: 0009-mount.cifs.rst-document-vers-3-mount-option.patch -Patch9: 0010-mount.cifs.rst-document-vers-3.02-mount-option.patch -Patch10: suse-document-new-vers-default-SMB2.1.patch -Patch11: allow-dns-resolver-key-to-expire.patch +Patch0: 0001-smbinfo-Improve-help-usage-and-add-h-option.patch +Patch1: 0002-smbinfo-Add-bash-completion-support-for-smbinfo.patch +Patch2: 0003-getcifsacl-Add-support-to-accept-more-paths.patch +Patch3: 0004-getcifsacl-Fix-usage-message-to-include-multiple-fil.patch +Patch4: 0005-smbinfo-add-GETCOMPRESSION-support.patch +Patch5: 0006-getcifsacl-Add-support-for-R-recursive-option.patch +Patch6: 0007-smbinfo-add-bash-completion-support-for-getcompressi.patch +Patch7: 0008-mount.cifs.c-fix-memory-leaks-in-main-func.patch +Patch8: 0009-Zero-fill-the-allocated-memory-for-new-struct-cifs_n.patch +Patch9: 0010-Zero-fill-the-allocated-memory-for-a-new-ACE.patch +Patch10: 0011-fix-doublefree.patch # cifs-utils 6.8 switched to python for man page generation # we need to require either py2 or py3 package @@ -85,11 +84,6 @@ BuildRequires: libwbclient-devel BuildRequires: pam-devel BuildRequires: pkg-config -%if 0%{?suse_version} >= 1500 || 0%{?sle_version} >= 150000 -BuildRequires: (samba-libs-python3 if samba-libs >= 4.9.3) -%else -BuildRequires: samba-libs-python3 -%endif Requires: keyutils %if ! %{defined _rundir} %define _rundir %{_localstatedir}/run @@ -101,7 +95,7 @@ %package devel Summary: Files needed for building plugins for cifs-utils -Group: Development/Libraries +Group: Development/Libraries/C and C++ %description devel The SMB/CIFS protocol is a standard file sharing protocol widely deployed @@ -136,7 +130,6 @@ %patch8 -p1 %patch9 -p1 %patch10 -p1 -%patch11 -p1 %build export CFLAGS="%{optflags} -D_GNU_SOURCE -fpie" @@ -187,7 +180,9 @@ %{_mandir}/man8/cifs.idmap.8%{ext_man} %{_bindir}/cifscreds %{_sbindir}/cifs.upcall +%{_bindir}/smbinfo %{_mandir}/man1/cifscreds.1%{ext_man} +%{_mandir}/man1/smbinfo.1%{ext_man} %{_mandir}/man8/cifs.upcall.8%{ext_man} %{_mandir}/man8/mount.cifs.8%{ext_man} %dir %{_sysconfdir}/request-key.d ++++++ 0001-smbinfo-Improve-help-usage-and-add-h-option.patch ++++++ >From 12c2f088fa3d666fc5aa48a700e740523d8d2023 Mon Sep 17 00:00:00 2001 From: Kenneth D'souza <[email protected]> Date: Wed, 17 Apr 2019 15:36:46 +0530 Subject: [PATCH] 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 <[email protected]> --- smbinfo.c | 27 ++++++++++++++++++++++----- smbinfo.rst | 5 ++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/smbinfo.c b/smbinfo.c index 4bc503a..6e258c2 100644 --- a/smbinfo.c +++ b/smbinfo.c @@ -64,6 +64,8 @@ usage(char *name) { fprintf(stderr, "Usage: %s [-V] <command> <file>\n" "-V for verbose output\n" + "-h display this help text\n" + "-v print smbinfo version\n" "Commands are\n" " fileaccessinfo:\n" " Prints FileAccessInfo for a cifs file.\n" @@ -97,6 +99,14 @@ usage(char *name) exit(1); } +static void +short_usage(char *name) +{ + fprintf(stderr, "Usage: %s [-v] [-V] <command> <file>\n" + "Try 'smbinfo -h' for more information.\n", name); + exit(1); +} + static void win_to_timeval(uint64_t smb2_time, struct timeval *tv) { @@ -1075,7 +1085,11 @@ int main(int argc, char *argv[]) int c; int f; - while ((c = getopt_long(argc, argv, "vV", NULL, NULL)) != -1) { + if (argc < 2) { + short_usage(argv[0]); + } + + while ((c = getopt_long(argc, argv, "vVh", NULL, NULL)) != -1) { switch (c) { case 'v': printf("smbinfo version %s\n", VERSION); @@ -1083,15 +1097,18 @@ int main(int argc, char *argv[]) case 'V': verbose = 1; break; - default: + case 'h': usage(argv[0]); + break; + default: + short_usage(argv[0]); } } - if (optind >= argc - 1) - usage(argv[0]); + if (optind >= argc -1) + short_usage(argv[0]); - if ((f = open(argv[optind + 1], O_RDONLY)) < 0) { + if ((f = open(argv[optind + 1 ], O_RDONLY)) < 0) { fprintf(stderr, "Failed to open %s\n", argv[optind + 1]); exit(1); } diff --git a/smbinfo.rst b/smbinfo.rst index 0c96050..be4c829 100644 --- a/smbinfo.rst +++ b/smbinfo.rst @@ -11,7 +11,7 @@ Userspace helper to display SMB-specific file information for the Linux SMB clie SYNOPSIS ******** - smbinfo [-v] [-V] {command} {file system object} + smbinfo [-v] [-h] [-V] {command} {file system object} *********** DESCRIPTION @@ -38,6 +38,9 @@ OPTIONS -V Verbose output. +-h + Print help explaining the command line options. + ******* COMMAND ******* -- 2.16.4 ++++++ 0002-smbinfo-Add-bash-completion-support-for-smbinfo.patch ++++++ >From dfe497f9f51983147a7caa69f62bb6648ea507ec Mon Sep 17 00:00:00 2001 From: Kenneth D'souza <[email protected]> Date: Wed, 17 Apr 2019 16:57:05 +0530 Subject: [PATCH] smbinfo: Add bash completion support for smbinfo. This help us better populate options using <tab> <tab>. Signed-off-by: Kenneth D'souza <[email protected]> Signed-off-by: Pavel Shilovsky <[email protected]> --- bash-completion/smbinfo | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bash-completion/smbinfo diff --git a/bash-completion/smbinfo b/bash-completion/smbinfo new file mode 100644 index 0000000..ad5d34d --- /dev/null +++ b/bash-completion/smbinfo @@ -0,0 +1,42 @@ +# bash completion for smbinfo -*- shell-script -*- +smb_info() +{ + local cur prev OPTS + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + OPTS="fileaccessinfo + filealigninfo + fileallinfo + filebasicinfo + fileeainfo + filefsfullsizeinfo + fileinternalinfo + filemodeinfo + filepositioninfo + filestandardinfo + fsctl-getobjid + list-snapshots + quota + secdesc" + case $prev in + '-v'|'-h') + return 0 + ;; + 'fileaccessinfo'|'filealigninfo'|'fileallinfo'|'filebasicinfo'|'fileeainfo'|'filefsfullsizeinfo'|\ + 'fileinternalinfo'|'filemodeinfo'|'filepositioninfo'|'filestandardinfo'|'fsctl-getobjid'|\ + 'list-snapshots'|'quota'|'secdesc') + local IFS=$'\n' + compopt -o filenames + COMPREPLY=( $(compgen -f -o dirnames -- ${cur:-""}) ) + return 0 + ;; + '-V'|*'smbinfo') + COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) + return 0 + ;; + esac + + return 0 +} +complete -F smb_info smbinfo -- 2.16.4 ++++++ 0003-getcifsacl-Add-support-to-accept-more-paths.patch ++++++ >From 9beaa8c3c895ca8460d81fb54a6a0de2bb21a277 Mon Sep 17 00:00:00 2001 From: Kenneth D'souza <[email protected]> Date: Wed, 17 Apr 2019 22:49:09 +0530 Subject: [PATCH] getcifsacl: Add support to accept more paths Accept more than one path on the getcifsacl command line. Signed-off-by: Kenneth D'souza <[email protected]> --- getcifsacl.c | 80 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/getcifsacl.c b/getcifsacl.c index fc78881..556178a 100644 --- a/getcifsacl.c +++ b/getcifsacl.c @@ -340,14 +340,52 @@ getcifsacl_usage(const char *prog) fprintf(stderr, "\nRefer to getcifsacl(1) manpage for details\n"); } +static void +getcifsacl(const char *filename, bool raw) +{ + ssize_t attrlen; + size_t bufsize = BUFSIZE; + char *attrval; + int failed = 0; +cifsacl: + if (bufsize >= XATTR_SIZE_MAX) { + fprintf(stderr, "buffer to allocate exceeds max size of %d\n", + XATTR_SIZE_MAX); + exit(1); + } + + attrval = malloc(bufsize * sizeof(char)); + if (!attrval) { + fprintf(stderr, "error allocating memory for attribute value buffer\n"); + exit(1); + } + + attrlen = getxattr(filename, ATTRNAME, attrval, bufsize); + if (attrlen == -1) { + if (errno == ERANGE) { + free(attrval); + bufsize += BUFSIZE; + goto cifsacl; + } else { + fprintf(stderr, "Failed to getxattr %s: %s\n", filename, + strerror(errno)); + failed = -1; + } + } + + if (failed == 0) { + printf("# filename: %s\n", filename); + parse_sec_desc((struct cifs_ntsd *)attrval, attrlen, raw); + printf("\n"); + } + free(attrval); +} + int main(const int argc, char *const argv[]) { int c, ret = 0; bool raw = false; - ssize_t attrlen; - size_t bufsize = BUFSIZE; - char *filename, *attrval; execname = basename(argv[0]); if (argc < 2) { @@ -374,8 +412,7 @@ main(const int argc, char *const argv[]) printf("you must specify a filename after options.\n"); printf("Usage: getcifsacl [option] <file_name>\n"); goto out; - } else - filename = argv[optind]; + } if (!raw && !plugin_loaded) { ret = init_plugin(&plugin_handle); @@ -386,38 +423,9 @@ main(const int argc, char *const argv[]) plugin_loaded = true; } -cifsacl: - if (bufsize >= XATTR_SIZE_MAX) { - printf("buffer to allocate exceeds max size of %d\n", - XATTR_SIZE_MAX); - ret = -1; - goto out; - } - - attrval = malloc(bufsize * sizeof(char)); - if (!attrval) { - printf("error allocating memory for attribute value buffer\n"); - ret = -1; - goto out; - } - - attrlen = getxattr(filename, ATTRNAME, attrval, bufsize); - if (attrlen == -1) { - if (errno == ERANGE) { - free(attrval); - bufsize += BUFSIZE; - goto cifsacl; - } else { - fprintf(stderr, "getxattr failed on %s: %s\n", filename, strerror(errno) ); - free(attrval); - ret = -1; - goto out; - } - } - - parse_sec_desc((struct cifs_ntsd *)attrval, attrlen, raw); + for(; optind < argc; optind++) + getcifsacl(argv[optind], raw); - free(attrval); out: if (plugin_loaded) exit_plugin(plugin_handle); -- 2.16.4 ++++++ 0004-getcifsacl-Fix-usage-message-to-include-multiple-fil.patch ++++++ >From f2955af017f604003e3c8c3efe0fb0fb85584cea Mon Sep 17 00:00:00 2001 From: Pavel Shilovsky <[email protected]> Date: Thu, 18 Apr 2019 12:32:02 -0700 Subject: [PATCH] getcifsacl: Fix usage message to include multiple files Signed-off-by: Pavel Shilovsky <[email protected]> --- getcifsacl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getcifsacl.c b/getcifsacl.c index 556178a..bea81ee 100644 --- a/getcifsacl.c +++ b/getcifsacl.c @@ -330,7 +330,7 @@ getcifsacl_usage(const char *prog) fprintf(stderr, "%s: Display CIFS/NTFS ACL in a security descriptor of a file object\n", prog); - fprintf(stderr, "Usage: %s [option] <file_name>\n", prog); + fprintf(stderr, "Usage: %s [option] <file_name1> [<file_name2>,<file_name3>,...]\n", prog); fprintf(stderr, "Valid options:\n"); fprintf(stderr, "\t-h Display this help text\n"); fprintf(stderr, "\n"); @@ -410,7 +410,7 @@ main(const int argc, char *const argv[]) if (optind >= argc) { printf("you must specify a filename after options.\n"); - printf("Usage: getcifsacl [option] <file_name>\n"); + printf("Usage: getcifsacl [option] <file_name1> [<file_name2>,<file_name3>,...]\n"); goto out; } -- 2.16.4 ++++++ 0005-smbinfo-add-GETCOMPRESSION-support.patch ++++++ >From 1e4fca25948d52fc29410963663f3af72275bcb6 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <[email protected]> Date: Thu, 11 Apr 2019 12:23:06 +1000 Subject: [PATCH] smbinfo: add GETCOMPRESSION support Signed-off-by: Ronnie Sahlberg <[email protected]> --- smbinfo.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ smbinfo.rst | 2 ++ 2 files changed, 50 insertions(+) diff --git a/smbinfo.c b/smbinfo.c index 6e258c2..b4d497b 100644 --- a/smbinfo.c +++ b/smbinfo.c @@ -89,6 +89,8 @@ usage(char *name) " Prints FileStandardInfo for a cifs file.\n" " fsctl-getobjid:\n" " Prints the objectid of the file and GUID of the underlying volume.\n" + " getcompression:\n" + " Prints the compression setting for the file.\n" " list-snapshots:\n" " List the previous versions of the volume that backs this file.\n" " quota:\n" @@ -252,6 +254,50 @@ fsctlgetobjid(int f) free(qi); } +static void +print_getcompression(uint8_t *sd) +{ + uint16_t u16; + + memcpy(&u16, &sd[0], 2); + u16 = le16toh(u16); + + printf("Compression: "); + switch (u16) { + case 0: + printf("(0) NONE\n"); + break; + case 2: + printf("(2) LZNT1\n"); + break; + default: + printf("(%d) UNKNOWN\n", u16); + break; + } +} + +static void +getcompression(int f) +{ + struct smb_query_info *qi; + + qi = malloc(sizeof(struct smb_query_info) + 2); + memset(qi, 0, sizeof(qi) + 2); + qi->info_type = 0x9003c; + qi->file_info_class = 0; + qi->additional_information = 0; + qi->input_buffer_length = 2; + qi->flags = PASSTHRU_FSCTL; + + if (ioctl(f, CIFS_QUERY_INFO, qi) < 0) { + fprintf(stderr, "ioctl failed with %s\n", strerror(errno)); + exit(1); + } + print_getcompression((uint8_t *)(&qi[1])); + + free(qi); +} + static void print_fileaccessinfo(uint8_t *sd, int type) { @@ -1135,6 +1181,8 @@ int main(int argc, char *argv[]) filestandardinfo(f); else if (!strcmp(argv[optind], "fsctl-getobjid")) fsctlgetobjid(f); + else if (!strcmp(argv[optind], "getcompression")) + getcompression(f); else if (!strcmp(argv[optind], "list-snapshots")) list_snapshots(f); else if (!strcmp(argv[optind], "quota")) diff --git a/smbinfo.rst b/smbinfo.rst index be4c829..500ce0e 100644 --- a/smbinfo.rst +++ b/smbinfo.rst @@ -67,6 +67,8 @@ COMMAND `fsctl-getobjid`: Prints the ObjectID +`getcompression`: Prints the compression setting for the file. + `list-snapshots`: Lists the previous versions of the volume that backs this file `quota`: Print the quota for the volume in the form -- 2.16.4 ++++++ 0006-getcifsacl-Add-support-for-R-recursive-option.patch ++++++ >From 43f389bb3759ea49efb705acd2d314fd91a7bc57 Mon Sep 17 00:00:00 2001 From: Kenneth D'souza <[email protected]> Date: Mon, 22 Apr 2019 11:23:41 +0530 Subject: [PATCH] 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 <[email protected]> --- getcifsacl.c | 32 +++++++++++++++++++++++++++----- getcifsacl.rst.in | 3 +++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/getcifsacl.c b/getcifsacl.c index bea81ee..d58b769 100644 --- a/getcifsacl.c +++ b/getcifsacl.c @@ -37,10 +37,12 @@ #include <sys/xattr.h> #include "cifsacl.h" #include "idmap_plugin.h" +#include <ftw.h> static void *plugin_handle; static bool plugin_loaded; static char *execname; +static bool raw = false; static void print_each_ace_mask(uint32_t mask) @@ -336,12 +338,14 @@ getcifsacl_usage(const char *prog) fprintf(stderr, "\n"); fprintf(stderr, "\t-v Version of the program\n"); fprintf(stderr, "\n"); + fprintf(stderr, "\t-R recurse into subdirectories\n"); + fprintf(stderr, "\n"); fprintf(stderr, "\t-r Display raw values of the ACE fields\n"); fprintf(stderr, "\nRefer to getcifsacl(1) manpage for details\n"); } static void -getcifsacl(const char *filename, bool raw) +getcifsacl(const char *filename) { ssize_t attrlen; size_t bufsize = BUFSIZE; @@ -381,12 +385,21 @@ cifsacl: free(attrval); } +static int recursive(const char *filename, const struct stat *sb, int tflag, struct FTW *ftwbuf) +{ + (void)sb; + (void)tflag; + (void)ftwbuf; + getcifsacl(filename); + return 0; +} + int main(const int argc, char *const argv[]) { int c, ret = 0; - bool raw = false; execname = basename(argv[0]); + int do_recursive = 0; if (argc < 2) { fprintf(stderr, "%s: you must specify a filename.\n", execname); @@ -394,7 +407,7 @@ main(const int argc, char *const argv[]) goto out; } - while ((c = getopt_long(argc, argv, "rhv", NULL, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "Rrhv", NULL, NULL)) != -1) { switch (c) { case 'v': printf("Version: %s\n", VERSION); @@ -402,6 +415,9 @@ main(const int argc, char *const argv[]) case 'r': raw = true; break; + case 'R': + do_recursive = 1; + break; default: getcifsacl_usage(execname); goto out; @@ -423,8 +439,14 @@ main(const int argc, char *const argv[]) plugin_loaded = true; } - for(; optind < argc; optind++) - getcifsacl(argv[optind], raw); + for(; optind < argc; optind++) { + if(do_recursive) { + if (nftw(argv[optind], recursive, 20, 0) == -1) + fprintf(stderr, "Invalid filename %s: %s\n", argv[optind], strerror(errno)); + } + else + getcifsacl(argv[optind]); + } out: if (plugin_loaded) diff --git a/getcifsacl.rst.in b/getcifsacl.rst.in index 21a10cd..ffde968 100644 --- a/getcifsacl.rst.in +++ b/getcifsacl.rst.in @@ -43,6 +43,9 @@ OPTIONS flags are displayed in hexadecimal format, a SID is not mapped to a name. +-R + List the ACLs of all files and directories recursively. + ***** NOTES ***** -- 2.16.4 ++++++ 0007-smbinfo-add-bash-completion-support-for-getcompressi.patch ++++++ >From 13c370424575d864544bfb4535832dfcffa91e82 Mon Sep 17 00:00:00 2001 From: Pavel Shilovsky <[email protected]> Date: Tue, 7 May 2019 15:52:30 -0700 Subject: [PATCH] smbinfo: add bash completion support for getcompression Signed-off-by: Pavel Shilovsky <[email protected]> --- bash-completion/smbinfo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bash-completion/smbinfo b/bash-completion/smbinfo index ad5d34d..282db55 100644 --- a/bash-completion/smbinfo +++ b/bash-completion/smbinfo @@ -16,6 +16,7 @@ smb_info() filepositioninfo filestandardinfo fsctl-getobjid + getcompression list-snapshots quota secdesc" @@ -25,7 +26,7 @@ smb_info() ;; 'fileaccessinfo'|'filealigninfo'|'fileallinfo'|'filebasicinfo'|'fileeainfo'|'filefsfullsizeinfo'|\ 'fileinternalinfo'|'filemodeinfo'|'filepositioninfo'|'filestandardinfo'|'fsctl-getobjid'|\ - 'list-snapshots'|'quota'|'secdesc') + 'getcompression'|'list-snapshots'|'quota'|'secdesc') local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -o dirnames -- ${cur:-""}) ) -- 2.16.4 ++++++ 0008-mount.cifs.c-fix-memory-leaks-in-main-func.patch ++++++ >From bf7f48f4c7dcee623bd92b2e7a6ffd97a64a1138 Mon Sep 17 00:00:00 2001 From: Jiawen Liu <[email protected]> Date: Tue, 6 Aug 2019 10:35:29 +0800 Subject: [PATCH] mount.cifs.c: fix memory leaks in main func MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 <[email protected]> Reported-by: Jin Du <[email protected]> Reviewed-by: Saisai Zhang <[email protected]> Reviewed-by: Aurélien Aptel <[email protected]> --- mount.cifs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mount.cifs.c b/mount.cifs.c index b3235e4..7748d54 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -1942,6 +1942,9 @@ restore_privs: gid_t __attribute__((unused)) gignore = setfsgid(oldfsgid); } + if (rc) { + free(*mountpointp); + } return rc; } @@ -2044,8 +2047,10 @@ int main(int argc, char **argv) /* chdir into mountpoint as soon as possible */ rc = acquire_mountpoint(&mountpoint); - if (rc) + if (rc) { + free(orgoptions); return rc; + } /* * mount.cifs does privilege separation. Most of the code to handle @@ -2064,6 +2069,8 @@ int main(int argc, char **argv) /* child */ rc = assemble_mountinfo(parsed_info, thisprogram, mountpoint, orig_dev, orgoptions); + free(orgoptions); + free(mountpoint); return rc; } else { /* parent */ @@ -2209,5 +2216,6 @@ mount_exit: } free(options); free(orgoptions); + free(mountpoint); return rc; } -- 2.16.4 ++++++ 0009-Zero-fill-the-allocated-memory-for-new-struct-cifs_n.patch ++++++ >From 5a468f3dcbea4bfbc380a3f86466b8e33bc40570 Mon Sep 17 00:00:00 2001 From: misku <[email protected]> Date: Wed, 31 Jul 2019 13:12:24 +0200 Subject: [PATCH] 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. --- setcifsacl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setcifsacl.c b/setcifsacl.c index da1d742..f3d0189 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -206,7 +206,7 @@ alloc_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd **npntsd, acessize = aces * sizeof(struct cifs_ace); bufsize = size + acessize; - *npntsd = malloc(bufsize); + *npntsd = calloc(1, bufsize); if (!*npntsd) { printf("%s: Memory allocation failure", __func__); return errno; -- 2.16.4 ++++++ 0010-Zero-fill-the-allocated-memory-for-a-new-ACE.patch ++++++ >From cb3dc2fe88f6179011acbafaaed025c5bdc96131 Mon Sep 17 00:00:00 2001 From: misku <[email protected]> Date: Wed, 31 Jul 2019 13:11:18 +0200 Subject: [PATCH] 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. --- setcifsacl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setcifsacl.c b/setcifsacl.c index 1b98c37..da1d742 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -672,7 +672,7 @@ build_cmdline_aces(char **arrptr, int numcaces) goto build_cmdline_aces_ret; } - cacesptr[i] = malloc(sizeof(struct cifs_ace)); + cacesptr[i] = calloc(1, sizeof(struct cifs_ace)); if (!cacesptr[i]) { printf("%s: ACE alloc error %d\n", __func__, errno); goto build_cmdline_aces_ret; -- 2.16.4 ++++++ 0011-fix-doublefree.patch ++++++ >From [email protected] Thu Sep 5 18:49:35 2019 From: " Paulo Alcantara (SUSE) " <[email protected]> To: <[email protected]>,<[email protected]>, <[email protected]> Cc: "Aurelien Aptel" <[email protected]> Subject: [PATCH] mount.cifs: Fix double-free issue when mounting with setuid root Date: Thu, 5 Sep 2019 15:49:35 -0300 Message-Id: <[email protected]> Content-Transfer-Encoding: 8bit Content-Type: text/plain MIME-Version: 1.0 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) <[email protected]> --- mount.cifs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mount.cifs.c b/mount.cifs.c index 7748d54aa814..2116fc803311 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -247,7 +247,6 @@ check_fstab(const char *progname, const char *mountpoint, const char *devname, * set of options. We don't want to trust what the user * gave us, so just take whatever is in /etc/fstab. */ - free(*options); *options = strdup(mnt->mnt_opts); return 0; } @@ -1762,6 +1761,7 @@ assemble_mountinfo(struct parsed_mount_info *parsed_info, const char *orig_dev, char *orgoptions) { int rc; + char *newopts = NULL; rc = drop_capabilities(0); if (rc) @@ -1773,10 +1773,11 @@ assemble_mountinfo(struct parsed_mount_info *parsed_info, if (getuid()) { rc = check_fstab(thisprogram, mountpoint, orig_dev, - &orgoptions); + &newopts); if (rc) goto assemble_exit; + orgoptions = newopts; /* enable any default user mount flags */ parsed_info->flags |= CIFS_SETUID_FLAGS; } @@ -1880,6 +1881,7 @@ assemble_mountinfo(struct parsed_mount_info *parsed_info, } assemble_exit: + free(newopts); return rc; } -- 2.23.0 ++++++ cifs-utils-6.8.tar.bz2 -> cifs-utils-6.9.tar.bz2 ++++++ ++++ 5965 lines of diff (skipped)
