Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-block/open-iscsi/, sys-block/open-iscsi/files/
Date: Fri, 18 Dec 2015 00:00:48
Message-Id: 1450396805.5eafff1506f58a1e7844b806f93dd9e93f9e271e.vapier@gentoo
1 commit: 5eafff1506f58a1e7844b806f93dd9e93f9e271e
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 17 23:55:29 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 18 00:00:05 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5eafff15
7
8 sys-block/open-iscsi: fix incorrect memset call
9
10 .../files/open-iscsi-2.0.873-memset.patch | 24 ++++++
11 sys-block/open-iscsi/open-iscsi-2.0.873-r1.ebuild | 95 ++++++++++++++++++++++
12 2 files changed, 119 insertions(+)
13
14 diff --git a/sys-block/open-iscsi/files/open-iscsi-2.0.873-memset.patch b/sys-block/open-iscsi/files/open-iscsi-2.0.873-memset.patch
15 new file mode 100644
16 index 0000000..c566691
17 --- /dev/null
18 +++ b/sys-block/open-iscsi/files/open-iscsi-2.0.873-memset.patch
19 @@ -0,0 +1,24 @@
20 +clear the size of the storage, not the size of the pointer
21 +
22 +--- a/usr/md5.c
23 ++++ b/usr/md5.c
24 +@@ -127,7 +127,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
25 +
26 + byteSwap(ctx->buf, 4);
27 + memcpy(digest, ctx->buf, 16);
28 +- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
29 ++ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
30 + }
31 +
32 + #ifndef ASM_MD5
33 +--- a/utils/md5.c
34 ++++ b/utils/md5.c
35 +@@ -133,7 +133,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
36 +
37 + byteSwap(ctx->buf, 4);
38 + memcpy(digest, ctx->buf, 16);
39 +- memset(ctx, 0, sizeof (ctx)); /* In case it's sensitive */
40 ++ memset(ctx, 0, sizeof (*ctx)); /* In case it's sensitive */
41 + }
42 +
43 + #ifndef ASM_MD5
44
45 diff --git a/sys-block/open-iscsi/open-iscsi-2.0.873-r1.ebuild b/sys-block/open-iscsi/open-iscsi-2.0.873-r1.ebuild
46 new file mode 100644
47 index 0000000..4392860
48 --- /dev/null
49 +++ b/sys-block/open-iscsi/open-iscsi-2.0.873-r1.ebuild
50 @@ -0,0 +1,95 @@
51 +# Copyright 1999-2015 Gentoo Foundation
52 +# Distributed under the terms of the GNU General Public License v2
53 +# $Id$
54 +
55 +EAPI=5
56 +
57 +inherit versionator linux-info eutils flag-o-matic toolchain-funcs
58 +
59 +MY_P="${PN}-$(replace_version_separator 2 "-")"
60 +
61 +DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720"
62 +HOMEPAGE="http://www.open-iscsi.org/"
63 +SRC_URI="http://www.open-iscsi.org/bits/${MY_P}.tar.gz"
64 +
65 +LICENSE="GPL-2"
66 +SLOT="0"
67 +KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
68 +IUSE="debug slp"
69 +
70 +DEPEND="slp? ( net-libs/openslp )"
71 +RDEPEND="${DEPEND}
72 + sys-fs/lsscsi
73 + sys-apps/util-linux"
74 +
75 +S="${WORKDIR}/${MY_P}"
76 +
77 +pkg_setup() {
78 + linux-info_pkg_setup
79 +
80 + if kernel_is -lt 2 6 16; then
81 + die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
82 + fi
83 +
84 + # Needs to be done, as iscsid currently only starts, when having the iSCSI
85 + # support loaded as module. Kernel builtion options don't work. See this for
86 + # more information:
87 + # https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
88 + # If there's a new release, check whether this is still valid!
89 + CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
90 + if linux_config_exists; then
91 + for module in ${CONFIG_CHECK_MODULES}; do
92 + linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
93 + done
94 + fi
95 +}
96 +
97 +src_prepare() {
98 + epatch "${FILESDIR}"/${P}-Makefiles.patch
99 + epatch "${FILESDIR}"/${P}-memset.patch
100 +
101 + sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
102 +}
103 +
104 +src_configure() {
105 + cd utils/open-isns || die
106 +
107 + # SSL (--with-security) is broken
108 + econf $(use_with slp) \
109 + --without-security
110 +}
111 +
112 +src_compile() {
113 + use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
114 +
115 + KSRC="${KV_DIR}" CFLAGS="" \
116 + emake \
117 + OPTFLAGS="${CFLAGS}" \
118 + AR="$(tc-getAR)" CC="$(tc-getCC)" \
119 + user
120 +}
121 +
122 +src_install() {
123 + emake DESTDIR="${ED}" sbindir="/usr/sbin" install
124 +
125 + dodoc README THANKS
126 +
127 + docinto test/
128 + dodoc test/*
129 +
130 + insinto /etc/iscsi
131 + newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
132 +
133 + # udev pieces
134 + insinto /lib/udev/rules.d
135 + doins "${FILESDIR}"/99-iscsi.rules
136 + exeinto /etc/udev/scripts
137 + doexe "${FILESDIR}"/iscsidev.sh
138 +
139 + newconfd "${FILESDIR}"/iscsid-conf.d iscsid
140 + newinitd "${FILESDIR}"/iscsid-init.d iscsid
141 +
142 + keepdir /var/db/iscsi
143 + fperms 700 /var/db/iscsi
144 + fperms 600 /etc/iscsi/iscsid.conf
145 +}