Re: [PATCH] Report what TLS priority string we use for a session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> > ---
> >  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/ :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux