diff -ur gnome-mount-0.8-orig/configure.in gnome-mount-0.8/configure.in --- gnome-mount-0.8-orig/configure.in 2018-04-20 12:02:21.442184563 +0000 +++ gnome-mount-0.8/configure.in 2018-04-20 12:53:50.050141318 +0000 @@ -86,7 +86,7 @@ GLIB_REQUIRED=2.15.0 NAUTILUS_REQUIRED=2.21.2 -PKG_CHECK_MODULES(GNOME_MOUNT, gconf-2.0 gnome-keyring-1 >= 0.4 dbus-glib-1 >= 0.31 hal-storage >= 0.5.8 gtk+-2.0 >= 2.8.0) +PKG_CHECK_MODULES(GNOME_MOUNT, gconf-2.0 libsecret-1 >= 0.18 dbus-glib-1 >= 0.31 hal-storage >= 0.5.8 gtk+-2.0 >= 2.8.0) AC_SUBST(GNOME_MOUNT_CFLAGS) AC_SUBST(GNOME_MOUNT_LIBS) diff -ur gnome-mount-0.8-orig/src/gnome-mount.c gnome-mount-0.8/src/gnome-mount.c --- gnome-mount-0.8-orig/src/gnome-mount.c 2018-04-20 12:02:21.439646878 +0000 +++ gnome-mount-0.8/src/gnome-mount.c 2018-04-20 12:51:44.962745408 +0000 @@ -42,7 +42,7 @@ #include #include #include "copy-paste/gnome-password-dialog.h" -#include +#include #include #if !defined(NOTIFY_EXPIRES_NEVER) @@ -2102,63 +2102,53 @@ } -static char * -lookup_password (const char *udi, gboolean *is_session) +static gchar * +lookup_password (const char *udi) { char *password; - GList *keyring_result; + GError *error = NULL; password = NULL; - if (gnome_keyring_find_network_password_sync (g_get_user_name (), /* user */ - NULL, /* domain */ - udi, /* server */ - "password", /* object */ - "org.gnome.Mount", /* protocol */ - NULL, /* authtype */ - 0, /* port */ - &keyring_result) != GNOME_KEYRING_RESULT_OK) - return FALSE; - - if (keyring_result != NULL && g_list_length (keyring_result) == 1) { - GnomeKeyringNetworkPasswordData *data1 = keyring_result->data; - - if (strcmp (data1->object, "password") == 0) { - password = g_strdup (data1->password); - } - - if (password != NULL) { - if (strcmp (data1->keyring, "session") == 0) - *is_session = TRUE; - else - *is_session = FALSE; - } - - gnome_keyring_network_password_list_free (keyring_result); - } - + password = secret_password_lookup_sync(SECRET_SCHEMA_COMPAT_NETWORK, NULL, &error, + "protocol", "org.gnome.Mount", + "server", udi, + "object", "password", + "user", g_get_user_name (), + "port", 0, + NULL); return password; } static void -save_password (const char *udi, const char *keyring, const char *password) +save_password (const char *udi, const char *collection, const gchar *password) { guint32 item_id; - GnomeKeyringResult keyring_result; + gchar *label; + GError *error = NULL; + + gboolean result; + + + label = g_strdup_printf ("GNOME_MOUNT password for %s", udi); - keyring_result = gnome_keyring_set_network_password_sync (keyring, /* keyring */ - g_get_user_name (), /* user */ - NULL, /* domain */ - udi, /* server */ - "password", /* object */ - "org.gnome.Mount", /* prtocol */ - NULL, /* authtype */ - 0, /* port */ - password, /* password */ - &item_id); /* item_id */ - if (keyring_result != GNOME_KEYRING_RESULT_OK) + result = secret_password_store_sync(SECRET_SCHEMA_COMPAT_NETWORK, + collection, + label, + password, + NULL, + &error, + "protocol", "org.gnome.Mount", + "server", udi, + "object", "password", + "user", g_get_user_name (), + "port", 0, + NULL); + + g_free(label); + if (error != NULL) { - g_warning ("Couldn't store password in keyring, code %d", (int) keyring_result); + g_warning ("Couldn't store password in keyring: %s ", error->message); } } @@ -2172,14 +2162,12 @@ GtkWidget *dialog; GnomePasswordDialogRemember remember; char *keyring_password; - gboolean keyring_is_session; LibHalDrive *drv; char *model; char *vendor; char *title; keyring_password = NULL; - keyring_is_session = FALSE; result = NULL; @@ -2208,7 +2196,7 @@ else drive_name = g_strdup (""); - keyring_password = lookup_password (udi, &keyring_is_session); + keyring_password = lookup_password (udi); if (!retry) { @@ -2271,13 +2259,8 @@ /* use the same keyring storage options as from the items we put in the entry boxes */ remember = GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING; - /* use the same keyring storage options as from the items we put in the entry boxes */ - remember = GNOME_PASSWORD_DIALOG_REMEMBER_NOTHING; if (keyring_password != NULL) { - if (keyring_is_session) - remember = GNOME_PASSWORD_DIALOG_REMEMBER_SESSION; - else - remember = GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER; + remember = GNOME_PASSWORD_DIALOG_REMEMBER_SESSION; } gnome_password_dialog_set_remember (GNOME_PASSWORD_DIALOG (dialog), remember); @@ -2299,10 +2282,10 @@ switch (gnome_password_dialog_get_remember (GNOME_PASSWORD_DIALOG (dialog))) { case GNOME_PASSWORD_DIALOG_REMEMBER_SESSION: - save_password (udi, "session", password); + save_password (udi, SECRET_COLLECTION_SESSION, password); break; case GNOME_PASSWORD_DIALOG_REMEMBER_FOREVER: - save_password (udi, NULL, password); + save_password (udi, SECRET_COLLECTION_DEFAULT, password); break; default: break;