Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 14.40 KB | None | 0 0
  1. Index: accountsservice-0.6.42/src/daemon.c
  2. ===================================================================
  3. --- accountsservice-0.6.42.orig/src/daemon.c
  4. +++ accountsservice-0.6.42/src/daemon.c
  5. @@ -92,7 +92,7 @@ G_DEFINE_TYPE_WITH_CODE (Daemon, daemon,
  6.  #define DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DAEMON, DaemonPrivate))
  7.  
  8.  static const GDBusErrorEntry accounts_error_entries[] =
  9. -{
  10. +{
  11.          { ERROR_FAILED, "org.freedesktop.Accounts.Error.Failed" },
  12.          { ERROR_USER_EXISTS, "org.freedesktop.Accounts.Error.UserExists" },
  13.          { ERROR_USER_DOES_NOT_EXIST, "org.freedesktop.Accounts.Error.UserDoesNotExist" },
  14. @@ -640,7 +640,7 @@ register_accounts_daemon (Daemon *daemon
  15.                          g_critical ("error exporting interface: %s", error->message);
  16.                          g_error_free (error);
  17.                  }
  18. -                goto error;    
  19. +                goto error;
  20.          }
  21.  
  22.          return TRUE;
  23. @@ -904,6 +904,7 @@ typedef struct {
  24.          gchar *user_name;
  25.          gchar *real_name;
  26.          gint account_type;
  27. +        gboolean encrypt_home;
  28.  } CreateUserData;
  29.  
  30.  static void
  31. @@ -944,6 +945,11 @@ daemon_create_user_authorized_cb (Daemon
  32.          argv[5] = cd->user_name;
  33.          argv[6] = NULL;
  34.  
  35. +        if (cd->encrypt_home) {
  36. +            argv[6] = "--encrypt-home";
  37. +            argv[7] = NULL;
  38. +        }
  39. +
  40.          error = NULL;
  41.          if (!spawn_with_login_uid (context, argv, &error)) {
  42.                  throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message);
  43. @@ -972,7 +978,8 @@ daemon_create_user (AccountsAccounts
  44.                      GDBusMethodInvocation *context,
  45.                      const gchar           *user_name,
  46.                      const gchar           *real_name,
  47. -                    gint                   account_type)
  48. +                    gint                   account_type,
  49. +                    gboolean               encrypt_home)
  50.  {
  51.          Daemon *daemon = (Daemon*)accounts;
  52.          CreateUserData *data;
  53. @@ -981,6 +988,7 @@ daemon_create_user (AccountsAccounts
  54.          data->user_name = g_strdup (user_name);
  55.          data->real_name = g_strdup (real_name);
  56.          data->account_type = account_type;
  57. +        data->encrypt_home = encrypt_home;
  58.  
  59.          daemon_local_check_auth (daemon,
  60.                                   NULL,
  61. @@ -1362,7 +1370,7 @@ load_autologin_lightdm (Daemon      *dae
  62.  
  63.          *name = g_key_file_get_string (keyfile, "Seat:*", "autologin-user", error);
  64.          if (!*name) {
  65. -            g_clear_error (error);          
  66. +            g_clear_error (error);
  67.              *name = g_key_file_get_string (keyfile, "SeatDefaults", "autologin-user", error);
  68.          }
  69.          *enabled = (*error == NULL && (*name) && (*name)[0] != 0);
  70. @@ -1384,7 +1392,7 @@ load_autologin (Daemon      *daemon,
  71.          /* First, determine whether we should load GDM or LightDM values by
  72.             checking if GDM is running. */
  73.          connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
  74. -        reply = g_dbus_connection_call_sync (connection,
  75. +        reply = g_dbus_connection_call_sync (connection,
  76.                                               "org.freedesktop.DBus",
  77.                                                "/",
  78.                                                "org.freedesktop.DBus",
  79. Index: accountsservice-0.6.42/src/accounts-generated.c
  80. ===================================================================
  81. --- accountsservice-0.6.42.orig/src/accounts-generated.c
  82. +++ accountsservice-0.6.42/src/accounts-generated.c
  83. @@ -362,11 +362,23 @@ static const _ExtendedGDBusArgInfo _acco
  84.    FALSE
  85.  };
  86.  
  87. +static const _ExtendedGDBusArgInfo _accounts_accounts_method_info_create_user_IN_ARG_encryptHome =
  88. +{
  89. +  {
  90. +    -1,
  91. +    (gchar *) "encryptHome",
  92. +    (gchar *) "b",
  93. +    NULL
  94. +  },
  95. +  FALSE
  96. +};
  97. +
  98.  static const _ExtendedGDBusArgInfo * const _accounts_accounts_method_info_create_user_IN_ARG_pointers[] =
  99.  {
  100.    &_accounts_accounts_method_info_create_user_IN_ARG_name,
  101.    &_accounts_accounts_method_info_create_user_IN_ARG_fullname,
  102.    &_accounts_accounts_method_info_create_user_IN_ARG_accountType,
  103. +  &_accounts_accounts_method_info_create_user_IN_ARG_encryptHome,
  104.    NULL
  105.  };
  106.  
  107. @@ -829,6 +841,7 @@ accounts_accounts_default_init (Accounts
  108.     * @arg_name: Argument passed by remote caller.
  109.     * @arg_fullname: Argument passed by remote caller.
  110.     * @arg_accountType: Argument passed by remote caller.
  111. +   * @arg_encryptHome: Argument passed by remote caller.
  112.     *
  113.     * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-freedesktop-Accounts.CreateUser">CreateUser()</link> D-Bus method.
  114.     *
  115. @@ -1361,6 +1374,7 @@ _out:
  116.   * @arg_name: Argument to pass with the method invocation.
  117.   * @arg_fullname: Argument to pass with the method invocation.
  118.   * @arg_accountType: Argument to pass with the method invocation.
  119. + * @arg_encryptHome: Argument to pass with the method invocation.
  120.   * @cancellable: (allow-none): A #GCancellable or %NULL.
  121.   * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
  122.   * @user_data: User data to pass to @callback.
  123. @@ -1377,6 +1391,7 @@ accounts_accounts_call_create_user (
  124.      const gchar *arg_name,
  125.      const gchar *arg_fullname,
  126.      gint arg_accountType,
  127. +    gboolean arg_encryptHome,
  128.      GCancellable *cancellable,
  129.      GAsyncReadyCallback callback,
  130.      gpointer user_data)
  131. @@ -1386,7 +1401,8 @@ accounts_accounts_call_create_user (
  132.      g_variant_new ("(ssi)",
  133.                     arg_name,
  134.                     arg_fullname,
  135. -                   arg_accountType),
  136. +                   arg_accountType,
  137. +                   arg_encryptHome),
  138.      G_DBUS_CALL_FLAGS_NONE,
  139.      -1,
  140.      cancellable,
  141. @@ -1430,6 +1446,7 @@ _out:
  142.   * @arg_name: Argument to pass with the method invocation.
  143.   * @arg_fullname: Argument to pass with the method invocation.
  144.   * @arg_accountType: Argument to pass with the method invocation.
  145. + * @arg_encryptHome: Argument to pass with the method invocation.
  146.   * @out_user: (out): Return location for return parameter or %NULL to ignore.
  147.   * @cancellable: (allow-none): A #GCancellable or %NULL.
  148.   * @error: Return location for error or %NULL.
  149. @@ -1446,6 +1463,7 @@ accounts_accounts_call_create_user_sync
  150.      const gchar *arg_name,
  151.      const gchar *arg_fullname,
  152.      gint arg_accountType,
  153. +    gboolean arg_encryptHome,
  154.      gchar **out_user,
  155.      GCancellable *cancellable,
  156.      GError **error)
  157. @@ -1456,7 +1474,8 @@ accounts_accounts_call_create_user_sync
  158.      g_variant_new ("(ssi)",
  159.                     arg_name,
  160.                     arg_fullname,
  161. -                   arg_accountType),
  162. +                   arg_accountType,
  163. +                   arg_encryptHome),
  164.      G_DBUS_CALL_FLAGS_NONE,
  165.      -1,
  166.      cancellable,
  167. @@ -1995,7 +2014,7 @@ accounts_accounts_proxy_set_property_cb
  168.    if (!_ret)
  169.      {
  170.        g_warning ("Error setting property '%s' on interface org.freedesktop.Accounts: %s (%s, %d)",
  171. -                 info->parent_struct.name,
  172. +                 info->parent_struct.name,
  173.                   error->message, g_quark_to_string (error->domain), error->code);
  174.        g_error_free (error);
  175.      }
  176. @@ -2844,4 +2863,3 @@ accounts_accounts_skeleton_new (void)
  177.  {
  178.    return ACCOUNTS_ACCOUNTS (g_object_new (ACCOUNTS_TYPE_ACCOUNTS_SKELETON, NULL));
  179.  }
  180. -
  181. Index: accountsservice-0.6.42/src/accounts-generated.h
  182. ===================================================================
  183. --- accountsservice-0.6.42.orig/src/accounts-generated.h
  184. +++ accountsservice-0.6.42/src/accounts-generated.h
  185. @@ -40,7 +40,8 @@ struct _AccountsAccountsIface
  186.      GDBusMethodInvocation *invocation,
  187.      const gchar *arg_name,
  188.      const gchar *arg_fullname,
  189. -    gint arg_accountType);
  190. +    gint arg_accountType,
  191. +    gboolean arg_encryptHome);
  192.  
  193.    gboolean (*handle_delete_user) (
  194.      AccountsAccounts *object,
  195. @@ -196,6 +197,7 @@ void accounts_accounts_call_create_user
  196.      const gchar *arg_name,
  197.      const gchar *arg_fullname,
  198.      gint arg_accountType,
  199. +    gboolean arg_encryptHome,
  200.      GCancellable *cancellable,
  201.      GAsyncReadyCallback callback,
  202.      gpointer user_data);
  203. @@ -211,6 +213,7 @@ gboolean accounts_accounts_call_create_u
  204.      const gchar *arg_name,
  205.      const gchar *arg_fullname,
  206.      gint arg_accountType,
  207. +    gboolean arg_encryptHome,
  208.      gchar **out_user,
  209.      GCancellable *cancellable,
  210.      GError **error);
  211. Index: accountsservice-0.6.42/src/libaccountsservice/act-user-manager.c
  212. ===================================================================
  213. --- accountsservice-0.6.42.orig/src/libaccountsservice/act-user-manager.c
  214. +++ accountsservice-0.6.42/src/libaccountsservice/act-user-manager.c
  215. @@ -3033,6 +3033,7 @@ act_user_manager_no_service (ActUserMana
  216.   * @username: a unix user name
  217.   * @fullname: a unix GECOS value
  218.   * @accounttype: a #ActUserAccountType
  219. + * @encrypthome: encrypt home directory
  220.   * @error: a #GError
  221.   *
  222.   * Creates a user account on the system.
  223. @@ -3044,6 +3045,7 @@ act_user_manager_create_user (ActUserMan
  224.                                const char          *username,
  225.                                const char          *fullname,
  226.                                ActUserAccountType   accounttype,
  227. +                              gboolean             encrypthome,
  228.                                GError             **error)
  229.  {
  230.          GError *local_error = NULL;
  231. @@ -3051,8 +3053,8 @@ act_user_manager_create_user (ActUserMan
  232.          gchar *path;
  233.          ActUser *user;
  234.  
  235. -        g_debug ("ActUserManager: Creating user '%s', '%s', %d",
  236. -                 username, fullname, accounttype);
  237. +        g_debug ("ActUserManager: Creating user '%s', '%s', %d, %d",
  238. +                 username, fullname, accounttype, (int)encrypthome);
  239.  
  240.          g_assert (manager->priv->accounts_proxy != NULL);
  241.  
  242. @@ -3061,6 +3063,7 @@ act_user_manager_create_user (ActUserMan
  243.                                                         username,
  244.                                                         fullname,
  245.                                                         accounttype,
  246. +                                                       encrypthome,
  247.                                                         &path,
  248.                                                         NULL,
  249.                                                         &local_error);
  250. @@ -3094,6 +3097,7 @@ act_user_manager_async_complete_handler
  251.   * @username: a unix user name
  252.   * @fullname: a unix GECOS value
  253.   * @accounttype: a #ActUserAccountType
  254. + * @encrypthome: encrypt home directory
  255.   * @cancellable: (allow-none): optional #GCancellable object,
  256.   *     %NULL to ignore
  257.   * @callback: (scope async): a #GAsyncReadyCallback to call
  258. @@ -3112,6 +3116,7 @@ act_user_manager_create_user_async (ActU
  259.                                      const char          *username,
  260.                                      const char          *fullname,
  261.                                      ActUserAccountType   accounttype,
  262. +                                    gboolean             encrypthome,
  263.                                      GCancellable        *cancellable,
  264.                                      GAsyncReadyCallback  callback,
  265.                                      gpointer             user_data)
  266. @@ -3121,8 +3126,8 @@ act_user_manager_create_user_async (ActU
  267.          g_return_if_fail (ACT_IS_USER_MANAGER (manager));
  268.          g_return_if_fail (manager->priv->accounts_proxy != NULL);
  269.  
  270. -        g_debug ("ActUserManager: Creating user (async) '%s', '%s', %d",
  271. -                 username, fullname, accounttype);
  272. +        g_debug ("ActUserManager: Creating user (async) '%s', '%s', %d, %d",
  273. +                 username, fullname, accounttype, (int)encrypthome);
  274.  
  275.          g_assert (manager->priv->accounts_proxy != NULL);
  276.  
  277. @@ -3135,6 +3140,7 @@ act_user_manager_create_user_async (ActU
  278.                                              username,
  279.                                              fullname,
  280.                                              accounttype,
  281. +                                            encrypthome,
  282.                                              cancellable,
  283.                                              act_user_manager_async_complete_handler, res);
  284.  }
  285. Index: accountsservice-0.6.42/src/libaccountsservice/act-user-manager.h
  286. ===================================================================
  287. --- accountsservice-0.6.42.orig/src/libaccountsservice/act-user-manager.h
  288. +++ accountsservice-0.6.42/src/libaccountsservice/act-user-manager.h
  289. @@ -95,11 +95,13 @@ ActUser *           act_user_manager_cre
  290.                                                              const char         *username,
  291.                                                              const char         *fullname,
  292.                                                              ActUserAccountType  accounttype,
  293. +                                                            gboolean            encrypthome,
  294.                                                              GError             **error);
  295.  void                act_user_manager_create_user_async     (ActUserManager     *manager,
  296.                                                              const gchar        *username,
  297.                                                              const gchar        *fullname,
  298.                                                              ActUserAccountType  accounttype,
  299. +                                                            gboolean            encrypthome,
  300.                                                              GCancellable       *cancellable,
  301.                                                              GAsyncReadyCallback callback,
  302.                                                              gpointer            user_data);
  303. Index: accountsservice-0.6.42/data/org.freedesktop.Accounts.xml
  304. ===================================================================
  305. --- accountsservice-0.6.42.orig/data/org.freedesktop.Accounts.xml
  306. +++ accountsservice-0.6.42/data/org.freedesktop.Accounts.xml
  307. @@ -83,6 +83,11 @@
  308.            <doc:summary>The account type, encoded as an integer</doc:summary>
  309.          </doc:doc>
  310.        </arg>
  311. +      <arg name="encryptHome" direction="in" type="b">
  312. +        <doc:doc>
  313. +          <doc:summary>Encrypt the home directory, boolean</doc:summary>
  314. +        </doc:doc>
  315. +      </arg>
  316.        <doc:doc>
  317.          <doc:description>
  318.            <doc:para>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement