Merge lp:~abreu-alexandre/click/clean-trust-dbs-on-package-removal into lp:click

Proposed by Alexandre Abreu
Status: Needs review
Proposed branch: lp:~abreu-alexandre/click/clean-trust-dbs-on-package-removal
Merge into: lp:click
Diff against target: 71 lines (+55/-0)
1 file modified
pk-plugin/pk-plugin-click.c (+55/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/click/clean-trust-dbs-on-package-removal
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+299459@code.launchpad.net

Commit message

Clean the trust DB store for the location service as click apps are being removed. This is not an optimal solution and is rather static but will work until click becomes deprecated.

Description of the change

Clean the trust DB store for the location service as click apps are being removed. This is not an optimal solution and is rather static but will work until click becomes deprecated.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Needs Fixing
Revision history for this message
Colin Watson (cjwatson) :
609. By Alexandre Abreu

Tweaks

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

udated

Revision history for this message
Colin Watson (cjwatson) wrote :

Looks good now provided that mentions of click_stderr in this diff are removed properly.

review: Approve
610. By Alexandre Abreu

remove unused error vars

611. By Alexandre Abreu

Cleanup all trust store DBs

Unmerged revisions

611. By Alexandre Abreu

Cleanup all trust store DBs

610. By Alexandre Abreu

remove unused error vars

609. By Alexandre Abreu

Tweaks

608. By Alexandre Abreu

Fix purge command line

607. By David Barth

add function to purge trust-store dbs (prototype stage)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'pk-plugin/pk-plugin-click.c'
--- pk-plugin/pk-plugin-click.c 2014-10-08 13:58:34 +0000
+++ pk-plugin/pk-plugin-click.c 2016-07-11 14:36:50 +0000
@@ -623,6 +623,58 @@
623 json_array_unref (array);623 json_array_unref (array);
624}624}
625625
626/* Fix for #1586737 - [CTA]privacies/permissions are not removed after the app
627 has been uninstalled
628*/
629
630static void
631trust_db_purge_for_service (const gchar *package_id, const gchar *service_name)
632{
633 gchar **argv = NULL;
634 gint i;
635 gchar **envp = NULL;
636
637 argv = g_malloc0_n (6, sizeof (*argv));
638 i = 0;
639
640 argv[i++] = g_strdup ("trust-store-cleaner");
641 argv[i++] = g_strdup ("--for-service");
642 argv[i++] = g_strdup (service_name);
643 argv[i++] = g_strdup ("--purge");
644 argv[i++] = g_strdup (package_id);
645
646 /* TODO: iterate over each well-known trust store services */
647 envp = click_get_envp ();
648 g_spawn_sync (NULL, argv, envp,
649 G_SPAWN_SEARCH_PATH
650 | G_SPAWN_STDOUT_TO_DEV_NULL
651 | G_SPAWN_STDERR_TO_DEV_NULL,
652 NULL, NULL, NULL,
653 NULL, NULL, NULL);
654 /* Note: we ignore errors, as we don't want the uninstall to fail for that reason */
655
656 g_strfreev (argv);
657 g_strfreev (envp);
658}
659
660static void
661trust_db_purge(const gchar *package_id)
662{
663 static gchar* service_names[] = {
664 "UbuntuLocationService",
665 "CameraService",
666 "PulseAudio",
667 "InAppPurchases"
668 };
669 int i;
670
671 for (i = 0;
672 i < sizeof(service_names) / sizeof(service_names[0]);
673 ++i) {
674 trust_db_purge_for_service(package_id, service_names[i]);
675 }
676}
677
626static gboolean678static gboolean
627click_remove_package (PkPlugin *plugin, PkTransaction *transaction,679click_remove_package (PkPlugin *plugin, PkTransaction *transaction,
628 const gchar *package_id)680 const gchar *package_id)
@@ -702,6 +754,9 @@
702 summary, error->message);754 summary, error->message);
703 goto out;755 goto out;
704 }756 }
757
758 trust_db_purge (package_id);
759
705 /* TODO: remove data? */760 /* TODO: remove data? */
706 ret = TRUE;761 ret = TRUE;
707762

Subscribers

People subscribed via source and target branches

to all changes: