Subject: pine and "userdb" in sendmail 8.6.12

From: Otmar Stahl <[email-masked]>
Date: Mon, 5 Jun 1995 14:14:52 +0200

Hi,

I recently set up sendmail 8.6.12 on HP-UX. My idea was to use the
"userdb" feature to replace my unix login name with first_name.last_name
for outgoing mail using the "mailname" entry in the sendmail user data
base. This in fact works with mailx and elm, but unfortunately not with
pine, my favourite mailer. In outgoing mail, the unix login name takes
preference over the entry in the user data base, although pine is set up
to use sendmail. Since elm uses the sendmail user data base, it looks like
a set-up problem with pine. 

Any hints?

With kind regards, 
Otmar Stahl
_______________________________________________________________________________
Otmar Stahl			e-mail: [email-masked]
Landessternwarte Koenigstuhl    Tel.: 	+49 6221 509 231
69117 Heidelberg		URL: http://www.lsw.uni-heidelberg.de/~ostahl/

---

From: [email-masked] (Phillip Vandry)
Date: 5 Jun 1995 18:27:54 -0400

>a set-up problem with pine. 

It's because PINE generates a From: header while the other MUA's don't.
This is exactly why I think it shouldn't. That's why I used the following
patches to prevent it from doing so. It's not a perfect solution, but
it suited our needs very well.

Users can still change the from address if ALLOW_CHANGING_FROM is defined,
but it cannot be done through the personal-name field.

Note that modifications were made to osdep/os-sv4.c. You'll have to instead
make them to whatever osdep/*.c is apropriate for you.

--- 1.1	1994/11/24 02:44:24
+++ osdep/os-sv4.c	1995/05/30 19:45:32
@@ -1708,7 +1710,6 @@
   Fork off mailer process and pipe the message into it
   Called to post news via Inews when NNTP is unavailable
   
-BUG, this needs to be filled in 
    ----*/
 char *
 post_handoff(header, body, errbuf)
@@ -1716,8 +1717,62 @@
      BODY    *body;
     char     *errbuf;
 {
-    sprintf(errbuf, "Can't post, NNTP-server must be defined!");
-    return(errbuf);
+    char    news_cmd[MAXPATH+1];
+    char   *tmpfile;
+    PIPE_S *syspipe;
+
+    dprint(1, (debugfile, "=== calling inews ===\n"));
+    *errbuf = '\0';
+
+/*
+    if(!header->env->to && !header->env->cc && !header->env->bcc)
+      return(NULL);	*/	/* nobody to send to, fail silently */
+
+    if(can_access(INEWS, EXECUTE_ACCESS) != 0){
+      sprintf(errbuf, "Mail Transport Agent %s %s",
+          INEWS,
+          (can_access(INEWS, ACCESS_EXISTS) != 0)
+            ? "doesn't exist"
+            : "isn't executable");
+      return(errbuf);
+    }
+
+    if((tmpfile = temp_nam(NULL, "pinepost"))
+       && append_message2(tmpfile, header, body) >= 0){
+
+	sprintf(news_cmd, "( ( %s %s ; /bin/rm -f %s ) < %s & )",
+		INEWS, INEWSFLAGS, tmpfile, tmpfile);
+
+	dprint(6, (debugfile, "Send command \"%s\"\n", news_cmd));
+
+	if(syspipe = open_system_pipe(news_cmd, NULL, PIPE_SYS|PIPE_PROT)){
+	    close_system_pipe(&syspipe, PIPE_SYS|PIPE_PROT);
+	}
+	else
+	  sprintf(errbuf, "Internal error: %s", error_description(errno));
+    }
+    else
+      sprintf(errbuf, "Can't write temp file for sending: %s",
+	      error_description(errno));
+
+    if(!*errbuf){
+	dprint(1, (debugfile, "Post SUCCESSFUL.\nTo: %s@%s\n",
+		   (header->env->to && header->env->to->mailbox)
+		     ? header->env->to->mailbox : "NULL",
+		   (header->env->to && header->env->to->host)
+	             ? header->env->to->host : "NULL"));
+	dprint(1, (debugfile, "Subject: %s\nMessage ID: %s\n\n",
+		   header->env->subject ? header->env->subject : "NULL",
+		   header->env->message_id ? header->env->message_id:"NULL"));
+    }
+    else
+      dprint(1,(debugfile, "** POST FAILED **\n\terror: %s\n\ttmpfile: %s\n\n",
+		errbuf, tmpfile ? tmpfile : "<NULL FILENAME>"));
+
+    if(tmpfile)
+      fs_give((void **)&tmpfile);
+
+    return(*errbuf ? errbuf : NULL);
 }
 
 /* ----------------------------------------------------------------------
--- 1.1	1994/11/22 03:43:54
+++ osdep/os-sv4.h	1995/05/31 15:40:43
@@ -282,10 +282,14 @@
 					   mail back errors, and
 					   get recipients from To, cc,
 					   and bcc header lines.      */
+
+/*----- The usual inews configuration for sending news on Unix ---------*/
+#define INEWS		"/local/lib/news/bin/inews"
+#define INEWSFLAGS	"-h"

 /*--------- Program employed by users to change their password ---------*/
--- 1.1	1995/05/11 05:39:08
+++ send.c	1995/06/01 17:52:31
@@ -1571,8 +1571,10 @@
 		set_default_hdrval(pf);
 	    }
 
+#if 0
 	    if(!outgoing->return_path)
 	      outgoing->return_path = rfc822_cpy_adr(outgoing->from);
+#endif
 
 	    if(pf->text)		/* free default value in any case */
 	      fs_give((void **)&pf->text);
@@ -3649,7 +3652,7 @@
 
     if(!pine_header_line(tmp,"Newsgroups",header,header->env->newsgroups,f,s)
        || !pine_header_line(tmp,"Date",header,header->env->date,f,s)
-       || !pine_address_line(tmp,"From",header,header->env->from,f,s)
+/*       || !pine_address_line(tmp,"From",header,header->env->from,f,s) */
 #if	!defined(DOS) || defined(NOAUTH)	/* add it below */
        || !pine_address_line(tmp,"X-Sender",header,header->env->sender,f,s)
 #endif
@@ -4088,8 +4093,13 @@
 
     dprint(4, (debugfile, "Posting: [%s]\n", header->env->newsgroups));
 
+#if 0
     if(ps_global->VAR_NNTP_SERVER && ps_global->VAR_NNTP_SERVER[0]
-       && ps_global->VAR_NNTP_SERVER[0][0]){
+       && ps_global->VAR_NNTP_SERVER[0][0])
+#else
+    if(0)
+#endif
+	{
        /*---------- NNTP server defined ----------*/
         error_mess              = NULL;
 
@@ -4417,13 +4427,14 @@
 		 * any of the forbidden headers.
 		 */
 		forbid = 0;
+		if (strucmp(name, "From")) {
 		if(is_a_std_hdr(name) || (forbid=is_a_forbidden_hdr(name))){
 		    if(forbid)
 			q_status_message1(0, 1, 2,
 			    "Not allowed to change header \"%s\"", name);
 		    *t = save;
 		    continue;
-		}
+		}}
 
 		pf->name = cpystr(name);
 		pf->type = FreeText;
---<EOF>---

-Phil