a pathologially selective listserv that needs to be replaced
brought to my attention the fact that my MUA has been inserting
a 
 Sender: david
line in the headers of my messages, out of accordance with rfc 850
which apparently specifies that the host-name is supposed to go there.

Rather than change MUA, I have modified qmail-smtpd.c to add
  @remotehost
to incomplete sender lines it might receive.
Here's what I did:

***************
*** 345,350 ****
--- 348,380 ----
    qmail_put(&qqt,ch,1);
  }
  
+ void TweakSendera(pch)
+ char *pch;
+ {       /* add @host to sender header if not provided */
+    char *qch;
+ 
+       qch = "(ABBAZA)";
+       while (*qch){ qmail_put(&qqt,qch++,1); }
+ 
+ 
+ }
+ void TweakSender(pch)
+ char *pch;
+ {       /* add @host to sender header if not provided */
+    char ch;
+    char *qch;
+ 
+    for(ch = *pch; ch != '\r' ;substdio_get(&ssin,&ch,1)){
+     if (ch == '@') {*pch = ch; return; }/* no tweaking required */
+     put(&ch);
+    } /* finishing the loop means \r was encountered before @ */
+     *pch = ch;
+     qmail_put(&qqt,"@",1);
+     qch = remotehost;
+     while (*qch){ qmail_put(&qqt,qch++,1); }
+ }
+ 
+ 
  void blast(hops)
  int *hops;
  {
***************
*** 355,361 ****
    int flagmaybex; /* 1 if this line might match RECEIVED, if fih */
    int flagmaybey; /* 1 if this line might match \r\n, if fih */
    int flagmaybez; /* 1 if this line might match DELIVERED, if fih */
!  
    state = 1;
    *hops = 0;
    flaginheader = 1;
--- 385,392 ----
    int flagmaybex; /* 1 if this line might match RECEIVED, if fih */
    int flagmaybey; /* 1 if this line might match \r\n, if fih */
    int flagmaybez; /* 1 if this line might match DELIVERED, if fih */
!   int flagmaybes; /* 1 if this line might match SENDER, if fih */
! 
    state = 1;
    *hops = 0;
    flaginheader = 1;
***************
*** 369,379 ****
          if (pos < 8)
            if (ch != "received"[pos]) if (ch != "RECEIVED"[pos]) flagmaybex = 0;
          if (flagmaybex) if (pos == 7) ++*hops;
          if (pos < 2) if (ch != "\r\n"[pos]) flagmaybey = 0;
          if (flagmaybey) if (pos == 1) flaginheader = 0;
        }
        ++pos;
!       if (ch == '\n') { pos = 0; flagmaybex = flagmaybey = flagmaybez = 1; }
      }
      switch(state) {
        case 0:
--- 400,413 ----
          if (pos < 8)
            if (ch != "received"[pos]) if (ch != "RECEIVED"[pos]) flagmaybex = 0;
          if (flagmaybex) if (pos == 7) ++*hops;
+         if (pos < 6)
+           if (ch != "sender"[pos]) if (ch != "SENDER"[pos]) flagmaybes = 0;
+         if (flagmaybes) if (pos == 6) TweakSender(&ch);
          if (pos < 2) if (ch != "\r\n"[pos]) flagmaybey = 0;
          if (flagmaybey) if (pos == 1) flaginheader = 0;
        }
        ++pos;
!       if (ch == '\n') { pos = 0; flagmaybes = flagmaybex = flagmaybey = flagmaybez = 
1; }
      }
      switch(state) {
        case 0:


-- 
                           David Nicol 816.235.1187 [EMAIL PROTECTED]

Reply via email to