python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / accountsservice / Disable-methods-that-change-files-in-etc.patch
blobacaccb8c848558f63bdf6ca1b46aaf0e4d225c85
1 From 6f172007452b39bfda5062fc29ea5382671ac16e Mon Sep 17 00:00:00 2001
2 From: Alexander Ried <ried@mytum.de>
3 Date: Thu, 26 May 2016 19:54:21 +0200
4 Subject: [PATCH] Disable methods that change files in /etc
6 Only if environment variable NIXOS_USERS_PURE is set.
7 ---
8 src/daemon.c | 10 ++++++++++
9 src/user.c | 35 +++++++++++++++++++++++++++++++++++
10 2 files changed, 45 insertions(+)
12 diff --git a/src/daemon.c b/src/daemon.c
13 index e62e124..87459b2 100644
14 --- a/src/daemon.c
15 +++ b/src/daemon.c
16 @@ -931,6 +931,11 @@ daemon_create_user (AccountsAccounts *accounts,
17 const gchar *real_name,
18 gint account_type)
20 + if (getenv("NIXOS_USERS_PURE")) {
21 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
22 + return;
23 + }
25 Daemon *daemon = (Daemon*)accounts;
26 CreateUserData *data;
28 @@ -1138,6 +1143,11 @@ daemon_delete_user (AccountsAccounts *accounts,
29 gint64 uid,
30 gboolean remove_files)
32 + if (getenv("NIXOS_USERS_PURE")) {
33 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
34 + return;
35 + }
37 Daemon *daemon = (Daemon*)accounts;
38 DeleteUserData *data;
40 diff --git a/src/user.c b/src/user.c
41 index 0fb1a17..dbdebaf 100644
42 --- a/src/user.c
43 +++ b/src/user.c
44 @@ -904,6 +904,11 @@ user_set_real_name (AccountsUser *auser,
45 GDBusMethodInvocation *context,
46 const gchar *real_name)
48 + if (getenv("NIXOS_USERS_PURE")) {
49 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
50 + return;
51 + }
53 User *user = (User*)auser;
54 int uid;
55 const gchar *action_id;
56 @@ -981,6 +986,11 @@ user_set_user_name (AccountsUser *auser,
57 GDBusMethodInvocation *context,
58 const gchar *user_name)
60 + if (getenv("NIXOS_USERS_PURE")) {
61 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
62 + return;
63 + }
65 User *user = (User*)auser;
66 daemon_local_check_auth (user->daemon,
67 user,
68 @@ -1263,6 +1273,11 @@ user_set_home_directory (AccountsUser *auser,
69 GDBusMethodInvocation *context,
70 const gchar *home_dir)
72 + if (getenv("NIXOS_USERS_PURE")) {
73 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
74 + return;
75 + }
77 User *user = (User*)auser;
78 daemon_local_check_auth (user->daemon,
79 user,
80 @@ -1322,6 +1337,11 @@ user_set_shell (AccountsUser *auser,
81 GDBusMethodInvocation *context,
82 const gchar *shell)
84 + if (getenv("NIXOS_USERS_PURE")) {
85 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
86 + return;
87 + }
89 User *user = (User*)auser;
90 daemon_local_check_auth (user->daemon,
91 user,
92 @@ -1602,6 +1622,11 @@ user_set_locked (AccountsUser *auser,
93 GDBusMethodInvocation *context,
94 gboolean locked)
96 + if (getenv("NIXOS_USERS_PURE")) {
97 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
98 + return;
99 + }
101 User *user = (User*)auser;
102 daemon_local_check_auth (user->daemon,
103 user,
104 @@ -1814,6 +1839,11 @@ user_set_password_mode (AccountsUser *auser,
105 GDBusMethodInvocation *context,
106 gint mode)
108 + if (getenv("NIXOS_USERS_PURE")) {
109 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
110 + return;
113 User *user = (User*)auser;
114 const gchar *action_id;
116 @@ -1905,6 +1935,11 @@ user_set_password (AccountsUser *auser,
117 const gchar *password,
118 const gchar *hint)
120 + if (getenv("NIXOS_USERS_PURE")) {
121 + throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
122 + return;
125 User *user = (User*)auser;
126 gchar **data;
129 2.9.3