[libvirt] [PATCH] Report what TLS priority string we use for a session
Daniel P. Berrange
berrange at redhat.com
Thu Mar 16 11:06:18 UTC 2017
On Thu, Mar 16, 2017 at 11:30:16AM +0100, Michal Privoznik wrote:
> On 03/15/2017 07:05 PM, Daniel P. Berrange wrote:
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> > src/rpc/virnettlscontext.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
> > index 847d457..0d5928e 100644
> > --- a/src/rpc/virnettlscontext.c
> > +++ b/src/rpc/virnettlscontext.c
> > @@ -1208,6 +1208,7 @@ virNetTLSSessionPtr virNetTLSSessionNew(virNetTLSContextPtr ctxt,
> > /* avoid calling all the priority functions, since the defaults
> > * are adequate.
> > */
> > + VIR_DEBUG("Setting priority string '%s'", ctxt->priority ? ctxt->priority : TLS_PRIORITY);
> > if ((err = gnutls_priority_set_direct(sess->session,
> > ctxt->priority ? ctxt->priority : TLS_PRIORITY,
> > NULL)) != 0) {
> >
>
> At this point I'd rather introduce a new variable that holds the
> priority (which is string btw?!) instead of repeating ternary operator.
>
> ACK with that fixed.
Ok, the result looks like this
@@ -1187,6 +1187,7 @@ virNetTLSSessionPtr virNetTLSSessionNew(virNetTLSContextPtr ctxt,
{
virNetTLSSessionPtr sess;
int err;
+ const char *priority;
VIR_DEBUG("ctxt=%p hostname=%s isServer=%d",
ctxt, NULLSTR(hostname), ctxt->isServer);
@@ -1208,12 +1209,14 @@ virNetTLSSessionPtr virNetTLSSessionNew(virNetTLSContextPtr ctxt,
/* avoid calling all the priority functions, since the defaults
* are adequate.
*/
+ priority = ctxt->priority ? ctxt->priority : TLS_PRIORITY;
+ VIR_DEBUG("Setting priority string '%s'", priority);
if ((err = gnutls_priority_set_direct(sess->session,
- ctxt->priority ? ctxt->priority : TLS_PRIORITY,
+ priority,
NULL)) != 0) {
virReportError(VIR_ERR_SYSTEM_ERROR,
_("Failed to set TLS session priority to %s: %s"),
- ctxt->priority ? ctxt->priority : TLS_PRIORITY, gnutls_strerror(err));
+ priority, gnutls_strerror(err));
goto error;
}
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
More information about the libvir-list
mailing list