6547aba
From 15722c7b2cb41dbe612d6b4c51c3dba11f5fe4c4 Mon Sep 17 00:00:00 2001
6547aba
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
6547aba
Date: Thu, 18 Jan 2018 17:40:50 +0100
6547aba
Subject: [PATCH 1/2] configure: Add option to disable writing dmrc files
6547aba
6547aba
---
6547aba
 configure.ac | 11 +++++++++++
6547aba
 1 file changed, 11 insertions(+)
6547aba
6547aba
diff --git a/configure.ac b/configure.ac
6547aba
index 711db441..3a20c84f 100644
6547aba
--- a/configure.ac
6547aba
+++ b/configure.ac
6547aba
@@ -170,8 +170,18 @@ AC_MSG_CHECKING(whether to build tests)
6547aba
 AC_ARG_ENABLE(tests,
6547aba
         AS_HELP_STRING([--disable-tests], [Disable tests building]),
6547aba
         [], [enable_tests="yes"])
6547aba
+AC_MSG_RESULT([$enable_tests])
6547aba
 AM_CONDITIONAL(COMPILE_TESTS, test x"$enable_tests" != "xno")
6547aba
 
6547aba
+AC_MSG_CHECKING(whether to enable writing dmrc files)
6547aba
+AC_ARG_ENABLE(dmrc,
6547aba
+        AS_HELP_STRING([--disable-dmrc], [Disable writing .dmrc in user home]),
6547aba
+        [], [enable_dmrc="yes"])
6547aba
+AC_MSG_RESULT([$enable_dmrc])
6547aba
+if test x"$enable_dmrc" != "xno"; then
6547aba
+  AC_DEFINE([WRITE_DMRC], [1], [Enable writing .dmrc in user home])
6547aba
+fi
6547aba
+
6547aba
 dnl ###########################################################################
6547aba
 dnl Configurable values
6547aba
 dnl ###########################################################################
6547aba
@@ -264,4 +274,5 @@ echo "
6547aba
         liblightdm-qt5:           $compile_liblightdm_qt5
6547aba
         libaudit support:         $use_libaudit
6547aba
         Enable tests:             $enable_tests
6547aba
+        Write .dmrc files:        $enable_dmrc
6547aba
 "
6547aba
6547aba
From 1072c1b0fe917358c4bdb9ee8bb23fd3c19e349c Mon Sep 17 00:00:00 2001
6547aba
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
6547aba
Date: Thu, 18 Jan 2018 17:41:30 +0100
6547aba
Subject: [PATCH 2/2] dmrc: Implement new configuration option
6547aba
6547aba
---
6547aba
 common/dmrc.c | 3 +++
6547aba
 1 file changed, 3 insertions(+)
6547aba
6547aba
diff --git a/common/dmrc.c b/common/dmrc.c
6547aba
index 9b92a52b..795ec2aa 100644
6547aba
--- a/common/dmrc.c
6547aba
+++ b/common/dmrc.c
6547aba
@@ -13,6 +13,7 @@
6547aba
 #include <string.h>
6547aba
 #include <unistd.h>
6547aba
 
6547aba
+#include "config.h"
6547aba
 #include "dmrc.h"
6547aba
 #include "configuration.h"
6547aba
 #include "privileges.h"
6547aba
@@ -54,6 +55,7 @@ dmrc_save (GKeyFile *dmrc_file, CommonUser *user)
6547aba
     gsize length;
6547aba
     g_autofree gchar *data = g_key_file_to_data (dmrc_file, &length, NULL);
6547aba
 
6547aba
+#ifdef WRITE_DMRC
6547aba
     /* Update the users .dmrc */
6547aba
     g_autofree gchar *path = g_build_filename (common_user_get_home_directory (user), ".dmrc", NULL);
6547aba
 
6547aba
@@ -65,6 +67,7 @@ dmrc_save (GKeyFile *dmrc_file, CommonUser *user)
6547aba
     g_file_set_contents (path, data, length, NULL);
6547aba
     if (drop_privileges)
6547aba
         privileges_reclaim ();
6547aba
+#endif
6547aba
 
6547aba
     /* Update the .dmrc cache */
6547aba
     g_autofree gchar *cache_dir = config_get_string (config_get_instance (), "LightDM", "cache-directory");