Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
0d5ca40a7b
!21 [sync] PR-20: avoild Ctrl+C print error stack
From: @openeuler-sync-bot 
Reviewed-by: @wk333 
Signed-off-by: @wk333
2024-04-08 08:48:14 +00:00
yanshuai01
b1a0241609 avoild Ctrl+C print error stack
(cherry picked from commit fa1d55a3d254a3b2aa97f8035ecda8f5ace33777)
2024-04-08 16:47:27 +08:00
openeuler-ci-bot
0c09206658
!19 [sync] PR-18: Fix changing savedir directory mode
From: @openeuler-sync-bot 
Reviewed-by: @wk333 
Signed-off-by: @wk333
2024-04-08 07:37:28 +00:00
yanshuai
4b116dbd7a Fix changing savedir directory mode
(cherry picked from commit 086876a1844bc20d5ac88cfa01b010e6a0004fdf)
2024-04-08 14:50:08 +08:00
openeuler-ci-bot
8753226a16 !7 targetcli升级至2.1.54
Merge pull request !7 from 吴磊磊/openEuler-22.03-LTS-Next
2021-12-30 13:27:13 +00:00
wu-leilei
74dc5cf832 package update 2021-12-30 16:07:47 +08:00
openeuler-ci-bot
d2d2a1edd8 !3 Fix unexpected error raised when adding luns
Merge pull request !3 from wang_yue111/master
2020-07-15 19:50:12 +08:00
wang_yue111
f4863df394 Fix unexpected error raised when adding luns 2020-07-15 19:26:52 +08:00
openeuler-ci-bot
5215822e04 !2 add targetcli.yaml
Merge pull request !2 from 成子晗/master
2020-05-09 20:17:58 +08:00
chengzihan2
626067bc9e add targetcli.yaml 2020-05-07 16:49:08 +08:00
7 changed files with 109 additions and 35 deletions

View File

@ -1,21 +0,0 @@
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

@ -0,0 +1,25 @@
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

@ -0,0 +1,48 @@
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

BIN
targetcli-fb-2.1.54.tar.gz Normal file

Binary file not shown.

View File

@ -1,14 +1,15 @@
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/v2.1.fb48.tar.gz
Patch0000: 0000-signed-char.patch
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
BuildArch: noarch
BuildRequires: python3-devel python3-setuptools
Requires: python3-rtslib target-restore python3-configshell python3-six python3-dbus python3-gobject
BuildRequires: python3-devel python3-setuptools systemd
Requires: python3-rtslib target-restore python3-configshell python3-six python3-dbus python3-gobject-base
%description
Targetcli is an administration tool for managing storage targets
@ -24,24 +25,41 @@ Help document for the %{name} package.
%autosetup -n targetcli-fb-%{version} -p1
%build
%{__python3} setup.py build
gzip --stdout targetcli.8 > targetcli.8.gz
%py3_build
%install
%{__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
%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}/
%files
%doc COPYING README.md
%{python3_sitelib}/*
%doc README.md
%license COPYING
%{python3_sitelib}/targetcli*
%{_bindir}/targetcli
%{_bindir}/targetclid
%{_unitdir}/*
%dir %{_sysconfdir}/target
%dir %{_sysconfdir}/target/backup
%files help
%{_mandir}/man8/targetcli.8.gz
%{_mandir}/man8/targetcli*.8*
%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

4
targetcli.yaml Normal file
View File

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

Binary file not shown.