Commit fefa2c56 authored by Thomas Guillem's avatar Thomas Guillem

credential: store returns true if creds come from the keystore

parent 9e06d25b
......@@ -185,6 +185,7 @@ struct vlc_credential
char *psz_dialog_username;
char *psz_dialog_password;
bool b_from_keystore;
bool b_store;
};
......@@ -240,7 +241,8 @@ vlc_credential_get(vlc_credential *p_credential, vlc_object_t *p_parent,
* This function will store the credential only if it comes from the dialog and
* if the vlc_keystore object is valid.
*
* @return true if credential was stored, false otherwise
* @return true if the credential was stored or comes from the keystore, false
* otherwise
*/
VLC_API bool
vlc_credential_store(vlc_credential *p_credential);
......
......@@ -274,6 +274,7 @@ credential_find_keystore(vlc_credential *p_credential)
{
p_credential->psz_password = (const char *)p_entry->p_secret;
p_credential->psz_username = p_entry->ppsz_values[KEY_USER];
p_credential->b_from_keystore = true;
}
}
}
......@@ -323,6 +324,7 @@ vlc_credential_get(vlc_credential *p_credential, vlc_object_t *p_parent,
return false;
}
p_credential->b_from_keystore = false;
/* Don't set username to NULL, we may want to use the last one set */
p_credential->psz_password = NULL;
......@@ -430,8 +432,9 @@ vlc_credential_get(vlc_credential *p_credential, vlc_object_t *p_parent,
bool
vlc_credential_store(vlc_credential *p_credential)
{
if (!p_credential->p_keystore || !p_credential->b_store)
return false;
if (!p_credential->p_keystore || !p_credential->b_store
|| p_credential->b_from_keystore)
return p_credential->b_from_keystore;
const vlc_url_t *p_url = p_credential->p_url;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment