Commit b3ad198
committed
Taking a "belt-and-suspenders" approach:
This is a potential problem for any command which registers a response
handler: a malicious server can easily guess what the next tag will be,
and send an `OK` response _before_ the client the response handler is
attached.
`STARTTLS` is an extreme example of this issue: if the `STARTTLS`
handler does not run, then `#starttls` will not start the TLS session,
and the connection is not secured, _but no error is raised._
We should _also_ attach the response handler before sending the `CRLF`,
but that is neither necessary (the response handler will added before
the `synchronize` mutex is unlocked) nor sufficient (the fake `OK` can
be sent _much_ earlier).
On the other hand, it _is_ okay for the server to send an error tagged
response (`NO` or `BAD`), before sending the command has completed.
1 parent 7a233c5 commit b3ad198
1 file changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3141 | 3141 | | |
3142 | 3142 | | |
3143 | 3143 | | |
| 3144 | + | |
3144 | 3145 | | |
3145 | 3146 | | |
3146 | 3147 | | |
| |||
3605 | 3606 | | |
3606 | 3607 | | |
3607 | 3608 | | |
| 3609 | + | |
3608 | 3610 | | |
3609 | 3611 | | |
3610 | 3612 | | |
| |||
3620 | 3622 | | |
3621 | 3623 | | |
3622 | 3624 | | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
| 3634 | + | |
| 3635 | + | |
| 3636 | + | |
| 3637 | + | |
3623 | 3638 | | |
3624 | 3639 | | |
3625 | 3640 | | |
| |||
0 commit comments