home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2728 < prev    next >
Internet Message Format  |  1991-02-09  |  3KB

  1. From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein)
  2. Newsgroups: alt.sources
  3. Subject: Unofficial patches to sendmail for RFC 931 support
  4. Message-ID: <28897:Feb809:32:5491@kramden.acf.nyu.edu>
  5. Date: 8 Feb 91 09:32:54 GMT
  6.  
  7. These are unofficial patches to sendmail 5.65 to stop forgeries. After
  8. you apply these patches and reinstall sendmail, you can use $F in
  9. sendmail.cf for the real user name as determined by RFC 931 (or
  10. ``unauthenticated'' in case the sending host doesn't support RFC 931).
  11. I recommend changing the second line of HReceived from
  12.  
  13.     id $i; $b
  14. to
  15.     id $i; $b, auth $F
  16.  
  17. These patches should work on sendmail 5.65 (on ucbarpa), sendmail 5.61
  18. (as on gatekeeper), and possibly earlier versions. You must have the
  19. authuser library, part of the authd package posted here recently. Make
  20. sure to add -lauthuser to sendmail's Makefile.
  21.  
  22. ---Dan
  23.  
  24. *** sendmail.h.old    Thu Nov 17 13:35:08 1988
  25. --- sendmail.h    Thu Feb  7 05:59:32 1991
  26. ***************
  27. *** 521,526 ****
  28. --- 521,527 ----
  29.   EXTERN char    *SmtpPhase;    /* current phase in SMTP processing */
  30.   EXTERN char    *MyHostName;    /* name of this host for SMTP messages */
  31.   EXTERN char    *RealHostName;    /* name of host we are talking to */
  32. + EXTERN char *RealUser; /* name of user we're talking to, given by RFC 931 */
  33.   EXTERN struct    sockaddr_in RealHostAddr;/* address of host we are talking to */
  34.   EXTERN char    *CurHostName;    /* current host we are dealing with */
  35.   EXTERN jmp_buf    TopFrame;    /* branch-to-top-of-loop-on-error frame */
  36. *** srvrsmtp.c.old    Thu Jan 19 18:03:48 1989
  37. --- srvrsmtp.c    Thu Feb  7 06:07:20 1991
  38. ***************
  39. *** 240,245 ****
  40. --- 240,249 ----
  41.                   break;
  42.               define('s', sendinghost, CurEnv);
  43.               define('r', "SMTP", CurEnv);
  44. +             /* RFC 931 sender name---2/7/91 DJB */
  45. +             if (RealUser)
  46. +               define('F', RealUser, CurEnv);
  47.               initsys();
  48.               setproctitle("%s %s: %s", CurEnv->e_id,
  49.                   CurHostName, inp);
  50. *** daemon.c.old    Thu Jan 19 18:56:33 1989
  51. --- daemon.c    Thu Feb  7 06:04:49 1991
  52. ***************
  53. *** 34,39 ****
  54. --- 34,41 ----
  55.   # include <sys/wait.h>
  56.   # include <sys/time.h>
  57.   # include <sys/resource.h>
  58. + extern int auth_fd();
  59. + extern char *auth_tcpuser();
  60.   
  61.   /*
  62.   **  DAEMON.C -- routines to use when running as a daemon.
  63. ***************
  64. *** 94,99 ****
  65. --- 96,105 ----
  66.       register struct servent *sp;
  67.       int on = 1;
  68.       extern reapchild();
  69. +     unsigned long in;
  70. +     unsigned short local;
  71. +     unsigned short remote;
  72. +     char *user;
  73.   
  74.       /*
  75.       **  Set up the address for the mailer.
  76. ***************
  77. *** 211,216 ****
  78. --- 217,223 ----
  79.               **    Collect verified idea of sending host.
  80.               **    Verify calling user id if possible here.
  81.               */
  82. +             /* You got it. ---DJB, 2/7/91 */
  83.   
  84.               (void) signal(SIGCHLD, SIG_DFL);
  85.   
  86. ***************
  87. *** 230,235 ****
  88. --- 237,255 ----
  89.               /* should we check for illegal connection here? XXX */
  90.   
  91.               RealHostName = newstr(buf);
  92. +             /* RFC 931 support added 2/7/91 by DJB */
  93. +             /* We could just use auth_xline but we don't */
  94. +             /* know the supposed username yet. */
  95. +             if (auth_fd(t,&in,&local,&remote) == -1)
  96. +               user = "unauthenticated"; /* no point in worrying */
  97. +             else
  98. +              {
  99. +               user = auth_tcpuser(in,local,remote);
  100. +               if (!user)
  101. +                 user = "unauthenticated";
  102. +              }
  103. +             RealUser = newstr(user);
  104.   
  105.               (void) close(DaemonSocket);
  106.               InChannel = fdopen(t, "r");
  107.