resolves: RHEL-131409 - fix regression with cifscreds(1)

Signed-off-by: Paulo Alcantara <paalcant@redhat.com>
This commit is contained in:
Paulo Alcantara 2025-11-27 14:35:09 -03:00
parent e4f80a539f
commit ff17c4260c
6 changed files with 122 additions and 49 deletions

1
.gitignore vendored
View File

@ -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

View File

@ -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

View File

@ -0,0 +1,82 @@
From 828cb25224cd88b3599d5ca79a7c9435491896db Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <pc@manguebit.org>
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 <xifeng@redhat.com>
Reported-by: Jay Shin <jaeshin@redhat.com>
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Cc: Steve French <smfrench@gmail.com>
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

View File

@ -0,0 +1,34 @@
From b9680e868d4bdf9337e542b08a559e9ca5ea6cc0 Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <pc@manguebit.org>
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 <apanagio@redhat.com>
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Cc: Steve French <smfrench@gmail.com>
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

View File

@ -1,47 +0,0 @@
From d69d2129c6476afbcbbe8dc6e2ed17f233084d85 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20Filipensk=C3=BD?= <pfilipensky@samba.org>
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ý <pfilipensky@samba.org>
---
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

View File

@ -1 +1 @@
SHA512 (cifs-utils-7.2.tar.bz2) = de1a3fb0c336814abec74d6af71890848625c75ab9642635ab292413d42560ea11ac19e48ef36c2db09d30da5b03d939dd612a6da60b270841b2c8bb2b1f8676
SHA512 (cifs-utils-7.4.tar.bz2) = 36fb64ed531e983752be243be488392ba52c3797ac638147a75998b8965448009e95d7ccda187c7d50d753b0ddb87a464a83044064b099d49fffe03a0b6ba739