- Import commit 94efce2ee59fca15a48ff9c232c8dd7cf930c0a0 (merge of v248.4)

For a complete list of changes, visit:
  c0aecee593...94efce2ee5
- Drop 1001-unit-name-generate-a-clear-error-code-when-convertin.patch
  as it was merged in v248.4.

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1171
This commit is contained in:
Franck Bui 2021-07-20 15:44:54 +00:00 committed by Git OBS Bridge
parent e819284afb
commit 40db07fd11
7 changed files with 29 additions and 72 deletions

View File

@ -1,63 +0,0 @@
From 83f392a392067d61be24eb720ff0cf1da7f1892b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 1 Jun 2021 19:43:55 +0200
Subject: [PATCH 1001/1003] unit-name: generate a clear error code when
converting an overly long fs path to a unit name
(cherry picked from commit 9d5acfab20c5f1177d877d0bec18063c0a6c5929)
[fbui: adjust context]
---
src/basic/unit-name.c | 6 ++++++
src/test/test-unit-name.c | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c
index 532f8fa048..85dcba6cb7 100644
--- a/src/basic/unit-name.c
+++ b/src/basic/unit-name.c
@@ -528,6 +528,9 @@ int unit_name_from_path(const char *path, const char *suffix, char **ret) {
if (!s)
return -ENOMEM;
+ if (strlen(s) >= UNIT_NAME_MAX) /* Return a slightly more descriptive error for this specific condition */
+ return -ENAMETOOLONG;
+
/* Refuse this if this got too long or for some other reason didn't result in a valid name */
if (!unit_name_is_valid(s, UNIT_NAME_PLAIN))
return -EINVAL;
@@ -559,6 +562,9 @@ int unit_name_from_path_instance(const char *prefix, const char *path, const cha
if (!s)
return -ENOMEM;
+ if (strlen(s) >= UNIT_NAME_MAX) /* Return a slightly more descriptive error for this specific condition */
+ return -ENAMETOOLONG;
+
/* Refuse this if this got too long or for some other reason didn't result in a valid name */
if (!unit_name_is_valid(s, UNIT_NAME_INSTANCE))
return -EINVAL;
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index ece78aa548..c0b79715e1 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -130,7 +130,7 @@ static void test_unit_name_from_path(void) {
test_unit_name_from_path_one("///", ".mount", "-.mount", 0);
test_unit_name_from_path_one("/foo/../bar", ".mount", NULL, -EINVAL);
test_unit_name_from_path_one("/foo/./bar", ".mount", NULL, -EINVAL);
- test_unit_name_from_path_one("/waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ".mount", NULL, -EINVAL);
+ test_unit_name_from_path_one("/waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ".mount", NULL, -ENAMETOOLONG);
}
static void test_unit_name_from_path_instance_one(const char *pattern, const char *path, const char *suffix, const char *expected, int ret) {
@@ -160,7 +160,7 @@ static void test_unit_name_from_path_instance(void) {
test_unit_name_from_path_instance_one("waldo", "..", ".mount", NULL, -EINVAL);
test_unit_name_from_path_instance_one("waldo", "/foo", ".waldi", NULL, -EINVAL);
test_unit_name_from_path_instance_one("wa--ldo", "/--", ".mount", "wa--ldo@\\x2d\\x2d.mount", 0);
- test_unit_name_from_path_instance_one("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "/waldo", ".mount", NULL, -EINVAL);
+ test_unit_name_from_path_instance_one("waldoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "/waldo", ".mount", NULL, -ENAMETOOLONG);
}
static void test_unit_name_to_path_one(const char *unit, const char *path, int ret) {
--
2.26.2

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Jul 20 15:25:38 UTC 2021 - Franck Bui <fbui@suse.com>
- Import commit 94efce2ee59fca15a48ff9c232c8dd7cf930c0a0 (merge of v248.4)
For a complete list of changes, visit:
https://github.com/openSUSE/systemd/compare/c0aecee593511e49638579cb2b9ac8aaf1f8e6c8...94efce2ee59fca15a48ff9c232c8dd7cf930c0a0
- Drop 1001-unit-name-generate-a-clear-error-code-when-convertin.patch
as it was merged in v248.4.
-------------------------------------------------------------------
Tue Jul 20 15:10:41 UTC 2021 - Franck Bui <fbui@suse.com>

View File

@ -26,7 +26,7 @@
##### WARNING: please do not edit this auto generated spec file. Use the systemd.spec! #####
%define mini -mini
%define min_kernel_version 4.5
%define suse_version +suse.38.gc0aecee593
%define suse_version +suse.40.g94efce2ee5
%bcond_with gnuefi
%if 0%{?bootstrap}
@ -58,7 +58,7 @@
Name: systemd-mini
URL: http://www.freedesktop.org/wiki/Software/systemd
Version: 248.3
Version: 248.4
Release: 0
Summary: A System and Session Manager
License: LGPL-2.1-or-later
@ -199,7 +199,6 @@ Patch100: 0001-Revert-core-prevent-excessive-proc-self-mountinfo-pa.patch
# Patches for bsc#1188063/CVE-2021-33910. They will be moved to the
# git repo once the bug will become public.
Patch1001: 1001-unit-name-generate-a-clear-error-code-when-convertin.patch
Patch1002: 1002-basic-unit-name-do-not-use-strdupa-on-a-path.patch
Patch1003: 1003-basic-unit-name-adjust-comments.patch

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38eae688b580e7f628054b7657c9997796d90202302802ebacfee98ef56f1fa9
size 7081196

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8cacf34cb67237b28635297628399b4945c7240dccc35efdd355b264ccd6f9e5
size 7122072

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Tue Jul 20 15:25:38 UTC 2021 - Franck Bui <fbui@suse.com>
- Import commit 94efce2ee59fca15a48ff9c232c8dd7cf930c0a0 (merge of v248.4)
For a complete list of changes, visit:
https://github.com/openSUSE/systemd/compare/c0aecee593511e49638579cb2b9ac8aaf1f8e6c8...94efce2ee59fca15a48ff9c232c8dd7cf930c0a0
- Drop 1001-unit-name-generate-a-clear-error-code-when-convertin.patch
as it was merged in v248.4.
-------------------------------------------------------------------
Tue Jul 20 15:10:41 UTC 2021 - Franck Bui <fbui@suse.com>

View File

@ -24,7 +24,7 @@
%define bootstrap 0
%define mini %nil
%define min_kernel_version 4.5
%define suse_version +suse.38.gc0aecee593
%define suse_version +suse.40.g94efce2ee5
%bcond_with gnuefi
%if 0%{?bootstrap}
@ -56,7 +56,7 @@
Name: systemd
URL: http://www.freedesktop.org/wiki/Software/systemd
Version: 248.3
Version: 248.4
Release: 0
Summary: A System and Session Manager
License: LGPL-2.1-or-later
@ -197,7 +197,6 @@ Patch100: 0001-Revert-core-prevent-excessive-proc-self-mountinfo-pa.patch
# Patches for bsc#1188063/CVE-2021-33910. They will be moved to the
# git repo once the bug will become public.
Patch1001: 1001-unit-name-generate-a-clear-error-code-when-convertin.patch
Patch1002: 1002-basic-unit-name-do-not-use-strdupa-on-a-path.patch
Patch1003: 1003-basic-unit-name-adjust-comments.patch