how do you turn off xdm?
a.e.mossberg
aem at mthvax.cs.miami.edu
Tue Nov 14 01:05:31 AEST 1989
Don't try running xdm from inittab! Use instead the xdmshell program
(and create a dummy login 'xdm' to start it up).
( e.g. xdm::35:51:login to start x window:/tmp:/etc/xdmshell )
Don't forget to have your exit xdm key setup in it's configuration file!
(that'll bring you back to a getty login).
Here's the xdmshell program, as a shar file.
(It's also available for anon ftp from mthvax.cs.miami.edu)
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# xdmshell
# This archive created: Mon Nov 13 08:58:49 1989
export PATH; PATH=/bin:$PATH
if test ! -d 'xdmshell'
then
mkdir 'xdmshell'
fi
cd 'xdmshell'
if test -f 'Makefile'
then
echo shar: will not over-write existing file "'Makefile'"
else
cat << \SHAR_EOF > 'Makefile'
all: xdmshell gxdmshell xdmshell.c dm.h
xdmshell: xdmshell.c dm.h
cc xdmshell.c -o xdmshell
gxdmshell: xdmshell.c dm.h
gcc -paged -X22 -X37 -X98 -X99 -X129 -X130 -X140 xdmshell.c -o gxdmshell
SHAR_EOF
fi # end of overwriting check
if test -f 'xdmshell.c'
then
echo shar: will not over-write existing file "'xdmshell.c'"
else
cat << \SHAR_EOF > 'xdmshell.c'
#define macII
/*
* xdmshell - simple program for running xdm from login
*
* Copyright 1988 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Jim Fulton, MIT X Consortium
*
* This program should probably be setuid to root. On the macII, it must be
* run from the console so that getty doesn't get confused about zero-length
* reads.
*
* WARNING: Make sure that you tailor your Xresources file to have a
* way of invoking the abort-display() action. Otherwise, you won't be able
* bring down X when you are finished.
*/
#include <stdio.h>
#include "dm.h"
#include <errno.h>
extern int errno;
extern int sys_nerr;
extern char *sys_errlist[];
#ifdef macII
#define ON_CONSOLE_ONLY
#endif
#ifdef ON_CONSOLE_ONLY
#include <sys/ioctl.h>
#endif
#ifndef BINDIR
#define BINDIR "/usr/bin/X11"
#endif
/*
* HP-UX does have vfork, but A/UX doesn't
*/
#if (defined(SYSV) || defined(macII)) && !defined(hpux)
#define vfork() fork()
#endif
char *ProgramName;
static char *SysErrorMsg (n)
int n;
{
char *s = (n > 0 && n < sys_nerr) ? sys_errlist[n] : "unknown";
return (s ? s : "null system error");
}
static int exec_one_arg (filename, arg)
char *filename;
char *arg;
{
int pid, deadpid;
waitType status;
if (!filename) return -1;
if (filename[0] != '/') {
fprintf (stderr,
"%s: attempt to execute program with relative pathname: %s\n",
ProgramName, filename);
return -1;
}
if (access (filename, X_OK) != 0) return -1;
#ifdef SYSV
status = 0;
#else
waitCode (status) = 0;
#endif
switch (pid = vfork ()) {
case -1: /* error */
return -1;
case 0: /* child */
execl (filename, filename, arg, 0);
_exit (1);
/* NOTREACHED */
default: /* parent */
while (wait (&status) != pid) ;
}
return waitCode (status);
}
main (argc, argv)
int argc;
char *argv[];
{
int ttyfd;
char cmdbuf[256];
#ifdef ON_CONSOLE_ONLY
int consfd;
int ttypgrp, conspgrp;
char *ttyName;
extern char *ttyname();
#endif
ProgramName = argv[0];
if (argc > 1) {
fprintf (stderr, "usage: %s\r\n", ProgramName);
exit (1);
}
ttyfd = open ("/dev/tty", O_RDWR, 0);
if (ttyfd < 3) { /* stdin = 0, stdout = 1, stderr = 2 */
fprintf (stderr,
"%s: must be run directly from the console.\r\n",
ProgramName);
exit (1);
}
#ifdef ON_CONSOLE_ONLY
if (ioctl (ttyfd, TIOCGPGRP, (char *)&ttypgrp) != 0) {
fprintf (stderr, "%s: unable to get process group of /dev/tty\r\n",
ProgramName);
(void) close (ttyfd);
exit (1);
}
#endif
(void) close (ttyfd);
#ifdef ON_CONSOLE_ONLY
ttyName = ttyname (0);
if (!ttyName || strcmp (ttyName, "/dev/console") != 0) {
fprintf (stderr, "%s: must login on /dev/console instead of %s\r\n",
ProgramName, ttyName ? ttyName : "non-terminal device");
exit (1);
}
consfd = open ("/dev/console", O_RDWR, 0);
if (consfd < 3) { /* stdin = 0, stdout = 1, stderr = 2 */
fprintf (stderr, "%s: unable to open /dev/console\r\n",
ProgramName);
exit (1);
}
if (ioctl (consfd, TIOCGPGRP, (char *)&conspgrp) != 0) {
fprintf (stderr,
"%s: unable to get process group of /dev/console\r\n",
ProgramName);
(void) close (consfd);
exit (1);
}
(void) close (consfd);
if (ttypgrp != conspgrp) {
fprintf (stderr, "%s: must be run from /dev/console\r\n",
ProgramName);
exit (1);
}
#endif
/*
* exec /usr/bin/X11/xdm -nodaemon
*/
strcpy (cmdbuf, BINDIR);
strcat (cmdbuf, "/xdm");
if (exec_one_arg (cmdbuf, "-nodaemon -session /usr/tmp/xdm/Xsession") == -1) {
fprintf (stderr, "%s: unable to execute %s (error %d, %s)\r\n",
ProgramName, cmdbuf, errno, SysErrorMsg(errno));
exit (1);
}
#ifdef macII
strcpy (cmdbuf, BINDIR);
strcat (cmdbuf, "/Xrepair");
(void) exec_one_arg (cmdbuf, NULL);
(void) exec_one_arg ("/usr/bin/screenrestore", NULL);
#endif
#ifdef sun
strcpy (cmdbuf, BINDIR);
strcat (cmdbuf, "/kbd_mode");
(void) exec_one_arg (cmdbuf, "-a");
#endif
exit (0);
}
SHAR_EOF
fi # end of overwriting check
if test -f 'dm.h'
then
echo shar: will not over-write existing file "'dm.h'"
else
cat << \SHAR_EOF > 'dm.h'
/*
* xdm - display manager daemon
*
* $XConsortium: dm.h,v 1.9 88/11/17 17:04:53 keith Exp $
*
* Copyright 1988 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* Author: Keith Packard, MIT X Consortium
*/
/*
* dm.h
*
* public interfaces for greet/verify functionality
*/
# include <X11/Xos.h>
# include <sys/param.h> /* for NGROUPS */
#ifdef SYSV
# define waitCode(w) ((w) & 0xff)
# define waitSig(w) (((w) >> 8) & 0xff)
typedef int waitType;
#else
# include <sys/wait.h>
# define waitCode(w) ((w).w_T.w_Retcode)
# define waitSig(w) ((w).w_T.w_Termsig)
typedef union wait waitType;
#endif
#ifdef UDP_SOCKET
#include <sys/types.h>
#include <netinet/in.h>
#endif
# define waitVal(w) (waitSig(w) ? (waitSig(w) * 256 + 1) : waitCode (w))
typedef enum displayStatus { running, notRunning } DisplayStatus;
#ifndef FD_ZERO
typedef struct my_fd_set { int fds_bits[1]; } my_fd_set;
# define FD_ZERO(fdp) bzero ((fdp), sizeof (*(fdp)))
# define FD_SET(f,fdp) ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] |= (1 << ((f) % (sizeof (int) * 8))))
# define FD_CLR(f,fdp) ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] &= ~(1 << ((f) % (sizeof (int) * 8))))
# define FD_ISSET(f,fdp) ((fdp)->fds_bits[(f) / (sizeof (int) * 8)] & (1 << ((f) % (sizeof (int) * 8))))
# define FD_TYPE my_fd_set
#else
# define FD_TYPE fd_set
#endif
/*
* local - server runs on local host
* foreign - server runs on remote host
* permanent - session restarted when it exits
* transient - session not restarted when it exits
* secure - cannot be disabled
* insecure - can be disabled
*/
typedef struct displayType {
unsigned int location:1;
unsigned int lifetime:1;
unsigned int mutable:1;
} DisplayType;
# define Local 1
# define Foreign 0
# define Permanent 1
# define Transient 0
# define Secure 1
# define Insecure 0
extern DisplayType parseDisplayType ();
typedef enum fileState { NewEntry, OldEntry, MissingEntry } FileState;
struct display {
struct display *next;
char *name; /* DISPLAY name */
char **argv; /* program name and arguments */
DisplayStatus status; /* current status */
int pid; /* process id of child */
FileState state; /* state during HUP processing */
char *resources; /* resource file */
char *xrdb; /* xrdb program */
char *cpp; /* cpp program */
char *startup; /* Xstartup program */
char *reset; /* Xreset program */
char *session; /* Xsession program */
char *userPath; /* path set for session */
char *systemPath; /* path set for startup/reset */
char *systemShell; /* interpreter for startup/reset */
char *failsafeClient;/* a client to start when the session fails */
int openDelay; /* open delay time */
int openRepeat; /* open attempts to make */
int openTimeout; /* abort open attempt timeout */
int terminateServer;/* restart for each session */
int grabTimeout; /* time to wait for grab */
DisplayType displayType; /* method to handle with */
#ifdef UDP_SOCKET
struct sockaddr_in addr; /* address used in connection */
#endif
};
struct greet_info {
char *name; /* user name */
char *password; /* user password */
char *string; /* random string */
};
struct verify_info {
int uid; /* user id */
#ifdef NGROUPS
int groups[NGROUPS];/* group list */
int ngroups; /* number of elements in groups */
#else
int gid; /* group id */
#endif
char **argv; /* arguments to session */
char **userEnviron; /* environment for session */
char **systemEnviron;/* environment for startup/reset */
};
/* session exit status definitions. */
# define OBEYTERM_DISPLAY 0 /* obey terminateServer resource */
# define RESTART_DISPLAY 1 /* force session restart */
# define ABORT_DISPLAY 2 /* force server restart */
# define DISABLE_DISPLAY 3 /* unmanage this display */
/* display manager exit status definitions */
# define OBEYSESS_DISPLAY 0 /* obey multipleSessions resource */
# define REMANAGE_DISPLAY 1 /* force remanage */
# define UNMANAGE_DISPLAY 2 /* force deletion */
extern char *servers;
extern int request_port;
extern int debugLevel;
extern char *errorLogFile;
extern int daemonMode;
extern char *pidFile;
extern struct display *FindDisplayByName (),
*FindDisplayByPid (),
*NewDisplay ();
extern char *malloc (), *realloc (), *strcpy ();
#ifdef UDP_SOCKET
# define START "START"
# define TERMINATE "TERMINATE"
# define RESTART "RESTART"
# define POLL_PROVIDERS "POLL"
# define ADVERTISE "ADVERTISE"
#endif
SHAR_EOF
fi # end of overwriting check
cd ..
# End of shell archive
exit 0
--
a.e.mossberg / aem at mthvax.cs.miami.edu / aem at umiami.BITNET / Pahayokee Bioregion
So I guess in a way they are counter revolutionary, and
God bless them for being that way. And I guess that makes
them contras, and so it makes me a contra too. - Ronald Reagan
More information about the Comp.unix.aux
mailing list