40 #include <glib/gi18n-lib.h> 41 #include <glib/gstdio.h> 42 #include <libsecret/secret.h> 48 {
"org.remmina.Password", SECRET_SCHEMA_NONE,
50 {
"filename", SECRET_SCHEMA_ATTRIBUTE_STRING },
51 {
"key", SECRET_SCHEMA_ATTRIBUTE_STRING },
56 #ifdef LIBSECRET_VERSION_0_18 64 #ifdef LIBSECRET_VERSION_0_18 78 #ifdef LIBSECRET_VERSION_0_18 87 remmina_plugin_service->
debug(
"Requesting unlock of the default '%s' collection", lbl);
89 secret_service_unlock_sync(
secretservice, objects, NULL, &ul, &error);
100 TRACE_CALL(__func__);
106 s = g_strdup_printf(
"Remmina: %s - %s", remmina_plugin_service->
file_get_string(remminafile,
"name"), key);
108 NULL, &r,
"filename", path,
"key", key, NULL);
111 remmina_plugin_service->
debug(
"Password \"%s\" saved for file %s\n", key, path);
113 remmina_plugin_service->
debug(
"Password \"%s\" cannot be saved for file %s\n", key, path);
121 TRACE_CALL(__func__);
130 p = g_strdup(password);
131 secret_password_free(password);
134 remmina_plugin_service->
debug(
"Password cannot be found for file %s\n", path);
141 TRACE_CALL(__func__);
148 remmina_plugin_service->
debug(
"password \"%s\" deleted for file %s", key, path);
150 remmina_plugin_service->
debug(
"password \"%s\" cannot be deleted for file %s", key, path);
155 #ifdef LIBSECRET_VERSION_0_18 158 secretservice = secret_service_get_sync(SECRET_SERVICE_LOAD_COLLECTIONS, NULL, &error);
160 g_print(
"[glibsecret] unable to get secret service: %s\n", error->message);
164 g_print(
"[glibsecret] unable to get secret service: Unknown error.\n");
170 g_print(
"[glibsecret] unable to get secret service default collection: %s\n", error->message);
178 g_print(
"Libsecret was too old during compilation, disabling secret service.\n");
186 N_(
"Secured password storage in the GNOME keyring"),
197 G_MODULE_EXPORT gboolean
200 TRACE_CALL(__func__);
206 remmina_plugin_service = service;
void(* debug)(const gchar *fmt,...)
typedefG_BEGIN_DECLS struct _RemminaFile RemminaFile
static SecretService * secretservice
static RemminaSecretPlugin remmina_plugin_glibsecret
G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService *service)
static SecretSchema remmina_file_secret_schema
gboolean(* register_plugin)(RemminaPlugin *plugin)
gboolean remmina_plugin_glibsecret_init()
static RemminaPluginService * remmina_plugin_service
void remmina_plugin_glibsecret_store_password(RemminaFile *remminafile, const gchar *key, const gchar *password)
static void remmina_plugin_glibsecret_unlock_secret_service()
const gchar *(* file_get_path)(RemminaFile *remminafile)
gboolean remmina_plugin_glibsecret_is_service_available()
gchar * remmina_plugin_glibsecret_get_password(RemminaFile *remminafile, const gchar *key)
void remmina_plugin_glibsecret_delete_password(RemminaFile *remminafile, const gchar *key)
static SecretCollection * defaultcollection
const gchar *(* file_get_string)(RemminaFile *remminafile, const gchar *setting)
N_("Unable to connect to VNC server")