View | Details | Raw Unified | Return to bug 1585 | Differences between
and this patch

Collapse All | Expand All

(-)a/regress/cfginclude.sh (-142 lines)
Lines 140-286 _EOF Link Here
140
140
141
trial a aa
141
trial a aa
142
142
143
# cleanup
144
rm -f $OBJ/ssh_config.i $OBJ/ssh_config.i.* $OBJ/ssh_config.out
145
#	$OpenBSD: cfginclude.sh,v 1.2 2016/05/03 15:30:46 dtucker Exp $
146
#	Placed in the Public Domain.
147
148
tid="config include"
149
150
cat > $OBJ/ssh_config.i << _EOF
151
Match host a
152
	Hostname aa
153
154
Match host b
155
	Hostname bb
156
	Include $OBJ/ssh_config.i.*
157
158
Match host c
159
	Include $OBJ/ssh_config.i.*
160
	Hostname cc
161
162
Match host m
163
	Include $OBJ/ssh_config.i.*
164
165
Host d
166
	Hostname dd
167
168
Host e
169
	Hostname ee
170
	Include $OBJ/ssh_config.i.*
171
172
Host f
173
	Include $OBJ/ssh_config.i.*
174
	Hostname ff
175
176
Host n
177
	Include $OBJ/ssh_config.i.*
178
_EOF
179
180
cat > $OBJ/ssh_config.i.0 << _EOF
181
Match host xxxxxx
182
_EOF
183
184
cat > $OBJ/ssh_config.i.1 << _EOF
185
Match host a
186
	Hostname aaa
187
188
Match host b
189
	Hostname bbb
190
191
Match host c
192
	Hostname ccc
193
194
Host d
195
	Hostname ddd
196
197
Host e
198
	Hostname eee
199
200
Host f
201
	Hostname fff
202
_EOF
203
204
cat > $OBJ/ssh_config.i.2 << _EOF
205
Match host a
206
	Hostname aaaa
207
208
Match host b
209
	Hostname bbbb
210
211
Match host c
212
	Hostname cccc
213
214
Host d
215
	Hostname dddd
216
217
Host e
218
	Hostname eeee
219
220
Host f
221
	Hostname ffff
222
223
Match all
224
	Hostname xxxx
225
_EOF
226
227
trial() {
228
	_host="$1"
229
	_exp="$2"
230
	${REAL_SSH} -F $OBJ/ssh_config.i -G "$_host" > $OBJ/ssh_config.out ||
231
		fatal "ssh config parse failed"
232
	_got=`grep -i '^hostname ' $OBJ/ssh_config.out | awk '{print $2}'`
233
	if test "x$_exp" != "x$_got" ; then
234
		fail "host $_host include fail: expected $_exp got $_got"
235
	fi
236
}
237
238
trial a aa
239
trial b bb
240
trial c ccc
241
trial d dd
242
trial e ee
243
trial f fff
244
trial m xxxx
245
trial n xxxx
246
trial x x
247
248
# Prepare an included config with an error.
249
250
cat > $OBJ/ssh_config.i.3 << _EOF
251
Hostname xxxx
252
	Junk
253
_EOF
254
255
${REAL_SSH} -F $OBJ/ssh_config.i -G a 2>/dev/null && \
256
	fail "ssh include allowed invalid config"
257
258
${REAL_SSH} -F $OBJ/ssh_config.i -G x 2>/dev/null && \
259
	fail "ssh include allowed invalid config"
260
261
rm -f $OBJ/ssh_config.i.*
262
263
# Ensure that a missing include is not fatal.
264
cat > $OBJ/ssh_config.i << _EOF
265
Include $OBJ/ssh_config.i.*
266
Hostname aa
267
_EOF
268
269
trial a aa
270
271
# Ensure that Match/Host in an included config does not affect parent.
272
cat > $OBJ/ssh_config.i.x << _EOF
273
Match host x
274
_EOF
275
276
trial a aa
277
278
cat > $OBJ/ssh_config.i.x << _EOF
279
Host x
280
_EOF
281
282
trial a aa
283
284
# Ensure that recursive includes are bounded.
143
# Ensure that recursive includes are bounded.
285
cat > $OBJ/ssh_config.i << _EOF
144
cat > $OBJ/ssh_config.i << _EOF
286
Include $OBJ/ssh_config.i
145
Include $OBJ/ssh_config.i
287
- 

Return to bug 1585