summaryrefslogtreecommitdiff
path: root/openwrt/package/openswan/patches/scripts.patch
blob: 5925f0768a78fb6a2e8ce1cfe67df0b4b8fec12d (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
diff -Nur openswan-2.4.0.orig/programs/loggerfix openswan-2.4.0/programs/loggerfix
--- openswan-2.4.0.orig/programs/loggerfix	1970-01-01 01:00:00.000000000 +0100
+++ openswan-2.4.0/programs/loggerfix	2005-09-29 13:44:43.325458750 +0200
@@ -0,0 +1,5 @@
+#!/bin/sh
+# use filename instead of /dev/null to log, but dont log to flash or ram
+# pref. log to nfs mount
+echo "$*" >> /dev/null
+exit 0
diff -Nur openswan-2.4.0.orig/programs/look/look.in openswan-2.4.0/programs/look/look.in
--- openswan-2.4.0.orig/programs/look/look.in	2005-08-18 16:10:09.000000000 +0200
+++ openswan-2.4.0/programs/look/look.in	2005-09-29 13:44:49.537847000 +0200
@@ -84,7 +84,7 @@
 then
 	pat="$pat|$defaultroutephys\$|$defaultroutevirt\$"
 else
-	for i in `echo "$IPSECinterfaces" | sed 's/=/ /'`
+	for i in `echo "$IPSECinterfaces" | tr '=' ' '`
 	do
 		pat="$pat|$i\$"
 	done
diff -Nur openswan-2.4.0.orig/programs/manual/manual.in openswan-2.4.0/programs/manual/manual.in
--- openswan-2.4.0.orig/programs/manual/manual.in	2005-04-18 00:57:12.000000000 +0200
+++ openswan-2.4.0/programs/manual/manual.in	2005-09-29 13:44:52.446028750 +0200
@@ -104,7 +104,7 @@
 				sub(/:/, " ", $0)
 				if (interf != "")
 					print $3 "@" interf
-			 }' | sed ':a;N;$!ba;s/\n/ /g'`"
+			 }' | tr '\n' ' '`"
 	;;
 esac
 
diff -Nur openswan-2.4.0.orig/programs/_plutorun/_plutorun.in openswan-2.4.0/programs/_plutorun/_plutorun.in
--- openswan-2.4.0.orig/programs/_plutorun/_plutorun.in	2005-04-21 23:57:16.000000000 +0200
+++ openswan-2.4.0/programs/_plutorun/_plutorun.in	2005-09-29 13:44:53.442091000 +0200
@@ -147,7 +147,7 @@
 			exit 1
 		fi
 	else
-		if test ! -w "`dirname $stderrlog`"
+		if test ! -w "`echo $stderrlog | sed -r 's/(^.*\/)(.*$)/\1/'`"
 		then
 			echo Cannot write to directory to create \"$stderrlog\".
 			exit 1
diff -Nur openswan-2.4.0.orig/programs/_realsetup/_realsetup.in openswan-2.4.0/programs/_realsetup/_realsetup.in
--- openswan-2.4.0.orig/programs/_realsetup/_realsetup.in	2005-07-28 02:23:48.000000000 +0200
+++ openswan-2.4.0/programs/_realsetup/_realsetup.in	2005-09-29 13:44:53.442091000 +0200
@@ -235,7 +235,7 @@
 
 	# misc pre-Pluto setup
 
-	perform test -d `dirname $subsyslock` "&&" touch $subsyslock
+	perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock
 
 	if test " $IPSECforwardcontrol" = " yes"
 	then
@@ -347,7 +347,7 @@
 		lsmod 2>&1 | grep "^xfrm_user" > /dev/null && rmmod -s xfrm_user
 	fi 
 
-	perform test -d `dirname $subsyslock` "&&" rm -f $subsyslock
+	perform test -d `echo $subsyslock | sed -r 's/(^.*\/)(.*$)/\1/'` "&&" touch $subsyslock "&&" rm -f $subsyslock
 
 	perform rm -f $info $lock $plutopid
 	perform echo "...Openswan IPsec stopped" "|" $LOGONLY
diff -Nur openswan-2.4.0.orig/programs/send-pr/send-pr.in openswan-2.4.0/programs/send-pr/send-pr.in
--- openswan-2.4.0.orig/programs/send-pr/send-pr.in	2005-04-18 01:04:46.000000000 +0200
+++ openswan-2.4.0/programs/send-pr/send-pr.in	2005-09-29 13:44:53.442091000 +0200
@@ -402,7 +402,7 @@
 		    else
 			if [ "$fieldname" != "Category" ]
 			then
-			    values=`${BINDIR}/query-pr --valid-values $fieldname | sed ':a;N;$!ba;s/\n/ /g' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
+			    values=`${BINDIR}/query-pr --valid-values $fieldname | tr '\n' ' ' | sed 's/ *$//g;s/ / | /g;s/^/[ /;s/$/ ]/;'`
 			    valslen=`echo "$values" | wc -c`
 			else
 			    values="choose from a category listed above"
@@ -414,7 +414,7 @@
 			else
 				desc="<${values} (one line)>";
 			fi
-			dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
+			dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
 			echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
 		    fi
 		    echo "${fmtname}${desc}" >> $file
@@ -425,7 +425,7 @@
 			desc="	$default_val";
 		    else
 		        desc="	<`${BINDIR}/query-pr --field-description $fieldname` (multiple lines)>";
-			dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
+			dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
 			echo "s/^${dpat}//" >> $FIXFIL
 		    fi
 		    echo "${fmtname}" >> $file;
@@ -437,7 +437,7 @@
 			desc="${default_val}"
 		    else
 			desc="<`${BINDIR}/query-pr --field-description $fieldname` (one line)>"
-			dpat=`echo "$desc" | sed 's/[][*+^$|\()&/]/./g'`
+			dpat=`echo "$desc" | tr '\]\[*+^$|\()&/' '............'`
 			echo "/^>${fieldname}:/ s/${dpat}//" >> $FIXFIL
 		    fi
 		    echo "${fmtname}${desc}" >> $file
diff -Nur openswan-2.4.0.orig/programs/setup/setup.in openswan-2.4.0/programs/setup/setup.in
--- openswan-2.4.0.orig/programs/setup/setup.in	2005-07-25 21:17:03.000000000 +0200
+++ openswan-2.4.0/programs/setup/setup.in	2005-09-29 13:44:52.446028750 +0200
@@ -117,12 +117,22 @@
 # do it
 case "$1" in
   start|--start|stop|--stop|_autostop|_autostart)
-	if test " `id -u`" != " 0"
+	if [ "x${USER}" != "xroot" ]
 	then
 		echo "permission denied (must be superuser)" |
 			logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
 		exit 1
 	fi
+
+	# make sure all required directories exist
+	if [ ! -d /var/run/pluto ]
+	then
+		mkdir -p /var/run/pluto
+	fi
+	if [ ! -d /var/lock/subsys ]
+	then
+		mkdir -p /var/lock/subsys
+	fi
 	tmp=/var/run/pluto/ipsec_setup.st
 	outtmp=/var/run/pluto/ipsec_setup.out
 	(
diff -Nur openswan-2.4.0.orig/programs/showhostkey/showhostkey.in openswan-2.4.0/programs/showhostkey/showhostkey.in
--- openswan-2.4.0.orig/programs/showhostkey/showhostkey.in	2004-11-14 14:40:41.000000000 +0100
+++ openswan-2.4.0/programs/showhostkey/showhostkey.in	2005-09-29 13:44:52.446028750 +0200
@@ -63,7 +63,7 @@
 	exit 1
 fi
 
-host="`hostname --fqdn`"
+host="`cat /proc/sys/kernel/hostname`"
 
 awk '	BEGIN {
 		inkey = 0
diff -Nur openswan-2.4.0.orig/programs/_startklips/_startklips.in openswan-2.4.0/programs/_startklips/_startklips.in
--- openswan-2.4.0.orig/programs/_startklips/_startklips.in	2005-03-31 23:07:27.000000000 +0200
+++ openswan-2.4.0/programs/_startklips/_startklips.in	2005-09-29 13:44:53.442091000 +0200
@@ -262,15 +262,15 @@
     echo "FATAL ERROR: Both KLIPS and NETKEY IPsec code is present in kernel"
     exit
 fi
-if test ! -f $ipsecversion && test ! -f $netkey && modprobe -qn ipsec
+if test ! -f $ipsecversion && test ! -f $netkey && insmod ipsec
 then
     # statically compiled KLIPS/NETKEY not found; try to load the module
-    modprobe ipsec
+    insmod ipsec
 fi
 
 if test ! -f $ipsecversion && test ! -f $netkey
 then
-	modprobe -v af_key
+	insmod -v af_key
 fi
 
 if test -f $netkey
@@ -278,18 +278,18 @@
 	klips=false
 	if test -f $modules
 	then
-		modprobe -qv ah4
-		modprobe -qv esp4
-		modprobe -qv ipcomp
+		insmod -qv ah4
+		insmod -qv esp4
+		insmod -qv ipcomp
 		#  xfrm4_tunnel is needed by ipip and ipcomp
-		modprobe -qv xfrm4_tunnel
+		insmod -qv xfrm4_tunnel
 		# xfrm_user contains netlink support for IPsec 
-		modprobe -qv xfrm_user
+		insmod -qv xfrm_user
 		# load the most common ciphers/algo's
-		modprobe -qv sha1
-		modprobe -qv md5
-		modprobe -qv des
-		modprobe -qv aes
+		insmod -qv sha1
+		insmod -qv md5
+		insmod -qv des
+		insmod -qv aes
 	fi
 fi
 
@@ -305,7 +305,12 @@
 		fi
                 unset MODPATH MODULECONF        # no user overrides!
                 depmod -a >/dev/null 2>&1
-                modprobe -v ipsec
+                if [ -f modprobe ]
+									then modprobe -v ipsec
+								elif [ -f insmod ]
+									then insmod ipsec
+								fi
+									
         fi
         if test ! -f $ipsecversion
         then