aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@gmail.com>2010-02-19 15:07:20 +0000
committerLeonardo Arena <rnalrd@gmail.com>2010-02-19 15:07:20 +0000
commitaccf8dcf9ac68e08e3e1ebfc4300287cf91f3e4e (patch)
tree38e5ae0d65c550817fdf84e178c6a552510549c9 /testing
parentfe3c74dd23459bd5a35e3d14d5f999fc17bd923a (diff)
downloadaports-accf8dcf9ac68e08e3e1ebfc4300287cf91f3e4e.tar.bz2
aports-accf8dcf9ac68e08e3e1ebfc4300287cf91f3e4e.tar.xz
testing/open-iscsi: new aport
Diffstat (limited to 'testing')
-rw-r--r--testing/open-iscsi/APKBUILD41
-rw-r--r--testing/open-iscsi/CVE-2009-1297.patch31
-rw-r--r--testing/open-iscsi/iscsid-2.0.871-r1.init.d127
-rw-r--r--testing/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch33
4 files changed, 232 insertions, 0 deletions
diff --git a/testing/open-iscsi/APKBUILD b/testing/open-iscsi/APKBUILD
new file mode 100644
index 0000000000..b2ea59d0d3
--- /dev/null
+++ b/testing/open-iscsi/APKBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Leonardo Arena <rnalrd@gmail.com>
+pkgname=open-iscsi
+pkgver=2.0.871
+_realver=2.0-871
+pkgrel=0
+pkgdesc="High performance, transport independent, multi-platform iSCSI initiator"
+url="http://www.open-iscsi.org"
+license="GPL-2"
+depends=
+makedepends=
+install=
+subpackages="$pkgname-doc"
+source="http://www.open-iscsi.org/bits/$pkgname-$_realver.tar.gz
+ CVE-2009-1297.patch
+ open-iscsi-2.0.871-makefile-cleanup.patch"
+
+_builddir="$srcdir"/$pkgname-$_realver
+
+prepare() {
+ cd "$_builddir"
+ patch -p0 < ../../CVE-2009-1297.patch || return 1
+ patch -p1 < ../../open-iscsi-2.0.871-makefile-cleanup.patch || return 1
+}
+
+build() {
+ cd "$_builddir"
+ make user || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install_user
+ mkdir -p $pkgdir/usr/bin
+ mv $pkgdir/sbin/iscsi-iname $pkgdir/usr/bin
+ mv $pkgdir/sbin/iscsi_discovery $pkgdir/usr/bin
+ mv $pkgdir/sbin/iscsiadm $pkgdir/usr/bin
+}
+
+md5sums="0c403e8c9ad41607571ba0e6e8ff196e open-iscsi-2.0-871.tar.gz
+d1584790b4e12f087e60089880b53d2b CVE-2009-1297.patch
+734300d7b7590dc9ae9b2fb7f5b51bf0 open-iscsi-2.0.871-makefile-cleanup.patch"
diff --git a/testing/open-iscsi/CVE-2009-1297.patch b/testing/open-iscsi/CVE-2009-1297.patch
new file mode 100644
index 0000000000..d1728fff7e
--- /dev/null
+++ b/testing/open-iscsi/CVE-2009-1297.patch
@@ -0,0 +1,31 @@
+--- utils.orig/iscsi_discovery 2009-10-26 23:09:08.000000000 +0100
++++ utils/iscsi_discovery 2009-10-26 23:11:56.000000000 +0100
+@@ -104,24 +104,22 @@
+
+ connected=0
+ discovered=0
+- df=/tmp/discovered.$$
+
+ dbg "starting discovery to $ip"
+- iscsiadm -m discovery --type sendtargets --portal ${ip}:${port} > ${df}
+- while read portal target
++ disc="$(iscsiadm -m discovery --type sendtargets --portal ${ip}:${port})"
++ echo "${disc}" | while read portal target
+ do
+ portal=${portal%,*}
+ select_transport
+- done < ${df}
++ done
+
+- discovered=$(cat ${df} | wc -l)
++ discovered=$(echo "${disc}" | wc -l)
+ if [ ${discovered} = 0 ]; then
+ echo "failed to discover targets at ${ip}"
+ exit 2
+ else
+ echo "discovered ${discovered} targets at ${ip}"
+ fi
+- /bin/rm -f ${df}
+ }
+
+ try_login()
diff --git a/testing/open-iscsi/iscsid-2.0.871-r1.init.d b/testing/open-iscsi/iscsid-2.0.871-r1.init.d
new file mode 100644
index 0000000000..2646dd5ebf
--- /dev/null
+++ b/testing/open-iscsi/iscsid-2.0.871-r1.init.d
@@ -0,0 +1,127 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/sys-block/open-iscsi/files/iscsid-2.0.871-r1.init.d,v 1.1 2009/11/12 09:29:48 robbat2 Exp $
+
+opts="${opts} starttargets stoptargets restarttargets"
+
+depend() {
+ after modules
+ use net
+}
+
+checkconfig() {
+ if [ ! -e /etc/conf.d/${SVCNAME} ]; then
+ eerror "Config file /etc/conf.d/${SVCNAME} does not exist!"
+ return 1
+ fi
+ if [ ! -e "${CONFIG_FILE}" ]; then
+ eerror "Config file ${CONFIG_FILE} does not exist!"
+ return 1
+ fi
+ if [ ! -e ${INITIATORNAME_FILE} ] || [ ! "$(grep "^InitiatorName=iqn\." ${INITIATORNAME_FILE})" ]; then
+ ewarn "${INITIATORNAME_FILE} should contain a string with your initiatior name."
+ IQN=iqn.$(date +%Y-%m).$(hostname -f | awk 'BEGIN { FS=".";}{x=NF; while (x>0) {printf $x ;x--; if (x>0) printf ".";} print ""}'):openiscsi
+ IQN=${IQN}-$(echo ${RANDOM}${RANDOM}${RANDOM}${RANDOM}${RANDOM} | md5sum | sed -e "s/\(.*\) -/\1/g" -e 's/ //g')
+ ebegin "Creating InitiatorName ${IQN} in ${INITIATORNAME_FILE}"
+ echo "InitiatorName=${IQN}" >> "${INITIATORNAME_FILE}"
+ eend $?
+ fi
+}
+
+do_modules() {
+ msg="$1"
+ shift
+ modules="${1}"
+ shift
+ modopts="$@"
+ for m in ${modules}
+ do
+ if [ -n "$(modprobe -l | grep ${m})" ]
+ then
+ ebegin "${msg} ${m}"
+ modprobe ${modopts} ${m}
+ ret=$?
+ eend ${ret}
+ if [ ${ret} -ne 0 ]; then
+ return ${ret}
+ fi
+ else
+ ebegin "${msg} ${m}: not found"
+ return 1
+ fi
+ done
+ return 0
+}
+
+start() {
+ ebegin "Checking open-iSCSI configuration"
+ checkconfig
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eend 1
+ return 1
+ fi
+ ebegin "Loading iSCSI modules"
+ do_modules 'Loading' 'libiscsi scsi_transport_iscsi iscsi_tcp'
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eend 1
+ return 1
+ fi
+
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --quiet --exec /usr/sbin/iscsid -- ${OPTS}
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eend $?
+ return $?
+ fi
+
+ # Start automatic targets when iscsid is started
+ if [ "${AUTOSTARTTARGETS}" = "yes" ]; then
+ starttargets
+ return $?
+ fi
+ return 0
+}
+
+stop() {
+ stoptargets
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --signal HUP --stop --quiet --exec /usr/sbin/iscsid #--pidfile $PID_FILE
+ eend $?
+
+ # ugly, but pid file is not removed by iscsid
+ rm -f $PID_FILE
+
+ do_modules 'Removing iSCSI modules' 'iscsi_tcp scsi_transport_iscsi libiscsi' '-r'
+ eend $?
+}
+
+starttargets() {
+ ebegin "Setting up iSCSI targets"
+ /usr/sbin/iscsiadm -m node --loginall=automatic
+ ret=$?
+ eend $ret
+ return $ret
+}
+
+stoptargets() {
+ ebegin "Disconnecting iSCSI targets"
+ sync
+ /usr/sbin/iscsiadm -m node --logoutall=all
+ ret=$?
+ eend $ret
+ return $ret
+}
+
+restarttargets() {
+ stoptargets
+ starttargets
+}
+
+status() {
+ ebegin "Showing current active iSCSI sessions"
+ /usr/sbin/iscsiadm -m session
+}
diff --git a/testing/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch b/testing/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch
new file mode 100644
index 0000000000..6ca2a4eaba
--- /dev/null
+++ b/testing/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch
@@ -0,0 +1,33 @@
+diff -Nuar open-iscsi-2.0-871.orig/usr/Makefile open-iscsi-2.0-871/usr/Makefile
+--- open-iscsi-2.0-871.orig/usr/Makefile 2009-07-10 20:55:58.000000000 -0700
++++ open-iscsi-2.0-871/usr/Makefile 2009-11-12 00:58:16.467960344 -0800
+@@ -48,14 +48,14 @@
+ all: $(PROGRAMS)
+
+ iscsid: $(COMMON_SRCS) $(IPC_OBJ) $(INITIATOR_SRCS) iscsid.o
+- $(CC) $(CFLAGS) $^ -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+ iscsiadm: $(COMMON_SRCS) $(FW_BOOT_SRCS) strings.o discovery.o iscsiadm.o
+- $(CC) $(CFLAGS) $^ -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+
+ iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
+ iscsistart.o statics.o
+- $(CC) $(CFLAGS) -static $^ -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
+ clean:
+ rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
+
+diff -Nuar open-iscsi-2.0-871.orig/utils/Makefile open-iscsi-2.0-871/utils/Makefile
+--- open-iscsi-2.0-871.orig/utils/Makefile 2009-07-10 20:55:58.000000000 -0700
++++ open-iscsi-2.0-871/utils/Makefile 2009-11-12 00:58:56.404623435 -0800
+@@ -6,7 +6,7 @@
+ all: $(PROGRAMS)
+
+ iscsi-iname: md5.o iscsi-iname.o
+- $(CC) $(CFLAGS) $^ $(DBM_LIB) -o $@
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(DBM_LIB) $^
+
+ clean:
+ rm -f *.o $(PROGRAMS) .depend