[vlc-devel] [PATCH 01/13] keystore: add b_secure

Thomas Guillem thomas at gllm.fr
Wed Feb 24 14:25:10 CET 2016


All keystore modules are secure except the plaintext one.
---
 include/vlc_keystore.h       | 2 ++
 modules/keystore/keychain.m  | 1 +
 modules/keystore/kwallet.cpp | 1 +
 modules/keystore/plaintext.c | 1 +
 modules/keystore/secret.c    | 1 +
 src/misc/keystore.c          | 5 +++++
 6 files changed, 11 insertions(+)

diff --git a/include/vlc_keystore.h b/include/vlc_keystore.h
index a797d8e..c743683 100644
--- a/include/vlc_keystore.h
+++ b/include/vlc_keystore.h
@@ -283,6 +283,8 @@ struct vlc_keystore
     module_t            *p_module;
     vlc_keystore_sys    *p_sys;
 
+    /** Set by the module Open function: true if the keystore is secure */
+    bool                b_secure;
     /** See vlc_keystore_store() */
     int                 (*pf_store)(vlc_keystore *p_keystore,
                                     const char *const ppsz_values[KEY_MAX],
diff --git a/modules/keystore/keychain.m b/modules/keystore/keychain.m
index 9b9be73..4950cce 100644
--- a/modules/keystore/keychain.m
+++ b/modules/keystore/keychain.m
@@ -471,6 +471,7 @@ static int Open(vlc_object_t *p_this)
     p_keystore->pf_store = Store;
     p_keystore->pf_find = Find;
     p_keystore->pf_remove = Remove;
+    p_keystore->b_secure = true;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/keystore/kwallet.cpp b/modules/keystore/kwallet.cpp
index 902fb09..75ef028 100644
--- a/modules/keystore/kwallet.cpp
+++ b/modules/keystore/kwallet.cpp
@@ -693,6 +693,7 @@ Open(vlc_object_t *p_this)
     p_keystore->pf_store = Store;
     p_keystore->pf_find = Find;
     p_keystore->pf_remove = Remove;
+    p_keystore->b_secure = true;
 
     return VLC_SUCCESS;
 }
diff --git a/modules/keystore/plaintext.c b/modules/keystore/plaintext.c
index b8ea30e..ad915f0 100644
--- a/modules/keystore/plaintext.c
+++ b/modules/keystore/plaintext.c
@@ -537,6 +537,7 @@ Open(vlc_object_t *p_this)
     p_keystore->pf_store = Store;
     p_keystore->pf_find = Find;
     p_keystore->pf_remove = Remove;
+    p_keystore->b_secure = false;
 
     vlc_mutex_unlock(&instance.lock);
 
diff --git a/modules/keystore/secret.c b/modules/keystore/secret.c
index 9bb5f5b..9ca2c96 100644
--- a/modules/keystore/secret.c
+++ b/modules/keystore/secret.c
@@ -332,6 +332,7 @@ Open(vlc_object_t *p_this)
     p_keystore->pf_store = Store;
     p_keystore->pf_find = Find;
     p_keystore->pf_remove = Remove;
+    p_keystore->b_secure = true;
 
     return VLC_SUCCESS;
 }
diff --git a/src/misc/keystore.c b/src/misc/keystore.c
index 3430b51..e0f9bba 100644
--- a/src/misc/keystore.c
+++ b/src/misc/keystore.c
@@ -488,6 +488,11 @@ vlc_credential_store(vlc_credential *p_credential)
         return false;
     }
 
+    if (!p_credential->p_keystore->b_secure)
+        msg_Warn(p_credential->p_keystore, "The '%s' keystore is not secure, "
+                 "stored password are not encrypted",
+                 module_get_name(p_credential->p_keystore->p_module, false));
+
     bool b_ret = vlc_keystore_store(p_credential->p_keystore, ppsz_values,
                                     (const uint8_t *)p_credential->psz_password,
                                     -1, psz_label) == VLC_SUCCESS;
-- 
2.7.0



More information about the vlc-devel mailing list