[vlc-devel] [RFC PATCH] add vlc_keystore API

Thomas Guillem thomas at gllm.fr
Mon Nov 23 16:56:43 CET 2015



On Mon, Nov 23, 2015, at 16:35, Rémi Denis-Courmont wrote:
> Le 2015-11-23 17:10, Thomas Guillem a écrit :
> > +VLC_API int
> > +vlc_keystore_store(vlc_keystore *p_keystore,
> > +                   const char *psz_user, const char *psz_protocol,
> > +                   const char *psz_server, const char *psz_port,
> > +                   const char *psz_passwd);
> 
> The authentication realm is missing for HTTP support. IMO, the 
> protocol, server and port should be merged as a single URI parameter.

OK For for http realm.
For the URI or protocol/port/server, I'll see when I'll plug the
keystore in vlc modules what is the easier way.

> 
> > +
> > +/**
> > + * Get a password associated with user, protocol, server and port 
> > keys
> > + *
> > + * @note This function is an helper for vlc_keystore_dict_find() 
> > when
> > + * the dict contains "user", "protocol", "server", "port" keys.
> > + *
> > + * @param p_keystore
> > + * @param psz_user if NULL, return any password that match
> > protocol/server/port
> > + * @param psz_protocol protocol (http, https, ftp, ftps, smb...)
> > + * @param psz_server (www.example.com)
> > + * @param psz_port if NULL, use default protocol port
> > + *
> > + * @return the password, a '\0' terminated string to be freed by 
> > free()
> > + */
> > +VLC_API char *
> > +vlc_keystore_find(vlc_keystore *p_keystore,
> > +                 const char *psz_user, const char *psz_protocol,
> > +                 const char *psz_server, const char *psz_port)
> > VLC_USED VLC_MALLOC;
> 
> Ditto.
> 
> Also should the username not be an output rather than input parameter?

It could be both: if a user is specified in URI or vlc arguments, you
want to specify an user in input, but if there is no input user, you
want to retrieve the output user that match the passwd.
It's not handled at all by this helper function (I missed it) but it's
handled by vlc_keystore_dict_find. Indeed, this function return the
matching passwd with the matching dictionary, so you can retrieve the
user by querying the "user" key from the dict...

> 
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list