Compare commits
3 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| b43b2cbf8a | |||
| a0a139a3b7 | |||
| 71b492ff7b |
@@ -0,0 +1,25 @@
|
||||
From 62edfa5bebb64611df7b945c94dda8826ed9e7af Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Blume <Thomas.Blume@suse.com>
|
||||
Date: Fri, 22 Aug 2025 15:34:25 +0200
|
||||
Subject: [PATCH] udiskslinuxmanager: Add lower bounds check to fd_index
|
||||
|
||||
---
|
||||
src/udiskslinuxmanager.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/udiskslinuxmanager.c b/src/udiskslinuxmanager.c
|
||||
index d15eba6..e2df3ba 100644
|
||||
--- a/src/udiskslinuxmanager.c
|
||||
+++ b/src/udiskslinuxmanager.c
|
||||
@@ -339,7 +339,7 @@ handle_loop_setup (UDisksManager *object,
|
||||
goto out;
|
||||
|
||||
fd_num = g_variant_get_handle (fd_index);
|
||||
- if (fd_list == NULL || fd_num >= g_unix_fd_list_get_length (fd_list))
|
||||
+ if (fd_list == NULL || fd_num < 0 || fd_num >= g_unix_fd_list_get_length (fd_list))
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
UDISKS_ERROR,
|
||||
--
|
||||
2.50.0
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 16 08:14:25 UTC 2025 - Stefan Schubert <schubi@suse.com>
|
||||
Mon Dec 22 16:48:02 UTC 2025 - Thomas Blume <thomas.blume@suse.com>
|
||||
|
||||
- Moved /etc/udisks2/modules.conf.d/udisks2_lsm.conf and
|
||||
/etc/udisks2/udisks2.conf do /usr/etc. (patch usr_etc.patch)
|
||||
- (CVE-2025-8067) VUL-0: missing bounds check can lead to out-of-bounds
|
||||
read in udisks daemon (bsc#1248502)
|
||||
+ add 0001-udiskslinuxmanager-Add-lower-bounds-check-to-fd_inde.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 22 15:28:36 UTC 2025 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||
Tue Nov 18 08:22:44 UTC 2025 - Thomas Blume <thomas.blume@suse.com>
|
||||
|
||||
- Fix dbus daemon requires, it's dbus-service, not dbus-1
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 14 13:24:13 UTC 2025 - Thomas Blume <thomas.blume@suse.com>
|
||||
|
||||
- Drop rcFOO symlinks for CODE16 (PED-266).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 22 13:17:26 UTC 2024 - Thomas Blume <Thomas.Blume@suse.com>
|
||||
|
||||
- update to version 2.10.1
|
||||
- Update Ukrainian translation
|
||||
- tests: Wipe used devices for LVM2 RAID tests
|
||||
@@ -40,35 +43,11 @@ Wed May 22 13:17:26 UTC 2024 - Thomas Blume <Thomas.Blume@suse.com>
|
||||
- build: Check for gobject-introspection m4 macro presence
|
||||
- tests: start the polkitd mock with the corresponding user if it exists
|
||||
|
||||
- Drop merged upstream patches:
|
||||
0001-doc-Clarify-the-Filesystem.Size-property-presence.patch
|
||||
0001-udiskslinuxfilesystem-Force-native-tools-for-mounted.patch
|
||||
0001-udiskslinuxfilesystem-Refactor-internal-whitelists.patch
|
||||
0001-tests-Mark-UDF-fstab-filesystem-tests-as-unstable.patch
|
||||
0001-tests-Add-offline-and-online-filesystem-grow-tests.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 11 15:37:37 UTC 2023 - Thomas Blume <thomas.blume@suse.com>
|
||||
|
||||
- fix mount failure on ntfs formatted usb disks (bsc#1216055)
|
||||
* add:
|
||||
0001-doc-Clarify-the-Filesystem.Size-property-presence.patch
|
||||
0001-tests-Mark-UDF-fstab-filesystem-tests-as-unstable.patch
|
||||
0001-udiskslinuxfilesystem-Refactor-internal-whitelists.patch
|
||||
0001-tests-Add-offline-and-online-filesystem-grow-tests.patch
|
||||
0001-udiskslinuxfilesystem-Force-native-tools-for-mounted.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 29 20:28:56 UTC 2023 - Luciano Santos <luc14n0@opensuse.org>
|
||||
|
||||
- Add Obsoletes tags for libudisks2-0_bcache and libudisks2-0_zram
|
||||
modules, dropped on latest version bump, so they get removed from
|
||||
end users' systems upon system upgrade.
|
||||
- Drop unnecessary/discouraged %{?systemd_requires} from spec file.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 16 23:33:19 UTC 2023 - Luciano Santos <luc14n0@opensuse.org>
|
||||
|
||||
- Update to version 2.10.0:
|
||||
+ This release brings large number of internal changes, while
|
||||
keeping the promise of API stability. This development cycle
|
||||
|
||||
59
udisks2.spec
59
udisks2.spec
@@ -34,11 +34,8 @@ Source0: %{url}/releases/download/udisks-%{version}/udisks-%{version}.tar
|
||||
# an exception will be silently removed with the next version update.
|
||||
|
||||
Patch0: harden_udisks2.service.patch
|
||||
Patch1: usr_etc.patch
|
||||
%if 0%{?suse_version} > 1500
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
%endif
|
||||
Patch1: 0001-udiskslinuxmanager-Add-lower-bounds-check-to-fd_inde.patch
|
||||
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: docbook-xsl-stylesheets
|
||||
BuildRequires: gobject-introspection-devel >= 0.6.2
|
||||
@@ -72,7 +69,7 @@ Requires: libudisks2-%{soversion} = %{version}
|
||||
# For LUKS devices
|
||||
Requires: cryptsetup
|
||||
# Needed to pull in the system bus daemon
|
||||
Requires: dbus-1 >= 1.4.0
|
||||
Requires: dbus-service
|
||||
# For mkfs.vfat
|
||||
Requires: dosfstools
|
||||
# For mkfs.ext3, mkfs.ext3, e2label
|
||||
@@ -210,10 +207,6 @@ Zsh command line completion support for the udisksctl command.
|
||||
%autosetup -p1 -n udisks-%{version}
|
||||
|
||||
%build
|
||||
%if 0%{?suse_version} > 1500
|
||||
autoreconf -f
|
||||
automake
|
||||
%endif
|
||||
%configure \
|
||||
--disable-static \
|
||||
--disable-gtk-doc \
|
||||
@@ -221,11 +214,7 @@ automake
|
||||
--enable-btrfs \
|
||||
--enable-lsm \
|
||||
--enable-lvm2 \
|
||||
%if 0%{?suse_version} > 1500
|
||||
--with-vendordir=%{_distconfdir} \
|
||||
%endif
|
||||
%{nil}
|
||||
|
||||
%make_build
|
||||
|
||||
%install
|
||||
@@ -244,43 +233,14 @@ ln -sf %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}
|
||||
|
||||
# Move example config file to docs
|
||||
mkdir -p %{buildroot}%{_docdir}/%{name}
|
||||
%if 0%{?suse_version} > 1500
|
||||
mv -v %{buildroot}%{_distconfdir}/udisks2/mount_options.conf.example \
|
||||
%{buildroot}%{_docdir}/%{name}/mount_options.conf.example
|
||||
%else
|
||||
mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example \
|
||||
%{buildroot}%{_docdir}/%{name}/mount_options.conf.example
|
||||
%endif
|
||||
%{buildroot}%{_docdir}/%{name}/mount_options.conf.example
|
||||
|
||||
%post -n libudisks2-%{soversion} -p /sbin/ldconfig
|
||||
%postun -n libudisks2-%{soversion} -p /sbin/ldconfig
|
||||
|
||||
%pre -n %{name}
|
||||
%service_add_pre udisks2.service
|
||||
%if 0%{?suse_version} > 1500
|
||||
# Prepare for migration to /usr/etc; save any old .rpmsave
|
||||
for i in udisks2/udisks2.conf; do
|
||||
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
|
||||
done
|
||||
|
||||
%posttrans
|
||||
# Migration to /usr/etc, restore just created .rpmsave
|
||||
for i in udisks2/udisks2.conf; do
|
||||
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
|
||||
done
|
||||
|
||||
%pre -n libudisks2-%{soversion}_lsm
|
||||
# Prepare for migration to /usr/etc; save any old .rpmsave
|
||||
for i in udisks2/modules.conf.d/udisks2_lsm.conf; do
|
||||
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||:
|
||||
done
|
||||
|
||||
%posttrans -n libudisks2-%{soversion}_lsm
|
||||
# Migration to /usr/etc, restore just created .rpmsave
|
||||
for i in udisks2/modules.conf.d/udisks2_lsm.conf; do
|
||||
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
|
||||
done
|
||||
%endif
|
||||
|
||||
%post -n %{name}
|
||||
%{?udev_rules_update:%udev_rules_update}
|
||||
@@ -297,15 +257,9 @@ done
|
||||
%doc AUTHORS NEWS
|
||||
%{_bindir}/udisksctl
|
||||
%{_datadir}/dbus-1/system.d/org.freedesktop.UDisks2.conf
|
||||
%if 0%{?suse_version} > 1500
|
||||
%dir %{_distconfdir}/udisks2
|
||||
%dir %{_distconfdir}/udisks2/modules.conf.d
|
||||
%config %{_distconfdir}/udisks2/udisks2.conf
|
||||
%else
|
||||
%dir %{_sysconfdir}/udisks2
|
||||
%dir %{_sysconfdir}/udisks2/modules.conf.d
|
||||
%config %{_sysconfdir}/udisks2/udisks2.conf
|
||||
%endif
|
||||
%doc %{_docdir}/%{name}/mount_options.conf.example
|
||||
%{_tmpfilesdir}/udisks2.conf
|
||||
%ghost %{_rundir}/media
|
||||
@@ -358,13 +312,8 @@ done
|
||||
%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.btrfs.policy
|
||||
|
||||
%files -n libudisks2-%{soversion}_lsm
|
||||
%if 0%{?suse_version} > 1500
|
||||
%dir %{_distconfdir}/udisks2/modules.conf.d
|
||||
%attr(0600,root,root) %config %{_distconfdir}/udisks2/modules.conf.d/udisks2_lsm.conf
|
||||
%else
|
||||
%dir %{_sysconfdir}/udisks2/modules.conf.d
|
||||
%attr(0600,root,root) %config %{_sysconfdir}/udisks2/modules.conf.d/udisks2_lsm.conf
|
||||
%endif
|
||||
%dir %{_libdir}/udisks2
|
||||
%dir %{_libdir}/udisks2/modules
|
||||
%{_libdir}/udisks2/modules/libudisks2_lsm.so
|
||||
|
||||
538
usr_etc.patch
538
usr_etc.patch
@@ -1,538 +0,0 @@
|
||||
diff -ur a/configure.ac b/configure.ac
|
||||
--- a/configure.ac 2023-09-07 14:25:58.000000000 +0200
|
||||
+++ b/configure.ac 2025-06-13 15:14:59.846832219 +0200
|
||||
@@ -246,6 +246,37 @@
|
||||
AC_SUBST([tmpfilesdir], [$with_tmpfilesdir])
|
||||
fi
|
||||
|
||||
+# libeconf
|
||||
+AC_ARG_WITH([econf],
|
||||
+ AS_HELP_STRING([--without-econf], [do not use libeconf]),
|
||||
+ [], [with_econf=check]
|
||||
+)
|
||||
+
|
||||
+have_econf=no
|
||||
+AS_IF([test "x$with_econf" != xno], [
|
||||
+ PKG_CHECK_MODULES([ECONF], [libeconf], [have_econf=yes], [have_econf=no])
|
||||
+ AS_CASE([$with_econf:$have_econf],
|
||||
+ [yes:no],
|
||||
+ [AC_MSG_ERROR([libeconf expected but libeconf not found])],
|
||||
+ [*:yes],
|
||||
+ AC_DEFINE([HAVE_LIBECONF], [1], [Define if libeconf is available])
|
||||
+ )
|
||||
+])
|
||||
+AM_CONDITIONAL([HAVE_ECONF], [test "x$have_econf" = xyes])
|
||||
+
|
||||
+AC_ARG_WITH([vendordir],
|
||||
+ AS_HELP_STRING([--with-vendordir=DIR], [Directory for distribution provided configuration files (libeconf is needed for it)]),
|
||||
+ [], []
|
||||
+)
|
||||
+AC_SUBST([vendordir], [$with_vendordir])
|
||||
+AM_CONDITIONAL([USE_VENDORDIR], [test "x$with_vendordir" != x])
|
||||
+AS_IF([test "x$with_vendordir" != x], [
|
||||
+ AC_DEFINE([USE_VENDORDIR], [1], [Define to 1 to use vendordir])
|
||||
+ AS_IF([test "x$with_econf" == xno], [
|
||||
+ AC_MSG_ERROR([libeconf is needed for using vendordir])
|
||||
+ ])
|
||||
+])
|
||||
+
|
||||
# kernel modules
|
||||
AC_ARG_WITH([modloaddir],
|
||||
[AS_HELP_STRING([--with-modloaddir=DIR], [Directory for configuring kernel modules to load at boot])],
|
||||
@@ -673,6 +704,7 @@
|
||||
sbindir: ${sbindir}
|
||||
datadir: ${datadir}
|
||||
sysconfdir: ${sysconfdir}
|
||||
+ vendordir: ${with_vendordir}
|
||||
localstatedir: ${localstatedir}
|
||||
docdir: ${docdir}
|
||||
introspection: ${found_introspection}
|
||||
@@ -684,6 +716,7 @@
|
||||
using libelogind: ${have_libelogind}
|
||||
use /media for mounting: ${fhs_media}
|
||||
acl support: ${have_acl}
|
||||
+ libeconf support: ${have_econf}
|
||||
|
||||
compiler: ${CC}
|
||||
cflags: ${CFLAGS}
|
||||
diff -ur a/doc/man/Makefile.am b/doc/man/Makefile.am
|
||||
--- a/doc/man/Makefile.am 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/doc/man/Makefile.am 2025-06-13 15:14:59.858832219 +0200
|
||||
@@ -22,6 +22,12 @@
|
||||
endif # HAVE_LSM
|
||||
endif # ENABLE_MAN
|
||||
|
||||
+if USE_VENDORDIR
|
||||
+VENDORDIR_COND = with_vendordir
|
||||
+else
|
||||
+VENDORDIR_COND = without_vendordir
|
||||
+endif
|
||||
+
|
||||
udisksctl.1 : udisksctl.xml
|
||||
$(XSLTPROC) -path "$(builddir)/.." -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
|
||||
@@ -40,7 +46,8 @@
|
||||
$(SED) "s|\$${prefix}|${prefix}|" $< > $@
|
||||
|
||||
udisks2.conf.5 : udisks2.conf.5.xml
|
||||
- $(XSLTPROC) -path "$(builddir)/.." -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
+ $(XSLTPROC) --stringparam profile.condition "$(VENDORDIR_COND)" -path "$(builddir)/.." \
|
||||
+ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
|
||||
if HAVE_LSM
|
||||
# Hack: Autotools expand @sysconfdir@ as %{prefix}/etc; that's why we sed this
|
||||
@@ -49,7 +56,8 @@
|
||||
$(SED) "s|\$${prefix}|${prefix}|" $< > $@
|
||||
|
||||
udisks2_lsm.conf.5 : udisks2_lsm.conf.5.xml
|
||||
- $(XSLTPROC) -path "$(builddir)/.." -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
+ $(XSLTPROC) --stringparam profile.condition "$(VENDORDIR_COND)" -path "$(builddir)/.." \
|
||||
+ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
|
||||
endif # HAVE_LSM
|
||||
|
||||
EXTRA_DIST = \
|
||||
diff -ur a/doc/man/udisks2.conf.5.xml.in.in b/doc/man/udisks2.conf.5.xml.in.in
|
||||
--- a/doc/man/udisks2.conf.5.xml.in.in 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/doc/man/udisks2.conf.5.xml.in.in 2025-06-13 15:14:59.858832219 +0200
|
||||
@@ -37,6 +37,16 @@
|
||||
the configuration file placed at
|
||||
<emphasis>@sysconfdir@/udisks2/udisks2.conf</emphasis>.
|
||||
</para>
|
||||
+
|
||||
+ <para condition="with_vendordir">
|
||||
+ If this file does not exist, the definitions are taken from the files
|
||||
+ <emphasis>@vendordir@/udisks2/udisks2.conf</emphasis>,
|
||||
+ <emphasis>@vendordir@/udisks2/udisks2.d/*</emphasis> and
|
||||
+ <emphasis>@sysconfdir@/udisks2/udisks2.d/*</emphasis> in that order.
|
||||
+ If <emphasis>@sysconfdir@/udisks2/udisks2.d/@filename@</emphasis> exists, then
|
||||
+ <emphasis>@vendordir@/udisks2/udisks2.d/@filename@</emphasis> will not be used.
|
||||
+ </para>
|
||||
+
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
diff -ur a/doc/man/udisks2_lsm.conf.5.xml.in.in b/doc/man/udisks2_lsm.conf.5.xml.in.in
|
||||
--- a/doc/man/udisks2_lsm.conf.5.xml.in.in 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/doc/man/udisks2_lsm.conf.5.xml.in.in 2025-06-13 15:14:59.858832219 +0200
|
||||
@@ -35,6 +35,12 @@
|
||||
Some storage systems require extra configuration in
|
||||
<emphasis>@sysconfdir@/udisks2/modules.conf.d/udisks2_lsm.conf</emphasis>.
|
||||
</para>
|
||||
+
|
||||
+ <para condition="with_vendordir">
|
||||
+ If this file does not exist, the definitions are taken from the files
|
||||
+ <emphasis>@vendordir@/udisks2/modules.conf.d/udisks2_lsm.conf</emphasis>.
|
||||
+ </para>
|
||||
+
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
diff -ur a/modules/lsm/lsm_data.c b/modules/lsm/lsm_data.c
|
||||
--- a/modules/lsm/lsm_data.c 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/modules/lsm/lsm_data.c 2025-06-13 15:14:59.862832219 +0200
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <libconfig.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
+#include <sys/stat.h>
|
||||
|
||||
#define _STD_LSM_SIM_URI "sim://"
|
||||
#define _STD_LSM_HPSA_URI "hpsa://"
|
||||
@@ -177,8 +178,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef USE_VENDORDIR
|
||||
static char *
|
||||
-_lsm_get_conf_path (UDisksDaemon *daemon)
|
||||
+_lsm_get_vendor_conf_path (void)
|
||||
+{
|
||||
+ /* This should give us '<vendordir>/modules.conf.d/udisks2_lsm.conf' */
|
||||
+ return g_build_filename (_PATH_VENDORDIR,
|
||||
+ PROJECT_SYSCONF_DIR,
|
||||
+ _STD_LSM_CONF_PATH,
|
||||
+ _STD_LSM_CONF_FILE,
|
||||
+ NULL);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static char *
|
||||
+_lsm_get_sys_conf_path (UDisksDaemon *daemon)
|
||||
{
|
||||
UDisksConfigManager *config_manager;
|
||||
|
||||
@@ -211,6 +225,9 @@
|
||||
char *conf_path;
|
||||
int i;
|
||||
gboolean ret = TRUE;
|
||||
+#ifdef USE_VENDORDIR
|
||||
+ struct stat st;
|
||||
+#endif
|
||||
|
||||
udisks_debug ("LSM: loading config file");
|
||||
|
||||
@@ -221,7 +238,16 @@
|
||||
}
|
||||
|
||||
/* Get the abs config file path. */
|
||||
- conf_path = _lsm_get_conf_path (daemon);
|
||||
+ conf_path = _lsm_get_sys_conf_path (daemon);
|
||||
+
|
||||
+#ifdef USE_VENDORDIR
|
||||
+ if (stat(conf_path, &st) != 0)
|
||||
+ {
|
||||
+ /* Trying if there is a vendor defined configuration file */
|
||||
+ g_free (conf_path);
|
||||
+ conf_path = _lsm_get_vendor_conf_path();
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
config_init (&cfg);
|
||||
if (config_read_file (&cfg, conf_path) != CONFIG_TRUE)
|
||||
diff -ur a/modules/lsm/Makefile.am b/modules/lsm/Makefile.am
|
||||
--- a/modules/lsm/Makefile.am 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/modules/lsm/Makefile.am 2025-06-13 15:14:59.862832219 +0200
|
||||
@@ -20,8 +20,13 @@
|
||||
$(GIO_CFLAGS) \
|
||||
$(GUDEV_CFLAGS) \
|
||||
$(BLOCKDEV_CFLAGS) \
|
||||
- $(WARN_CFLAGS) \
|
||||
- $(NULL)
|
||||
+ $(WARN_CFLAGS)
|
||||
+if USE_VENDORDIR
|
||||
+CPPFLAGS += \
|
||||
+ -D_PATH_VENDORDIR=\"${vendordir}\"
|
||||
+endif
|
||||
+
|
||||
+CPPFLAGS += $(NULL)
|
||||
|
||||
if ENABLE_DAEMON
|
||||
|
||||
diff -ur a/src/Makefile.am b/src/Makefile.am
|
||||
--- a/src/Makefile.am 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/src/Makefile.am 2025-06-13 15:14:59.874832218 +0200
|
||||
@@ -27,8 +27,13 @@
|
||||
$(GIO_CFLAGS) \
|
||||
$(GMODULE_CFLAGS) \
|
||||
$(BLOCKDEV_CFLAGS) \
|
||||
- $(WARN_CFLAGS) \
|
||||
- $(NULL)
|
||||
+ $(WARN_CFLAGS)
|
||||
+if USE_VENDORDIR
|
||||
+CPPFLAGS += \
|
||||
+ -D_PATH_VENDORDIR=\"${vendordir}\"
|
||||
+endif
|
||||
+
|
||||
+CPPFLAGS += $(NULL)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
@@ -148,8 +153,13 @@
|
||||
$(LIBELOGIND_LIBS) \
|
||||
$(PART_LDFLAGS) \
|
||||
$(SWAP_LIBS) \
|
||||
- $(top_builddir)/udisks/libudisks2.la \
|
||||
- $(NULL)
|
||||
+ $(top_builddir)/udisks/libudisks2.la
|
||||
+
|
||||
+if HAVE_ECONF
|
||||
+libudisks_daemon_la_LIBADD += -leconf
|
||||
+endif
|
||||
+
|
||||
+libudisks_daemon_la_LIBADD += $(NULL)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
diff -ur a/src/udisksconfigmanager.c b/src/udisksconfigmanager.c
|
||||
--- a/src/udisksconfigmanager.c 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/src/udisksconfigmanager.c 2025-06-13 15:14:59.874832218 +0200
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
+#include <stdio.h>
|
||||
+#if defined (HAVE_LIBECONF) && defined (USE_VENDORDIR)
|
||||
+#include <libeconf.h>
|
||||
+#endif
|
||||
|
||||
#include "udiskslogging.h"
|
||||
#include "udisksdaemontypes.h"
|
||||
@@ -91,6 +95,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
+static void
|
||||
+set_module_list (GList **out_modules, gchar **modules)
|
||||
+{
|
||||
+ gchar **modules_tmp = modules;
|
||||
+
|
||||
+ for (gchar * module_i = *modules_tmp; module_i; module_i = *++modules_tmp)
|
||||
+ {
|
||||
+ g_strstrip (module_i);
|
||||
+ if (! udisks_module_validate_name (module_i) && !g_str_equal (module_i, MODULES_ALL_ARG))
|
||||
+ {
|
||||
+ g_warning ("Invalid module name '%s' specified in the config file.",
|
||||
+ module_i);
|
||||
+ continue;
|
||||
+ }
|
||||
+ *out_modules = g_list_append (*out_modules, g_strdup (module_i));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+set_load_preference (UDisksModuleLoadPreference *out_load_preference, const gchar *load_preference)
|
||||
+{
|
||||
+ /* Check the key value */
|
||||
+ if (g_ascii_strcasecmp (load_preference, "ondemand") == 0)
|
||||
+ {
|
||||
+ *out_load_preference = UDISKS_MODULE_LOAD_ONDEMAND;
|
||||
+ }
|
||||
+ else if (g_ascii_strcasecmp (load_preference, "onstartup") == 0)
|
||||
+ {
|
||||
+ *out_load_preference = UDISKS_MODULE_LOAD_ONSTARTUP;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ udisks_warning ("Unknown value used for 'modules_load_preference': %s; defaulting to 'ondemand'",
|
||||
+ load_preference);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static const gchar *
|
||||
get_encryption_config (const gchar *encryption)
|
||||
{
|
||||
@@ -138,6 +179,136 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#if defined (HAVE_LIBECONF) && defined (USE_VENDORDIR)
|
||||
+
|
||||
+static void
|
||||
+parse_config_file (UDisksConfigManager *manager,
|
||||
+ UDisksModuleLoadPreference *out_load_preference,
|
||||
+ const gchar **out_encryption,
|
||||
+ GList **out_modules)
|
||||
+{
|
||||
+ gchar *conf_dir;
|
||||
+ gchar *conf_filename;
|
||||
+ gchar *load_preference;
|
||||
+ gchar *encryption;
|
||||
+ gchar **modules;
|
||||
+ econf_err econf_ret = ECONF_SUCCESS;
|
||||
+ econf_file *key_file = NULL;
|
||||
+ gchar *val;
|
||||
+
|
||||
+ /* Get modules and means of loading */
|
||||
+ conf_dir = g_build_path (G_DIR_SEPARATOR_S,
|
||||
+ PACKAGE_SYSCONF_DIR,
|
||||
+ PROJECT_SYSCONF_DIR,
|
||||
+ NULL);
|
||||
+
|
||||
+ if (manager->uninstalled || !g_str_equal(conf_dir,manager->config_dir))
|
||||
+ {
|
||||
+ /* Taking this file only and not parsing e.g. vendor files */
|
||||
+ conf_filename = g_build_filename (G_DIR_SEPARATOR_S,
|
||||
+ manager->config_dir,
|
||||
+ PACKAGE_NAME_UDISKS2 ".conf",
|
||||
+ NULL);
|
||||
+ udisks_debug ("Loading configuration file: %s", conf_filename);
|
||||
+ if ((econf_ret = econf_readFile (&key_file, conf_filename, "=", "#")))
|
||||
+ {
|
||||
+ udisks_warning ("Error cannot read file %s: %s", conf_filename, econf_errString(econf_ret));
|
||||
+ }
|
||||
+ g_free (conf_filename);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Parsing vendor, run and syscconf dir */
|
||||
+ udisks_debug ("Loading configuration files (%s.conf)", PACKAGE_NAME_UDISKS2);
|
||||
+
|
||||
+ if (econf_ret == ECONF_SUCCESS)
|
||||
+ {
|
||||
+ econf_ret = econf_readConfig(&key_file,
|
||||
+ PROJECT_SYSCONF_DIR,
|
||||
+ _PATH_VENDORDIR,
|
||||
+ PACKAGE_NAME_UDISKS2,
|
||||
+ ".conf",
|
||||
+ "=",
|
||||
+ "#");
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ udisks_warning ("Error cannot read file %s.conf: %s",
|
||||
+ PACKAGE_NAME_UDISKS2, econf_errString(econf_ret));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (econf_ret != ECONF_SUCCESS)
|
||||
+ return;
|
||||
+
|
||||
+ if (out_modules != NULL)
|
||||
+ {
|
||||
+ /* Read the list of modules to load. */
|
||||
+ econf_ret = econf_getStringValue (key_file, MODULES_GROUP_NAME, MODULES_KEY, &val);
|
||||
+ if (econf_ret != ECONF_SUCCESS)
|
||||
+ {
|
||||
+ if (econf_ret != ECONF_NOKEY) {
|
||||
+ udisks_warning ("Error cannot read value %s/%s: %s",
|
||||
+ MODULES_GROUP_NAME, MODULES_KEY, econf_errString(econf_ret));
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ modules = g_strsplit (val, ",", -1);
|
||||
+ if (modules)
|
||||
+ {
|
||||
+ set_module_list (out_modules, modules);
|
||||
+ g_strfreev (modules);
|
||||
+ }
|
||||
+ g_free(val);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (out_load_preference != NULL)
|
||||
+ {
|
||||
+ /* Read the load preference configuration option. */
|
||||
+ econf_ret = econf_getStringValue (key_file, MODULES_GROUP_NAME, MODULES_LOAD_PREFERENCE_KEY,
|
||||
+ &load_preference);
|
||||
+ if (econf_ret != ECONF_SUCCESS) {
|
||||
+ if (econf_ret != ECONF_NOKEY)
|
||||
+ udisks_warning ("Error cannot read value%s/%s: %s",
|
||||
+ MODULES_GROUP_NAME, MODULES_LOAD_PREFERENCE_KEY, econf_errString(econf_ret));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (load_preference)
|
||||
+ {
|
||||
+ set_load_preference (out_load_preference, load_preference);
|
||||
+ g_free (load_preference);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (out_encryption != NULL)
|
||||
+ {
|
||||
+ /* Read the encryption option. */
|
||||
+ econf_ret = econf_getStringValue (key_file, DEFAULTS_GROUP_NAME, DEFAULTS_ENCRYPTION_KEY,
|
||||
+ &encryption);
|
||||
+ if (econf_ret != ECONF_SUCCESS) {
|
||||
+ if (econf_ret != ECONF_NOKEY)
|
||||
+ udisks_warning ("Error cannot read value %s/%s: %s",
|
||||
+ DEFAULTS_GROUP_NAME, DEFAULTS_ENCRYPTION_KEY, econf_errString(econf_ret));
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (encryption)
|
||||
+ {
|
||||
+ *out_encryption = get_encryption_config (encryption);
|
||||
+ g_free (encryption);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ econf_free (key_file);
|
||||
+}
|
||||
+
|
||||
+#else /* using vendordir and libeconf */
|
||||
+
|
||||
static void
|
||||
parse_config_file (UDisksConfigManager *manager,
|
||||
UDisksModuleLoadPreference *out_load_preference,
|
||||
@@ -148,9 +319,7 @@
|
||||
gchar *conf_filename;
|
||||
gchar *load_preference;
|
||||
gchar *encryption;
|
||||
- gchar *module_i;
|
||||
gchar **modules;
|
||||
- gchar **modules_tmp;
|
||||
|
||||
/* Get modules and means of loading */
|
||||
conf_filename = g_build_filename (G_DIR_SEPARATOR_S,
|
||||
@@ -171,18 +340,7 @@
|
||||
/* Read the list of modules to load. */
|
||||
if (modules)
|
||||
{
|
||||
- modules_tmp = modules;
|
||||
- for (module_i = *modules_tmp; module_i; module_i = *++modules_tmp)
|
||||
- {
|
||||
- g_strstrip (module_i);
|
||||
- if (! udisks_module_validate_name (module_i) && !g_str_equal (module_i, MODULES_ALL_ARG))
|
||||
- {
|
||||
- g_warning ("Invalid module name '%s' specified in the %s config file.",
|
||||
- module_i, conf_filename);
|
||||
- continue;
|
||||
- }
|
||||
- *out_modules = g_list_append (*out_modules, g_strdup (module_i));
|
||||
- }
|
||||
+ set_module_list (out_modules, modules);
|
||||
g_strfreev (modules);
|
||||
}
|
||||
}
|
||||
@@ -193,28 +351,14 @@
|
||||
load_preference = g_key_file_get_string (config_file, MODULES_GROUP_NAME, MODULES_LOAD_PREFERENCE_KEY, NULL);
|
||||
if (load_preference)
|
||||
{
|
||||
- /* Check the key value */
|
||||
- if (g_ascii_strcasecmp (load_preference, "ondemand") == 0)
|
||||
- {
|
||||
- *out_load_preference = UDISKS_MODULE_LOAD_ONDEMAND;
|
||||
- }
|
||||
- else if (g_ascii_strcasecmp (load_preference, "onstartup") == 0)
|
||||
- {
|
||||
- *out_load_preference = UDISKS_MODULE_LOAD_ONSTARTUP;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- udisks_warning ("Unknown value used for 'modules_load_preference': %s; defaulting to 'ondemand'",
|
||||
- load_preference);
|
||||
- }
|
||||
-
|
||||
+ set_load_preference (out_load_preference, load_preference);
|
||||
g_free (load_preference);
|
||||
}
|
||||
}
|
||||
|
||||
if (out_encryption != NULL)
|
||||
{
|
||||
- /* Read the load preference configuration option. */
|
||||
+ /* Read the encryption option. */
|
||||
encryption = g_key_file_get_string (config_file, DEFAULTS_GROUP_NAME, DEFAULTS_ENCRYPTION_KEY, NULL);
|
||||
if (encryption)
|
||||
{
|
||||
@@ -231,6 +375,7 @@
|
||||
g_key_file_free (config_file);
|
||||
g_free (conf_filename);
|
||||
}
|
||||
+#endif
|
||||
|
||||
static void
|
||||
udisks_config_manager_constructed (GObject *object)
|
||||
diff -ur a/udisks/Makefile.am b/udisks/Makefile.am
|
||||
--- a/udisks/Makefile.am 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/udisks/Makefile.am 2025-06-13 15:15:29.930832035 +0200
|
||||
@@ -5,7 +5,11 @@
|
||||
NULL =
|
||||
|
||||
if ENABLE_DAEMON
|
||||
+if USE_VENDORDIR
|
||||
+moduleconfdir = $(vendordir)/udisks2/
|
||||
+else
|
||||
moduleconfdir = $(sysconfdir)/udisks2/
|
||||
+endif
|
||||
|
||||
moduleconf_DATA = udisks2.conf mount_options.conf
|
||||
endif
|
||||
diff -ur a/udisks/modules.conf.d/Makefile.am b/udisks/modules.conf.d/Makefile.am
|
||||
--- a/udisks/modules.conf.d/Makefile.am 2023-09-07 14:11:56.000000000 +0200
|
||||
+++ b/udisks/modules.conf.d/Makefile.am 2025-06-13 15:15:14.250832131 +0200
|
||||
@@ -1,6 +1,9 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
-
|
||||
+if USE_VENDORDIR
|
||||
+moduleconfdir = $(vendordir)/udisks2/modules.conf.d
|
||||
+else
|
||||
moduleconfdir = $(sysconfdir)/udisks2/modules.conf.d
|
||||
+endif
|
||||
|
||||
|
||||
if ENABLE_DAEMON
|
||||
Reference in New Issue
Block a user