Although I said I wouldn't summarize, I got
many letters asking me to do so. Since there's
new info beyond the previous summary, here it
is:
Before that: You all who had problems reaching
me, please excuse me. Our mailer here went
mad the day I posted the request, and my
address got messed up. It seems to be working
now.
I got many answers, whith many suggestions, such
as:
- edit xdm and xinit scripts to do that - it only
works at startup, not if a user do that at the
command line (why would he/she do it? well...)
- substitute xterm by a script that gets -C option
out when needed - it works, but it's not very
elegant;
- this is fixed by patch number 100188-02 - probably
the best answer! In stead of fixing xterm only,
it provides a way to avoid anyone to try such a
trick anymore. I haven't got the patch yet, but
I'm trying...
- two answers suggested changes to xterm code to
check if the user already owns the console. It
also disable xterm sessions if the /etc/nologin
file is found. At the end I include one of them
as a context diff, sent by John Hasley <hasle@andy.
bgsu.edu>. I've installed it, and it's working
just fine.
Thanks to:
eric@cc.uq.oz.au (Eric Halil)
hasley@andy.bgsu.edu (John Hasley)
oran@spg.amdahl.com (Oran Davis)
juo@ecto.rutgers.edu (John Oleynick)
ckd@eff.org (Christopher Davis)
rheaton@synaptics.com (Rick Heaton)
--Dorgival
+------------------------------------+-------------------------+
| Dorgival Olavo Guedes Neto | dorgival@dcc.ufmg.br or |
+------------------------------------+-------------------------+
| Systems Analyst - Network Support | dorgival@dccbhz.ufmg.br |
| Dept of Computer Science | FAX: +55(031)443-4352 |
| Federal University of Minas Gerais | PHONE: +55(031)443-4088 |
+------------------------------------+-------------------------+
Here goes the patch I've used:
> Date: Fri, 13 Mar 92 13:03:37 -0500
> From: John Hasley <hasley@andy.bgsu.edu>
> Subject: Re: xterm -C
> OK. Here it is. The changes are pretty straight-forward.
> No guarantees, of course. It's a standard context diff, appliable with patch.
> 1). The part that checks for '/etc/nologin' is within "#ifdef BGSU",
> (which is defined immediately before it, you can just remove the ifdef...endif
> pair, if you prefer.)
> 2). The part that handles 'xterm -C' is within "#ifdef TIOCCONS".
> John Hasley Internet: hasley@bgsu.edu
> University Computer Services UUCP: ...!osu-cis!bgsuvax!hasley
> Bowling Green State University BITNET: hasley@BGSUOPIE
> Bowling Green, OH 43403-0125 MaBell: (419) 372-2102
-----Cut here----
*** main.c Fri Apr 5 09:59:00 1991
--- main.bgsu2.c Fri Apr 5 13:26:10 1991
***************
*** 107,112 ****
--- 107,117 ----
#include <errno.h>
#include <setjmp.h>
+ #ifdef TIOCCONS
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #endif /* TIOCCONS */
+
#ifdef hpux
#include <sys/utsname.h>
#endif /* hpux */
***************
*** 560,565 ****
--- 565,576 ----
int Xsocket, mode;
char *basename();
int xerror(), xioerror();
+ #define BGSU
+ #ifdef BGSU
+ static char nolog[20] = "/etc/nologin";
+ FILE *nlfd_bgsu;
+ char bgsu_c;
+ #endif /* BGSU */
ProgramName = argv[0];
***************
*** 713,724 ****
if(**argv != '-') Syntax (*argv);
switch(argv[0][1]) {
case 'h':
Help ();
/* NOTREACHED */
case 'C':
#ifdef TIOCCONS
! Console = TRUE;
#endif /* TIOCCONS */
continue;
case 'S':
--- 724,746 ----
if(**argv != '-') Syntax (*argv);
switch(argv[0][1]) {
+ #ifdef TIOCCONS
+ static char console_path[20] = "/dev/console";
+ struct stat stat_of_console;
+ #endif /* TIOCCONS */
case 'h':
Help ();
/* NOTREACHED */
case 'C':
#ifdef TIOCCONS
! if (stat(console_path, &stat_of_console))
! perror("error in accessing console");
! else if (getuid() == (int) stat_of_console.st_uid)
! Console = TRUE;
! else {
! fprintf(stderr, "Only use -C from the console\n");
! Console = FALSE;
! }
#endif /* TIOCCONS */
continue;
case 'S':
***************
*** 746,751 ****
--- 768,783 ----
(ButtonPressMask|ButtonReleaseMask),
GrabModeAsync, GrabModeAsync);
+ #ifdef BGSU
+ /* If not super-user, check for logins disabled */
+ if (getuid() != 0 && (nlfd_bgsu = fopen(nolog, "r")) > 0) {
+ while ((bgsu_c = getc(nlfd_bgsu)) != EOF)
+ putchar(bgsu_c);
+ fflush(stdout);
+ sleep(5);
+ exit(0);
+ }
+ #endif /* BGSU */
term = (XtermWidget) XtCreateManagedWidget(
"vt100", xtermWidgetClass, toplevel, NULL, 0);
/* this causes the initialize method to be called */
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:38 CDT