ssl: Don't try hostname check if cert subject check fails
ssl: Don't try hostname check if cert subject check fails

Currently, SSL verification of the peer certificate checks if
the certificate's subject CN or one of its subjectAltName match
the hostname. If this succeeds, then the verification succeeds.
Otherwise openssl_verify() checks the cert subject if this was set,
which means it checks the certificate's subject (not just its CN) matches
exactly the cert subject string that is set in SpiceSession.

Given that the cert subject is something the user specifies in addition
to the hostname, the cert subject check should have priority over the
hostname check, that is, when we have a cert subject set, the
success/failure of the cert subject cert should determine the
success/failure of openssl_verify(), and the hostname check
should only be carried out when no cert subject was set.

This fixes rhbz#871034

Fantu/spice-common,elmarco/spice-common,freedesktop-unofficial-mirror/spice__spice-common,fgouget/spice-common,elmarco/spice-common,Fantu/spice-common,SPICE/spice-common,Fantu/spice-common,fgouget/spice-common,Fantu/spice-common,elmarco/spice-common,elmarco/spice-common,fgouget/spice-common,freedesktop-unofficial-mirror/spice__spice-common,freedesktop-unofficial-mirror/spice__spice-common,SPICE/spice-common,freedesktop-unofficial-mirror/spice__spice-common,SPICE/spice-common,fgouget/spice-common