summaryrefslogtreecommitdiff
path: root/rts.exp
blob: 242d7cf65758ca4c18a9f976d2b18c60abad1bbd (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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
--- tcpclient prints usage message without enough arguments
tcpclient: usage: tcpclient [ -hHrRdDqQv ] [ -i localip ] [ -p localport ] [ -T timeoutconn ] [ -l localname ] [ -t timeoutinfo ] host port program
100
--- tcpclient prints error message with unknown port name
tcpclient: fatal: unable to figure out port number for nonexistentport
111
--- tcpclient prints error message when connection fails
tcpclient: unable to connect to 127.0.0.1 port 16: connection refused
111
--- tcpclient -q does not print error message when connection fails
111
--- tcpclient understands empty host name as synonym for 0
tcpclient: unable to connect to 127.0.0.1 port 16: connection refused
111
--- tcpclient understands unbracketed IP address
tcpclient: unable to connect to 127.0.0.1 port 16: connection refused
111
--- tcpclient understands bracketed IP address
tcpclient: unable to connect to 127.0.0.1 port 16: connection refused
111
--- tcpclient prints error message with unknown host name
tcpclient: fatal: no IP address for nonexistent.local.
111
--- tcpclient prints error message with unresolvable host name
tcpclient: fatal: temporarily unable to figure out IP address for thislabelistoolongbecausednshasalimitof63charactersinasinglelabel.: protocol error
111
--- tcpserver prints usage message without enough arguments
tcpserver: usage: tcpserver [ -1UXpPhHrRoOdDqQv ] [ -c limit ] [ -x rules.cdb ] [ -B banner ] [ -g gid ] [ -u uid ] [ -b backlog ] [ -l localname ] [ -t timeout ] host port program
100
--- tcpserver -u 1 attempts to set uid to 1
tcpserver: fatal: unable to set uid: permission denied
111
--- tcpserver -U reads $UID
tcpserver: fatal: unable to set uid: permission denied
111
--- tcpserver -g 2 attempts to set gid to 2
tcpserver: fatal: unable to set gid: permission denied
111
--- tcpserver -U reads $GID
tcpserver: fatal: unable to set gid: permission denied
111
--- tcpserver prints error message with unknown port name
tcpserver: fatal: unable to figure out port number for nonexistentport
111
--- tcpserver prints error message with unknown host name
tcpserver: fatal: no IP address for nonexistent.local.
111
--- tcpserver prints error message with unresolvable host name
tcpserver: fatal: temporarily unable to figure out IP address for thislabelistoolongbecausednshasalimitof63charactersinasinglelabel.: protocol error
111
--- tcpserver prints error message with non-local host name
tcpserver: fatal: unable to bind: address not available
111
--- tcpserver sets basic environment variables
bannerPROTO=TCP
TCPLOCALHOST=Local
TCPLOCALIP=127.0.0.1
TCPLOCALPORT=50016
TCPREMOTEHOST=localhost
TCPREMOTEIP=127.0.0.1
TCPREMOTEPORT=50017
TCPREMOTEINFO=unset
0
--- tcpclient recognizes -D, -i, -r, -h, -t
bannerPROTO=TCP
TCPLOCALHOST=Local
TCPLOCALIP=127.0.0.1
TCPLOCALPORT=50016
TCPREMOTEHOST=localhost
TCPREMOTEIP=127.0.0.1
TCPREMOTEPORT=50018
TCPREMOTEINFO=unset
0
--- tcpclient sets basic environment variables
PROTO=TCP
TCPLOCALHOST=Local
TCPLOCALIP=127.0.0.1
TCPLOCALPORT=50019
TCPREMOTEHOST=unset
TCPREMOTEIP=127.0.0.1
TCPREMOTEPORT=50016
TCPREMOTEINFO=unset
0
--- tcpclient looks up host names properly
PROTO=TCP
TCPLOCALHOST=localhost
TCPLOCALIP=127.0.0.1
TCPLOCALPORT=50020
TCPREMOTEHOST=localhost
TCPREMOTEIP=127.0.0.1
TCPREMOTEPORT=50016
TCPREMOTEINFO=unset
0
--- tcpclient -v works
tcpclient: connected to 127.0.0.1 port 50016
ok
0
--- tcpserver prints error message with used port
tcpserver: fatal: unable to bind: address already used
111
--- tcpcat works
bannerPROTO=TCP
TCPLOCALHOST=Local
TCPLOCALIP=127.0.0.1
TCPLOCALPORT=50016
TCPREMOTEHOST=localhost
TCPREMOTEIP=127.0.0.1
TCPREMOTEINFO=unset
0
--- mconnect works
bannerPROTO=TCP
TCPLOCALHOST=Local
TCPLOCALIP=127.0.0.1
TCPLOCALPORT=50016
TCPREMOTEHOST=localhost
TCPREMOTEIP=127.0.0.1
TCPREMOTEINFO=unset
0
--- tcprules prints usage message without enough arguments
tcprules: usage: tcprules rules.cdb rules.tmp
100
--- tcprules prints error message if it cannot create tmp
tcprules: fatal: unable to create /dev/nonexistent/tmp: file does not exist
111
--- tcprules prints error message if it cannot move tmp to cdb
tcprules: fatal: unable to move test.tmp to /dev/nonexistent/cdb: file does not exist
111
--- tcprules creates a cdb file
0
--- tcprulescheck sees deny
rule 1.2.3.4:
deny connection
0
--- tcprulescheck does not apply deny to another host
default:
allow connection
0
--- tcprules replaces a cdb file
0
--- tcprulescheck finds rule with address and info
rule joe@127.0.0.1:
set environment variable which=first
allow connection
0
--- tcprulescheck finds rule with address
rule 18.23.0.32:
set environment variable which=second
allow connection
0
--- tcprulescheck finds one-dot wildcard
rule 127.:
set environment variable which=third
allow connection
0
--- tcprulescheck finds zero-dot wildcard
rule :
set environment variable which=fourth
allow connection
0
--- tcprules handles comments, address ranges, multiple variables
0
rule 127.0.:
set environment variable which=first
set environment variable where=whatever
allow connection
rule 127.1.:
set environment variable which=first
set environment variable where=whatever
allow connection
rule 127.2.:
set environment variable which=first
set environment variable where=whatever
allow connection
rule 127.3.:
set environment variable which=first
set environment variable where=whatever
allow connection
rule 127.4.:
set environment variable which=first
set environment variable where=whatever
allow connection
rule 127.5.:
set environment variable which=first
set environment variable where=whatever
allow connection
default:
allow connection
default:
allow connection
default:
allow connection
default:
allow connection
default:
allow connection
--- tcprules handles host names
0
rule =known.edu:
set environment variable which=known
allow connection
rule :
set environment variable which=anybody
allow connection
rule :
set environment variable which=anybody
allow connection
rule =.abuser.edu:
deny connection
rule =.abuser.edu:
deny connection
--- tcprulescheck searches for rules in the proper order
0
rule xyz@86.75.30.9:
set environment variable which=first
allow connection
rule xyz@86.75.30.9:
set environment variable which=first
allow connection
rule xyz@=one.two.three:
set environment variable which=second
allow connection
rule 86.75.30.9:
set environment variable which=third
allow connection
rule 86.75.30.9:
set environment variable which=third
allow connection
rule 86.75.30.9:
set environment variable which=third
allow connection
rule 86.75.30.9:
set environment variable which=third
allow connection
rule =one.two.three:
set environment variable which=fourth
allow connection
rule =one.two.three:
set environment variable which=fourth
allow connection
rule 86.75.30.:
set environment variable which=fifth
allow connection
rule 86.75.30.:
set environment variable which=fifth
allow connection
rule 86.75.:
set environment variable which=sixth
allow connection
rule 86.75.:
set environment variable which=sixth
allow connection
rule 86.75.:
set environment variable which=sixth
allow connection
rule 86.75.:
set environment variable which=sixth
allow connection
rule 86.:
set environment variable which=seventh
allow connection
rule 86.:
set environment variable which=seventh
allow connection
rule 86.:
set environment variable which=seventh
allow connection
rule 86.:
set environment variable which=seventh
allow connection
rule =.two.three:
set environment variable which=eighth
allow connection
rule =.two.three:
set environment variable which=eighth
allow connection
rule =.three:
set environment variable which=ninth
allow connection
rule =.three:
set environment variable which=ninth
allow connection
rule =:
set environment variable which=tenth
allow connection
rule =:
set environment variable which=tenth
allow connection
rule :
set environment variable which=eleventh
allow connection
rule :
set environment variable which=eleventh
allow connection
--- addcr leaves an empty file alone
0
--- addcr leaves a partial final line alone
test0
--- addcr adds CR after the first line
test^M
0
--- addcr adds CR after the second line
test^M
test2^M
0
--- addcr handles nulls
t^@st^M
0
--- delcr leaves an empty file alone
0
--- delcr leaves a non-CR line alone
test
0
--- delcr removes CR if a line has it
test
0
--- delcr converts CR CR LF to CR LF
test^M
0
--- delcr does not remove CR from a partial final line
test^M0
--- delcr handles a non-CR partial final line
test0
--- delcr handles nulls
t^@st
0
--- fixcrio works
^M
hi^M
there^M
bye^M
--- recordio works
... < test $
... > test $
... < [EOF]$
... > [EOF]$
--- recordio handles multiple-line packets
... < test $
... < test2 $
... > test $
... > test2 $
... < [EOF]$
... > [EOF]$
--- recordio handles partial final lines
... < test+$
... > test+$
... < [EOF]$
... > [EOF]$
--- argv0 works
zero
0
--- argv0 requires arguments
argv0: usage: argv0 realname program [ arg ... ]
100
--- rblsmtpd does not find 127.0.0.1 on the RBL
ok
0
--- rblsmtpd finds 127.0.0.2 on the RBL
rblsmtpd: 127.0.0.2 pid x: 451 Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
220 rblsmtpd.local^M
451 Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>^M
221 rblsmtpd.local^M
0
--- rblsmtpd -b uses a permanent error code
rblsmtpd: 127.0.0.2 pid x: 553 Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
220 rblsmtpd.local^M
553 Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>^M
221 rblsmtpd.local^M
0
--- rblsmtpd quits after a timeout
rblsmtpd: 127.0.0.2 pid x: 451 Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
220 rblsmtpd.local^M
0
--- rblsmtpd prints an immediate error message with -t0
rblsmtpd: 127.0.0.2 pid x: 451 Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>
451 Blackholed - see <URL:http://mail-abuse.org/cgi-bin/lookup?127.0.0.2>^M
0
--- rblsmtpd understands an empty $RBLSMTPD
ok
0
--- rblsmtpd understands a nonempty $RBLSMTPD
rblsmtpd: 127.0.0.2 pid x: 451 Error
220 rblsmtpd.local^M
451 Error^M
221 rblsmtpd.local^M
0
--- rblsmtpd understands a permanent $RBLSMTPD
rblsmtpd: 127.0.0.2 pid x: 553 Error
220 rblsmtpd.local^M
553 Error^M
221 rblsmtpd.local^M
0
--- rblsmtpd understands -r
ok
0
--- rblsmtpd understands -a
ok
0
--- tcpserver -1v prints proper messages
50016
tcpserver: status: 0/2
tcpserver: status: 1/2
tcpserver: pid x from 127.0.0.1
tcpserver: ok x Local:127.0.0.1:50016 localhost:127.0.0.1::x
tcpserver: end x status 0
tcpserver: status: 0/2
tcpserver: status: 1/2
tcpserver: pid x from 127.0.0.1
tcpserver: ok x Local:127.0.0.1:50016 localhost:127.0.0.1::x
tcpserver: end x status 0
tcpserver: status: 0/2
tcpserver: status: 1/2
tcpserver: pid x from 127.0.0.1
tcpserver: ok x Local:127.0.0.1:50016 localhost:127.0.0.1::x
tcpserver: end x status 0
tcpserver: status: 0/2
tcpserver: status: 1/2
tcpserver: pid x from 127.0.0.1
tcpserver: ok x Local:127.0.0.1:50016 localhost:127.0.0.1::x
tcpserver: end x status 0
tcpserver: status: 0/2
tcpserver: status: 1/2
tcpserver: pid x from 127.0.0.1
tcpserver: ok x Local:127.0.0.1:50016 localhost:127.0.0.1::x
tcpserver: end x status 0
tcpserver: status: 0/2
tcpserver: status: 1/2
tcpserver: pid x from 127.0.0.1
tcpserver: ok x Local:127.0.0.1:50016 localhost:127.0.0.1::x
tcpserver: end x status 0
tcpserver: status: 0/2
tcpserver: status: 1/2
tcpserver: pid x from 127.0.0.1
tcpserver: ok x Local:127.0.0.1:50016 localhost:127.0.0.1::x
tcpserver: end x status 0
tcpserver: status: 0/2