processone/ejabberd — pull request #185 by weiss (2014-04-27 23:48:00+00:00)
Title: Support certificate verification for outgoing s2s connections

Handle `s2s_use_starttls: required_trusted` the same way for outgoing s2s connections as for incoming s2s connections. That is, check the remote server's certificate (including the host name) and abort the connection if verification fails. Without this commit, `required_trusted` is handled like `required` for outgoing connections; i.e., certificates aren't verified.

Note that the diff looks *much* larger than it really is. It mostly just moves the existing certificate verification code from `ejabberd_s2s_in` to `ejabberd_s2s` and lets both `ejabberd_s2s_in` and `ejabberd_s2s_out` call that code.