Compare commits
7 Commits
76410e9849
...
e83ef04d97
Author | SHA1 | Date |
---|---|---|
Frantisek Sumsal | e83ef04d97 | |
Lennart Poettering | 384bd937fa | |
Lennart Poettering | dfe01841e6 | |
Lennart Poettering | d02933fded | |
Lennart Poettering | 33bd857f94 | |
Lennart Poettering | 503298b724 | |
Lennart Poettering | 268f5a5463 |
3
TODO
3
TODO
|
@ -57,9 +57,6 @@ Features:
|
||||||
* by default, in systemd --user service bump the OOMAdjust to 100, as privs
|
* by default, in systemd --user service bump the OOMAdjust to 100, as privs
|
||||||
allow so that systemd survives
|
allow so that systemd survives
|
||||||
|
|
||||||
* honour specifiers in unit files that resolve to some very basic
|
|
||||||
/etc/os-release data, such as ID, VERSION_ID, BUILD_ID, VARIANT_ID.
|
|
||||||
|
|
||||||
* cryptsetup: allow encoding key directly in /etc/crypttab, maybe with a
|
* cryptsetup: allow encoding key directly in /etc/crypttab, maybe with a
|
||||||
"base64:" prefix. Useful in particular for pkcs11 mode.
|
"base64:" prefix. Useful in particular for pkcs11 mode.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||||
|
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<row id='a'>
|
||||||
|
<entry><literal>%a</literal></entry>
|
||||||
|
<entry>Architecture</entry>
|
||||||
|
<entry>A short string identifying the architecture of the local system. A string such as <constant>x86</constant>, <constant>x86-64</constant> or <constant>arm64</constant>. See the architectures defined for <varname>ConditionArchitecture=</varname> in <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> for a full list.</entry>
|
||||||
|
</row>
|
||||||
|
<row id='B'>
|
||||||
|
<entry><literal>%B</literal></entry>
|
||||||
|
<entry>Operating system build ID</entry>
|
||||||
|
<entry>The operating system build identifier of the running system, as read from the <varname>BUILD_ID=</varname> field of <filename>/etc/os-release</filename>. If not set, resolves to an empty string. See <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
|
</row>
|
||||||
|
<row id='o'>
|
||||||
|
<entry><literal>%o</literal></entry>
|
||||||
|
<entry>Operating system ID</entry>
|
||||||
|
<entry>The operating system identifier of the running system, as read from the <varname>ID=</varname> field of <filename>/etc/os-release</filename>. See <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
|
</row>
|
||||||
|
<row id='w'>
|
||||||
|
<entry><literal>%w</literal></entry>
|
||||||
|
<entry>Operating system version ID</entry>
|
||||||
|
<entry>The operating system version identifier of the running system, as read from the <varname>VERSION_ID=</varname> field of <filename>/etc/os-release</filename>. If not set, resolves to an empty string. See <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
|
</row>
|
||||||
|
<row id='W'>
|
||||||
|
<entry><literal>%W</literal></entry>
|
||||||
|
<entry>Operating system variant ID</entry>
|
||||||
|
<entry>The operating system variant identifier of the running system, as read from the <varname>VARIANT_ID=</varname> field of <filename>/etc/os-release</filename>. If not set, resolves to an empty string. See <citerefentry><refentrytitle>os-release</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
|
</row>
|
||||||
|
</tbody>
|
|
@ -3,7 +3,9 @@
|
||||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||||
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
|
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
|
||||||
|
|
||||||
<refentry id="systemd.dnssd" conditional='ENABLE_RESOLVE'>
|
<refentry id="systemd.dnssd"
|
||||||
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||||
|
conditional='ENABLE_RESOLVE'>
|
||||||
|
|
||||||
<refentryinfo>
|
<refentryinfo>
|
||||||
<title>systemd.dnssd</title>
|
<title>systemd.dnssd</title>
|
||||||
|
@ -87,26 +89,31 @@
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<row>
|
<xi:include href="standard-specifiers.xml" xpointer="a"/>
|
||||||
<entry><literal>%m</literal></entry>
|
|
||||||
<entry>Machine ID</entry>
|
|
||||||
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%b</literal></entry>
|
<entry><literal>%b</literal></entry>
|
||||||
<entry>Boot ID</entry>
|
<entry>Boot ID</entry>
|
||||||
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="B"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%H</literal></entry>
|
<entry><literal>%H</literal></entry>
|
||||||
<entry>Host name</entry>
|
<entry>Host name</entry>
|
||||||
<entry>The hostname of the running system.</entry>
|
<entry>The hostname of the running system.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>%m</literal></entry>
|
||||||
|
<entry>Machine ID</entry>
|
||||||
|
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="o"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%v</literal></entry>
|
<entry><literal>%v</literal></entry>
|
||||||
<entry>Kernel release</entry>
|
<entry>Kernel release</entry>
|
||||||
<entry>Identical to <command>uname -r</command> output.</entry>
|
<entry>Identical to <command>uname -r</command> output.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="w"/>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="W"/>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
]>
|
]>
|
||||||
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
|
<!-- SPDX-License-Identifier: LGPL-2.1+ -->
|
||||||
|
|
||||||
<refentry id="systemd.unit">
|
<refentry id="systemd.unit"
|
||||||
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
|
||||||
<refentryinfo>
|
<refentryinfo>
|
||||||
<title>systemd.unit</title>
|
<title>systemd.unit</title>
|
||||||
|
@ -1708,11 +1709,18 @@
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<row>
|
||||||
|
<!-- We do not use the common definition from standard-specifiers.xml here since it includes a reference onto our own man page, which would make the rendered version self-referential. -->
|
||||||
|
<entry><literal>%a</literal></entry>
|
||||||
|
<entry>Architecture</entry>
|
||||||
|
<entry>A short string identifying the architecture of the local system. A string such as <constant>x86</constant>, <constant>x86-64</constant> or <constant>arm64</constant>. See the architectures defined for <varname>ConditionArchitecture=</varname> above for a full list.</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%b</literal></entry>
|
<entry><literal>%b</literal></entry>
|
||||||
<entry>Boot ID</entry>
|
<entry>Boot ID</entry>
|
||||||
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="B"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%C</literal></entry>
|
<entry><literal>%C</literal></entry>
|
||||||
<entry>Cache directory root</entry>
|
<entry>Cache directory root</entry>
|
||||||
|
@ -1770,6 +1778,7 @@ Note that this setting is <emphasis>not</emphasis> influenced by the <varname>Us
|
||||||
<entry>Machine ID</entry>
|
<entry>Machine ID</entry>
|
||||||
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="o"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%n</literal></entry>
|
<entry><literal>%n</literal></entry>
|
||||||
<entry>Full unit name</entry>
|
<entry>Full unit name</entry>
|
||||||
|
@ -1844,6 +1853,8 @@ Note that this setting is <emphasis>not</emphasis> influenced by the <varname>Us
|
||||||
<entry>Directory for larger and persistent temporary files</entry>
|
<entry>Directory for larger and persistent temporary files</entry>
|
||||||
<entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
|
<entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="w"/>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="W"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%%</literal></entry>
|
<entry><literal>%%</literal></entry>
|
||||||
<entry>Single percent sign</entry>
|
<entry>Single percent sign</entry>
|
||||||
|
|
|
@ -251,11 +251,13 @@ r - 500-900
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="a"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%b</literal></entry>
|
<entry><literal>%b</literal></entry>
|
||||||
<entry>Boot ID</entry>
|
<entry>Boot ID</entry>
|
||||||
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="B"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%H</literal></entry>
|
<entry><literal>%H</literal></entry>
|
||||||
<entry>Host name</entry>
|
<entry>Host name</entry>
|
||||||
|
@ -266,6 +268,7 @@ r - 500-900
|
||||||
<entry>Machine ID</entry>
|
<entry>Machine ID</entry>
|
||||||
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="o"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%T</literal></entry>
|
<entry><literal>%T</literal></entry>
|
||||||
<entry>Directory for temporary files</entry>
|
<entry>Directory for temporary files</entry>
|
||||||
|
@ -281,6 +284,8 @@ r - 500-900
|
||||||
<entry>Directory for larger and persistent temporary files</entry>
|
<entry>Directory for larger and persistent temporary files</entry>
|
||||||
<entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
|
<entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="w"/>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="W"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%%</literal></entry>
|
<entry><literal>%%</literal></entry>
|
||||||
<entry>Escaped <literal>%</literal></entry>
|
<entry>Escaped <literal>%</literal></entry>
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
Copyright © 2010 Brandon Philips
|
Copyright © 2010 Brandon Philips
|
||||||
-->
|
-->
|
||||||
<refentry id="tmpfiles.d">
|
<refentry id="tmpfiles.d"
|
||||||
|
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
|
||||||
<refentryinfo>
|
<refentryinfo>
|
||||||
<title>tmpfiles.d</title>
|
<title>tmpfiles.d</title>
|
||||||
|
@ -631,11 +632,13 @@ w- /proc/sys/vm/swappiness - - - - 10</programlisting></para>
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="a"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%b</literal></entry>
|
<entry><literal>%b</literal></entry>
|
||||||
<entry>Boot ID</entry>
|
<entry>Boot ID</entry>
|
||||||
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
<entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="B"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%C</literal></entry>
|
<entry><literal>%C</literal></entry>
|
||||||
<entry>System or user cache directory</entry>
|
<entry>System or user cache directory</entry>
|
||||||
|
@ -661,6 +664,7 @@ w- /proc/sys/vm/swappiness - - - - 10</programlisting></para>
|
||||||
<entry>Machine ID</entry>
|
<entry>Machine ID</entry>
|
||||||
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
<entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="o"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%S</literal></entry>
|
<entry><literal>%S</literal></entry>
|
||||||
<entry>System or user state directory</entry>
|
<entry>System or user state directory</entry>
|
||||||
|
@ -706,6 +710,8 @@ w- /proc/sys/vm/swappiness - - - - 10</programlisting></para>
|
||||||
<entry>Directory for larger and persistent temporary files</entry>
|
<entry>Directory for larger and persistent temporary files</entry>
|
||||||
<entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
|
<entry>This is either <filename>/var/tmp</filename> or the path <literal>$TMPDIR</literal>, <literal>$TEMP</literal> or <literal>$TMP</literal> are set to.</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="w"/>
|
||||||
|
<xi:include href="standard-specifiers.xml" xpointer="W"/>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>%%</literal></entry>
|
<entry><literal>%%</literal></entry>
|
||||||
<entry>Escaped <literal>%</literal></entry>
|
<entry>Escaped <literal>%</literal></entry>
|
||||||
|
|
|
@ -186,8 +186,14 @@ int unit_name_printf(const Unit *u, const char* format, char **ret) {
|
||||||
* %u: the username of the running user
|
* %u: the username of the running user
|
||||||
*
|
*
|
||||||
* %m: the machine ID of the running system
|
* %m: the machine ID of the running system
|
||||||
* %H: the hostname of the running system
|
|
||||||
* %b: the boot ID of the running system
|
* %b: the boot ID of the running system
|
||||||
|
* %H: the hostname of the running system
|
||||||
|
* %v: the kernel version
|
||||||
|
* %a: the native userspace architecture
|
||||||
|
* %o: the OS ID according to /etc/os-release
|
||||||
|
* %w: the OS version ID, according to /etc/os-release
|
||||||
|
* %B: the OS build ID, according to /etc/os-release
|
||||||
|
* %W: the OS variant ID, according to /etc/os-release
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Specifier table[] = {
|
const Specifier table[] = {
|
||||||
|
@ -203,8 +209,14 @@ int unit_name_printf(const Unit *u, const char* format, char **ret) {
|
||||||
{ 'u', specifier_user_name, NULL },
|
{ 'u', specifier_user_name, NULL },
|
||||||
|
|
||||||
{ 'm', specifier_machine_id, NULL },
|
{ 'm', specifier_machine_id, NULL },
|
||||||
{ 'H', specifier_host_name, NULL },
|
|
||||||
{ 'b', specifier_boot_id, NULL },
|
{ 'b', specifier_boot_id, NULL },
|
||||||
|
{ 'H', specifier_host_name, NULL },
|
||||||
|
{ 'v', specifier_kernel_release, NULL },
|
||||||
|
{ 'a', specifier_architecture, NULL },
|
||||||
|
{ 'o', specifier_os_id, NULL },
|
||||||
|
{ 'w', specifier_os_version_id, NULL },
|
||||||
|
{ 'B', specifier_os_build_id, NULL },
|
||||||
|
{ 'W', specifier_os_variant_id, NULL },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -218,10 +218,15 @@ int config_parse_search_domains(
|
||||||
|
|
||||||
int config_parse_dnssd_service_name(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata) {
|
int config_parse_dnssd_service_name(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata) {
|
||||||
static const Specifier specifier_table[] = {
|
static const Specifier specifier_table[] = {
|
||||||
|
{ 'm', specifier_machine_id, NULL },
|
||||||
{ 'b', specifier_boot_id, NULL },
|
{ 'b', specifier_boot_id, NULL },
|
||||||
{ 'H', specifier_host_name, NULL },
|
{ 'H', specifier_host_name, NULL },
|
||||||
{ 'm', specifier_machine_id, NULL },
|
|
||||||
{ 'v', specifier_kernel_release, NULL },
|
{ 'v', specifier_kernel_release, NULL },
|
||||||
|
{ 'a', specifier_architecture, NULL },
|
||||||
|
{ 'o', specifier_os_id, NULL },
|
||||||
|
{ 'w', specifier_os_version_id, NULL },
|
||||||
|
{ 'B', specifier_os_build_id, NULL },
|
||||||
|
{ 'W', specifier_os_variant_id, NULL },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
DnssdService *s = userdata;
|
DnssdService *s = userdata;
|
||||||
|
|
|
@ -153,10 +153,15 @@ static int specifier_dnssd_host_name(char specifier, const void *data, const voi
|
||||||
|
|
||||||
int dnssd_render_instance_name(DnssdService *s, char **ret_name) {
|
int dnssd_render_instance_name(DnssdService *s, char **ret_name) {
|
||||||
static const Specifier specifier_table[] = {
|
static const Specifier specifier_table[] = {
|
||||||
|
{ 'm', specifier_machine_id, NULL },
|
||||||
{ 'b', specifier_boot_id, NULL },
|
{ 'b', specifier_boot_id, NULL },
|
||||||
{ 'H', specifier_dnssd_host_name, NULL },
|
{ 'H', specifier_dnssd_host_name, NULL },
|
||||||
{ 'm', specifier_machine_id, NULL },
|
|
||||||
{ 'v', specifier_kernel_release, NULL },
|
{ 'v', specifier_kernel_release, NULL },
|
||||||
|
{ 'a', specifier_architecture, NULL },
|
||||||
|
{ 'o', specifier_os_id, NULL },
|
||||||
|
{ 'w', specifier_os_version_id, NULL },
|
||||||
|
{ 'B', specifier_os_build_id, NULL },
|
||||||
|
{ 'W', specifier_os_variant_id, NULL },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
_cleanup_free_ char *name = NULL;
|
_cleanup_free_ char *name = NULL;
|
||||||
|
|
|
@ -133,9 +133,14 @@ int install_full_printf(const UnitFileInstallInfo *i, const char *format, char *
|
||||||
{ 'u', specifier_user_name, NULL },
|
{ 'u', specifier_user_name, NULL },
|
||||||
|
|
||||||
{ 'm', specifier_machine_id, NULL },
|
{ 'm', specifier_machine_id, NULL },
|
||||||
{ 'H', specifier_host_name, NULL },
|
|
||||||
{ 'b', specifier_boot_id, NULL },
|
{ 'b', specifier_boot_id, NULL },
|
||||||
|
{ 'H', specifier_host_name, NULL },
|
||||||
{ 'v', specifier_kernel_release, NULL },
|
{ 'v', specifier_kernel_release, NULL },
|
||||||
|
{ 'a', specifier_architecture, NULL },
|
||||||
|
{ 'o', specifier_os_id, NULL },
|
||||||
|
{ 'w', specifier_os_version_id, NULL },
|
||||||
|
{ 'B', specifier_os_build_id, NULL },
|
||||||
|
{ 'W', specifier_os_variant_id, NULL },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,12 @@
|
||||||
#include "sd-id128.h"
|
#include "sd-id128.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
|
#include "architecture.h"
|
||||||
#include "format-util.h"
|
#include "format-util.h"
|
||||||
#include "fs-util.h"
|
#include "fs-util.h"
|
||||||
#include "hostname-util.h"
|
#include "hostname-util.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
#include "os-util.h"
|
||||||
#include "specifier.h"
|
#include "specifier.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
|
@ -175,6 +177,52 @@ int specifier_kernel_release(char specifier, const void *data, const void *userd
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int specifier_architecture(char specifier, const void *data, const void *userdata, char **ret) {
|
||||||
|
char *t;
|
||||||
|
|
||||||
|
t = strdup(architecture_to_string(uname_architecture()));
|
||||||
|
if (!t)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
*ret = t;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int specifier_os_release_common(const char *field, char **ret) {
|
||||||
|
char *t = NULL;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
r = parse_os_release(NULL, field, &t, NULL);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
if (!t) {
|
||||||
|
/* fields in /etc/os-release might quite possibly be missing, even if everything is entirely
|
||||||
|
* valid otherwise. Let's hence return "" in that case. */
|
||||||
|
t = strdup("");
|
||||||
|
if (!t)
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ret = t;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int specifier_os_id(char specifier, const void *data, const void *userdata, char **ret) {
|
||||||
|
return specifier_os_release_common("ID", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int specifier_os_version_id(char specifier, const void *data, const void *userdata, char **ret) {
|
||||||
|
return specifier_os_release_common("VERSION_ID", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int specifier_os_build_id(char specifier, const void *data, const void *userdata, char **ret) {
|
||||||
|
return specifier_os_release_common("BUILD_ID", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int specifier_os_variant_id(char specifier, const void *data, const void *userdata, char **ret) {
|
||||||
|
return specifier_os_release_common("VARIANT_ID", ret);
|
||||||
|
}
|
||||||
|
|
||||||
int specifier_group_name(char specifier, const void *data, const void *userdata, char **ret) {
|
int specifier_group_name(char specifier, const void *data, const void *userdata, char **ret) {
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,11 @@ int specifier_machine_id(char specifier, const void *data, const void *userdata,
|
||||||
int specifier_boot_id(char specifier, const void *data, const void *userdata, char **ret);
|
int specifier_boot_id(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
int specifier_host_name(char specifier, const void *data, const void *userdata, char **ret);
|
int specifier_host_name(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
int specifier_kernel_release(char specifier, const void *data, const void *userdata, char **ret);
|
int specifier_kernel_release(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
|
int specifier_architecture(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
|
int specifier_os_id(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
|
int specifier_os_version_id(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
|
int specifier_os_build_id(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
|
int specifier_os_variant_id(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
|
|
||||||
int specifier_group_name(char specifier, const void *data, const void *userdata, char **ret);
|
int specifier_group_name(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
int specifier_group_id(char specifier, const void *data, const void *userdata, char **ret);
|
int specifier_group_id(char specifier, const void *data, const void *userdata, char **ret);
|
||||||
|
|
|
@ -1393,6 +1393,11 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
||||||
{ 'b', specifier_boot_id, NULL },
|
{ 'b', specifier_boot_id, NULL },
|
||||||
{ 'H', specifier_host_name, NULL },
|
{ 'H', specifier_host_name, NULL },
|
||||||
{ 'v', specifier_kernel_release, NULL },
|
{ 'v', specifier_kernel_release, NULL },
|
||||||
|
{ 'a', specifier_architecture, NULL },
|
||||||
|
{ 'o', specifier_os_id, NULL },
|
||||||
|
{ 'w', specifier_os_version_id, NULL },
|
||||||
|
{ 'B', specifier_os_build_id, NULL },
|
||||||
|
{ 'W', specifier_os_variant_id, NULL },
|
||||||
{ 'T', specifier_tmp_dir, NULL },
|
{ 'T', specifier_tmp_dir, NULL },
|
||||||
{ 'V', specifier_var_tmp_dir, NULL },
|
{ 'V', specifier_var_tmp_dir, NULL },
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -9,12 +9,17 @@
|
||||||
|
|
||||||
static void test_specifier_printf(void) {
|
static void test_specifier_printf(void) {
|
||||||
static const Specifier table[] = {
|
static const Specifier table[] = {
|
||||||
{ 'a', specifier_string, (char*) "AAAA" },
|
{ 'X', specifier_string, (char*) "AAAA" },
|
||||||
{ 'b', specifier_string, (char*) "BBBB" },
|
{ 'Y', specifier_string, (char*) "BBBB" },
|
||||||
{ 'm', specifier_machine_id, NULL },
|
{ 'm', specifier_machine_id, NULL },
|
||||||
{ 'B', specifier_boot_id, NULL },
|
{ 'b', specifier_boot_id, NULL },
|
||||||
{ 'H', specifier_host_name, NULL },
|
{ 'H', specifier_host_name, NULL },
|
||||||
{ 'v', specifier_kernel_release, NULL },
|
{ 'v', specifier_kernel_release, NULL },
|
||||||
|
{ 'a', specifier_architecture, NULL },
|
||||||
|
{ 'o', specifier_os_id, NULL },
|
||||||
|
{ 'w', specifier_os_version_id, NULL },
|
||||||
|
{ 'B', specifier_os_build_id, NULL },
|
||||||
|
{ 'W', specifier_os_variant_id, NULL },
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +28,7 @@ static void test_specifier_printf(void) {
|
||||||
|
|
||||||
log_info("/* %s */", __func__);
|
log_info("/* %s */", __func__);
|
||||||
|
|
||||||
r = specifier_printf("xxx a=%a b=%b yyy", table, NULL, &w);
|
r = specifier_printf("xxx a=%X b=%Y yyy", table, NULL, &w);
|
||||||
assert_se(r >= 0);
|
assert_se(r >= 0);
|
||||||
assert_se(w);
|
assert_se(w);
|
||||||
|
|
||||||
|
@ -31,10 +36,15 @@ static void test_specifier_printf(void) {
|
||||||
assert_se(streq(w, "xxx a=AAAA b=BBBB yyy"));
|
assert_se(streq(w, "xxx a=AAAA b=BBBB yyy"));
|
||||||
|
|
||||||
free(w);
|
free(w);
|
||||||
r = specifier_printf("machine=%m, boot=%B, host=%H, version=%v", table, NULL, &w);
|
r = specifier_printf("machine=%m, boot=%b, host=%H, version=%v, arch=%a", table, NULL, &w);
|
||||||
assert_se(r >= 0);
|
assert_se(r >= 0);
|
||||||
assert_se(w);
|
assert_se(w);
|
||||||
puts(w);
|
puts(w);
|
||||||
|
|
||||||
|
w = mfree(w);
|
||||||
|
specifier_printf("os=%o, os-version=%w, build=%B, variant=%W", table, NULL, &w);
|
||||||
|
if (w)
|
||||||
|
puts(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_str_in_set(void) {
|
static void test_str_in_set(void) {
|
||||||
|
|
|
@ -185,6 +185,11 @@ static const Specifier specifier_table[] = {
|
||||||
{ 'b', specifier_boot_id, NULL },
|
{ 'b', specifier_boot_id, NULL },
|
||||||
{ 'H', specifier_host_name, NULL },
|
{ 'H', specifier_host_name, NULL },
|
||||||
{ 'v', specifier_kernel_release, NULL },
|
{ 'v', specifier_kernel_release, NULL },
|
||||||
|
{ 'a', specifier_architecture, NULL },
|
||||||
|
{ 'o', specifier_os_id, NULL },
|
||||||
|
{ 'w', specifier_os_version_id, NULL },
|
||||||
|
{ 'B', specifier_os_build_id, NULL },
|
||||||
|
{ 'W', specifier_os_variant_id, NULL },
|
||||||
|
|
||||||
{ 'g', specifier_group_name, NULL },
|
{ 'g', specifier_group_name, NULL },
|
||||||
{ 'G', specifier_group_id, NULL },
|
{ 'G', specifier_group_id, NULL },
|
||||||
|
@ -256,10 +261,11 @@ static int log_unresolvable_specifier(const char *filename, unsigned line) {
|
||||||
* not considered as an error so log at LOG_NOTICE only for the first time
|
* not considered as an error so log at LOG_NOTICE only for the first time
|
||||||
* and then downgrade this to LOG_DEBUG for the rest. */
|
* and then downgrade this to LOG_DEBUG for the rest. */
|
||||||
|
|
||||||
log_full(notified ? LOG_DEBUG : LOG_NOTICE,
|
log_syntax(NULL,
|
||||||
"[%s:%u] Failed to resolve specifier: %s, skipping",
|
notified ? LOG_DEBUG : LOG_NOTICE,
|
||||||
filename, line,
|
filename, line, 0,
|
||||||
arg_user ? "Required $XDG_... variable not defined" : "uninitialized /etc detected");
|
"Failed to resolve specifier: %s, skipping",
|
||||||
|
arg_user ? "Required $XDG_... variable not defined" : "uninitialized /etc detected");
|
||||||
|
|
||||||
if (!notified)
|
if (!notified)
|
||||||
log_notice("All rules containing unresolvable specifiers will be skipped.");
|
log_notice("All rules containing unresolvable specifiers will be skipped.");
|
||||||
|
@ -2431,9 +2437,7 @@ static int specifier_expansion_from_arg(Item *i) {
|
||||||
|
|
||||||
case SET_XATTR:
|
case SET_XATTR:
|
||||||
case RECURSIVE_SET_XATTR:
|
case RECURSIVE_SET_XATTR:
|
||||||
assert(i->xattrs);
|
STRV_FOREACH(xattr, i->xattrs) {
|
||||||
|
|
||||||
STRV_FOREACH (xattr, i->xattrs) {
|
|
||||||
r = specifier_printf(*xattr, specifier_table, NULL, &resolved);
|
r = specifier_printf(*xattr, specifier_table, NULL, &resolved);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -2511,11 +2515,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
if (IN_SET(r, -EINVAL, -EBADSLT))
|
if (IN_SET(r, -EINVAL, -EBADSLT))
|
||||||
/* invalid quoting and such or an unknown specifier */
|
/* invalid quoting and such or an unknown specifier */
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
return log_error_errno(r, "[%s:%u] Failed to parse line: %m", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Failed to parse line: %m");
|
||||||
} else if (r < 2) {
|
} else if (r < 2) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Syntax error.", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "Syntax error.");
|
||||||
return -EIO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty_or_dash(buffer)) {
|
if (!empty_or_dash(buffer)) {
|
||||||
|
@ -2526,8 +2529,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
|
|
||||||
if (isempty(action)) {
|
if (isempty(action)) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Command too short '%s'.", fname, line, action);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "Command too short '%s'.", action);
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pos = 1; action[pos]; pos++) {
|
for (pos = 1; action[pos]; pos++) {
|
||||||
|
@ -2539,15 +2541,12 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
allow_failure = true;
|
allow_failure = true;
|
||||||
else {
|
else {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Unknown modifiers in command '%s'",
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "Unknown modifiers in command '%s'", action);
|
||||||
fname, line, action);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boot && !arg_boot) {
|
if (boot && !arg_boot) {
|
||||||
log_debug("Ignoring entry %s \"%s\" because --boot is not specified.",
|
log_syntax(NULL, LOG_DEBUG, fname, line, 0, "Ignoring entry %s \"%s\" because --boot is not specified.", action, path);
|
||||||
action, path);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2561,7 +2560,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
if (IN_SET(r, -EINVAL, -EBADSLT))
|
if (IN_SET(r, -EINVAL, -EBADSLT))
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
return log_error_errno(r, "[%s:%u] Failed to replace specifiers in '%s': %m", fname, line, path);
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Failed to replace specifiers in '%s': %m", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = patch_var_run(fname, line, &i.path);
|
r = patch_var_run(fname, line, &i.path);
|
||||||
|
@ -2585,7 +2584,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
case RELABEL_PATH:
|
case RELABEL_PATH:
|
||||||
case RECURSIVE_RELABEL_PATH:
|
case RECURSIVE_RELABEL_PATH:
|
||||||
if (i.argument)
|
if (i.argument)
|
||||||
log_warning("[%s:%u] %c lines don't take argument fields, ignoring.", fname, line, i.type);
|
log_syntax(NULL, LOG_WARNING, fname, line, 0, "%c lines don't take argument fields, ignoring.", i.type);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2604,8 +2603,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
case WRITE_FILE:
|
case WRITE_FILE:
|
||||||
if (!i.argument) {
|
if (!i.argument) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Write file requires argument.", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "Write file requires argument.");
|
||||||
return -EBADMSG;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2617,8 +2615,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
|
|
||||||
} else if (!path_is_absolute(i.argument)) {
|
} else if (!path_is_absolute(i.argument)) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Source path is not absolute.", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "Source path '%s' is not absolute.", i.argument);
|
||||||
return -EBADMSG;
|
|
||||||
|
|
||||||
} else if (arg_root) {
|
} else if (arg_root) {
|
||||||
char *p;
|
char *p;
|
||||||
|
@ -2636,15 +2633,13 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
case CREATE_BLOCK_DEVICE:
|
case CREATE_BLOCK_DEVICE:
|
||||||
if (!i.argument) {
|
if (!i.argument) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Device file requires argument.", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG), "Device file requires argument.");
|
||||||
return -EBADMSG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r = parse_dev(i.argument, &i.major_minor);
|
r = parse_dev(i.argument, &i.major_minor);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error_errno(r, "[%s:%u] Can't parse device file major/minor '%s'.", fname, line, i.argument);
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Can't parse device file major/minor '%s'.", i.argument);
|
||||||
return -EBADMSG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -2653,8 +2648,8 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
case RECURSIVE_SET_XATTR:
|
case RECURSIVE_SET_XATTR:
|
||||||
if (!i.argument) {
|
if (!i.argument) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Set extended attribute requires argument.", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG),
|
||||||
return -EBADMSG;
|
"Set extended attribute requires argument.");
|
||||||
}
|
}
|
||||||
r = parse_xattrs_from_arg(&i);
|
r = parse_xattrs_from_arg(&i);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -2665,8 +2660,8 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
case RECURSIVE_SET_ACL:
|
case RECURSIVE_SET_ACL:
|
||||||
if (!i.argument) {
|
if (!i.argument) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Set ACLs requires argument.", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG),
|
||||||
return -EBADMSG;
|
"Set ACLs requires argument.");
|
||||||
}
|
}
|
||||||
r = parse_acls_from_arg(&i);
|
r = parse_acls_from_arg(&i);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -2677,8 +2672,8 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
case RECURSIVE_SET_ATTRIBUTE:
|
case RECURSIVE_SET_ATTRIBUTE:
|
||||||
if (!i.argument) {
|
if (!i.argument) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Set file attribute requires argument.", fname, line);
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG),
|
||||||
return -EBADMSG;
|
"Set file attribute requires argument.");
|
||||||
}
|
}
|
||||||
r = parse_attribute_from_arg(&i);
|
r = parse_attribute_from_arg(&i);
|
||||||
if (IN_SET(r, -EINVAL, -EBADSLT))
|
if (IN_SET(r, -EINVAL, -EBADSLT))
|
||||||
|
@ -2688,15 +2683,15 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_error("[%s:%u] Unknown command type '%c'.", fname, line, (char) i.type);
|
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
return -EBADMSG;
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG),
|
||||||
|
"Unknown command type '%c'.", (char) i.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path_is_absolute(i.path)) {
|
if (!path_is_absolute(i.path)) {
|
||||||
log_error("[%s:%u] Path '%s' not absolute.", fname, line, i.path);
|
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
return -EBADMSG;
|
return log_syntax(NULL, LOG_ERR, fname, line, SYNTHETIC_ERRNO(EBADMSG),
|
||||||
|
"Path '%s' not absolute.", i.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
path_simplify(i.path, false);
|
path_simplify(i.path, false);
|
||||||
|
@ -2710,8 +2705,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
if (IN_SET(r, -EINVAL, -EBADSLT))
|
if (IN_SET(r, -EINVAL, -EBADSLT))
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
return log_error_errno(r, "[%s:%u] Failed to substitute specifiers in argument: %m",
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Failed to substitute specifiers in argument: %m");
|
||||||
fname, line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_root) {
|
if (arg_root) {
|
||||||
|
@ -2729,7 +2723,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
r = get_user_creds(&u, &i.uid, NULL, NULL, NULL, USER_CREDS_ALLOW_MISSING);
|
r = get_user_creds(&u, &i.uid, NULL, NULL, NULL, USER_CREDS_ALLOW_MISSING);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
return log_error_errno(r, "[%s:%u] Unknown user '%s'.", fname, line, user);
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Failed to resolve user '%s': %m", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
i.uid_set = true;
|
i.uid_set = true;
|
||||||
|
@ -2741,8 +2735,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
r = get_group_creds(&g, &i.gid, USER_CREDS_ALLOW_MISSING);
|
r = get_group_creds(&g, &i.gid, USER_CREDS_ALLOW_MISSING);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Unknown group '%s'.", fname, line, group);
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Failed to resolve group '%s'.", group);
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i.gid_set = true;
|
i.gid_set = true;
|
||||||
|
@ -2757,10 +2750,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
mm++;
|
mm++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse_mode(mm, &m) < 0) {
|
r = parse_mode(mm, &m);
|
||||||
|
if (r < 0) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Invalid mode '%s'.", fname, line, mode);
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Invalid mode '%s'.", mode);
|
||||||
return -EBADMSG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i.mode = m;
|
i.mode = m;
|
||||||
|
@ -2776,10 +2769,10 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
a++;
|
a++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse_sec(a, &i.age) < 0) {
|
r = parse_sec(a, &i.age);
|
||||||
|
if (r < 0) {
|
||||||
*invalid_config = true;
|
*invalid_config = true;
|
||||||
log_error("[%s:%u] Invalid age '%s'.", fname, line, age);
|
return log_syntax(NULL, LOG_ERR, fname, line, r, "Invalid age '%s'.", age);
|
||||||
return -EBADMSG;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i.age_set = true;
|
i.age_set = true;
|
||||||
|
@ -2793,8 +2786,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool
|
||||||
|
|
||||||
for (n = 0; n < existing->n_items; n++) {
|
for (n = 0; n < existing->n_items; n++) {
|
||||||
if (!item_compatible(existing->items + n, &i) && !i.append_or_force) {
|
if (!item_compatible(existing->items + n, &i) && !i.append_or_force) {
|
||||||
log_notice("[%s:%u] Duplicate line for path \"%s\", ignoring.",
|
log_syntax(NULL, LOG_NOTICE, fname, line, 0, "Duplicate line for path \"%s\", ignoring.", i.path);
|
||||||
fname, line, i.path);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue