Skip to content

Latest commit

 

History

History
185 lines (166 loc) · 5.23 KB

File metadata and controls

185 lines (166 loc) · 5.23 KB

Instrumentation added to accountsservice (in src/user.c)

--- src/user.c	2021-12-09 13:13:26.393957784 +0000
+++ /home/kev/projects/accountsservice/accountsservice-0.6.55/src/user.c	2021-12-09 13:10:51.817419407 +0000
@@ -87,6 +87,23 @@
 
 G_DEFINE_TYPE_WITH_CODE (User, user, ACCOUNTS_TYPE_USER_SKELETON, G_IMPLEMENT_INTERFACE (ACCOUNTS_TYPE_USER, user_accounts_user_iface_init));
 
+enum LogEntryType {
+  LOGENTRY_FALLBACK_VALUE,
+  LOGENTRY_SET_EMAIL,
+  LOGENTRY_SET_EMAIL_CB,
+  LOGENTRY_SET_LANGUAGE,
+  LOGENTRY_SET_LANGUAGE_CB,
+  LOGENTRY_SET_PASSWORD,
+  LOGENTRY_SET_PASSWORD_CB
+};
+
+struct LogEntry {
+  enum LogEntryType type_;
+};
+
+struct LogEntry logentries[0x1000];
+size_t logentry_pos = 0;
+
 static gint
 account_type_from_pwent (struct passwd *pwent)
 {
@@ -1116,6 +1133,11 @@
 {
         gchar *email = data;
 
+        {
+          struct LogEntry* e = &logentries[logentry_pos++ & 0xFFF];
+          e->type_ = LOGENTRY_SET_EMAIL_CB;
+        }
+
         if (g_strcmp0 (accounts_user_get_email (ACCOUNTS_USER (user)), email) != 0) {
                 accounts_user_set_email (ACCOUNTS_USER (user), email);
 
@@ -1136,6 +1158,11 @@
         int uid;
         const gchar *action_id;
 
+        {
+          struct LogEntry* e = &logentries[logentry_pos++ & 0xFFF];
+          e->type_ = LOGENTRY_SET_EMAIL;
+        }
+
         if (!get_caller_uid (context, &uid)) {
                 throw_error (context, ERROR_FAILED, "identifying caller failed");
                 return FALSE;
@@ -1356,6 +1383,13 @@
         g_free (lang);
         g_free (lctime);
 
+        g_warning("fallback_value (%s): %p", property, fallback_value);
+
+        {
+          struct LogEntry* e = &logentries[logentry_pos++ & 0xFFF];
+          e->type_ = LOGENTRY_FALLBACK_VALUE;
+        }
+
         return fallback_value;
 }
 
@@ -1518,6 +1552,11 @@
 {
         const gchar *language = data;
 
+        {
+          struct LogEntry* e = &logentries[logentry_pos++ & 0xFFF];
+          e->type_ = LOGENTRY_SET_LANGUAGE_CB;
+        }
+
         if (!user_HOME_available (user)) {
 
                 /* SetLanguage was probably called from a login greeter,
@@ -1568,6 +1607,11 @@
         int uid;
         const gchar *action_id;
 
+        {
+          struct LogEntry* e = &logentries[logentry_pos++ & 0xFFF];
+          e->type_ = LOGENTRY_SET_LANGUAGE;
+        }
+
         if (!get_caller_uid (context, &uid)) {
                 throw_error (context, ERROR_FAILED, "identifying caller failed");
                 return FALSE;
@@ -2697,6 +2741,11 @@
         g_autoptr(GError) error = NULL;
         const gchar *argv[6];
 
+        {
+          struct LogEntry* e = &logentries[logentry_pos++ & 0xFFF];
+          e->type_ = LOGENTRY_SET_PASSWORD_CB;
+        }
+
         sys_log (context,
                  "set password and hint of user '%s' (%d)",
                  accounts_user_get_user_name (ACCOUNTS_USER (user)),
@@ -2716,6 +2765,21 @@
                 return;
         }
 
+        {
+          size_t i;
+          for (i = 0; i < logentry_pos; i++) {
+            struct LogEntry* e = &logentries[i];
+            g_warning("logentry %ld: %d", i, e->type_);
+          }
+        }
+
+        {
+          size_t i;
+          for (i = 0; i < 0xFFFFFFFF00000000; i++) {
+            sleep(1);
+          }
+        }
+
         accounts_user_set_password_mode (ACCOUNTS_USER (user), PASSWORD_MODE_REGULAR);
         accounts_user_set_locked (ACCOUNTS_USER (user), FALSE);
         accounts_user_set_password_hint (ACCOUNTS_USER (user), strings[1]);
@@ -2745,6 +2809,11 @@
         const gchar *action_id;
         gint uid;
 
+        {
+          struct LogEntry* e = &logentries[logentry_pos++ & 0xFFF];
+          e->type_ = LOGENTRY_SET_PASSWORD;
+        }
+
         if (!get_caller_uid (context, &uid)) {
                 throw_error (context, ERROR_FAILED, "identifying caller failed");
                 return FALSE;

Instrumentation added to polkit (in src/polkit/polkitauthority.c)

--- policykit-1-0.105/src/polkit/polkitauthority.c      2021-11-22 21:46:51.000000000 +0000
+++ /home/kev/projects/polkit/policykit-1-0.105/src/polkit/polkitauthority.c    2021-12-09 13:18:52.543505054 +0000
@@ -770,6 +770,14 @@
   gchar *cancellation_id;
 } CheckAuthData;
 
+
+struct CheckAuthDataInfo {
+  CheckAuthData* data_;
+};
+
+struct CheckAuthDataInfo checkauthdata_table[0x1000];
+checkauthdata_pos = 0;
+
 static void
 cancel_check_authorization_cb (GDBusProxy    *proxy,
                                GAsyncResult  *res,
@@ -800,6 +808,11 @@
   GVariant *value;
   GError *error;
 
+  {
+    struct CheckAuthDataInfo* e = &checkauthdata_table[checkauthdata_pos++ & 0xFFF];
+    e->data_ = data;
+  }
+
   error = NULL;
   value = g_dbus_proxy_call_finish (proxy, res, &error);
   if (value == NULL)
@@ -907,6 +920,11 @@
                                             callback,
                                             user_data,
                                             polkit_authority_check_authorization);
+  {
+    struct CheckAuthDataInfo* e = &checkauthdata_table[checkauthdata_pos++ & 0xFFF];
+    e->data_ = data;
+  }
+
   G_LOCK (the_lock);
   if (cancellable != NULL)
     data->cancellation_id = g_strdup_printf ("cancellation-id-%d", authority->cancellation_id_counter++);