home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / agetty / patch01 next >
Internet Message Format  |  1994-06-08  |  3KB

  1. From: wietse@wzv.win.tue.nl (Wietse Venema)
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i008:  agetty - simple flexible login front end, Patch01
  4. Date: 8 Jun 1994 12:10:39 -0500
  5. Organization: Eindhoven University of Technology, The Netherlands
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2t4u2f$o1h@sparky.sterling.com>
  9. X-Md4-Signature: b0ff7e48488c72883eda9cd67629d756
  10.  
  11. Submitted-by: wietse@wzv.win.tue.nl (Wietse Venema)
  12. Posting-number: Volume 43, Issue 8
  13. Archive-name: agetty/patch01
  14. Environment: System V.[24], SunOS 4, termio.
  15. Patch-To: agetty: Volume 39, Issue 46
  16.  
  17. Agetty is a login front end for non-network logins that I wrote about
  18. six years ago, and that has served me well through several generations
  19. of hardware and software, from the days of System V.2, SunOS 4 up to
  20. Solaris 2.x.
  21.  
  22. Well, today Janusz Harkot reported a loophole that probably affects all
  23. systems where the login program accepts command-line options, i.e.  any
  24. UNIX (or clone) later than System V.2 or BSD 4.1.
  25.  
  26. Below is a source-code patch. A fully-patched version of the source and
  27. docs can be found on ftp.win.tue.nl in /pub/unix/agetty.shar.Z.
  28.  
  29.     Wietse
  30.  
  31. *** README-    Fri Aug 20 22:20:28 1993
  32. --- README    Thu May 12 09:30:04 1994
  33. ***************
  34. *** 1,4 ****
  35. ! @(#) README 1.9 8/20/93 22:20:26
  36.   
  37.   Traditionally, getty is the program that listens on terminal and modem
  38.   ports and that prompts for a login name.  Agetty is an alternative for
  39. --- 1,6 ----
  40. ! @(#) README 1.10 5/12/94 09:30:00
  41. ! [This version closes a loophole with usernames that begin with '-'].
  42.   
  43.   Traditionally, getty is the program that listens on terminal and modem
  44.   ports and that prompts for a login name.  Agetty is an alternative for
  45. *** agetty.c-    Sun Aug 22 13:57:19 1993
  46. --- agetty.c    Thu May 12 09:27:06 1994
  47. ***************
  48. *** 176,188 ****
  49.   /* CREATION DATE
  50.   /*    Sat Nov 25 22:51:05 MET 1989
  51.   /* LAST MODIFICATION
  52. ! /*    93/08/22 13:57:02
  53.   /* VERSION/RELEASE
  54. ! /*    1.30
  55.   /*--*/
  56.   
  57.   #ifndef    lint
  58. ! char sccsid[] = "@(#) agetty.c 1.30 22 Aug 1993 13:57:02";
  59.   #endif
  60.   
  61.   #include <termio.h>
  62. --- 176,188 ----
  63.   /* CREATION DATE
  64.   /*    Sat Nov 25 22:51:05 MET 1989
  65.   /* LAST MODIFICATION
  66. ! /*    94/05/12 09:27:01
  67.   /* VERSION/RELEASE
  68. ! /*    1.31
  69.   /*--*/
  70.   
  71.   #ifndef    lint
  72. ! char sccsid[] = "@(#) agetty.c 1.31 5/12/94 09:27:01";
  73.   #endif
  74.   
  75.   #include <termio.h>
  76. ***************
  77. *** 841,846 ****
  78. --- 841,851 ----
  79.           }
  80.           break;
  81.           }
  82. +     }
  83. +     if (*logname == '-') {
  84. +         static char text[] = "\r\nlogin names may not begin with '-'.\r\n";
  85. +         write(2, text, sizeof(text) - 1);
  86. +         *logname = 0;
  87.       }
  88.       }
  89.       /* Handle names with upper case and no lower case. */
  90.  
  91. exit 0 # Just in case...
  92.