diff options
Diffstat (limited to 'trunk/utils')
-rw-r--r-- | trunk/utils/.cvsignore | 10 | ||||
-rw-r--r-- | trunk/utils/Makefile.am | 65 | ||||
-rw-r--r-- | trunk/utils/gdm-dmx-reconnect-proxy.c | 133 | ||||
-rw-r--r-- | trunk/utils/gdm-ssh-session | 8 | ||||
-rw-r--r-- | trunk/utils/gdmaskpass.c | 58 | ||||
-rw-r--r-- | trunk/utils/gdmmktemp.c | 36 | ||||
-rw-r--r-- | trunk/utils/gdmopen.c | 254 | ||||
-rw-r--r-- | trunk/utils/gdmprefetch.c | 144 | ||||
-rw-r--r-- | trunk/utils/gdmtranslate.c | 51 |
9 files changed, 0 insertions, 759 deletions
diff --git a/trunk/utils/.cvsignore b/trunk/utils/.cvsignore deleted file mode 100644 index bc1ecb14..00000000 --- a/trunk/utils/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -Makefile -Makefile.in -.libs -.deps -gdmaskpass -gdmopen -gdmprefetch -gdmmktemp -gdmtranslate -gdm-dmx-reconnect-proxy diff --git a/trunk/utils/Makefile.am b/trunk/utils/Makefile.am deleted file mode 100644 index 759c70b7..00000000 --- a/trunk/utils/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -## Process this file with automake to produce makefile.in -DEFS = @DEFS@ -DGDM_CONFIG_FILE=\"$(gdmconfdir)/gdm.conf\" \ - -DGDM_FACTORY_CONFIG_FILE=\"$(gdmconfdir)/factory-gdm.conf\" \ - -DGDM_GLADE_DIR=\"@datadir@/gdm\" - -INCLUDES = \ - -I. \ - -I.. \ - -I$(top_srcdir)/daemon \ - -I$(top_srcdir)/vicious-extensions \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - $(UTILS_CFLAGS) - -EXTRA_DIST = gdm-ssh-session - -libexec_SCRIPTS = \ - @GDMSSHSESSION@ - -libexec_PROGRAMS = \ - @GDMASKPASS@ \ - @GDMOPEN@ \ - @GDMPREFETCH@ \ - gdmtranslate - -if DMX_SUPPORT -bin_PROGRAMS = gdm-dmx-reconnect-proxy -endif - -EXTRA_SCRIPTS = gdm-ssh-session -EXTRA_PROGRAMS = gdmaskpass gdmopen gdmprefetch - -gdmaskpass_SOURCES = \ - gdmaskpass.c - -gdmtranslate_SOURCES = \ - gdmtranslate.c - -gdmopen_SOURCES = \ - gdmopen.c - -gdmprefetch_SOURCES = \ - gdmprefetch.c - -gdmaskpass_LDADD = \ - $(INTLLIBS) \ - -lpam \ - $(EXTRA_GDMASKPASS_LIBS) - -gdmopen_LDADD = \ - $(INTLLIBS) - -gdmtranslate_LDADD = \ - $(INTLLIBS) - -if DMX_SUPPORT -gdm_dmx_reconnect_proxy_SOURCES = \ - gdm-dmx-reconnect-proxy.c - -gdm_dmx_reconnect_proxy_LDADD = \ - $(GLIB_LIBS) \ - $(X_EXTRA_LIBS) \ - $(X_LIBS) \ - -lX11 \ - $(DMX_LIBS) -endif diff --git a/trunk/utils/gdm-dmx-reconnect-proxy.c b/trunk/utils/gdm-dmx-reconnect-proxy.c deleted file mode 100644 index c3bab83e..00000000 --- a/trunk/utils/gdm-dmx-reconnect-proxy.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (C) 2005 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include <stdlib.h> -#include <locale.h> -#include <glib.h> -#include <glib/gi18n.h> - -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -static char *to_display = NULL; -static char *backend_display = NULL; -static char *to_authfile = NULL; -static char *backend_authfile = NULL; - -static GOptionEntry options[] = { - { - "to", 0, 0, G_OPTION_ARG_STRING, &to_display, - N_("DMX display to migrate to"), - N_("DISPLAY") - }, - { - "display", 0, 0, G_OPTION_ARG_STRING, &backend_display, - N_("Backend display name"), - N_("DISPLAY") - }, - { - "to-authfile", 0, 0, G_OPTION_ARG_STRING, &to_authfile, - N_("Xauthority file for destination display"), - N_("AUTHFILE") - }, - { - "display-authfile", 0, 0, G_OPTION_ARG_STRING, &backend_authfile, - N_("Xauthority file for backend display"), - N_("AUTHFILE") - }, - { NULL } -}; - -static Display * -get_dmx_display (const char *display_name, - const char *authfile) -{ - Display *display; - int event_base, error_base; - const char *old_authfile; - - old_authfile = getenv ("XAUTHORITY"); - g_setenv ("XAUTHORITY", authfile, TRUE); - - if ((display = XOpenDisplay (display_name)) == NULL) - g_printerr (_("Failed to open display \"%s\"\n"), display_name); - - if (display != NULL && - !DMXQueryExtension (display, &event_base, &error_base)) { - g_printerr (_("DMX extension not present on \"%s\"\n"), display_name); - XCloseDisplay (display); - display = NULL; - } - - g_setenv ("XAUTHORITY", old_authfile, TRUE); - - return display; -} - -int -main (int argc, char **argv) -{ - GOptionContext *options_context; - Display *display; - DMXScreenAttributes attr; - guint mask; - int screen; - - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - textdomain (GETTEXT_PACKAGE); - - options_context = g_option_context_new (_("- migrate a backend display from one DMX display to another")); - g_option_context_add_main_entries (options_context, options, GETTEXT_PACKAGE); - g_option_context_parse (options_context, &argc, &argv, NULL); - g_option_context_free (options_context); - - if (to_display == NULL) { - g_printerr (_("You must specify a destination DMX display using %s\n"), "--to"); - return 1; - } - - if (backend_display == NULL) { - g_printerr (_("You must specify a backend display by using %s\n"), "--display"); - return 1; - } - - if ((display = get_dmx_display (to_display, to_authfile)) == NULL) - return 1; - - /* Note, we have no way yet of using backend_authfile to ensure - * that the DMX server can authenticate against the backend Xserver. - * For now, we must disable access control on the backend server. - */ - - mask = 0; - screen = 0; - if (!DMXAddScreen (display, backend_display, mask, &attr, &screen)) { - g_printerr (_("DMXAddScreen \"%s\" failed on \"%s\"\n"), - backend_display, to_display); - XCloseDisplay (display); - return 1; - } - - XCloseDisplay (display); - - return 0; -} diff --git a/trunk/utils/gdm-ssh-session b/trunk/utils/gdm-ssh-session deleted file mode 100644 index b70af907..00000000 --- a/trunk/utils/gdm-ssh-session +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -ZENITY=`which zenity` -TARGETHOST=`$ZENITY --title "Host to connect to" --entry --text "Enter the name of the host you want to log in to"` -# @@@ should probably get a user name too; -# for now can bet set using the $USERNAME@ convention -# @@@ should it do an ssh-add so the user doesn't have to enter its passphrase again? -ssh -A -X -T -n "$TARGETHOST" /etc/X11/Xsession diff --git a/trunk/utils/gdmaskpass.c b/trunk/utils/gdmaskpass.c deleted file mode 100644 index 206b9eda..00000000 --- a/trunk/utils/gdmaskpass.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Simple pam thingie to ask the root password, for use in XKeepsCrashing - * script. */ -#include "config.h" -#include <glib/gi18n.h> -#include <stdio.h> -#include <locale.h> -#include <unistd.h> -#include <security/pam_appl.h> -#include <security/pam_misc.h> - -static struct pam_conv conv = { - misc_conv, - NULL -}; - -int -main (int argc, char *argv[]) -{ - pam_handle_t *pamh; - const char *username = "root"; - int retval; - int tries = 3; - - if (getuid () != geteuid () || - getuid () != 0) { - fprintf (stderr, _("gdmaskpass only runs as root\n")); - return 1; - } - - if (argc >= 2) { - username = argv[1]; - } - - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - textdomain (GETTEXT_PACKAGE); - - for (tries = 3; tries > 0; tries --) { - if ((retval = pam_start ("gdm", username, &conv, &pamh)) != PAM_SUCCESS) { - pam_end (pamh, retval); - pamh = NULL; - printf (_("Authentication failure!\n")); - continue; - } - if ((retval = pam_authenticate (pamh, 0)) != PAM_SUCCESS) { - pam_end (pamh, retval); - pamh = NULL; - printf (_("Authentication failure!\n")); - continue; - } - break; - } - - if (pamh != NULL) - pam_end (pamh, retval); - - return (retval == PAM_SUCCESS) ? 0 : 1; -} diff --git a/trunk/utils/gdmmktemp.c b/trunk/utils/gdmmktemp.c deleted file mode 100644 index dba23650..00000000 --- a/trunk/utils/gdmmktemp.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * gdmmkstemp.c by the Queen of England - * A utility to do mkstemp from a script. - * - * Copyright (c) 2001 by Queen of England - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include "config.h" -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - - -int -main (int argc, char *argv[]) -{ - char template[] = "/tmp/gdm-XXXXXX"; - int i; - - i = mkstemp (template); - if (i < 0) - return 1; - - fchmod (i, 0600); - - printf ("%s\n", template); - close (i); - return 0; -} diff --git a/trunk/utils/gdmopen.c b/trunk/utils/gdmopen.c deleted file mode 100644 index b49f51af..00000000 --- a/trunk/utils/gdmopen.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * gdmopen.c by the Queen of England, based upon original open. - * Simplified for the purposes of gdm. All useless (to me) - * functionality stripped. Also returns what the command returns. - * Return of 66 means error with open. - * - * Original header: - * - * open.c open a vt to run a new command (or shell). - * - * Copyright (c) 1994 by Jon Tombs <jon@gtex02.us.es> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include "config.h" -#include <stdio.h> -#include <signal.h> -#include <unistd.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <dirent.h> -#include <pwd.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/vt.h> -#include <sys/types.h> -#include <sys/wait.h> - -#define IGNORE_EINTR(expr) \ - do { \ - errno = 0; \ - expr; \ - } while (errno == EINTR); - -#ifndef FALSE -#define FALSE 0 -#define TRUE !FALSE -#endif - - -/* - * Where your VTs are hidden - */ -#ifdef __linux__ -#define VTNAME "/dev/tty%d" -#endif - -#ifdef ESIX_5_3_2_D -#define VTBASE "/dev/vt%02d" -#endif - -const char *GDMOPENversion = "gdmopen " VERSION " simplified (was: open: 1.4 (c) Jon Tombs 1994)"; - -#ifndef VTNAME -#error vt device name must be defined in open.c -#endif - -static pid_t child_pid = -1; -struct vt_stat vt; -static int vtno; -static int fd = 0; -static int do_switchback = FALSE; - -static void -sighandler (int sig) -{ - if (child_pid > 1) { - if (kill (child_pid, sig) == 0) - waitpid (child_pid, NULL, 0); - } - - if (do_switchback) { - /* Switch back... */ - (void) ioctl(fd, VT_ACTIVATE, vt.v_active); - /* wait to be really sure we have switched */ - (void) ioctl(fd, VT_WAITACTIVE, vt.v_active); - } - - /* Kill myself with this signal */ - signal (sig, SIG_DFL); - raise (sig); -} - -int -main (int argc, char *argv[]) -{ - char vtname[256]; - int status; - int cmd_start = 1; - char *command = NULL; - - if (getuid () != geteuid () || - getuid () != 0) { - fprintf (stderr, "gdmopen: Only root wants to run me\n"); - return 66; - } - - signal (SIGTERM, sighandler); - signal (SIGINT, sighandler); - signal (SIGHUP, sighandler); - - if (argc <= 1) { - fprintf (stderr, "gdmopen: must supply a command!\n"); - return 66; - } - - command = argv[1]; - - if (strcmp (argv[1], "-l") == 0) { - char *p; - if (argc <= 2) { - fprintf (stderr, "gdmopen: must supply a command!\n"); - return 66; - } - /* prepend '-' and start the command at - * argument 2 */ - cmd_start = 2; - command = argv[2]; - argv[2] = malloc (strlen (command) + 2); - if (argv[2] == NULL) { - fprintf (stderr, "gdmopen: cannot allocate memory!\n"); - return 66; - } - p = strrchr (command, '/'); - if (p != NULL) { - /* make it "-basename" */ - strcpy (argv[2]+1, p+1); - } else { - strcpy (argv[2]+1, command); - } - *(argv[2]) = '-'; - } - - fd = open ("/dev/console", O_WRONLY, 0); - if (fd < 0) { - perror ("gdmopen: Failed to open /dev/console"); - return 66; - } - - errno = 0; - if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) || (vtno == -1)) { - perror ("gdmopen: Cannot find a free VT"); - IGNORE_EINTR (close (fd)); - return 66; - } - - if (ioctl(fd, VT_GETSTATE, &vt) < 0) { - perror ("gdmopen: can't get VTstate"); - IGNORE_EINTR (close(fd)); - return 66; - } - - snprintf (vtname, sizeof (vtname), VTNAME, vtno); - - chown (vtname, 0, -1); - - child_pid = fork(); - if (child_pid == 0) { - char VT_NUMBER[256]; - - if (getenv ("UNSAFE_TO_TRANSLATE") != NULL && - strcmp (getenv ("UNSAFE_TO_TRANSLATE"), "yes") == 0) { - putenv ("LANG=C"); - - /* portable way to truly unset with putenv? */ - putenv ("LC_ALL="); - putenv ("LC_MESSAGES="); - putenv ("LC_ALL"); - putenv ("LC_MESSAGES"); - } - -#ifdef __linux__ - putenv ("TERM=linux"); -#endif - - snprintf (VT_NUMBER, sizeof (VT_NUMBER), "VT_NUMBER=%d", vtno); - putenv (VT_NUMBER); - - signal (SIGTERM, SIG_DFL); - signal (SIGINT, SIG_DFL); - signal (SIGHUP, SIG_DFL); - - /* leave current vt */ - if ( -#ifdef ESIX_5_3_2_D - setpgrp() < 0 -#else - setsid() < 0 -#endif - ) { - fprintf(stderr, "open: Unable to set new session (%s)\n", - strerror(errno)); - } - IGNORE_EINTR (close (0)); - IGNORE_EINTR (close (1)); - IGNORE_EINTR (close (2)); - IGNORE_EINTR (close (fd)); - - /* and grab new one */ - fd = open (vtname, O_RDWR); - if (fd < 0) { /* Shouldn't happen */ - _exit (66); /* silently die */ - } - dup(fd); - dup(fd); - - /* - * Can't tell anyone if any of these fail, so throw away - * the return values - */ - (void) ioctl(fd, VT_ACTIVATE, vtno); - /* wait to be really sure we have switched */ - (void) ioctl(fd, VT_WAITACTIVE, vtno); - -#ifdef __linux__ - /* Turn on fonts */ - IGNORE_EINTR (write (0, "\033(K", 3)); -#endif /* __linux__ */ - - execvp (command, &argv[cmd_start]); - - _exit (66); /* failed */ - } - - if (child_pid < 0) { - perror ("gdmopen: fork() error"); - return 66; - } - - do_switchback = TRUE; - - IGNORE_EINTR (waitpid (child_pid, &status, 0)); - child_pid = -1; - - do_switchback = FALSE; - - /* Switch back... */ - (void) ioctl(fd, VT_ACTIVATE, vt.v_active); - /* wait to be really sure we have switched */ - (void) ioctl(fd, VT_WAITACTIVE, vt.v_active); - - IGNORE_EINTR (close (fd)); - - if (WIFEXITED (status)) - return WEXITSTATUS (status); - else - return 66; -} diff --git a/trunk/utils/gdmprefetch.c b/trunk/utils/gdmprefetch.c deleted file mode 100644 index 3e385b7f..00000000 --- a/trunk/utils/gdmprefetch.c +++ /dev/null @@ -1,144 +0,0 @@ -/* GDM - The GNOME Display Manager - * Copyright (C) 2005 Sun Microsystems, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* - * program to either force pages into memory or force them - * out (-o option) - */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/mman.h> -#include <fcntl.h> -#include <sys/stat.h> -#include <unistd.h> -#include <errno.h> -#include <strings.h> - -int out = 0; - -static int -doout(char *s) -{ - int fd; - void *map; - struct stat buf; - - if (((fd = open (s, O_RDONLY)) < 0) || - (fstat (fd, &buf) < 0) || - ((map = mmap (NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == - MAP_FAILED)) { - (void)close(fd); - return (-1); - } - - (void)close (fd); - (void)msync (map, buf.st_size, MS_INVALIDATE); - (void)munmap (map, buf.st_size); - return (0); -} - -#define SIZE 1024*128 - -static int -doin (char *s) -{ - int fd; - char buffer[SIZE]; - - if ((fd = open(s, O_RDONLY)) < 0) { - fprintf (stderr, "fopen: %s %s\n", strerror (errno), s); - return (-1); - } - - while (read (fd, buffer, SIZE) != 0) - ; - - (void)close (fd); - - return (0); -} - -int -main (int argc, char *argv[]) -{ - FILE *fp = 0; - int c, errflg = 0; - extern int optind, optopt; - extern char *optarg; - - while ((c = getopt (argc, argv, "o:")) != -1) { - switch (c) { - - case 'o': - out = 1; - break; - default: - errflg++; - break; - - } - } - - if (errflg) { - fprintf (stderr, "usage: %s [-o] filename [filename]\n", - argv[0]); - exit (1); - } - - - for (; optind < argc; optind++) { - if ((argv[optind][0] == '@') && ((fp = fopen (argv[optind], "r")) == 0)) { - char path[1024]; - - if ((fp = fopen (&(argv[optind][1]), "r")) == 0) { - fprintf (stderr, "fopen: %s %s\n", strerror (errno), &argv[optind][1]); - continue; - } - while (fgets (path, sizeof (path), fp) != 0) { - path[strlen(path) -1] = '\0'; - - if (path[0] == '#') { - continue; - } - - if (!out) { - doin (path); - } else { - doout (path); - } - } - fclose (fp); - fp = 0; - - } else { - if (fp != 0) { - fclose (fp); - fp = 0; - } - - if (!out) { - doin (argv[optind]); - } else { - doout (argv[optind]); - } - } - } - exit (0); -} - diff --git a/trunk/utils/gdmtranslate.c b/trunk/utils/gdmtranslate.c deleted file mode 100644 index 03814919..00000000 --- a/trunk/utils/gdmtranslate.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "config.h" -#include <stdio.h> -#include <locale.h> -#include <string.h> -#include <stdlib.h> - -#define gboolean char -#define FALSE 0 -#define TRUE 1 - -#ifdef ENABLE_NLS -#include <libintl.h> -#define _(String) gettext(String) -#else /* !ENABLE_NLS */ -#define _(String) (String) -#endif - -int -main (int argc, char *argv[]) -{ - char *string; - gboolean is_utf8 = FALSE; - - if (argc == 3 && - strcmp (argv[1], "--utf8") == 0) { - string = argv[2]; - is_utf8 = TRUE; - } else if (argc == 2) { - string = argv[1]; - is_utf8 = FALSE; - } else { - fprintf (stderr, "usage: gdmtranslate [--utf8] <string to translate>\n"); - return 0; - } - - if (getenv ("UNSAFE_TO_TRANSLATE") != NULL && - strcmp (getenv ("UNSAFE_TO_TRANSLATE"), "yes") == 0) { - printf ("%s\n", string); - return 0; - } - - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - if (is_utf8) - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - printf ("%s\n", _(string)); - - return 0; -} |