|
188 | 188 | ("502 SYNTAX ERROR") |
189 | 189 | ("530 AUTH ERROR") |
190 | 190 | ("520 FATAL ERROR")) |
191 | | - (lambda (response-code) (begin |
| 191 | + (lambda (response-code) |
192 | 192 | (server-set-response-code! server response-code) |
193 | 193 | (let |
194 | 194 | ((responses |
195 | 195 | (sendmail-send-message smtp-connection "failure content" "sender@sender.to" '("user@recipient.to")))) |
196 | | - (assert (all? send-error? responses) (string-append "Expected client to fail when server responds with error:" response-code)))))) |
| 196 | + (assert (all? send-error? responses) (string-append "Expected client to fail when server responds with error:" response-code))))) |
197 | 197 |
|
198 | 198 | (capability 'handle-421 (list |
199 | 199 | ; As send-message handles multiple commands and responses, it also needs to deal with responses that |
|
348 | 348 |
|
349 | 349 | (data-test "CRLF detection in send-message sender" |
350 | 350 | '(("foo\r\nbar@email.com") ("foo\nbar@email.com") ("foo\rbar@email.com")) |
351 | | - (lambda (sender-string) (begin |
| 351 | + (lambda (sender-string) |
352 | 352 | (let |
353 | 353 | ((responses (sendmail-send-message smtp-connection "message content" sender-string '("user@recipient.to")))) |
354 | 354 | (display responses) |
355 | | - (assert (all? send-error? responses) (string-append "Expected client to fail when CR or LF is in sender of send-message: " sender-string)))))) |
| 355 | + (assert (all? send-error? responses) (string-append "Expected client to fail when CR or LF is in sender of send-message: " sender-string))))) |
356 | 356 |
|
357 | 357 | (data-test "CRLF detection in send-message recipient" |
358 | 358 | '(("foo\r\nbar@email.com") ("foo\nbar@email.com") ("foo\rbar@email.com")) |
359 | | - (lambda (recipient-string) (begin |
| 359 | + (lambda (recipient-string) |
360 | 360 | (let |
361 | 361 | ((responses (sendmail-send-message smtp-connection "message content" "sender@email.com" (list recipient-string)))) |
362 | | - (assert (all? send-error? responses) (string-append "Expected client to fail when CR or LF is in recipient of send-message: " recipient-string)))))) |
| 362 | + (assert (all? send-error? responses) (string-append "Expected client to fail when CR or LF is in recipient of send-message: " recipient-string))))) |
363 | 363 |
|
364 | 364 | )) |
365 | 365 |
|
366 | 366 | (capability 'mitigation (list |
367 | 367 |
|
368 | 368 | (data-test "CRLF mitigation in send-message sender" |
369 | 369 | '(("foo\r\nbar@email.com" "\r\n") ("foo\nbar@email.com" "\n") ("foo\rbar@email.com" "\r")) |
370 | | - (lambda (sender-string injection) (begin |
| 370 | + (lambda (sender-string injection) |
371 | 371 | (let |
372 | 372 | ((responses (sendmail-send-message smtp-connection "message content" sender-string '("user@recipient.to")))) |
373 | 373 | (assert (all? send-success? responses)) |
374 | 374 | (assert |
375 | 375 | (all? |
376 | 376 | (lambda (c) (not (string-index c injection))) |
377 | 377 | (server-requests-with-command server "MAIL")) |
378 | | - (string-append "Expected client to remove CR or LF or both from sender of send-message: " sender-string)))))) |
| 378 | + (string-append "Expected client to remove CR or LF or both from sender of send-message: " sender-string))))) |
379 | 379 |
|
380 | 380 | (data-test "CRLF mitigation in send-message recipient" |
381 | 381 | '(("foo\r\nbar@email.com" "\r\n") ("foo\nbar@email.com" "\n") ("foo\rbar@email.com" "\r")) |
382 | | - (lambda (recipient-string injection) (begin |
| 382 | + (lambda (recipient-string injection) |
383 | 383 | (let |
384 | 384 | ((responses (sendmail-send-message smtp-connection "message content" "sender@email.com" (list recipient-string)))) |
385 | 385 | (assert (all? send-success? responses)) |
386 | 386 | (assert |
387 | 387 | (all? |
388 | 388 | (lambda (c) (not (string-index c injection))) |
389 | 389 | (server-requests-with-command server "RCPT")) |
390 | | - (string-append "Expected client to remove CR or LF or both from recipients of send-message: " recipient-string)))))) |
| 390 | + (string-append "Expected client to remove CR or LF or both from recipients of send-message: " recipient-string))))) |
391 | 391 | )) |
392 | 392 |
|
393 | 393 | )) |
|
0 commit comments