[gnutls-devel] gnutls_priority_set() with 'empty' priority argument

Nikos Mavrogiannopoulos nmav at gnutls.org
Wed Dec 21 13:57:11 CET 2016


On Wed, 2016-12-21 at 12:46 +0100, Tim Ruehsen wrote:
> On Wednesday, December 21, 2016 7:50:52 AM CET Nikos
> Mavrogiannopoulos wrote:
> > On Tue, Dec 20, 2016 at 3:07 PM, Tim Ruehsen <tim.ruehsen at gmx.de>
> > wrote:
> > > Hi,
> > > 
> > > Nikos, after your patch on the wget mailing list I checked wget2
> > > code.
> > > 
> > > In short:
> > > ##########
> > > static gnutls_priority_t
> > > 
> > >         _priority_cache;
> > > 
> > > if (priorities) /* priority string from somewhere */
> > > 
> > >         gnutls_priority_init(&_priority_cache, priorities, NULL);
> > > 
> > > /* ... later ... */
> > > gnutls_priority_set(session, _priority_cache);
> > > ##########
> > > 
> > > So, by default we give an 'empty' gnutls_priority_t var to
> > > gnutls_priority_set().
> > > 
> > > Q: is that correct resp. is that the same as
> > > gnutls_set_default_priority(session) ?
> > 
> > I don't think so. The behavior is most likely undefined. Do you
> > check
> > the error code of gnutls_priority_check()?
> 
> (gnutls_priority_set) I didn't but do now, no error.
> 
> > > If not, should we call
> > > 
> > >         gnutls_priority_init(&_priority_cache, "NORMAL", NULL);
> > > 
> > > when no 'priorities' string is given ?
> > 
> > To simulate the set_default() you can call:
> > gnutls_priority_init(&_priority_cache, NULL, NULL);
> 
> I took a look into the GnuTLS source, NULL is mapped to "NORMAL".
> But this might change, depending on documentation.

Right this is the default. In Fedora we patch that value to the system
default (taken on run-time from system-priority-file). I've just added
a configuration option to allow changing the default without patching
the source:
https://gitlab.com/gnutls/gnutls/merge_requests/198

regards,
Nikos




More information about the Gnutls-devel mailing list