Accepting request 967142 from home:lee_duncan:branches:Base:System

Update to version v1.0.82 (from 1.0.74)

OBS-URL: https://build.opensuse.org/request/show/967142
OBS-URL: https://build.opensuse.org/package/show/Base:System/tgt?expand=0&rev=51
This commit is contained in:
Lee Duncan 2022-04-06 17:39:28 +00:00 committed by Git OBS Bridge
parent e57e6f060f
commit 141d6d0711
7 changed files with 52 additions and 116 deletions

View File

@ -4,8 +4,8 @@
<param name="url">https://github.com/fujita/tgt.git</param>
<param name="subdir"></param>
<param name="filename">tgt</param>
<param name="versionformat">v1.0.74</param>
<param name="revision">1.0.74</param>
<param name="versionformat">v1.0.82</param>
<param name="revision">v1.0.82</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">

View File

@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/fujita/tgt.git</param>
<param name="changesrevision">f33f6b73d3bfac8b3e44f068d02f90627b407f4e</param></service></servicedata>
<param name="changesrevision">fd4ca0546aa20fa9627c41ca2028db26e11f8d56</param></service></servicedata>

View File

@ -1,102 +0,0 @@
From 2de8bebe132e3b998bf4848d0bd22b50367ad4b8 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Sat, 16 Feb 2019 10:29:19 -0800
Subject: [PATCH] Fix gcc7 string truncation warnings.
Mostly, this is fixed by checking the legnth
of strings to be copied, making sure they will
fit where they are being copied to, and
erroring out if the copy will not fit. Then
we can just use strcpy(). We also use
scsi_sprintf() for copying to SCSI structures,
with their special requirements.
---
usr/mgmt.c | 9 +++++++--
usr/smc.c | 9 +++++++--
usr/spc.c | 9 ++++++---
usr/tgtadm.c | 6 +++++-
4 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/usr/mgmt.c b/usr/mgmt.c
index de23f1469494..00a4e08c01dc 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -797,11 +797,16 @@ int ipc_init(void)
goto close_lock_fd;
}
- snprintf(mgmt_path, sizeof(mgmt_path), "%s.%d", path, control_port);
+ snprintf(mgmt_path, sizeof(mgmt_path) - 1, "%s.%d", path, control_port);
+ if (strlen(mgmt_path) > (sizeof(addr.sun_path) - 1)) {
+ eprintf("managment path too long: %s\n", mgmt_path);
+ goto close_ipc_fd;
+ }
unlink(mgmt_path);
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL;
- strncpy(addr.sun_path, mgmt_path, sizeof(addr.sun_path));
+ /* no need for strncpy because we already checked length */
+ strcpy(addr.sun_path, mgmt_path);
err = bind(fd, (struct sockaddr *) &addr, sizeof(addr));
if (err) {
diff --git a/usr/smc.c b/usr/smc.c
index b80aba272909..bbc7b7fc7b88 100644
--- a/usr/smc.c
+++ b/usr/smc.c
@@ -732,8 +732,13 @@ static tgtadm_err config_slot(struct scsi_lu *lu, struct tmp_param *tmp)
adm_err = TGTADM_SUCCESS;
break;
}
- strncpy(s->barcode, tmp->barcode, sizeof(s->barcode));
- strncpy(s->volume_tag, tmp->volume_tag, sizeof(s->volume_tag));
+ if (strlen(tmp->barcode) > sizeof(s->barcode) ||
+ strlen(tmp->volume_tag) > sizeof(s->volume_tag)) {
+ eprintf("barcode or volume tag too large?");
+ break;
+ }
+ strcpy(s->barcode, tmp->barcode);
+ strcpy(s->volume_tag, tmp->volume_tag);
set_slot_full(s, 0, NULL);
adm_err = TGTADM_SUCCESS;
break;
diff --git a/usr/spc.c b/usr/spc.c
index 82a6ec9ee863..902d5bf4a60b 100644
--- a/usr/spc.c
+++ b/usr/spc.c
@@ -289,9 +289,12 @@ int spc_inquiry(int host_no, struct scsi_cmd *cmd)
data[7] = 0x02;
memset(data + 8, 0x20, 28);
- strncpy((char *)data + 8, attrs->vendor_id, VENDOR_ID_LEN);
- strncpy((char *)data + 16, attrs->product_id, PRODUCT_ID_LEN);
- strncpy((char *)data + 32, attrs->product_rev, PRODUCT_REV_LEN);
+ scsi_sprintf((char *)data + 8, VENDOR_ID_LEN, "%-*s",
+ VENDOR_ID_LEN, attrs->vendor_id);
+ scsi_sprintf((char *)data + 16, PRODUCT_ID_LEN, "%-*s",
+ PRODUCT_ID_LEN, attrs->product_id);
+ scsi_sprintf((char *)data + 32, PRODUCT_REV_LEN, "%-*s",
+ PRODUCT_REV_LEN, attrs->product_rev);
desc = (uint16_t *)(data + 58);
for (i = 0; i < ARRAY_SIZE(attrs->version_desc); i++)
diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index 5572c3888a80..cb3eb1cd126f 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -224,7 +224,11 @@ static int ipc_mgmt_connect(int *fd)
snprintf(mgmt_path, sizeof(mgmt_path), "%s.%d",
path, control_port);
- strncpy(addr.sun_path, mgmt_path, sizeof(addr.sun_path));
+ if (strlen(mgmt_path) > (sizeof(addr.sun_path) - 1)) {
+ eprintf("management path too long: %s\n", mgmt_path);
+ return EINVAL;
+ }
+ strcpy(addr.sun_path, mgmt_path);
err = connect(*fd, (struct sockaddr *) &addr, sizeof(addr));
if (err < 0)
--
2.16.4

3
tgt-v1.0.82.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:063faa1db0585bd61d3610ca5e51c710a44c06329cf8fe316698aef9e5cba232
size 313941

View File

@ -1,3 +1,42 @@
-------------------------------------------------------------------
Tue Apr 5 19:01:02 UTC 2022 - Lee Duncan <lduncan@suse.com>
- Update to version v1.0.82 (from 1.0.74):
* tgt 1.0.82
* README: minor improvement
* Fix FMK and other flags. sg return good length and sense len. Not needed, additional condition. LTO streamer not work with check only ILI flag, need check FMK and may be other. Without thois check working fine. Test on LTO1 and LTO5 streamers.
* tgt 1.0.81
* README: use markdown format
* Add LICENSE file
* replace sourceforge with github
* tgt 1.0.80
* scripts/checkpatch.pl: escape literal left braces
* Replace __packed with __attribute__(...)
* Avoid passing NULL pointer to printf
* set INFORMATION field on COMPARE AND WRITE miscompare
* add helper to fill sense INFORMATION field
* Clean up error handling
* target: replace bzero with memset
* CHAP_AUTH_STATE_RESPONSE belongs to auth_state
* After rewind option, la->tail may equal la->head. This causes the old logmsg to be lost
* tgt 1.0.79
* fix coding style in log.h
* tgt 1.0.78
* tgtd: support pid file for tgtd daemon
* iscsi_tcp: add support for listening on random port
* iscsi_tcp: fix compile warning
* iscsi_tcp: Replace deprecated valloc function
* tgt 1.0.77
* spc: implement spc 0xb1 and support rotation rate
* tgt 1.0.76
* fix segmentation fault caused by scsi_sprintf
* tgt 1.0.75
* Fix gcc7 string truncation warnings.
* Update README
This removed the need for the following patch (in the code now):
* tgt-Fix-gcc7-string-truncation-warnings.patch
The SPEC file was also updated to match updated filenames.
-------------------------------------------------------------------
Wed Nov 24 15:09:05 UTC 2021 - Johannes Segitz <jsegitz@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package tgt
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -22,20 +22,19 @@
%endif
Name: tgt
Version: 1.0.74
Version: v1.0.82
Release: 0
Summary: Generic Linux target framework (tgt)
License: GPL-2.0-only
Group: System/Daemons
URL: http://stgt.sourceforge.net/
Source: https://github.com/fujita/%{name}/archive/v%{version}.tar.gz
Source: %{name}-%{version}.tar.gz
Source1: %{name}d.service
Source4: sysconfig.%{name}
Patch1: %{name}-fix-build
Patch2: setup-tgt-conf-d.patch
Patch3: %{name}-include-sys-macros-for-major.patch
Patch4: %{name}-Fix-gcc7-string-truncation-warnings.patch
Patch5: harden_tgtd.service.patch
Patch5: harden_tgtd.service.patch
BuildRequires: docbook-xsl-stylesheets
BuildRequires: libaio-devel
BuildRequires: libxslt
@ -59,7 +58,6 @@ user-space daemon and tools (i.e. they completely runs in user space).
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
@ -97,9 +95,10 @@ ln -sf service %{buildroot}/%{_sbindir}/rc%{name}d
%config %attr(0644,root,root) %{_sysconfdir}/tgt/targets.conf
%{_fillupdir}/sysconfig.tgt
%{_unitdir}/%{name}d.service
%doc README doc/README.iscsi doc/README.iser doc/README.lu_configuration
%doc README.md doc/README.iscsi doc/README.iser doc/README.lu_configuration
%doc doc/README.mmc doc/README.passthrough doc/README.sbcjukebox doc/README.ssc
%doc doc/README.rbd doc/tmf.txt
%doc doc/README.rbd doc/README.glfs doc/README.sheepdog doc/README.vtl
%doc doc/tmf.txt
%doc %_defaultdocdir/%name/examples
%doc %_defaultdocdir/%name/html
%{_mandir}/man5/*

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bfc202790d5326d7a18bd3928b4bb204ffb0acf443a5ec5c16a1a0fbc53be99f
size 296992