summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2012-04-17 11:08:37 -0700
committerAuke Kok <auke-jan.h.kok@intel.com>2012-04-17 11:08:37 -0700
commit8303bf17f90ed214c20acfbb4e917d55eae56576 (patch)
treec0915942e0ecf7b2ecb4dbb46406cb640f17f1cd
parent4a6f858d0e16114844a05d504d628e210875ef0b (diff)
downloadxorg-launch-helper-8303bf17f90ed214c20acfbb4e917d55eae56576.tar.gz
xorg-launch-helper-8303bf17f90ed214c20acfbb4e917d55eae56576.tar.bz2
xorg-launch-helper-8303bf17f90ed214c20acfbb4e917d55eae56576.zip
Remove Xau support.
After looking through this, I don't see any other way that Xauth support is providing functionality other than to remote displays, which exclude ssh X forwarding. Remote displays are in the form where DISPLAY=some-other-machine:0. We really don't care for those at all at this time, so let's remove all this legacy support that we don't need as it just complicates things.
-rw-r--r--configure.ac3
-rw-r--r--src/main.c2
-rw-r--r--src/user-session.h4
-rw-r--r--src/user.c13
-rw-r--r--src/xserver.c73
5 files changed, 0 insertions, 95 deletions
diff --git a/configure.ac b/configure.ac
index de6b026..4169b0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,9 +12,6 @@ AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AC_PROG_INSTALL
-# FIXME: Replace `main' with a function in `-lXau':
-AC_CHECK_LIB([Xau], [main], ,
- AC_MSG_ERROR([libXau is required but was not found]))
# FIXME: Replace `main' with a function in `-lpam':
AC_CHECK_LIB([pam], [main], ,
AC_MSG_ERROR([libpam is required but was not found]))
diff --git a/src/main.c b/src/main.c
index 9471653..383782e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -133,8 +133,6 @@ int main(int argc, char **argv)
// close_consolekit_session();
close_pam_session();
- unlink(xauth_cookie_file);
-
/* Make sure that we clean up after ourselves */
sleep(1);
diff --git a/src/user-session.h b/src/user-session.h
index a130865..b47d008 100644
--- a/src/user-session.h
+++ b/src/user-session.h
@@ -14,9 +14,6 @@ extern struct passwd *pass;
extern char displaydev[];
extern char displayname[];
-extern char xauth_cookie_file[];
-extern Xauth x_auth;
-extern char user_xauth_path[];
extern int tty;
extern char session[];
@@ -36,7 +33,6 @@ extern void close_pam_session(void);
extern void switch_to_user(void);
extern void setup_user_environment(void);
extern void set_tty(void);
-extern void setup_xauth(void);
extern void start_X_server(void);
extern void wait_for_X_signal(void);
extern void wait_for_session_exit(void);
diff --git a/src/user.c b/src/user.c
index 8d06414..640c03e 100644
--- a/src/user.c
+++ b/src/user.c
@@ -33,8 +33,6 @@
static int uid;
struct passwd *pass;
-char user_xauth_path[PATH_MAX];
-
static void do_env(void)
{
char buf[PATH_MAX];
@@ -54,8 +52,6 @@ static void do_env(void)
setenv("DISPLAY", displayname, 1);
snprintf(buf, PATH_MAX, "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:%s/bin", pass->pw_dir);
setenv("PATH", buf, 1);
- snprintf(user_xauth_path, PATH_MAX, "%s/.Xauthority", pass->pw_dir);
- setenv("XAUTHORITY", user_xauth_path, 1);
file = popen("/bin/bash -l -c export", "r");
if (!file)
@@ -143,15 +139,6 @@ void switch_to_user(void)
ret = chdir(pass->pw_dir);
- setup_xauth();
-
- fp = fopen(user_xauth_path, "w");
- if (fp) {
- if (XauWriteAuth(fp, &x_auth) != 1)
- lprintf("Unable to write .Xauthority");
- fclose(fp);
- }
-
d_out();
}
diff --git a/src/xserver.c b/src/xserver.c
index 32b7fe5..41702a4 100644
--- a/src/xserver.c
+++ b/src/xserver.c
@@ -34,12 +34,8 @@
#include "user-session.h"
-#include <X11/Xauth.h>
-
char displaydev[PATH_MAX]; /* "/dev/tty1" */
char displayname[256] = ":0"; /* ":0" */
-char xauth_cookie_file[PATH_MAX];
-Xauth x_auth;
static pthread_mutex_t notify_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t notify_condition = PTHREAD_COND_INITIALIZER;
@@ -87,72 +83,6 @@ void set_tty(void)
d_out();
}
-void setup_xauth(void)
-{
- FILE *fp;
- int fd;
- static char cookie[16];
- struct utsname uts;
-
- static char xau_address[80];
- static char xau_number[] = "0"; // FIXME, detect correct displaynum
- static char xau_name[] = "MIT-MAGIC-COOKIE-1";
-
- d_in();
-
- fp = fopen("/dev/urandom", "r");
- if (!fp)
- return;
- if (fgets(cookie, sizeof(cookie), fp) == NULL) {
- fclose(fp);
- return;
- }
- fclose(fp);
-
- /* construct xauth data */
- if (uname(&uts) < 0) {
- lprintf("uname failed");
- return;
- }
-
- sprintf(xau_address, "%s", uts.nodename);
- x_auth.family = FamilyLocal;
- x_auth.address = xau_address;
- x_auth.number = xau_number;
- x_auth.name = xau_name;
- x_auth.address_length = strlen(xau_address);
- x_auth.number_length = strlen(xau_number);
- x_auth.name_length = strlen(xau_name);
- x_auth.data = (char *) cookie;
- x_auth.data_length = sizeof(cookie);
-
- snprintf(xauth_cookie_file, PATH_MAX, "/run/user/%s/Xauth-XXXXXX",
- pass->pw_name);
-
- fd = mkstemp(xauth_cookie_file);
- if (fd < 0) {
- lprintf("unable to make tmp file for xauth");
- return;
- }
-
- lprintf("Xauth cookie file: %s", xauth_cookie_file);
-
- fp = fdopen(fd, "a");
- if (!fp) {
- lprintf("unable to open xauth fp");
- close(fd);
- return;
- }
-
- /* write it out to disk */
- if (XauWriteAuth(fp, &x_auth) != 1)
- lprintf("unable to write xauth data to disk");
-
- fclose(fp);
-
- d_out();
-}
-
static void usr1handler(int foo)
{
/* Got the signal from the X server that it's ready */
@@ -286,9 +216,6 @@ void start_X_server(void)
ptrs[++count] = strdup("-noreset");
- ptrs[++count] = strdup("-auth");
- ptrs[++count] = user_xauth_path;
-
opt = strtok(addn_xopts, " ");
while (opt) {
dprintf("adding xopt: \"%s\"", opt);