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

Tim Ruehsen tim.ruehsen at gmx.de
Wed Dec 21 12:46:37 CET 2016


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.

Thanks for your answer, changed to code in wget2 slightly.

Regards, Tim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/attachments/20161221/180b82b2/attachment.sig>


More information about the Gnutls-devel mailing list