Skip to content

Instantly share code, notes, and snippets.

@jackpot51
Created June 19, 2017 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackpot51/8e24f48ec97d26f9f49d0750a92bd8bc to your computer and use it in GitHub Desktop.
Save jackpot51/8e24f48ec97d26f9f49d0750a92bd8bc to your computer and use it in GitHub Desktop.
Index: accountsservice-0.6.42/src/daemon.c
===================================================================
--- accountsservice-0.6.42.orig/src/daemon.c
+++ accountsservice-0.6.42/src/daemon.c
@@ -92,7 +92,7 @@ G_DEFINE_TYPE_WITH_CODE (Daemon, daemon,
#define DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DAEMON, DaemonPrivate))
static const GDBusErrorEntry accounts_error_entries[] =
-{
+{
{ ERROR_FAILED, "org.freedesktop.Accounts.Error.Failed" },
{ ERROR_USER_EXISTS, "org.freedesktop.Accounts.Error.UserExists" },
{ ERROR_USER_DOES_NOT_EXIST, "org.freedesktop.Accounts.Error.UserDoesNotExist" },
@@ -640,7 +640,7 @@ register_accounts_daemon (Daemon *daemon
g_critical ("error exporting interface: %s", error->message);
g_error_free (error);
}
- goto error;
+ goto error;
}
return TRUE;
@@ -904,6 +904,7 @@ typedef struct {
gchar *user_name;
gchar *real_name;
gint account_type;
+ gboolean encrypt_home;
} CreateUserData;
static void
@@ -944,6 +945,11 @@ daemon_create_user_authorized_cb (Daemon
argv[5] = cd->user_name;
argv[6] = NULL;
+ if (cd->encrypt_home) {
+ argv[6] = "--encrypt-home";
+ argv[7] = NULL;
+ }
+
error = NULL;
if (!spawn_with_login_uid (context, argv, &error)) {
throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
@@ -972,7 +978,8 @@ daemon_create_user (AccountsAccounts
GDBusMethodInvocation *context,
const gchar *user_name,
const gchar *real_name,
- gint account_type)
+ gint account_type,
+ gboolean encrypt_home)
{
Daemon *daemon = (Daemon*)accounts;
CreateUserData *data;
@@ -981,6 +988,7 @@ daemon_create_user (AccountsAccounts
data->user_name = g_strdup (user_name);
data->real_name = g_strdup (real_name);
data->account_type = account_type;
+ data->encrypt_home = encrypt_home;
daemon_local_check_auth (daemon,
NULL,
@@ -1362,7 +1370,7 @@ load_autologin_lightdm (Daemon *dae
*name = g_key_file_get_string (keyfile, "Seat:*", "autologin-user", error);
if (!*name) {
- g_clear_error (error);
+ g_clear_error (error);
*name = g_key_file_get_string (keyfile, "SeatDefaults", "autologin-user", error);
}
*enabled = (*error == NULL && (*name) && (*name)[0] != 0);
@@ -1384,7 +1392,7 @@ load_autologin (Daemon *daemon,
/* First, determine whether we should load GDM or LightDM values by
checking if GDM is running. */
connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
- reply = g_dbus_connection_call_sync (connection,
+ reply = g_dbus_connection_call_sync (connection,
"org.freedesktop.DBus",
"/",
"org.freedesktop.DBus",
Index: accountsservice-0.6.42/src/accounts-generated.c
===================================================================
--- accountsservice-0.6.42.orig/src/accounts-generated.c
+++ accountsservice-0.6.42/src/accounts-generated.c
@@ -362,11 +362,23 @@ static const _ExtendedGDBusArgInfo _acco
FALSE
};
+static const _ExtendedGDBusArgInfo _accounts_accounts_method_info_create_user_IN_ARG_encryptHome =
+{
+ {
+ -1,
+ (gchar *) "encryptHome",
+ (gchar *) "b",
+ NULL
+ },
+ FALSE
+};
+
static const _ExtendedGDBusArgInfo * const _accounts_accounts_method_info_create_user_IN_ARG_pointers[] =
{
&_accounts_accounts_method_info_create_user_IN_ARG_name,
&_accounts_accounts_method_info_create_user_IN_ARG_fullname,
&_accounts_accounts_method_info_create_user_IN_ARG_accountType,
+ &_accounts_accounts_method_info_create_user_IN_ARG_encryptHome,
NULL
};
@@ -829,6 +841,7 @@ accounts_accounts_default_init (Accounts
* @arg_name: Argument passed by remote caller.
* @arg_fullname: Argument passed by remote caller.
* @arg_accountType: Argument passed by remote caller.
+ * @arg_encryptHome: Argument passed by remote caller.
*
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts.CreateUser">CreateUser()</link> D-Bus method.
*
@@ -1361,6 +1374,7 @@ _out:
* @arg_name: Argument to pass with the method invocation.
* @arg_fullname: Argument to pass with the method invocation.
* @arg_accountType: Argument to pass with the method invocation.
+ * @arg_encryptHome: Argument to pass with the method invocation.
* @cancellable: (allow-none): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
* @user_data: User data to pass to @callback.
@@ -1377,6 +1391,7 @@ accounts_accounts_call_create_user (
const gchar *arg_name,
const gchar *arg_fullname,
gint arg_accountType,
+ gboolean arg_encryptHome,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -1386,7 +1401,8 @@ accounts_accounts_call_create_user (
g_variant_new ("(ssi)",
arg_name,
arg_fullname,
- arg_accountType),
+ arg_accountType,
+ arg_encryptHome),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
@@ -1430,6 +1446,7 @@ _out:
* @arg_name: Argument to pass with the method invocation.
* @arg_fullname: Argument to pass with the method invocation.
* @arg_accountType: Argument to pass with the method invocation.
+ * @arg_encryptHome: Argument to pass with the method invocation.
* @out_user: (out): Return location for return parameter or %NULL to ignore.
* @cancellable: (allow-none): A #GCancellable or %NULL.
* @error: Return location for error or %NULL.
@@ -1446,6 +1463,7 @@ accounts_accounts_call_create_user_sync
const gchar *arg_name,
const gchar *arg_fullname,
gint arg_accountType,
+ gboolean arg_encryptHome,
gchar **out_user,
GCancellable *cancellable,
GError **error)
@@ -1456,7 +1474,8 @@ accounts_accounts_call_create_user_sync
g_variant_new ("(ssi)",
arg_name,
arg_fullname,
- arg_accountType),
+ arg_accountType,
+ arg_encryptHome),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
@@ -1995,7 +2014,7 @@ accounts_accounts_proxy_set_property_cb
if (!_ret)
{
g_warning ("Error setting property '%s' on interface org.freedesktop.Accounts: %s (%s, %d)",
- info->parent_struct.name,
+ info->parent_struct.name,
error->message, g_quark_to_string (error->domain), error->code);
g_error_free (error);
}
@@ -2844,4 +2863,3 @@ accounts_accounts_skeleton_new (void)
{
return ACCOUNTS_ACCOUNTS (g_object_new (ACCOUNTS_TYPE_ACCOUNTS_SKELETON, NULL));
}
-
Index: accountsservice-0.6.42/src/accounts-generated.h
===================================================================
--- accountsservice-0.6.42.orig/src/accounts-generated.h
+++ accountsservice-0.6.42/src/accounts-generated.h
@@ -40,7 +40,8 @@ struct _AccountsAccountsIface
GDBusMethodInvocation *invocation,
const gchar *arg_name,
const gchar *arg_fullname,
- gint arg_accountType);
+ gint arg_accountType,
+ gboolean arg_encryptHome);
gboolean (*handle_delete_user) (
AccountsAccounts *object,
@@ -196,6 +197,7 @@ void accounts_accounts_call_create_user
const gchar *arg_name,
const gchar *arg_fullname,
gint arg_accountType,
+ gboolean arg_encryptHome,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -211,6 +213,7 @@ gboolean accounts_accounts_call_create_u
const gchar *arg_name,
const gchar *arg_fullname,
gint arg_accountType,
+ gboolean arg_encryptHome,
gchar **out_user,
GCancellable *cancellable,
GError **error);
Index: accountsservice-0.6.42/src/libaccountsservice/act-user-manager.c
===================================================================
--- accountsservice-0.6.42.orig/src/libaccountsservice/act-user-manager.c
+++ accountsservice-0.6.42/src/libaccountsservice/act-user-manager.c
@@ -3033,6 +3033,7 @@ act_user_manager_no_service (ActUserMana
* @username: a unix user name
* @fullname: a unix GECOS value
* @accounttype: a #ActUserAccountType
+ * @encrypthome: encrypt home directory
* @error: a #GError
*
* Creates a user account on the system.
@@ -3044,6 +3045,7 @@ act_user_manager_create_user (ActUserMan
const char *username,
const char *fullname,
ActUserAccountType accounttype,
+ gboolean encrypthome,
GError **error)
{
GError *local_error = NULL;
@@ -3051,8 +3053,8 @@ act_user_manager_create_user (ActUserMan
gchar *path;
ActUser *user;
- g_debug ("ActUserManager: Creating user '%s', '%s', %d",
- username, fullname, accounttype);
+ g_debug ("ActUserManager: Creating user '%s', '%s', %d, %d",
+ username, fullname, accounttype, (int)encrypthome);
g_assert (manager->priv->accounts_proxy != NULL);
@@ -3061,6 +3063,7 @@ act_user_manager_create_user (ActUserMan
username,
fullname,
accounttype,
+ encrypthome,
&path,
NULL,
&local_error);
@@ -3094,6 +3097,7 @@ act_user_manager_async_complete_handler
* @username: a unix user name
* @fullname: a unix GECOS value
* @accounttype: a #ActUserAccountType
+ * @encrypthome: encrypt home directory
* @cancellable: (allow-none): optional #GCancellable object,
* %NULL to ignore
* @callback: (scope async): a #GAsyncReadyCallback to call
@@ -3112,6 +3116,7 @@ act_user_manager_create_user_async (ActU
const char *username,
const char *fullname,
ActUserAccountType accounttype,
+ gboolean encrypthome,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -3121,8 +3126,8 @@ act_user_manager_create_user_async (ActU
g_return_if_fail (ACT_IS_USER_MANAGER (manager));
g_return_if_fail (manager->priv->accounts_proxy != NULL);
- g_debug ("ActUserManager: Creating user (async) '%s', '%s', %d",
- username, fullname, accounttype);
+ g_debug ("ActUserManager: Creating user (async) '%s', '%s', %d, %d",
+ username, fullname, accounttype, (int)encrypthome);
g_assert (manager->priv->accounts_proxy != NULL);
@@ -3135,6 +3140,7 @@ act_user_manager_create_user_async (ActU
username,
fullname,
accounttype,
+ encrypthome,
cancellable,
act_user_manager_async_complete_handler, res);
}
Index: accountsservice-0.6.42/src/libaccountsservice/act-user-manager.h
===================================================================
--- accountsservice-0.6.42.orig/src/libaccountsservice/act-user-manager.h
+++ accountsservice-0.6.42/src/libaccountsservice/act-user-manager.h
@@ -95,11 +95,13 @@ ActUser * act_user_manager_cre
const char *username,
const char *fullname,
ActUserAccountType accounttype,
+ gboolean encrypthome,
GError **error);
void act_user_manager_create_user_async (ActUserManager *manager,
const gchar *username,
const gchar *fullname,
ActUserAccountType accounttype,
+ gboolean encrypthome,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
Index: accountsservice-0.6.42/data/org.freedesktop.Accounts.xml
===================================================================
--- accountsservice-0.6.42.orig/data/org.freedesktop.Accounts.xml
+++ accountsservice-0.6.42/data/org.freedesktop.Accounts.xml
@@ -83,6 +83,11 @@
<doc:summary>The account type, encoded as an integer</doc:summary>
</doc:doc>
</arg>
+ <arg name="encryptHome" direction="in" type="b">
+ <doc:doc>
+ <doc:summary>Encrypt the home directory, boolean</doc:summary>
+ </doc:doc>
+ </arg>
<doc:doc>
<doc:description>
<doc:para>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment