aboutsummaryrefslogtreecommitdiff
Add "display_name" configuration option and use its value instead of the hard
coded one.

Patch by Diego N. Barbato
---
 app.cpp        | 23 ++++++++++-------------
 cfg.cpp        |  1 +
 switchuser.cpp |  2 +-
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/app.cpp b/app.cpp
index b840e60..4f72da0 100644
--- a/app.cpp
+++ b/app.cpp
@@ -270,7 +270,16 @@ App::App(int argc, char** argv)
 
 void App::Run()
 {
-	DisplayName = DISPLAY;
+	/* Read configuration */
+	if ( cfg == 0 )
+	{
+		cfg = new Cfg;
+		const char *cfgfile = getenv("SLIM_CFGFILE");
+		if (!cfgfile) cfgfile = CFGFILE;
+		cfg->readConf(cfgfile);
+
+		DisplayName = cfg->getOption("display_name").c_str();
+	}
 
 #ifdef XNEST_DEBUG
 	char* p = getenv("DISPLAY");
@@ -281,14 +287,7 @@ void App::Run()
 	}
 #endif
 
-	/* Read configuration and theme */
-	if ( cfg == 0 )
-	{
-		cfg = new Cfg;
-		const char* cfgfile = getenv("SLIM_CFGFILE");
-		if (!cfgfile) cfgfile = CFGFILE;
-		cfg->readConf(cfgfile);
-	}
+        /* Read theme */
 	string themebase = "";
 	string themefile = "";
 	string themedir = "";
@@ -1115,9 +1114,7 @@ int App::StartServer()
 	static const int MAX_XSERVER_ARGS = 256;
 	static char* server[MAX_XSERVER_ARGS+2] = { NULL };
 	server[0] = (char *)cfg->getOption("default_xserver").c_str();
-	string argOption = cfg->getOption("xserver_arguments");
-	/* Add mandatory -xauth option */
-	argOption = argOption + " -auth " + cfg->getOption("authfile");
+	string argOption = cfg->getOption("display_name") + " " + cfg->getOption("xserver_arguments") + " -auth " + cfg->getOption("authfile");
 	char* args = new char[argOption.length()+2]; /* NULL plus vt */
 	strcpy(args, argOption.c_str());
 
@@ -1424,7 +1421,7 @@ void App::CreateServerAuth()
 	authfile = cfg->getOption("authfile");
 	remove(authfile.c_str());
 	putenv(StrConcat("XAUTHORITY=", authfile.c_str()));
-	Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"),
+	Util::add_mcookie(mcookie, cfg->getOption("display_name").c_str(), cfg->getOption("xauth_path"),
 	  authfile);
 }
 
diff --git a/cfg.cpp b/cfg.cpp
index 37fb10d..a0c9bf1 100644
--- a/cfg.cpp
+++ b/cfg.cpp
@@ -40,6 +40,7 @@ Cfg::Cfg()
 	/* Configuration options */
 	options.insert(option("default_path","/bin:/usr/bin:/usr/local/bin"));
 	options.insert(option("default_xserver","/usr/bin/X"));
+	options.insert(option("display_name",":0.0"));
 	options.insert(option("xserver_arguments",""));
 	options.insert(option("numlock",""));
 	options.insert(option("daemon",""));
diff --git a/switchuser.cpp b/switchuser.cpp
index ca936ae..255f5d9 100644
--- a/switchuser.cpp
+++ b/switchuser.cpp
@@ -69,6 +69,6 @@ void SwitchUser::SetClientAuth(const char* mcookie)
 	string home = string(Pw->pw_dir);
 	string authfile = home + "/.Xauthority";
 	remove(authfile.c_str());
-	Util::add_mcookie(mcookie, ":0", cfg->getOption("xauth_path"),
+	Util::add_mcookie(mcookie, cfg->getOption("display_name").c_str(), cfg->getOption("xauth_path"),
 	  authfile);
 }
-- 
2.39.2

tip'>* gnu/build/linux-container.scm (mount-file-systems): 'mounts' is now a list of <file-system> objects instead of a list of lists ("specs"). Add call to 'file-system->spec' as the argument to 'mount-file-system'. (run-container, call-with-container): Adjust docstring accordingly. * gnu/system/file-systems.scm (spec->file-system): New procedure. * gnu/system/linux-container.scm (container-script)[script]: Call 'spec->file-system' inside gexp. * guix/scripts/environment.scm (launch-environment/container): Remove call to 'file-system->spec'. * tests/containers.scm ("call-with-container, mnt namespace") ("call-with-container, mnt namespace, wrong bind mount"): Pass a list of <file-system> objects. Ludovic Courtès 2016-10-19container: Allow 'container-excursion' to the same namespaces....Before that, 'container-excursion' would call 'setns' even when the target namespace is the one the caller is already in, which would fail. * gnu/build/linux-container.scm (container-excursion): Introduce 'source' and 'target'. Compare the result of 'readlink' on these instead of comparing file descriptors to decide whether to call 'setns'. * tests/containers.scm ("container-excursion, same namespace"): New test. Ludovic Courtès 2016-06-25tests: Skip all the container tests when needed....Reported by myglc2 <myglc2@gmail.com> at <http://bugs.gnu.org/23836>. * tests/containers.scm (skip-if-unsupported): New procedure. Call it before each test. Ludovic Courtès 2016-05-31container: Gracefully report mount errors in the child process....Fixes <http://bugs.gnu.org/23306>. * gnu/build/linux-container.scm (run-container): Use 'socketpair' instead of 'pipe'. Rename 'in' to 'child' and 'out' to 'parent'. Send a 'ready message or an exception argument list from the child to the parent; adjust the parent accordingly. * tests/containers.scm ("call-with-container, mnt namespace, wrong bind mount"): New test. * tests/guix-environment-container.sh: Add test with --expose=/does-not-exist. Ludovic Courtès 2016-04-03build: Add a Guile custom test driver using SRFI-64....Before that '.log' files for scheme tests were fragmented and not included in test-suite.log. This unifies the semantics of SRFI-64 API with Automake test suite. * build-aux/test-driver.scm: New file. * Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables. (SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables. (AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0. * test-env.in: Silence guix-daemon. * doc/guix.texi (Running the Test Suite): Describe how to display the detailed results. Bug reports require only 'test-suite.log' file. * tests/base32.scm, tests/build-utils.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm, tests/cve.scm, tests/derivations.scm, tests/elpa.scm, tests/file-systems.scm, tests/gem.scm, tests/gexp.scm, tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm, tests/gremlin.scm, tests/hackage.scm, tests/hash.scm, tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm, tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm, tests/profiles.scm, tests/publish.scm, tests/pypi.scm, tests/records.scm, tests/scripts-build.scm, tests/scripts.scm, tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm, tests/store.scm, tests/substitute.scm, tests/syscalls.scm, tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm, tests/utils.scm: Don't exit at the end of test groups. * tests/containers.scm: Likewise. Use 'test-skip' instead of exiting with error code 77. Mathieu Lirzin 2015-11-03build: container: Add feature test predicates....* gnu/build/linux-container.scm (user-namespace-supported?, unprivileged-user-namespace-supported?, setgroups-supported?): New procedures. * tests/container.scm: Use predicates. * tests/syscalls.scm: Likewise. David Thompson 2015-10-10build: container: Fix call-with-clean-exit....Before, call-with-clean-exit would *always* return an exit code of 1. * gnu/build/linux-container.scm (call-with-clean-exit): Exit with status code of 0 if thunk does not throw an exception. * tests/containers.scm: Add test. David Thompson 2015-08-11tests: containers: Skip if setgroups file does not exist....Fixes bug #21226. Linux 3.19 introduced a fix for a security vulnerability in user namespaces. This fix introduced a new proc file called 'setgroups' and was backported to many older kernels. However, some users run a kernel that is new enough to support user namespaces yet old enough to not include the patch, so we must skip the tests. * tests/containers.scm: Skip all tests if /proc/self/setgroups does not exist. David Thompson 2015-08-08build: container: Add #:host-uids argument to call-with-container....It's not always possible to map 65536 uids when creating a container as the root user within another user namespace. This is true when building Guix within the build daemon's container. By using a uid range of 1 by default, even as the root user, the tests now pass. * gnu/build/linux-container.scm (initialize-user-namespace, run-container): Add 'host-uids' argument. (call-with-container): Add #:host-uids keyword argument. * tests/containers.scm ("container-excursion"): Update 'run-container' call. David Thompson 2015-07-20tests: Skip container tests if namespaces are not available....* tests/containers.scm: Skip all tests if user namespaces do not exist. David Thompson 2015-07-09gnu: build: Add Linux container module....* gnu/build/linux-container.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it. * .dir-locals.el: Add Scheme indent rules for 'call-with-container', and 'container-excursion'. * tests/containers.scm: New file. * Makefile.am (SCM_TESTS): Add it. David Thompson