From ff17c4260cb5aee2da981b7f8eae5c1f0f28a1f0 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Thu, 27 Nov 2025 14:35:09 -0300 Subject: [PATCH] resolves: RHEL-131409 - fix regression with cifscreds(1) Signed-off-by: Paulo Alcantara --- .gitignore | 1 + cifs-utils.spec | 5 +- ...x-parsing-of-commands-and-parameters.patch | 82 +++++++++++++++++++ docs-update-echo_interval-description.patch | 34 ++++++++ smbinfo-bash-completion.patch | 47 ----------- sources | 2 +- 6 files changed, 122 insertions(+), 49 deletions(-) create mode 100644 cifscreds-fix-parsing-of-commands-and-parameters.patch create mode 100644 docs-update-echo_interval-description.patch delete mode 100644 smbinfo-bash-completion.patch diff --git a/.gitignore b/.gitignore index 9a1f2bd..c610338 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ cifs-utils-4.6.tar.bz2 /cifs-utils-7.0.tar.bz2 /cifs-utils-7.1.tar.bz2 /cifs-utils-7.2.tar.bz2 +/cifs-utils-7.4.tar.bz2 diff --git a/cifs-utils.spec b/cifs-utils.spec index 002cfc1..9aa8807 100644 --- a/cifs-utils.spec +++ b/cifs-utils.spec @@ -4,7 +4,7 @@ %global bash_completion_dir %(pkg-config --variable=completionsdir bash-completion || echo /etc/bash_completion.d) Name: cifs-utils -Version: 7.2 +Version: 7.4 Release: %autorelease Summary: Utilities for mounting and managing CIFS mounts @@ -24,6 +24,9 @@ Recommends: %{name}-info%{?_isa} = %{version}-%{release} Source0: https://download.samba.org/pub/linux-cifs/cifs-utils/%{name}-%{version}.tar.bz2 +Patch0: cifscreds-fix-parsing-of-commands-and-parameters.patch +Patch1: docs-update-echo_interval-description.patch + %description The SMB/CIFS protocol is a standard file sharing protocol widely deployed on Microsoft Windows machines. This package contains tools for mounting diff --git a/cifscreds-fix-parsing-of-commands-and-parameters.patch b/cifscreds-fix-parsing-of-commands-and-parameters.patch new file mode 100644 index 0000000..2f2e9df --- /dev/null +++ b/cifscreds-fix-parsing-of-commands-and-parameters.patch @@ -0,0 +1,82 @@ +From 828cb25224cd88b3599d5ca79a7c9435491896db Mon Sep 17 00:00:00 2001 +From: Paulo Alcantara +Date: Tue, 25 Nov 2025 16:30:27 -0300 +Subject: [PATCH 1/2] cifscreds: fix parsing of commands and parameters + +Fix the parsing of '--username' and '--timeout' options as both +require an argument by fixing the value passed in @optstring when +calling getopt_long(3). + +Also fix the matching of commands by breaking the loop when an exact +match is found. Otherwise `cifscreds clear ...` would return +"Ambiguous command" due to "clearall" command. + +* Before patch + +$ ./cifscreds add -u testuser w22-root2.zelda.test +error: Could not resolve address for testuser +$ ./cifscreds add -u testuser -d ZELDA +Password: +$ grep 'cifs:[ad]' /proc/keys +198de7a1 I--Q--- 1 perm 0d0d0000 0 0 logon cifs:d:testuser: 13 + ^^ wrong desc +$ ./cifscreds clear -u testuser w22-root2.zelda.test +Ambiguous command +$ ./cifscreds clear -u testuser -d ZELDA +Ambiguous command + +* After patch + +$ ./cifscreds add -u testuser w22-root2.zelda.test +Password: +$ ./cifscreds add -u testuser -d ZELDA +Password: +$ grep 'cifs:[ad]' /proc/keys +089183a9 I--Q--- 1 perm 0d0d0000 0 0 logon cifs:a:192.168.124.32: 17 +0ca5ed80 I--Q--- 1 perm 0d0d0000 0 0 logon cifs:d:ZELDA: 17 +$ ./cifscreds clear -u testuser w22-root2.zelda.test +$ ./cifscreds clear -u testuser -d ZELDA + +Reported-by: Xiaoli Feng +Reported-by: Jay Shin +Signed-off-by: Paulo Alcantara (Red Hat) +Cc: Steve French +Cc: linux-cifs@vger.kernel.org +--- + cifscreds.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/cifscreds.c b/cifscreds.c +index 295059f9683d..e8713be23d71 100644 +--- a/cifscreds.c ++++ b/cifscreds.c +@@ -71,7 +71,7 @@ static struct command commands[] = { + static struct option longopts[] = { + {"username", 1, NULL, 'u'}, + {"domain", 0, NULL, 'd' }, +- {"timeout", 0, NULL, 't' }, ++ {"timeout", 1, NULL, 't' }, + {NULL, 0, NULL, 0} + }; + +@@ -477,7 +477,7 @@ int main(int argc, char **argv) + if (argc == 1) + return usage(); + +- while((n = getopt_long(argc, argv, "dut:", longopts, NULL)) != -1) { ++ while((n = getopt_long(argc, argv, "du:t:", longopts, NULL)) != -1) { + switch (n) { + case 'd': + arg.keytype = (char) n; +@@ -507,7 +507,7 @@ int main(int argc, char **argv) + if (cmd->name[n] == 0) { + /* exact match */ + best = cmd; +- continue; ++ break; + } + + /* partial match */ +-- +2.51.1 + diff --git a/docs-update-echo_interval-description.patch b/docs-update-echo_interval-description.patch new file mode 100644 index 0000000..790edf4 --- /dev/null +++ b/docs-update-echo_interval-description.patch @@ -0,0 +1,34 @@ +From b9680e868d4bdf9337e542b08a559e9ca5ea6cc0 Mon Sep 17 00:00:00 2001 +From: Paulo Alcantara +Date: Tue, 25 Nov 2025 17:54:04 -0300 +Subject: [PATCH 2/2] docs: update echo_interval description + +It is '3 * echo_interval' since upstream commit f2caf901c1b7 ("cifs: +Fix a race condition with cifs_echo_request"). + +Reported-by: Alexandros Panagiotou +Signed-off-by: Paulo Alcantara (Red Hat) +Cc: Steve French +Cc: linux-cifs@vger.kernel.org +--- + mount.cifs.rst | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mount.cifs.rst b/mount.cifs.rst +index d4890706a0fe..4b6d47447c0e 100644 +--- a/mount.cifs.rst ++++ b/mount.cifs.rst +@@ -483,8 +483,8 @@ echo_interval=n + sets the interval at which echo requests are sent to the server on an + idling connection. This setting also affects the time required for a + connection to an unresponsive server to timeout. Here n is the echo +- interval in seconds. The reconnection happens at twice the value of the +- echo_interval set for an unresponsive server. ++ interval in seconds. The reconnection happens at three times the ++ value of the echo_interval set for an unresponsive server. + If this option is not given then the default value of 60 seconds is used. + The minimum tunable value is 1 second and maximum can go up to 600 seconds. + +-- +2.51.1 + diff --git a/smbinfo-bash-completion.patch b/smbinfo-bash-completion.patch deleted file mode 100644 index 384efd8..0000000 --- a/smbinfo-bash-completion.patch +++ /dev/null @@ -1,47 +0,0 @@ -From d69d2129c6476afbcbbe8dc6e2ed17f233084d85 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= -Date: Mon, 7 Oct 2024 21:48:31 +0200 -Subject: [PATCH] smbinfo: add bash completion support for filestreaminfo, - keys, gettconinfo -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Pavel Filipenský ---- - bash-completion/smbinfo | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/bash-completion/smbinfo b/bash-completion/smbinfo -index d56b581..ec0d8a4 100644 ---- a/bash-completion/smbinfo -+++ b/bash-completion/smbinfo -@@ -15,19 +15,22 @@ smb_info() - filemodeinfo - filepositioninfo - filestandardinfo -+ filestreaminfo - fsctl-getobjid - getcompression - setcompression - list-snapshots - quota -- secdesc" -+ secdesc -+ keys -+ gettconinfo" - case $prev in - '-v'|'-h') - return 0 - ;; - 'fileaccessinfo'|'filealigninfo'|'fileallinfo'|'filebasicinfo'|'fileeainfo'|'filefsfullsizeinfo'|\ -- 'fileinternalinfo'|'filemodeinfo'|'filepositioninfo'|'filestandardinfo'|'fsctl-getobjid'|\ -- 'getcompression'|'setcompression'|'list-snapshots'|'quota'|'secdesc') -+ 'fileinternalinfo'|'filemodeinfo'|'filepositioninfo'|'filestandardinfo'|'filestreaminfo'|'fsctl-getobjid'|\ -+ 'getcompression'|'setcompression'|'list-snapshots'|'quota'|'secdesc'|'keys'|'gettconinfo') - local IFS=$'\n' - compopt -o filenames - COMPREPLY=( $(compgen -f -o dirnames -- ${cur:-""}) ) --- -2.46.1 - diff --git a/sources b/sources index f1fc9fb..1503a0e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cifs-utils-7.2.tar.bz2) = de1a3fb0c336814abec74d6af71890848625c75ab9642635ab292413d42560ea11ac19e48ef36c2db09d30da5b03d939dd612a6da60b270841b2c8bb2b1f8676 +SHA512 (cifs-utils-7.4.tar.bz2) = 36fb64ed531e983752be243be488392ba52c3797ac638147a75998b8965448009e95d7ccda187c7d50d753b0ddb87a464a83044064b099d49fffe03a0b6ba739