[PATCH RFC] udisks2 mount options configuration files
Michael Biebl
mbiebl at gmail.com
Fri Apr 24 12:27:53 PDT 2015
Hi Stanislav!
Thanks for your interest in udisks.
Are you aware, that you can set mount options via /etc/fstab and
udisks2 will use them?
What does this patch offer that is not covered by that?
Michael
2015-04-24 19:56 GMT+02:00 Stanislav Brabec <sbrabec at suse.cz>:
> People often complain that it is impossible to change mount options
> with udisks2. It is actually not true, because ignoring possibility to
> set (well, very limited subset of) mount options is a lack of support
> of udisks2 clients.
>
> However having a possibility to configure mount options directly in
> udisks2 would be nice, especially if it would support advanced
> features like per-volume and per-device options.
>
> That is why I wrote a patch that makes it possible (see lower in this
> mail).
>
> Now udisks2 accepts a configuration options in /etc/udisks2-mount.conf
> and ~/.config/udisks2-mount.conf.
>
> Here is an example of use of ~/.config/udisks2-mount.conf for real tasks:
>
> [my camera]
> Type=vfat
> UUID=CB6C-D3C8
> Options=shortname=lower;time_offset=-120;
>
> Configuration is a set of rules. Each rule must contain Options. Allowed
> keys to match are now:
> Type, UUID, Label, Usage, Version (case matters)
>
> Bad options intentionally cause fatal error and API now recognizes new
> error: UDISKS_ERROR_SYNTAX_ERROR =
> org.freedesktop.UDisks2.Error.SyntaxError
>
>
> What do you think about this approach?
>
>
>
> There are still some thing to finish and to discuss and to implement:
>
> - Documentation needs update.
>
> - Add possibility to configure drive parameter as matching keys
> (physical location of port, removable flag, medium type etc.).
>
> - No GUI editor for this file.
>
> - Configuration paths are hardcoded, not using client XDG
> environment. It could make problems e. g. with private AFS mount not
> accessible for root. (If it will be an issue, config file would have
> to be parsed by client.)
>
> - There is still no way to get a client timezone (for better mounting
> of FAT with local time zone) or locale (for better mounting of NTFS
> or codepage guessing).
>
>
> I was thinking about ways to pass environment from the client to the
> daemon. It is theoretically possible without any client API change:
> DBus supports GetConnectionUnixProcessID service. With the PID, I can
> access read environment. But it looks like an ugly approach.
>
> Alternative approach:
>
> - Required environment parts (e. g. timezone for FAT, locale for ntfs
> or smarter codepage selection) needs to be addded to the client,
> which will pass them to the daemon as a special mount
> conditions. E. g.: "x-udisks-tz=".
>
> This alternative approach requires code addition to all clients.
>
>
>
> Index: udisks-2.1.5/src/udiskslinuxfilesystem.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxfilesystem.c
> +++ udisks-2.1.5/src/udiskslinuxfilesystem.c
> @@ -79,6 +79,8 @@ static void filesystem_iface_init (UDisk
> G_DEFINE_TYPE_WITH_CODE (UDisksLinuxFilesystem, udisks_linux_filesystem, UDISKS_TYPE_FILESYSTEM_SKELETON,
> G_IMPLEMENT_INTERFACE (UDISKS_TYPE_FILESYSTEM, filesystem_iface_init));
>
> +#define MOUNT_CONF "udisks2-mount.conf"
> +
> #ifdef HAVE_FHS_MEDIA
> # define MOUNT_BASE "/media"
> #else
> @@ -283,7 +285,12 @@ typedef struct
> /* ---------------------- vfat -------------------- */
>
> static const gchar *vfat_defaults[] = { "uid=", "gid=", "shortname=mixed", "utf8=1", "showexec", "flush", NULL };
> -static const gchar *vfat_allow[] = { "flush", "utf8=", "shortname=", "umask=", "dmask=", "fmask=", "codepage=", "iocharset=", "usefree", "showexec", NULL };
> +static const gchar *vfat_allow[] = { "flush", "utf8=", "shortname=", "umask=", "dmask=", "fmask=", "codepage=", "iocharset=", "usefree", "showexec",
> + /* FAT flags */
> + "allow_utime=", "check=", "discard", "dos1xfloppy", "errors=", "fat=", "nfs=", "tz=UTC", "time_offset=", "quiet", "rodir", "sys_immutable", "dots", "nodots", "dotsOK=",
> + /* VFAT flags */
> + "uni_xlate", "nonumtail",
> + NULL };
> static const gchar *vfat_allow_uid_self[] = { "uid=", NULL };
> static const gchar *vfat_allow_gid_self[] = { "gid=", NULL };
>
> @@ -532,10 +539,164 @@ is_mount_option_allowed (const FSMountOp
> return allowed;
> }
>
> +/* There can be 3 results:
> + * no key match (return FALSE, match = FALSE)
> + * id match (return TRUE, match = TRUE)
> + * no id match (return TRUE, match = FALSE)
> + * group/key is expected to exist, no checks are performed!
> + */
> +static inline gboolean
> +check_mount_conf_condition (GKeyFile *keyfile,
> + const gchar *group, const gchar *key, gboolean *match,
> + const gchar *key_to_match, const gchar *id_to_match)
> +{
> + if (!strcmp (key, key_to_match))
> + {
> + if (id_to_match)
> + {
> + gchar **strarray, **value;
> + strarray = g_key_file_get_string_list (keyfile,
> + group,
> + key_to_match, NULL, NULL);
> + for (value = strarray; *value; value++)
> + if (!strcmp (*value, id_to_match))
> + *match = TRUE;
> + g_strfreev(strarray);
> + }
> + return TRUE;
> + } else
> + return FALSE;
> +}
> +
> +static void
> +get_mount_conf_dir_options (const gchar *config_dir,
> + GPtrArray *options,
> + const gchar *fs_type,
> + UDisksBlock *block,
> + GError **error)
> +{
> + GError *local_error;
> + GKeyFile *keyfile;
> +
> + gchar *conf_filename;
> + conf_filename = g_build_filename (config_dir, MOUNT_CONF, NULL);
> +
> + local_error = NULL;
> + keyfile = g_key_file_new ();
> + if (g_key_file_load_from_file (keyfile, conf_filename,
> + G_KEY_FILE_NONE, &local_error))
> + {
> + gchar **groups, **group;
> +
> + udisks_info ("Loading %s", conf_filename);
> +
> + groups = g_key_file_get_groups (keyfile, NULL);
> +
> + group = groups;
> + while (*group)
> + {
> + gchar **keys, **key;
> + gboolean options_seen = FALSE;
> + gboolean match_all = TRUE;
> + gchar **options_add = NULL;
> +
> + keys = g_key_file_get_keys (keyfile, *group, NULL, NULL);
> + key = keys;
> +
> + while (*key)
> + {
> + if (!strcmp (*key, "Options"))
> + {
> + options_seen = TRUE;
> + options_add = g_key_file_get_string_list (keyfile,
> + *group,
> + "Options", NULL, NULL);
> + } else {
> + gboolean match = FALSE;
> + if (!((fs_type ?
> + check_mount_conf_condition (keyfile, *group, *key, &match, "Type", fs_type) :
> + check_mount_conf_condition (keyfile, *group, *key, &match, "Type", udisks_block_get_id_type (block))) ||
> + check_mount_conf_condition (keyfile, *group, *key, &match, "UUID", udisks_block_get_id_uuid (block)) ||
> + check_mount_conf_condition (keyfile, *group, *key, &match, "Label", udisks_block_get_id_label (block)) ||
> + check_mount_conf_condition (keyfile, *group, *key, &match, "Usage", udisks_block_get_id_usage (block)) ||
> + check_mount_conf_condition (keyfile, *group, *key, &match, "Version", udisks_block_get_id_version (block))))
> + {
> + g_set_error (error,
> + UDISKS_ERROR,
> + UDISKS_ERROR_SYNTAX_ERROR,
> + "Error parsing %s: [%s]: unknown match keyword %s",
> + conf_filename, *group, *key);
> + g_strfreev (keys);
> + goto key_error;
> + }
> + if (!match)
> + match_all = FALSE;
> + }
> + key++;
> + }
> + g_strfreev (keys);
> +
> + if (!options_seen) {
> + g_set_error (error,
> + UDISKS_ERROR,
> + UDISKS_ERROR_SYNTAX_ERROR,
> + "Error parsing %s: [%s]: mission keyword \"Options\"",
> + conf_filename, *group);
> + goto key_error;
> + }
> +
> + if (match_all)
> + {
> + udisks_debug ("Mount options rule \"%s\" matches", *group);
> + for (key = options_add; *key; key++)
> + g_ptr_array_add (options, *key);
> + }
> +
> + /* Free just the array, keep elements allocated to save g_strdup() */
> + g_free (options_add);
> +
> + group++;
> + }
> + key_error:
> + g_strfreev (groups);
> + g_key_file_free (keyfile);
> + } else
> + if (!g_error_matches (*error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
> + {
> + if (local_error->code != G_FILE_ERROR_NOENT)
> + g_propagate_prefixed_error (error, local_error, "Error opening %s", conf_filename);
> + else
> + g_error_free (local_error);
> + }
> + g_free (conf_filename);
> +}
> +
> +static void
> +get_mount_conf_options (GPtrArray *options,
> + gchar *caller_home,
> + const gchar *fs_type,
> + UDisksBlock *block,
> + GError **error)
> +{
> + gchar *config_dir;
> +
> + get_mount_conf_dir_options (PACKAGE_SYSCONF_DIR, options, fs_type, block, error);
> + if (*error)
> + return;
> + config_dir = g_build_filename (caller_home, ".config", NULL);
> + get_mount_conf_dir_options (config_dir, options, fs_type, block, error);
> + g_free (config_dir);
> +
> +}
> +
> static gchar **
> prepend_default_mount_options (const FSMountOptions *fsmo,
> uid_t caller_uid,
> - GVariant *given_options)
> + gchar *caller_home,
> + GVariant *given_options,
> + const gchar *fs_type,
> + UDisksBlock *block,
> + GError **error)
> {
> GPtrArray *options;
> gint n;
> @@ -544,6 +705,7 @@ prepend_default_mount_options (const FSM
> const gchar *option_string;
>
> options = g_ptr_array_new ();
> +
> if (fsmo != NULL)
> {
> const gchar *const *defaults = fsmo->defaults;
> @@ -573,6 +735,8 @@ prepend_default_mount_options (const FSM
> }
> }
>
> + get_mount_conf_options (options, caller_home, fs_type, block, error);
> +
> if (g_variant_lookup (given_options,
> "options",
> "&s", &option_string))
> @@ -712,6 +876,7 @@ static gchar *
> calculate_mount_options (UDisksDaemon *daemon,
> UDisksBlock *block,
> uid_t caller_uid,
> + gchar *caller_home,
> const gchar *fs_type,
> GVariant *options,
> GError **error)
> @@ -720,6 +885,7 @@ calculate_mount_options (UDisksDaemon
> gchar **options_to_use;
> gchar *options_to_use_str;
> GString *str;
> + GError *local_error;
> guint n;
>
> options_to_use = NULL;
> @@ -730,7 +896,13 @@ calculate_mount_options (UDisksDaemon
> /* always prepend some reasonable default mount options; these are
> * chosen here; the user can override them if he wants to
> */
> - options_to_use = prepend_default_mount_options (fsmo, caller_uid, options);
> + local_error = NULL;
> + options_to_use = prepend_default_mount_options (fsmo, caller_uid, caller_home, options, fs_type, block, &local_error);
> + if (local_error)
> + {
> + g_propagate_error (error, local_error);
> + goto out2;
> + }
>
> /* validate mount options */
> str = g_string_new ("uhelper=udisks2,nodev,nosuid");
> @@ -744,7 +916,7 @@ calculate_mount_options (UDisksDaemon
> g_set_error (error,
> UDISKS_ERROR,
> UDISKS_ERROR_OPTION_NOT_PERMITTED,
> - "Malformed mount option `%s'",
> + "Malformed mount option `%s' (separate " MOUNT_CONF " options by \";\")",
> option);
> g_string_free (str, TRUE);
> goto out;
> @@ -770,8 +942,10 @@ calculate_mount_options (UDisksDaemon
> out:
> g_strfreev (options_to_use);
>
> + out2:
> g_assert (options_to_use_str == NULL || g_utf8_validate (options_to_use_str, -1, NULL));
>
> + udisks_info ("Calculated mount options: %s", options_to_use_str);
> return options_to_use_str;
> }
>
> @@ -1159,6 +1333,7 @@ handle_mount (UDisksFilesystem *fi
> gchar *escaped_mount_point_to_use;
> gchar *error_message;
> gchar *caller_user_name;
> + gchar *caller_user_home;
> GError *error;
> const gchar *action_id;
> const gchar *message;
> @@ -1175,6 +1350,7 @@ handle_mount (UDisksFilesystem *fi
> escaped_mount_options_to_use = NULL;
> escaped_mount_point_to_use = NULL;
> caller_user_name = NULL;
> + caller_user_home = NULL;
> system_managed = FALSE;
>
> /* only allow a single call at a time */
> @@ -1228,6 +1404,7 @@ handle_mount (UDisksFilesystem *fi
> &caller_uid,
> &caller_gid,
> &caller_user_name,
> + &caller_user_home,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -1402,6 +1579,7 @@ handle_mount (UDisksFilesystem *fi
> mount_options_to_use = calculate_mount_options (daemon,
> block,
> caller_uid,
> + caller_user_home,
> fs_type_to_use,
> options,
> &error);
> @@ -1530,6 +1708,7 @@ handle_mount (UDisksFilesystem *fi
> g_free (mount_point_to_use);
> g_free (fstab_mount_options);
> g_free (caller_user_name);
> + g_free (caller_user_home);
> g_clear_object (&object);
>
> /* only allow a single call at a time */
> @@ -1618,7 +1797,7 @@ handle_unmount (UDisksFilesystem *
> }
>
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> @@ -1884,6 +2063,7 @@ handle_set_label (UDisksFilesystem
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> Index: udisks-2.1.5/src/udisksbasejob.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udisksbasejob.c
> +++ udisks-2.1.5/src/udisksbasejob.c
> @@ -384,6 +384,7 @@ handle_cancel (UDisksJob *_
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_take_error (invocation, error);
> Index: udisks-2.1.5/src/udiskslinuxblock.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxblock.c
> +++ udisks-2.1.5/src/udiskslinuxblock.c
> @@ -2243,7 +2243,7 @@ handle_format (UDisksBlock *bl
> }
>
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, &caller_gid, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, &caller_gid, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> Index: udisks-2.1.5/src/udiskslinuxdrive.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxdrive.c
> +++ udisks-2.1.5/src/udiskslinuxdrive.c
> @@ -1006,6 +1006,7 @@ handle_eject (UDisksDrive *_dr
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -1423,6 +1424,7 @@ handle_power_off (UDisksDrive
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> Index: udisks-2.1.5/src/udiskslinuxdriveata.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxdriveata.c
> +++ udisks-2.1.5/src/udiskslinuxdriveata.c
> @@ -1171,6 +1171,7 @@ handle_smart_selftest_start (UDisksDrive
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -2265,6 +2266,7 @@ handle_security_erase_unit (UDisksDriveA
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -2358,6 +2360,7 @@ handle_smart_set_enabled (UDisksDriveAta
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> Index: udisks-2.1.5/src/udiskslinuxencrypted.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxencrypted.c
> +++ udisks-2.1.5/src/udiskslinuxencrypted.c
> @@ -307,7 +307,7 @@ handle_unlock (UDisksEncrypted *e
>
> /* we need the uid of the caller for the unlocked-luks file */
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> @@ -556,7 +556,7 @@ handle_lock (UDisksEncrypted *enc
>
> /* we need the uid of the caller to check authorization */
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> @@ -676,7 +676,7 @@ handle_change_passphrase (UDisksEncrypte
> }
>
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> Index: udisks-2.1.5/src/udiskslinuxloop.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxloop.c
> +++ udisks-2.1.5/src/udiskslinuxloop.c
> @@ -215,7 +215,7 @@ handle_delete (UDisksLoop *l
> state = udisks_daemon_get_state (daemon);
>
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> @@ -401,7 +401,7 @@ handle_set_autoclear (UDisksLoop
> daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
>
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> Index: udisks-2.1.5/src/udiskslinuxmanager.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxmanager.c
> +++ udisks-2.1.5/src/udiskslinuxmanager.c
> @@ -319,7 +319,7 @@ handle_loop_setup (UDisksManager
>
> /* we need the uid of the caller for the loop file */
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (manager->daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (manager->daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_error_free (error);
> @@ -555,7 +555,7 @@ handle_mdraid_create (UDisksManager
> dev_t raid_device_num;
>
> error = NULL;
> - if (!udisks_daemon_util_get_caller_uid_sync (manager->daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, &error))
> + if (!udisks_daemon_util_get_caller_uid_sync (manager->daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, NULL, &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> g_clear_error (&error);
> Index: udisks-2.1.5/src/udiskslinuxmdraid.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxmdraid.c
> +++ udisks-2.1.5/src/udiskslinuxmdraid.c
> @@ -609,6 +609,7 @@ handle_start (UDisksMDRaid *_m
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -773,6 +774,7 @@ handle_stop (UDisksMDRaid *_md
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -957,6 +959,7 @@ handle_remove_device (UDisksMDRaid
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -1160,6 +1163,7 @@ handle_add_device (UDisksMDRaid
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -1299,6 +1303,7 @@ handle_set_bitmap_location (UDisksMDRaid
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -1421,6 +1426,7 @@ handle_request_sync_action (UDisksMDRaid
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> Index: udisks-2.1.5/src/udiskslinuxpartition.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxpartition.c
> +++ udisks-2.1.5/src/udiskslinuxpartition.c
> @@ -260,6 +260,7 @@ handle_set_flags (UDisksPartition
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -425,6 +426,7 @@ handle_set_name (UDisksPartition
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -767,6 +769,7 @@ handle_set_type (UDisksPartition
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -878,6 +881,7 @@ handle_delete (UDisksPartition *p
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> Index: udisks-2.1.5/src/udiskslinuxpartitiontable.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxpartitiontable.c
> +++ udisks-2.1.5/src/udiskslinuxpartitiontable.c
> @@ -382,6 +382,7 @@ handle_create_partition (UDisksPartition
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> Index: udisks-2.1.5/src/udiskslinuxswapspace.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udiskslinuxswapspace.c
> +++ udisks-2.1.5/src/udiskslinuxswapspace.c
> @@ -181,6 +181,7 @@ handle_start (UDisksSwapspace *sw
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> @@ -268,6 +269,7 @@ handle_stop (UDisksSwapspace *swa
> &caller_uid,
> &caller_gid,
> NULL,
> + NULL,
> &error))
> {
> g_dbus_method_invocation_return_gerror (invocation, error);
> Index: udisks-2.1.5/src/udisksdaemonutil.h
> ===================================================================
> --- udisks-2.1.5.orig/src/udisksdaemonutil.h
> +++ udisks-2.1.5/src/udisksdaemonutil.h
> @@ -61,6 +61,7 @@ gboolean udisks_daemon_util_get_caller_u
> uid_t *out_uid,
> gid_t *out_gid,
> gchar **out_user_name,
> + gchar **out_user_home,
> GError **error);
>
> gboolean udisks_daemon_util_get_caller_pid_sync (UDisksDaemon *daemon,
> Index: udisks-2.1.5/src/udisksdaemonutil.c
> ===================================================================
> --- udisks-2.1.5.orig/src/udisksdaemonutil.c
> +++ udisks-2.1.5/src/udisksdaemonutil.c
> @@ -467,6 +467,7 @@ check_authorization_no_polkit (UDisksDae
> &caller_uid,
> NULL, /* gid_t *out_gid */
> NULL, /* gchar **out_user_name */
> + NULL, /* gchar **out_user_home */
> &error))
> {
> g_dbus_method_invocation_return_error (invocation,
> @@ -778,6 +779,7 @@ udisks_daemon_util_get_caller_uid_sync (
> uid_t *out_uid,
> gid_t *out_gid,
> gchar **out_user_name,
> + gchar **out_user_home,
> GError **error)
> {
> gboolean ret;
> @@ -854,6 +856,8 @@ udisks_daemon_util_get_caller_uid_sync (
> *out_gid = pw->pw_gid;
> if (out_user_name != NULL)
> *out_user_name = g_strdup (pwstruct.pw_name);
> + if (out_user_home != NULL)
> + *out_user_home = g_strdup (pwstruct.pw_dir);
> }
>
> ret = TRUE;
> Index: udisks-2.1.5/udisks/udisksenums.h
> ===================================================================
> --- udisks-2.1.5.orig/udisks/udisksenums.h
> +++ udisks-2.1.5/udisks/udisksenums.h
> @@ -46,6 +46,7 @@ G_BEGIN_DECLS
> * @UDISKS_ERROR_TIMED_OUT: The operation timed out.
> * @UDISKS_ERROR_WOULD_WAKEUP: The operation would wake up a disk that is in a deep-sleep state.
> * @UDISKS_ERROR_DEVICE_BUSY: Attempting to unmount a device that is busy.
> + * @UDISKS_ERROR_SYNTAX_ERROR: Syntax error in the configuration file.
> *
> * Error codes for the #UDISKS_ERROR error domain and the
> * corresponding D-Bus error names.
> @@ -66,10 +67,11 @@ typedef enum
> UDISKS_ERROR_NOT_SUPPORTED, /* org.freedesktop.UDisks2.Error.NotSupported */
> UDISKS_ERROR_TIMED_OUT, /* org.freedesktop.UDisks2.Error.Timedout */
> UDISKS_ERROR_WOULD_WAKEUP, /* org.freedesktop.UDisks2.Error.WouldWakeup */
> - UDISKS_ERROR_DEVICE_BUSY /* org.freedesktop.UDisks2.Error.DeviceBusy */
> + UDISKS_ERROR_DEVICE_BUSY, /* org.freedesktop.UDisks2.Error.DeviceBusy */
> + UDISKS_ERROR_SYNTAX_ERROR /* org.freedesktop.UDisks2.Error.SyntaxError */
> } UDisksError;
>
> -#define UDISKS_ERROR_NUM_ENTRIES (UDISKS_ERROR_DEVICE_BUSY + 1)
> +#define UDISKS_ERROR_NUM_ENTRIES (UDISKS_ERROR_SYNTAX_ERROR + 1)
>
> /**
> * UDisksPartitionTypeInfoFlags:
> Index: udisks-2.1.5/udisks/udiskserror.c
> ===================================================================
> --- udisks-2.1.5.orig/udisks/udiskserror.c
> +++ udisks-2.1.5/udisks/udiskserror.c
> @@ -48,6 +48,7 @@ static const GDBusErrorEntry dbus_error_
> {UDISKS_ERROR_TIMED_OUT, "org.freedesktop.UDisks2.Error.Timedout"},
> {UDISKS_ERROR_WOULD_WAKEUP, "org.freedesktop.UDisks2.Error.WouldWakeup"},
> {UDISKS_ERROR_DEVICE_BUSY, "org.freedesktop.UDisks2.Error.DeviceBusy"},
> + {UDISKS_ERROR_SYNTAX_ERROR, "org.freedesktop.UDisks2.Error.SyntaxError"},
> };
>
> GQuark
>
> SUSE references:
> https://bugzilla.opensuse.org/show_bug.cgi?id=912583
> https://build.opensuse.org/package/show/home:sbrabec:branches:udisks2-mount-conf/udisks2
>
> --
> Best Regards / S pozdravem,
>
> Stanislav Brabec
> software developer
> ---------------------------------------------------------------------
> SUSE LINUX, s. r. o. e-mail: sbrabec at suse.cz
> Lihovarská 1060/12 tel: +49 911 7405384547
> 190 00 Praha 9 fax: +420 284 084 001
> Czech Republic http://www.suse.cz/
> PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
> _______________________________________________
> devkit-devel mailing list
> devkit-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/devkit-devel
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
More information about the devkit-devel
mailing list