[gnome-initial-setup/parental-controls-crash-fixes: 2/2] driver: Allow setting parent password twice



commit 6823489e9c33a1595d9f317e19cc6c98f152a63a
Author: Matthew Leeds <matthew leeds endlessm com>
Date:   Mon Mar 16 15:09:09 2020 -0700

    driver: Allow setting parent password twice
    
    Currently we have g_assert (priv->parent_password == NULL); in
    gis_driver_set_parent_permissions() but in practice this assertion fails
    because we set the parent permissions twice: once in the account page
    when the user is created and again in the password page when a password
    is put on the account. Perhaps this should be refactored at some point
    to create the account at the same time its password is created.
    
    Similarly, fix the case where gis_driver_set_user_permissions() is
    called more than once, which was leaking the password.

 gnome-initial-setup/gis-driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index a774055..14b62e0 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -347,6 +347,7 @@ gis_driver_set_user_permissions (GisDriver   *driver,
 {
   GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
   g_set_object (&priv->user_account, user);
+  g_free (priv->user_password);
   priv->user_password = g_strdup (password);
 }
 
@@ -383,7 +384,7 @@ gis_driver_set_parent_permissions (GisDriver   *driver,
   GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
 
   g_set_object (&priv->parent_account, parent);
-  g_assert (priv->parent_password == NULL);
+  g_free (priv->parent_password);
   priv->parent_password = g_strdup (password);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]