home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1283 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  3.1 KB

  1. From: eps@toaster.SFSU.EDU (Eric P. Scott)
  2. Newsgroups: alt.sources
  3. Subject: [next] Re: Interpretation of carriage returns
  4. Message-ID: <11957@stag.math.lsa.umich.edu>
  5. Date: 8 May 90 22:05:54 GMT
  6.  
  7. Archive-name: unregistered/08-May-90
  8. Original-posting-by: eps@toaster.SFSU.EDU (Eric P. Scott)
  9. Original-subject: Re: Interpretation of carriage returns
  10. Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)
  11.  
  12. [This is an experimental alt.sources re-posting from the newsgroup(s)
  13. comp.sys.next. Comments on this service to emv@math.lsa.umich.edu 
  14. (Edward Vielmetti).]
  15.  
  16.  
  17. In article <90128.025215CMH117@psuvm.psu.edu> CMH117@psuvm.psu.edu
  18.     (Charles Hannum) writes:
  19. >If I log on the console of the NeXT and load a Terminal or Shell, carriage
  20. >returns seem to be interpreted as :M.  But if I log in remotely, they are
  21. >interpreted as :J, which breaks nice things like tn3270.
  22. >
  23. >Could someone please tell me why?
  24.  
  25. This is a BUG in telnetd.  This is a BUG in the original 4.3 BSD
  26. telnetd that Berkeley fixed long ago.
  27.  
  28. There are two replacements: one is the telnetd from the 4.3-tahoe
  29. distribution.  It corrects this problem (and a few others), but
  30. still dates from Berkeley's Lousy Code Era (i.e. you have to
  31. compile with -fwritable-strings etc.).  The 90.03.01 is the new
  32. "clean" version, which fixes some grave omissions, and adds some
  33. really nifty functionality.  It also comes with source patches to
  34. the kernel.  A lot of good that does me.  :-(
  35.  
  36. I can only hope that NeXT looks kindly on its Internet customers
  37. in the future and bundles the kernel support necessary for
  38. traceroute, SLIP, RARP, linemode...  Their competitors WILL (if
  39. they don't already).
  40.  
  41.                     -=EPS=-
  42. P.S. Having sources to things like telnetd and ftpd is essential
  43. if you want to add local security hacks, e.g.
  44.  
  45. /*
  46.  * Copyright 1990 by Eric P. Scott <eps@cs.sfsu.edu>
  47.  * Redistribution permitted as long as this notice is retained.
  48.  */
  49. void unregistered(f, srca)    /* call if gethostbyaddr() fails */
  50. int f;
  51. struct in_addr srca;
  52. {
  53.     char *index();
  54.     extern char *sys_errlist[];
  55.     struct arpreq ar;
  56.     char buf[BUFSIZ];
  57.  
  58.     bzero((char *)&ar, sizeof ar);
  59.     ar.arp_pa.sa_family=AF_INET;
  60.     ((struct sockaddr_in *)&ar.arp_pa)->sin_addr.s_addr=srca.s_addr;
  61.     if (ioctl(f, SIOCGARP, (caddr_t)&ar)<0) {
  62.         if (errno==ENXIO)
  63.             (void)sprintf(buf, "Access denied to %s\r\n\
  64. Get your Zone Administrator to fix your nameservers.\r\n",
  65.             inet_ntoa(srca));
  66.         else (void)sprintf(buf, "telnetd: %s SIOCGARP error: %s\r\n",
  67.             inet_ntoa(srca), sys_errlist[errno]);
  68.     }
  69.     else {
  70.         if ((ar.arp_flags&ATF_COM)==0)    /* should never happen */
  71.             (void)sprintf(buf, "telnetd: %s (not complete)\r\n",
  72.             inet_ntoa(srca));
  73.         else (void)sprintf(buf,    /* unauthorized Ethernet tap */
  74.             "Access denied to %s at %02X:%02X:%02X:%02X:%02X:%02X\
  75. \r\nPlease contact contact campus Network Support for assistance.\r\n",
  76.             inet_ntoa(srca),
  77.             ar.arp_ha.sa_data[0]&255,
  78.             ar.arp_ha.sa_data[1]&255,
  79.             ar.arp_ha.sa_data[2]&255,
  80.             ar.arp_ha.sa_data[3]&255,
  81.             ar.arp_ha.sa_data[4]&255,
  82.             ar.arp_ha.sa_data[5]&255);
  83.     }
  84.     (void)write(f, buf, strlen(buf));
  85.     if (buf[0]!='A') return;
  86.     *index(buf, '\r')='\0';
  87.     syslog(LOG_NOTICE, "%s\n", buf);    /* if syslogd worked */
  88.     sleep(5);
  89.     exit(1);
  90. }
  91.