Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Feb 2002 12:11:27 GMT
From:      Ian Pallfreeman <ip@mcc.ac.uk>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/35179: elm-2.5.5_1: bounce command doesn't work
Message-ID:  <200202211211.g1LCBRa44020@albatross.mcc.ac.uk>

next in thread | raw e-mail | index | archive | help

>Number:         35179
>Category:       ports
>Synopsis:       elm-2.5.5_1: bounce command doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 21 04:20:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ian Pallfreeman
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
Manchester University, UK.
>Environment:
dark & chilly
System: FreeBSD albatross 4.5-STABLE FreeBSD 4.5-STABLE #4: Thu Feb 7 15:23:11 GMT 2002 ip@karma:/usr/src/sys/compile/ALBATROSS i386

>Description:

Using the 'b' (bounce) command, to remail a message, doesn't work in elm2.5.
This appears to be a consequence of:

kris        2001/07/23 20:01:26 PDT

  Modified files:
    mail/elm             Makefile 
  Added files:
    mail/elm/files       patch-mkstemp 
  Log:
  Fix insecure temporary file handling.
  
  Obtained from:        RedHat
  
  Revision  Changes    Path
  1.64      +2 -1      ports/mail/elm/Makefile

which ends up passing garbage to system(). The mail isn't sent, nor is it 
deleted from /tmp.

>How-To-Repeat:

Try bouncing a message from elm...

>Fix:

--- reply.c.ports	Thu Feb 21 12:06:09 2002
+++ reply.c	Thu Feb 21 12:07:36 2002
@@ -571,12 +571,12 @@
     
     FILE *mailfd;
     char entered[VERY_LONG_STRING], expanded[VERY_LONG_STRING];
-    char *filename, buffer[VERY_LONG_STRING], *msg;
+    char buffer[VERY_LONG_STRING], *msg;
     int  err,tmpfd;
     char tempfilename[255],*tmpdir;
-    filename = NULL;
     
     entered[0] = '\0';
+    tempfilename[0] = '\0';
 
     if (!get_to(entered, expanded, SM_ORIGINAL))
 	return FALSE;
@@ -608,29 +608,24 @@
     }
     if ((mailfd = fdopen(tmpfd, "w")) == NULL)
 	goto failed;
-    (void) elm_chown(filename, userid, groupid);
+    (void) elm_chown(tempfilename, userid, groupid);
 #ifdef MMDF
     if (strcmp(submitmail, mailer) == 0)
       do_mmdf_addresses(mailfd, expanded);
 #endif /* MMDF */
     copy_message(mailfd, curr_folder.curr_mssg, CM_REMOTE|CM_MMDF_HEAD|CM_REMAIL);
-    if (file_close(mailfd, filename) < 0)
+    if (file_close(mailfd, tempfilename) < 0)
 	goto failed;
 
-    build_mailer_command(buffer, filename,
+    build_mailer_command(buffer, tempfilename,
 	expanded, (char *)NULL, (char *)NULL);
     PutLine0(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmResendingMail,
 	    "Resending mail..."));
     (void) system_call(buffer, 0);
     set_error(catgets(elm_msg_cat, ElmSet, ElmMailResent, "Mail resent."));
-    free((malloc_t)filename);
     return TRUE;
-
 failed:
-    if (filename != NULL) {
-	(void) unlink(filename);
-	free((malloc_t)filename);
-    }
+    (void) unlink(tempfilename);
     return TRUE;
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202211211.g1LCBRa44020>