[vlc-commits] credential: store returns true if creds come from the keystore

Thomas Guillem git at videolan.org
Tue Jan 12 09:58:44 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 12 09:05:34 2016 +0100| [fefa2c56a46bbe09733e0c331a6414ec0dd62a0e] | committer: Thomas Guillem

credential: store returns true if creds come from the keystore

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fefa2c56a46bbe09733e0c331a6414ec0dd62a0e
---

 include/vlc_keystore.h |    4 +++-
 src/misc/keystore.c    |    7 +++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/vlc_keystore.h b/include/vlc_keystore.h
index 94780ee..9880441 100644
--- a/include/vlc_keystore.h
+++ b/include/vlc_keystore.h
@@ -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);
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index eaa8e13..2587bd2 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -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;
 



More information about the vlc-commits mailing list