aboutsummaryrefslogtreecommitdiffstats
path: root/main/open-iscsi-grsec/CVE-2009-1297.patch
blob: d1728fff7e6514819cd0140a03a4730571084b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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()