diff options
author | keith <empty> | 1988-10-20 17:37:02 +0000 |
---|---|---|
committer | keith <empty> | 1988-10-20 17:37:02 +0000 |
commit | 40f5e95a31b69f355fd68c72e05960885d6a95be (patch) | |
tree | 7b720730648360dd5981455c857b04809bc3e79f /xc | |
parent | 1acb170c0449e1701be3d2b009330e96eb495023 (diff) |
added real session arguments
Diffstat (limited to 'xc')
-rw-r--r-- | xc/programs/xdm/greeter/greet.c | 25 | ||||
-rw-r--r-- | xc/programs/xdm/resource.c | 21 | ||||
-rw-r--r-- | xc/programs/xdm/session.c | 69 |
3 files changed, 89 insertions, 26 deletions
diff --git a/xc/programs/xdm/greeter/greet.c b/xc/programs/xdm/greeter/greet.c index cf211afbb..bd6c2e3b7 100644 --- a/xc/programs/xdm/greeter/greet.c +++ b/xc/programs/xdm/greeter/greet.c @@ -1,7 +1,7 @@ /* * xdm - display manager daemon * - * $XConsortium: $ + * $XConsortium: greet.c,v 1.5 88/10/15 19:10:59 keith Exp $ * * Copyright 1988 Massachusetts Institute of Technology * @@ -30,6 +30,7 @@ # include "Login.h" # include <X11/Shell.h> # include <X11/Command.h> +# include <X11/Logo.h> # include "dm.h" extern Display *dpy; @@ -38,7 +39,8 @@ static int done; static char name[128], password[128]; static Widget toplevel; static Widget login; -static Widget loginFailedButton; +static Widget logoToplevel; +static Widget logo; GreetDone (w, data, status) Widget w; @@ -81,9 +83,19 @@ struct display *d; i = 0; XtSetArg (arglist[i], XtNnotifyDone, GreetDone); i++; - login = XtCreateManagedWidget ("login", loginWidgetClass, - toplevel, arglist, i); + login = XtCreateManagedWidget ("login", loginWidgetClass, toplevel, + arglist, i); XtRealizeWidget (toplevel); +#ifdef DRAWLOGO + i = 0; + XtSetArg (arglist[i], XtNgeometry, "100x100-0-0"); i++; + logoToplevel = XtCreateApplicationShell (0, topLevelShellWidgetClass, + arglist, i); + i = 0; + logo = XtCreateManagedWidget ("logo", logoWidgetClass, logoToplevel, + arglist, i); + XtRealizeWidget (logoToplevel); +#endif } CloseGreet (d) @@ -97,6 +109,7 @@ struct display *d; struct greet_info *greet; { XEvent event; + Arg args[1]; Debug ("dispatching\n"); done = 0; @@ -107,7 +120,9 @@ struct greet_info *greet; XFlush (XtDisplay (toplevel)); greet->name = name; greet->password = password; - greet->string = 0; + XtSetArg (args[0], XtNsessionArgument, (char *) &(greet->string)); + XtGetValues (login, args, 1); + Debug ("sessionArgument: %s\n", greet->string ? greet->string : "<NULL>"); } diff --git a/xc/programs/xdm/resource.c b/xc/programs/xdm/resource.c index a38ed194f..008e52756 100644 --- a/xc/programs/xdm/resource.c +++ b/xc/programs/xdm/resource.c @@ -1,7 +1,7 @@ /* * xdm - display manager daemon * - * $XConsortium: resource.c,v 1.4 88/09/23 14:21:29 keith Exp $ + * $XConsortium: resource.c,v 1.5 88/10/15 19:12:30 keith Exp $ * * Copyright 1988 Massachusetts Institute of Technology * @@ -26,10 +26,13 @@ # include <X11/Xlib.h> # include <X11/Xresource.h> +/* XtOffset() hack for ibmrt BandAidCompiler */ + char *servers; int request_port; int debugLevel; char *errorLogFile; +int daemonMode; # define DM_STRING 0 # define DM_INT 1 @@ -49,6 +52,8 @@ struct dmResources { "0", "errorLogFile", "ErrorLogFile", DM_STRING, &errorLogFile, "", +"daemonMode", "DaemonMode", DM_BOOL, (char **) &daemonMode, + "true" }; # define NUM_DM_RESOURCES (sizeof DmResources / sizeof DmResources[0]) @@ -77,8 +82,14 @@ struct displayResources { "5", "terminateServer","TerminateServer",DM_BOOL, boffset(terminateServer), "false", -"unixPath", "UnixPath", DM_STRING, boffset(unixPath), - ":/bin:/usr/bin:/usr/bin/X11:/usr/ucb" +"userPath", "Path", DM_STRING, boffset(userPath), + ":/bin:/usr/bin:/usr/bin/X11:/usr/ucb", +"systemPath", "Path", DM_STRING, boffset(systemPath), + "/etc:/bin:/usr/bin:/usr/bin/X11:/usr/ucb", +"systemShell", "Shell", DM_STRING, boffset(systemShell), + "/bin/sh", +"failsafeClient","FailsafeClient", DM_STRING, boffset(failsafeClient), + "/usr/bin/X11/xterm", }; # define NUM_DISPLAY_RESOURCES (sizeof DisplayResources/\ @@ -142,6 +153,8 @@ XrmOptionDescRec optionTable [] = { {"-debug", "*debugLevel", XrmoptionSepArg, (caddr_t) NULL }, {"-config", NULL, XrmoptionSkipArg, (caddr_t) NULL }, {"-xrm", NULL, XrmoptionResArg, (caddr_t) NULL }, +{"-daemon", ".daemonMode", XrmoptionNoArg, "true" }, +{"-nodaemon", ".daemonMode", XrmoptionNoArg, "false" }, }; #ifndef DEFAULT_XDM_CONFIG @@ -167,7 +180,7 @@ char **argv; } if (!config) { config = DEFAULT_XDM_CONFIG; - if (access (config, 1) == -1) + if (access (config, 4) == -1) config = 0; } if (config) { diff --git a/xc/programs/xdm/session.c b/xc/programs/xdm/session.c index 833339edd..b3388599b 100644 --- a/xc/programs/xdm/session.c +++ b/xc/programs/xdm/session.c @@ -1,7 +1,7 @@ /* * xdm - display manager daemon * - * $XConsortium: session.c,v 1.4 88/09/23 14:21:31 keith Exp $ + * $XConsortium: session.c,v 1.5 88/10/15 19:12:57 keith Exp $ * * Copyright 1988 Massachusetts Institute of Technology * @@ -38,7 +38,6 @@ struct display *d; /* * Step 5: Load system default Resources */ - Debug ("ManageSession %s\n", d->name); LoadXloginResources (d); InitGreet (d); for (;;) { @@ -60,13 +59,12 @@ struct display *d; * Step 8: Run system-wide initialization file * /etc/Xstartup */ - source (d->startup); + source (&verify, d->startup); /* * Step 9: Start the clients, changing uid/groups * setting up environment and running /etc/Xsession */ - Debug ("Startup sourced\n"); - if (StartClient (&verify, &clientPid)) { + if (StartClient (&verify, d, &clientPid)) { Debug ("Client Started\n"); /* * Step 13: Wait for session to end, @@ -82,7 +80,7 @@ struct display *d; /* * Step 15: run /etc/Xreset */ - source (d->reset); + source (&verify, d->reset); exit (OBEYTERM_DISPLAY); } @@ -99,52 +97,89 @@ struct display *d; } } -StartClient (verify, pidp) +StartClient (verify, d, pidp) struct verify_info *verify; +struct display *d; int *pidp; { char **f, *home, *getEnv (); + char *failsafeArgv[2]; int pid; Debug ("StartSession %s: ", verify->argv[0]); for (f = verify->argv; *f; f++) Debug ("%s ", *f); Debug ("; "); - for (f = verify->environ; *f; f++) + for (f = verify->userEnviron; *f; f++) Debug ("%s ", *f); Debug ("\n"); switch (pid = fork ()) { case 0: + CloseOnFork (); setpgrp (0, getpid ()); #ifdef NGROUPS + setgroups (verify->ngroups, verify->groups); setgid (verify->groups[0]); #else setgid (verify->gid); #endif setuid (verify->uid); - home = getEnv (verify->environ, "HOME"); + home = getEnv (verify->userEnviron, "HOME"); if (home) - if (chdir (home) == -1) + if (chdir (home) == -1) { + LogError ("No home directory %s for user %s, using /\n", + home, getEnv (verify->userEnviron, "USER")); chdir ("/"); - execve (verify->argv[0], verify->argv, verify->environ); + } + Debug ("executing session %s\n", verify->argv[0]); + execve (verify->argv[0], verify->argv, verify->userEnviron); + LogError ("Session execution failed %s\n", verify->argv[0]); Debug ("exec failed\n"); + failsafeArgv[0] = d->failsafeClient; + failsafeArgv[1] = 0; + execve (failsafeArgv[0], failsafeArgv, verify->userEnviron); exit (1); case -1: - Debug ("StartSession failed\n"); + Debug ("StartSession, fork failed\n"); return 0; default: - Debug ("StartSession suceeded\n"); + Debug ("StartSession, fork suceeded %d\n", pid); *pidp = pid; return 1; } } -source (file) -char *file; +source (verify, file) +struct verify_info *verify; +char *file; { + char *args[4]; + int pid, wpid; + extern int errno; + + Debug ("source %s\n", file); if (file[0] && access (file, 1) == 0) { - Debug ("source %s\n", file); - system (file); + switch (pid = fork ()) { + case 0: + CloseOnFork (); + setpgrp (0, getpid ()); + if (!(args[0] = getEnv (verify->systemEnviron, "SHELL"))) + args[0] = "/bin/sh"; + args[1] = "-c"; + args[2] = file; + args[3] = 0; + Debug ("interpreting %s with %s\n", args[2], args[0]); + execve (args[0], args, verify->systemEnviron); + LogError ("can't execute system shell %s\n", args[0]); + exit (1); + case -1: + Debug ("fork failed\n"); + break; + default: + while ((wpid = wait ((waitType *) 0)) != pid) + ; + break; + } } } |