realmd/0001-Create-parent-directory-for-sssd.conf-if-not-exists.patch

43 lines
1.2 KiB
Diff
Raw Permalink Normal View History

From e7e123db1cecceeebafc442ef5ea2e8a282c78d5 Mon Sep 17 00:00:00 2001
From: Samuel Cabrero <scabrero@suse.de>
Date: Thu, 7 Nov 2024 13:23:28 +0100
Subject: [PATCH 1/2] Create parent directory for sssd.conf if not exists
OpenSUSE ships the default sssd configuration in /usr/etc and
realmd expects /etc/sssd to exists.
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
---
service/realm-ini-config.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/service/realm-ini-config.c b/service/realm-ini-config.c
index 7bbea34..b7a18e3 100644
--- a/service/realm-ini-config.c
+++ b/service/realm-ini-config.c
@@ -691,6 +691,21 @@ realm_ini_config_write_file (RealmIniConfig *self,
* write an empty file.
*/
if (length > 0 || g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ gchar *dirname;
+ gint rc;
+
+ dirname = g_path_get_dirname (filename);
+ if (dirname == NULL) {
+ g_bytes_unref (bytes);
+ return FALSE;
+ }
+
+ rc = g_mkdir_with_parents (dirname, S_IRWXU | S_IRGRP | S_IXGRP);
+ g_free (dirname);
+ if (rc != 0) {
+ g_bytes_unref (bytes);
+ return FALSE;
+ }
if (self->flags & REALM_INI_PRIVATE)
mask = umask (S_IRWXG | S_IRWXO);
--
2.47.1