Projects
home:Eustace:branches:Eulaceura:Factory
NutShell-systemd
_service:obs_scm:CVE-2020-1712-3.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:CVE-2020-1712-3.patch of Package NutShell-systemd
From 95f82ae9d774f3508ce89dcbdd0714ef7385df59 Mon Sep 17 00:00:00 2001 From: Lennart Poettering <lennart@poettering.net> Date: Wed, 22 Jan 2020 16:44:43 +0100 Subject: [PATCH] polkit: reuse some common bus message appending code https://github.com/systemd/systemd/commit/95f82ae9d774f3508ce89dcbdd0714ef7385df59 --- src/shared/bus-util.c | 56 ++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 4bfdd3a..04153d6 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -211,6 +211,34 @@ static int check_good_user(sd_bus_message *m, uid_t good_user) { return sender_uid == good_user; } +#if ENABLE_POLKIT +static int bus_message_append_strv_key_value( + sd_bus_message *m, + const char **l) { + + const char **k, **v; + int r; + + assert(m); + + r = sd_bus_message_open_container(m, 'a', "{ss}"); + if (r < 0) + return r; + + STRV_FOREACH_PAIR(k, v, l) { + r = sd_bus_message_append(m, "{ss}", *k, *v); + if (r < 0) + return r; + } + + r = sd_bus_message_close_container(m); + if (r < 0) + return r; + + return r; +} +#endif + int bus_test_polkit( sd_bus_message *call, int capability, @@ -241,7 +269,7 @@ int bus_test_polkit( _cleanup_(sd_bus_message_unrefp) sd_bus_message *request = NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; int authorized = false, challenge = false; - const char *sender, **k, **v; + const char *sender; sender = sd_bus_message_get_sender(call); if (!sender) @@ -265,17 +293,7 @@ int bus_test_polkit( if (r < 0) return r; - r = sd_bus_message_open_container(request, 'a', "{ss}"); - if (r < 0) - return r; - - STRV_FOREACH_PAIR(k, v, details) { - r = sd_bus_message_append(request, "{ss}", *k, *v); - if (r < 0) - return r; - } - - r = sd_bus_message_close_container(request); + r = bus_message_append_strv_key_value(request, details); if (r < 0) return r; @@ -388,7 +406,7 @@ int bus_verify_polkit_async( #if ENABLE_POLKIT _cleanup_(sd_bus_message_unrefp) sd_bus_message *pk = NULL; AsyncPolkitQuery *q; - const char *sender, **k, **v; + const char *sender; sd_bus_message_handler_t callback; void *userdata; int c; @@ -498,17 +516,7 @@ int bus_verify_polkit_async( if (r < 0) return r; - r = sd_bus_message_open_container(pk, 'a', "{ss}"); - if (r < 0) - return r; - - STRV_FOREACH_PAIR(k, v, details) { - r = sd_bus_message_append(pk, "{ss}", *k, *v); - if (r < 0) - return r; - } - - r = sd_bus_message_close_container(pk); + r = bus_message_append_strv_key_value(pk, details); if (r < 0) return r; -- 2.19.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2