[vlc-devel] [PATCH 4/4] http: add keystore

Felix Paul Kühne fkuehne at videolan.org
Thu Nov 26 10:38:12 CET 2015


> On 26 Nov 2015, at 10:09, Steve Lhomme <robux4 at gmail.com> wrote:
> 
> On Wed, Nov 25, 2015 at 7:14 PM, Thomas Guillem <thomas at gllm.fr> wrote:
>> ---
>> modules/access/http.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 70 insertions(+)
>> 
>> diff --git a/modules/access/http.c b/modules/access/http.c
>> index b62f92e..69cfb65 100644
>> --- a/modules/access/http.c
>> +++ b/modules/access/http.c
>> @@ -46,6 +46,7 @@
>> #include <vlc_input.h>
>> #include <vlc_http.h>
>> #include <vlc_interrupt.h>
>> +#include <vlc_keystore.h>
>> 
>> #ifdef HAVE_ZLIB_H
>> #   include <zlib.h>
>> @@ -214,6 +215,8 @@ static int Open( vlc_object_t *p_this )
>>     access_t *p_access = (access_t*)p_this;
>>     const char *psz_url = p_access->psz_url;
>>     char *psz;
>> +    bool b_store_passwd = false;
>> +    vlc_keystore *p_keystore = NULL;
>> 
>>     access_sys_t *p_sys = malloc( sizeof(*p_sys) );
>>     if( unlikely(p_sys == NULL) )
>> @@ -287,6 +290,8 @@ static int Open( vlc_object_t *p_this )
>>         if( p_sys->url.i_port <= 0 )
>>             p_sys->url.i_port = 80;
>>     }
>> +    char psz_port[sizeof(unsigned) * 3];
>> +    sprintf(psz_port, "%u", p_sys->url.i_port);
>> 
>>     /* Determine the HTTP user agent */
>>     /* See RFC2616 §2.2 token and comment definition, and §3.8 and
>> @@ -418,6 +423,53 @@ connect:
>>         }
>>         msg_Dbg( p_access, "authentication failed for realm %s",
>>                  p_sys->auth.psz_realm );
>> +
>> +        /* Only one try */
>> +        if( !p_keystore && ( p_keystore = vlc_keystore_get( p_access ) ) )
>> +        {
>> +            vlc_keystore_entry *p_entries;
>> +            unsigned int i_count =
>> +                vlc_keystore_find( p_keystore, &p_entries,
>> +                                   KEY_USER, p_sys->url.psz_username,
>> +                                   KEY_REALM, p_sys->auth.psz_realm,
>> +                                   KEY_SERVER,  p_sys->url.psz_host,
>> +                                   KEY_PORT, psz_port,
>> +                                   KEY_PROTOCOL, p_sys->url.psz_protocol,
> 
> Does it mean passwords for HTTP won't work for HTTPS ?

This depends on the implementation of the keystore module and its backend. We still need to define whether the protocol parameter is a hint or an enforced requirement.

Best regards,

Felix



More information about the vlc-devel mailing list