Compare commits

..

No commits in common. "0d5ca40a7b7830cb6863bb4d344421d3acf5c4cd" and "6b0691445ff8163901ae2707c0f55eae041797e8" have entirely different histories.

7 changed files with 35 additions and 109 deletions

21
0000-signed-char.patch Normal file
View File

@ -0,0 +1,21 @@
commit ed5ff9b9505e50b545e86dfbdd32077f0ddda0cb
Author: Taylor Jakobson <tjakobs@us.ibm.com>
Date: Thu Feb 1 14:44:32 2018 -0600
Use signed char instead of char
Python3 does not have the "character" type, use signed char instead.
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index 3a2db10..5af448f 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -536,7 +536,7 @@ class UIBlockBackstore(UIBackstore):
except (OSError, IOError):
raise ExecutionError("Could not open %s" % dev)
# ioctl returns an int. Provision a buffer for it
- buf = array.array('c', [chr(0)] * 4)
+ buf = array.array('b', [0] * 4)
try:
fcntl.ioctl(f, BLKROGET, buf)
except (OSError, IOError):

View File

@ -1,25 +0,0 @@
From b4632c05d8c0a51460fb84ea70820f5136105fff Mon Sep 17 00:00:00 2001
From: Mingzhe Zou <zoumingzhe@qq.com>
Date: Mon, 27 Mar 2023 16:42:43 +0800
Subject: [PATCH] targetcli: avoild Ctrl+C print error stack
---
scripts/targetcli | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/targetcli b/scripts/targetcli
index f00bffc..89a8188 100755
--- a/scripts/targetcli
+++ b/scripts/targetcli
@@ -326,4 +326,7 @@ def main():
if __name__ == "__main__":
- main()
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
--
2.27.0

View File

@ -1,48 +0,0 @@
From b8eb1933d4fdcbe806edead8cfa94879d0fc2015 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Mon, 24 Apr 2023 10:34:39 -0700
Subject: [PATCH] Fix changing savedir directory mode
Commit 9f5764dac39b ("saveconfig: set right perms on /etc/target/ dir")
fixed CVE-2020-13867 by ensuring that the mode of the target
meta-data directory (/etc/target) was always mode 0600. But users
can specify a different directory, such as "/tmp", and we don't
want targetcli changing the mode of such directories to 0600. So
only change the mode of the directory, when saving a config file,
if the directory is /etc/target.
---
targetcli/ui_root.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/targetcli/ui_root.py b/targetcli/ui_root.py
index 39e5ee9..79ee985 100644
--- a/targetcli/ui_root.py
+++ b/targetcli/ui_root.py
@@ -34,8 +34,9 @@ from .ui_backstore import complete_path, UIBackstores
from .ui_node import UINode
from .ui_target import UIFabricModule
-default_save_file = "/etc/target/saveconfig.json"
-universal_prefs_file = "/etc/target/targetcli.conf"
+default_target_dir = "/etc/target"
+default_save_file = os.path.join(default_target_dir, "saveconfig.json")
+universal_prefs_file = os.path.join(default_target_dir, "targetcli.conf")
class UIRoot(UINode):
'''
@@ -112,8 +113,9 @@ class UIRoot(UINode):
finally:
os.umask(umask_original)
else:
- if (os.stat(dirname).st_mode & 0o777) != mode:
- os.chmod(dirname, mode)
+ if dirname == default_target_dir:
+ if (os.stat(dirname).st_mode & 0o777) != mode:
+ os.chmod(dirname, mode)
def _save_backups(self, savefile):
'''
--
2.23.0

Binary file not shown.

View File

@ -1,15 +1,14 @@
Name: targetcli
Version: 2.1.fb48
Release: 9
License: ASL 2.0
Summary: Generic SCSI target CLI shell
Version: 2.1.54
Release: 3
URL: https://github.com/open-iscsi/targetcli-fb
Source: https://github.com/open-iscsi/targetcli-fb/archive/v%{version}/targetcli-fb-%{version}.tar.gz
Patch01: Fix-changing-savedir-directory-mode.patch
Patch02: Avoild-print-error-stack.patch
Source: https://github.com/open-iscsi/targetcli-fb/archive/v2.1.fb48.tar.gz
Patch0000: 0000-signed-char.patch
BuildArch: noarch
BuildRequires: python3-devel python3-setuptools systemd
Requires: python3-rtslib target-restore python3-configshell python3-six python3-dbus python3-gobject-base
BuildRequires: python3-devel python3-setuptools
Requires: python3-rtslib target-restore python3-configshell python3-six python3-dbus python3-gobject
%description
Targetcli is an administration tool for managing storage targets
@ -25,41 +24,24 @@ Help document for the %{name} package.
%autosetup -n targetcli-fb-%{version} -p1
%build
%py3_build
%{__python3} setup.py build
gzip --stdout targetcli.8 > targetcli.8.gz
%install
%py3_install
mkdir -p %{buildroot}%{_sysconfdir}/target/backup
mkdir -p %{buildroot}%{_mandir}/man8/
install -m 644 targetcli*.8 %{buildroot}%{_mandir}/man8/
mkdir -p %{buildroot}%{_unitdir}/
install -m 644 systemd/* %{buildroot}%{_unitdir}/
%{__python3} setup.py install --skip-build --root %{buildroot}
install -d %{buildroot}%{_sysconfdir}/target/backup
install -D -m 644 targetcli.8.gz %{buildroot}%{_mandir}/man8/targetcli.8.gz
%files
%doc README.md
%license COPYING
%{python3_sitelib}/targetcli*
%doc COPYING README.md
%{python3_sitelib}/*
%{_bindir}/targetcli
%{_bindir}/targetclid
%{_unitdir}/*
%dir %{_sysconfdir}/target
%dir %{_sysconfdir}/target/backup
%files help
%{_mandir}/man8/targetcli*.8*
%{_mandir}/man8/targetcli.8.gz
%changelog
* Mon Apr 8 2024 yanshuai <yanshuai@kylinos.cn> - 2.1.54-3
- avoild Ctrl+C print error stack
* Sun Apr 7 2024 yanshuai <yanshuai@kylinos.cn> - 2.1.54-2
- Fix changing savedir directory mode
* Wed Dec 29 2021 wulei <wulei80@huawei.com> - 2.1.54-1
- Package update
* Wed Jul 15 2020 wangyue <wangyue92@huawei.com> - 2.1.fb48-10
- fix unexpected error raised when adding luns
* Fri Feb 14 2020 lingsheng <lingsheng@huawei.com> - 2.1.fb48-9
- Package int

View File

@ -1,4 +0,0 @@
version_control: github
src_repo: open-iscsi/targetcli-fb
tag_prefix: ^v
seperator: .

BIN
v2.1.fb48.tar.gz Normal file

Binary file not shown.