networkmanager: Fix build with hardening

Drop using xlocale.h

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Khem Raj
2017-06-27 19:08:08 -07:00
committed by Martin Jansa
parent c0d763a6e6
commit 9d7a49a58b
3 changed files with 98 additions and 0 deletions
@@ -0,0 +1,29 @@
From a9bfe6f2029d75caf28fcdf3e740843cf6359615 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 27 Jun 2017 07:31:25 -0700
Subject: [PATCH 1/2] systemd: xlocale.h is dropped by newer glibc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/systemd/src/basic/parse-util.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/systemd/src/basic/parse-util.c b/src/systemd/src/basic/parse-util.c
index 9c21e5a..dd95d1f 100644
--- a/src/systemd/src/basic/parse-util.c
+++ b/src/systemd/src/basic/parse-util.c
@@ -25,11 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef __GLIBC__
-#include <xlocale.h>
-#else
#include <locale.h>
-#endif
#include "alloc-util.h"
#include "extract-word.h"
#include "macro.h"
--
2.13.2
@@ -0,0 +1,67 @@
From adc0668b854289a11cfc29597b5566ba1869d17e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 27 Jun 2017 07:32:09 -0700
Subject: [PATCH 2/2] user format string in g_dbus_message_new_method_error ()
This fixes format errors with -Werror=format-security
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/nm-manager.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index c3d65cd..e814912 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -4871,6 +4871,7 @@ prop_set_auth_done_cb (NMAuthChain *chain,
if (error || (result != NM_AUTH_CALL_RESULT_YES)) {
reply = g_dbus_message_new_method_error (pfd->message,
NM_PERM_DENIED_ERROR,
+ "%s",
(error_message = "Not authorized to perform this operation"));
if (error)
error_message = error->message;
@@ -4882,6 +4883,7 @@ prop_set_auth_done_cb (NMAuthChain *chain,
if (!object) {
reply = g_dbus_message_new_method_error (pfd->message,
"org.freedesktop.DBus.Error.UnknownObject",
+ "%s",
(error_message = "Object doesn't exist."));
goto done;
}
@@ -4890,6 +4892,7 @@ prop_set_auth_done_cb (NMAuthChain *chain,
if (!nm_exported_object_get_interface_by_type (object, pfd->interface_type)) {
reply = g_dbus_message_new_method_error (pfd->message,
"org.freedesktop.DBus.Error.InvalidArgs",
+ "%s",
(error_message = "Object is of unexpected type."));
goto done;
}
@@ -4905,6 +4908,7 @@ prop_set_auth_done_cb (NMAuthChain *chain,
if (global_dns && !nm_global_dns_config_is_internal (global_dns)) {
reply = g_dbus_message_new_method_error (pfd->message,
NM_PERM_DENIED_ERROR,
+ "%s",
(error_message = "Global DNS configuration already set via configuration file"));
goto done;
}
@@ -4949,6 +4953,7 @@ do_set_property_check (gpointer user_data)
if (!pfd->subject) {
reply = g_dbus_message_new_method_error (pfd->message,
NM_PERM_DENIED_ERROR,
+ "%s",
(error_message = "Could not determine request UID."));
goto out;
}
@@ -4958,6 +4963,7 @@ do_set_property_check (gpointer user_data)
if (!chain) {
reply = g_dbus_message_new_method_error (pfd->message,
NM_PERM_DENIED_ERROR,
+ "%s",
(error_message = "Could not authenticate request."));
goto out;
}
--
2.13.2
@@ -34,6 +34,8 @@ SRC_URI = "${GNOME_MIRROR}/NetworkManager/${@gnome_verdir("${PV}")}/NetworkManag
file://0001-check-for-strndupa-before-using-it.patch \
file://0001-dns-resolved-add-systemd-resolved-backend.patch \
file://0001-dns-resolved-also-check-for-etc-resolv-conf.systemd.patch \
file://0001-systemd-xlocale.h-is-dropped-by-newer-glibc.patch \
file://0002-user-format-string-in-g_dbus_message_new_method_erro.patch \
"
SRC_URI[md5sum] = "63f1e0d6d7e9099499d062c84c927a75"
SRC_URI[sha256sum] = "829378f318cc008d138a23ca6a9191928ce75344e7e47a2f2c35f4ac82133309"