--- bsd-mailx-8.1.2-0.20081101cvs.orig/temp.c +++ bsd-mailx-8.1.2-0.20081101cvs/temp.c @@ -39,6 +39,8 @@ #endif /* not lint */ #include "rcv.h" +#include +#include #include "extern.h" /* --- bsd-mailx-8.1.2-0.20081101cvs.orig/collect.c +++ bsd-mailx-8.1.2-0.20081101cvs/collect.c @@ -159,8 +159,10 @@ break; if (linebuf[0] != escape || value("interactive") == NULL || lastlong) { - if (putline(collf, linebuf, !longline) < 0) + if (putline(collf, linebuf, !longline) < 0) { + warn("%s", tempname); goto err; + } continue; } c = linebuf[1]; @@ -171,10 +173,12 @@ * Otherwise, it's an error. */ if (c == escape) { - if (putline(collf, &linebuf[1], !longline) < 0) + if (putline(collf, &linebuf[1], !longline) < 0) { + warn("%s", tempname); goto err; - else + } else { break; + } } puts("Unknown tilde escape."); break; @@ -226,13 +230,22 @@ break; case 's': /* - * Set the Subject list. + * Set the Subject line. */ cp = &linebuf[2]; while (isspace(*cp)) cp++; hp->h_subject = savestr(cp); break; + case 'R': + /* + * Set the Reply-To line. + */ + cp = &linebuf[2]; + while (isspace(*cp)) + cp++; + hp->h_replyto = savestr(cp); + break; case 'c': /* * Add to the CC list. @@ -283,6 +296,7 @@ lc++; if ((t = putline(collf, linebuf, rc != LINESIZE-1)) < 0) { + warn("%s", tempname); (void)Fclose(fbuf); goto err; } @@ -304,7 +318,10 @@ } if ((cp = expand(cp)) == NULL) break; - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } exwrite(cp, collf, 1); break; case 'm': @@ -334,7 +351,10 @@ * Print out the current state of the * message without altering anything. */ - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } puts("-------\nMessage contains:"); puthead(hp, stdout, GTO|GSUBJECT|GCC|GBCC|GNL); while ((t = getc(collf)) != EOF) @@ -345,7 +365,10 @@ * Pipe message through command. * Collect output as new message. */ - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } mespipe(collf, &linebuf[2]); goto cont; case 'v': @@ -355,7 +378,10 @@ * 'e' means to use EDITOR * 'v' means to use VISUAL */ - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } mesedit(collf, c); goto cont; } @@ -383,8 +409,11 @@ collf = NULL; } out: - if (collf != NULL) - rewind(collf); + if (collf != NULL && fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + (void)Fclose(collf); + collf = NULL; + } noreset--; return(collf); } @@ -410,8 +439,10 @@ fputs("File exists\n", stderr); return(-1); } + /* FIXME: Fopen with "w" will currently prevent writing to an existig file + (/dev/null), for now I am not sure this would even marginally useful to allow */ if ((of = Fopen(name, "w")) == NULL) { - warn(NULL); + warn("fopen"); return(-1); } lc = 0; @@ -531,7 +562,7 @@ puts("No appropriate messages"); return(0); } - msgvec[1] = NULL; + msgvec[1] = 0; } if (tolower(f) == 'f') tabst = NULL; --- bsd-mailx-8.1.2-0.20081101cvs.orig/cmd2.c +++ bsd-mailx-8.1.2-0.20081101cvs/cmd2.c @@ -61,7 +61,7 @@ int *msgvec = v; int *ip, *ip2, list[2], mdot; - if (*msgvec != NULL) { + if (*msgvec != 0) { /* * If some messages were supplied, find the * first applicable one following dot using @@ -73,7 +73,8 @@ * Find the first message in the supplied * message list which follows dot. */ - for (ip = msgvec; *ip != NULL; ip++) + + for (ip = msgvec; *ip != 0; ip++) if (*ip > mdot) break; if (*ip == 0) @@ -85,7 +86,7 @@ dot = mp; goto hitit; } - if (*ip2 != NULL) + if (*ip2 != 0) ip2++; if (*ip2 == 0) ip2 = msgvec; @@ -118,7 +119,7 @@ * Print dot. */ list[0] = dot - &message[0] + 1; - list[1] = NULL; + list[1] = 0; return(type(list)); } @@ -166,7 +167,7 @@ printf("No messages to %s.\n", cmd); return(1); } - msgvec[1] = NULL; + msgvec[1] = 0; } if (f && getmsglist(str, msgvec, 0) < 0) return(1); @@ -179,7 +180,7 @@ else disp = "[New file]"; if ((obuf = Fopen(file, "a")) == NULL) { - warn(NULL); + warn("fopen"); return(1); } for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) { @@ -279,7 +280,7 @@ list[0] = dot - &message[0] + 1; if (list[0] > lastdot) { touch(dot); - list[1] = NULL; + list[1] = 0; return(type(list)); } puts("At EOF"); @@ -299,18 +300,18 @@ struct message *mp; int *ip, last; - last = NULL; - for (ip = msgvec; *ip != NULL; ip++) { + last = 0; + for (ip = msgvec; *ip != 0; ip++) { mp = &message[*ip - 1]; touch(mp); mp->m_flag |= MDELETED|MTOUCH; mp->m_flag &= ~(MPRESERVE|MSAVED|MBOX); last = *ip; } - if (last != NULL) { + if (last != 0) { dot = &message[last-1]; last = first(0, MDELETED); - if (last != NULL) { + if (last != 0) { dot = &message[last-1]; return(0); } --- bsd-mailx-8.1.2-0.20081101cvs.orig/list.c +++ bsd-mailx-8.1.2-0.20081101cvs/list.c @@ -38,6 +38,9 @@ #endif #endif /* not lint */ +#define _GNU_SOURCE // for strcasecmp +#include // for strcasecmp + #include "rcv.h" #include #include "extern.h" --- bsd-mailx-8.1.2-0.20081101cvs.orig/tty.c +++ bsd-mailx-8.1.2-0.20081101cvs/tty.c @@ -46,6 +46,8 @@ #include "rcv.h" #include "extern.h" +#include +#include #include #include @@ -78,6 +80,10 @@ char *s; int error; + /* do nothing if not on tty, see Debian Bug #149005 */ + if (!isatty(0)) + return 0; + sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; act.sa_handler = SIG_DFL; @@ -242,7 +248,7 @@ goto redo; } if (c == EOF || c == '\n') - break; + break; *cp2++ = c; } act.sa_handler = SIG_DFL; --- bsd-mailx-8.1.2-0.20081101cvs.orig/cmd1.c +++ bsd-mailx-8.1.2-0.20081101cvs/cmd1.c @@ -174,7 +174,7 @@ int *msgvec = v; int *ip; - for (ip = msgvec; *ip != NULL; ip++) + for (ip = msgvec; *ip; ip++) printhead(*ip); if (--ip >= msgvec) dot = &message[*ip - 1]; @@ -222,7 +222,7 @@ dispc = 'M'; parse(headline, &hl, pbuf); from = nameof(mp, 0); - to = skin(hfield("to", mp)); + to = skin(hfield("to", mp), 0); np = extract(from, GTO); np = delname(np, myname); if (altnames) @@ -348,6 +348,8 @@ char *cp; FILE *obuf; + cp = NULL; + obuf = stdout; restoreterm = 0; --- bsd-mailx-8.1.2-0.20081101cvs.orig/mail.1 +++ bsd-mailx-8.1.2-0.20081101cvs/mail.1 @@ -41,11 +41,12 @@ .Nm mail .Bk -words .Op Fl dEIinv -.Op Fl b Ar list -.Op Fl c Ar list +.Op Fl a Ar header +.Op Fl b Ar bcc-addr +.Op Fl c Ar cc-addr .Op Fl s Ar subject .Ar to-addr ... -.Op Fl Ar sendmail-options ... +.Op Fl - Ar sendmail-options ... .Ek .Nm mail .Op Fl dEIiNnv @@ -63,14 +64,19 @@ .Pp The options are as follows: .Bl -tag -width Ds -.It Fl b Ar list +.It Fl a +Specify additional header fields on the command line such as "X-Loop: +foo@bar" etc. You have to use quotes if the string contains spaces. +This argument may be specified more than once, the headers will then +be concatenated. +.It Fl b Ar bcc-addr Send blind carbon copies to -.Ar list . -.It Fl c Ar list +.Ar bcc-addr . +.It Fl c Ar cc-addr Send carbon copies to -.Ar list +list of users. -.Ar list +.Ar cc-addr should be a comma separated list of names. .It Fl d Causes @@ -272,7 +278,7 @@ command in .Nm mail . System wide distribution lists can be created by editing -.Pa /etc/mail/aliases +.Pa /etc/aliases , (see .Xr aliases 5 and @@ -770,6 +776,10 @@ in your home directory if .Ic save is set. +.It Ic ~R Ns Ar string +Use +.Ar string +as the Reply-To field. .It Ic ~r Ns Ar filename Read the named file into the message. .It Ic ~s Ns Ar string @@ -1009,6 +1019,9 @@ The default paginator .Xr more 1 is used if this option is not defined. +.It Ev REPLYTO +If set, will be used to initialize the Reply-To field for outgoing +messages. .It Ev SHELL Pathname of the shell to use in the .Ic !\& @@ -1079,10 +1092,18 @@ utilizes the .Ev HOME , .Ev LOGNAME , +.Ev USER , +.Ev SHELL , +.Ev DEAD , +.Ev PAGER , +.Ev LISTER , +.Ev EDITOR , +.Ev VISUAL , +.Ev REPLYTO , .Ev MAIL , .Ev MAILRC , and -.Ev USER +.Ev MBOX environment variables. .Pp If the @@ -1090,7 +1111,7 @@ environment variable is set, its value is used as the path to the user's mail spool. .Sh FILES -.Bl -tag -width /usr/share/misc/mail.*help -compact +.Bl -tag -width /usr/share/mailx/mail.*help -compact .It Pa /var/mail/* post office (unless overridden by the .Ev MAIL @@ -1103,14 +1124,14 @@ environment variable .It Pa /tmp/R* temporary files -.It Pa /usr/share/misc/mail.*help +.It Pa /usr/share/mailx/mail.*help help files .It Pa /etc/mail.rc system initialization file .El .Sh SEE ALSO .Xr fmt 1 , -.Xr lockspool 1 , +.Xr newaliases 1 , .Xr vacation 1 , .Xr aliases 5 , .Xr mailaddr 7 , @@ -1119,7 +1140,7 @@ .Xr sendmail 8 .Pp "Mail Reference Manual", -.Pa /usr/share/doc/usd/07.mail/ . +.Pa /usr/share/doc/mailx . .Sh HISTORY A .Nm mail @@ -1134,9 +1155,9 @@ not useful to the general user. .Pp Usually, -.Nm mail +.Nm Mail and .Nm mailx are just links to -.Nm Mail , +.Nm mail , which can be confusing. --- bsd-mailx-8.1.2-0.20081101cvs.orig/def.h +++ bsd-mailx-8.1.2-0.20081101cvs/def.h @@ -55,13 +55,21 @@ #include #include #include +#include +#include #include "pathnames.h" +#include "bsd_utils.h" + #define APPEND /* New mail goes to end of mailbox */ #define ESCAPE '~' /* Default escape for sending */ #define NMLSIZE 1024 /* max names in a message list */ +#ifdef MAXPATHLEN #define PATHSIZE MAXPATHLEN /* Size of pathnames throughout */ +#else +#define PATHSIZE 4096 +#endif #define HSHSIZE 59 /* Hash size for aliases and vars */ #define LINESIZE BUFSIZ /* max readable line width */ #define STRINGSIZE ((unsigned) 128)/* Dynamic allocation units */ @@ -70,6 +78,10 @@ #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */ +#ifndef NOFILE +#define NOFILE 256 +#endif + struct message { short m_flag; /* flags, see below */ int m_offset; /* offset in block of message */ @@ -159,12 +171,14 @@ #define GSUBJECT 2 /* Likewise, Subject: line */ #define GCC 4 /* And the Cc: line */ #define GBCC 8 /* And also the Bcc: line */ -#define GMASK (GTO|GSUBJECT|GCC|GBCC) +#define GREPLYTO 0x10 /* And the Reply-To: line */ +#define GINREPLYTO 0x20 /* The In-Reply-To: line */ +#define GMASK (GTO|GSUBJECT|GCC|GBCC|GREPLYTO|GINREPLYTO) /* Mask of places from whence */ -#define GNL 16 /* Print blank line after */ -#define GDEL 32 /* Entity removed from list */ -#define GCOMMA 64 /* detract puts in commas */ +#define GNL 0x40 /* Print blank line after */ +#define GDEL 0x80 /* Entity removed from list */ +#define GCOMMA 0x100 /* detract puts in commas */ /* * Structure used to pass about the current @@ -173,8 +187,11 @@ struct header { struct name *h_to; /* Dynamic "To:" string */ char *h_subject; /* Subject string */ + char *h_header; /* Additional header string */ struct name *h_cc; /* Carbon copies string */ struct name *h_bcc; /* Blind carbon copies */ + char *h_replyto; /* Reply address */ + char *h_inreplyto; /* Reference */ struct name *h_smopts; /* Sendmail options */ }; @@ -262,4 +279,9 @@ (void)ftruncate(fileno(stream), (off_t)ftell(stream)); \ } while(0) + + +#ifndef UID_MAX +#define UID_MAX -1 +#endif #endif /* MAIL_DEF_H */ --- bsd-mailx-8.1.2-0.20081101cvs.orig/main.c +++ bsd-mailx-8.1.2-0.20081101cvs/main.c @@ -49,7 +49,7 @@ #include #include "extern.h" -__dead void usage(void); +static void usage(void); int main(int, char **); /* @@ -64,11 +64,25 @@ int i; struct name *to, *cc, *bcc, *smopts; char *subject; + char *replyto; + char *header; char *ef; + char* cmd; char nosrc = 0; char *rc; extern const char version[]; + /* + * drop any sgid/suid privileges + */ + if (setgid (getgid()) < 0) { + err(1, "setgid"); + } + + if (setuid (getuid()) < 0) { + err(1, "setuid"); + } + /* * Set up a reasonable environment. * Figure out whether we are being run interactively, @@ -78,6 +92,28 @@ (void)signal(SIGPIPE, SIG_IGN); if (isatty(0)) assign("interactive", ""); + + /* + * Grab some stuff from the environment we might use + */ + + if ((cmd = getenv("PAGER"))) + assign("PAGER", cmd); + if ((cmd = getenv("LISTER"))) + assign("LISTER", cmd); + if ((cmd = getenv("SHELL"))) + assign("SHELL", cmd); + if ((cmd = getenv("EDITOR"))) + assign("EDITOR", cmd); + if ((cmd = getenv("VISUAL"))) + assign("VISUAL", cmd); + if ((cmd = getenv("MBOX"))) + assign("MBOX", cmd); + if ((cmd = getenv("DEAD"))) + assign("DEAD", cmd); + if ((cmd = getenv("REPLYTO"))) + assign("REPLYTO", cmd); + image = -1; /* * Now, determine how we are being used. @@ -92,7 +128,9 @@ bcc = NULL; smopts = NULL; subject = NULL; - while ((i = getopt(argc, argv, "EINT:b:c:dfins:u:v")) != -1) { + header = NULL; + replyto = NULL; + while ((i = getopt(argc, argv, "EINT:a:b:c:defins:u:v")) != -1) { switch (i) { case 'T': /* @@ -108,8 +146,10 @@ /* * Next argument is person to pretend to be. */ +#ifndef DEBIAN if (strlen(optarg) >= MAXLOGNAME) errx(1, "username `%s' too long", optarg); +#endif unsetenv("MAIL"); myname = optarg; uflag = 1; @@ -124,13 +164,35 @@ case 'd': debug++; break; +#define REMOVE_NEWLINES(arg) { char *t; \ + for (t = (arg); *t; t++) \ + if (*t == '\n' || *t == '\r') *t = ' '; \ + } case 's': /* * Give a subject field for sending from * non terminal */ + REMOVE_NEWLINES(optarg); subject = optarg; break; + + case 'a': + /* + * Give additional header fields for sending from + * non terminal + */ + REMOVE_NEWLINES(optarg); + if (header == NULL) { + if ((header = (char *)malloc(strlen(optarg)+1)) != NULL) + strcpy(header, optarg); + } else { + if ((header = (char *)realloc(header, strlen(optarg)+strlen(header)+2)) != NULL) { + strcat(header, "\n"); + strcat(header, optarg); + } + } + break; case 'f': /* * User is specifying file to "edit" with Mail, @@ -182,6 +244,7 @@ */ bcc = cat(bcc, nalloc(optarg, GBCC)); break; + case 'e': case 'E': /* * Don't send messages with an empty body. @@ -220,6 +283,7 @@ spreserve(); if (!nosrc) load(_PATH_MASTER_RC); + replyto = value("REPLYTO"); /* * Expand returns a savestr, but load only uses the file name * for fopen, so it's safe to do this. @@ -228,7 +292,7 @@ rc = "~/.mailrc"; load(expand(rc)); if (!rcvmode) { - mail(to, cc, bcc, smopts, subject); + mail(to, cc, bcc, smopts, subject, header, replyto); /* * why wait? */ @@ -275,7 +339,7 @@ if (ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) ws.ws_col = ws.ws_row = 0; if (tcgetattr(1, &tbuf) < 0) - ospeed = 9600; + ospeed = B9600; else ospeed = cfgetospeed(&tbuf); if (ospeed < B1200) @@ -292,15 +356,15 @@ screenwidth = 80; } -__dead void +static void usage(void) { - fprintf(stderr, "usage: %s [-dEIinv] [-b list] [-c list] " + fprintf(stderr, "usage: %s [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] " "[-s subject] to-addr ...\n", __progname); - fprintf(stderr, " %*s [-sendmail-options ...]\n", + fprintf(stderr, " %*s [-- sendmail-options ...]\n", (int)strlen(__progname), ""); - fprintf(stderr, " %s [-dEIiNnv] -f [file]\n", __progname); + fprintf(stderr, " %s [-dEIiNnv] -f [name]\n", __progname); fprintf(stderr, " %s [-dEIiNnv] [-u user]\n", __progname); exit(1); } --- bsd-mailx-8.1.2-0.20081101cvs.orig/vars.c +++ bsd-mailx-8.1.2-0.20081101cvs/vars.c @@ -78,8 +78,7 @@ void vfree(char *cp) { - - if (*cp) + if (cp && *cp) (void)free(cp); } @@ -92,6 +91,8 @@ { char *new; + if (str == NULL) + return NULL; if (*str == '\0') return(""); if ((new = strdup(str)) == NULL) @@ -108,19 +109,24 @@ value(char *name) { struct var *vp; +#ifndef DEBIAN char *env; +#endif if ((vp = lookup(name)) != NULL) return(vp->v_value); +#ifndef DEBIAN /* do not trust environment */ + else if ((env = getenv(name))) return(env); +#endif /* not set, see if we can provide a default */ else if (strcmp(name, "SHELL") == 0) - return(_PATH_CSHELL); + return(_PATH_SHELL); else if (strcmp(name, "LISTER") == 0) return(_PATH_LS); else if (strcmp(name, "PAGER") == 0) - return(_PATH_MORE); + return(_PATH_PAGER); else return(NULL); } --- bsd-mailx-8.1.2-0.20081101cvs.orig/cmd3.c +++ bsd-mailx-8.1.2-0.20081101cvs/cmd3.c @@ -203,6 +203,7 @@ struct name *np; struct header head; + memset(&head, 0, sizeof(head)); if (msgvec[1] != 0) { puts("Sorry, can't reply to multiple messages at once"); return(1); @@ -210,11 +211,11 @@ mp = &message[msgvec[0] - 1]; touch(mp); dot = mp; - if ((rcv = skin(hfield("from", mp))) == NULL) - rcv = skin(nameof(mp, 1)); - if ((replyto = skin(hfield("reply-to", mp))) != NULL) + if ((rcv = skin(hfield("from", mp), 1)) == NULL) + rcv = skin(nameof(mp, 1), 1); + if ((replyto = skin(hfield("reply-to", mp), 1)) != NULL) np = extract(replyto, GTO); - else if ((cp = skin(hfield("to", mp))) != NULL) + else if ((cp = skin(hfield("to", mp), 1)) != NULL) np = extract(cp, GTO); else np = NULL; @@ -238,7 +239,7 @@ if ((head.h_subject = hfield("subject", mp)) == NULL) head.h_subject = hfield("subj", mp); head.h_subject = reedit(head.h_subject); - if (replyto == NULL && (cp = skin(hfield("cc", mp))) != NULL) { + if (replyto == NULL && (cp = skin(hfield("cc", mp), 2)) != NULL) { np = elide(extract(cp, GCC)); np = delname(np, myname); if (altnames != 0) @@ -249,6 +250,9 @@ head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; + head.h_replyto = value("REPLYTO"); + head.h_inreplyto = skin(hfield("message-id", mp), 1); + mail1(&head, 1); return(0); } @@ -284,7 +288,7 @@ int *msgvec = v; int *ip; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { dot = &message[*ip-1]; dot->m_flag &= ~(MBOX|MREAD|MTOUCH); dot->m_flag |= MNEW|MSTATUS; @@ -307,7 +311,7 @@ puts("Cannot \"preserve\" in edit mode"); return(1); } - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; mp->m_flag |= MPRESERVE; @@ -326,7 +330,7 @@ int *msgvec = v; int *ip; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { dot = &message[*ip-1]; dot->m_flag &= ~(MREAD|MTOUCH); dot->m_flag |= MSTATUS; @@ -344,7 +348,7 @@ struct message *mp; int *ip, mesg; - for (ip = msgvec; *ip != NULL; ip++) { + for (ip = msgvec; *ip != 0; ip++) { mesg = *ip; mp = &message[mesg-1]; printf("%d: %d/%d\n", mesg, mp->m_lines, mp->m_size); @@ -611,15 +615,20 @@ struct message *mp; int *ap; char *cp; + char *mid; + memset(&head, 0, sizeof(head)); + + mid = NULL; head.h_to = NULL; for (ap = msgvec; *ap != 0; ap++) { mp = &message[*ap - 1]; touch(mp); dot = mp; - if ((cp = skin(hfield("from", mp))) == NULL) - cp = skin(nameof(mp, 2)); + if ((cp = skin(hfield("from", mp), 2)) == NULL) + cp = skin(nameof(mp, 2), 2); head.h_to = cat(head.h_to, extract(cp, GTO)); + mid = skin(hfield("message-id", mp), 1); } if (head.h_to == NULL) return(0); @@ -630,6 +639,9 @@ head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; + head.h_replyto = value("REPLYTO"); + head.h_inreplyto = mid; + mail1(&head, 1); return(0); } --- bsd-mailx-8.1.2-0.20081101cvs.orig/quit.c +++ bsd-mailx-8.1.2-0.20081101cvs/quit.c @@ -38,8 +38,12 @@ #endif #endif /* not lint */ +#ifdef __USE_SVID +#include +#endif #include "rcv.h" #include +#include #include "extern.h" /* @@ -104,7 +108,7 @@ fbuf = Fopen(mailname, "r+"); if (fbuf == NULL) goto newmail; - if (flock(fileno(fbuf), LOCK_EX) == -1) { + if (lockf(fileno(fbuf), F_LOCK, 0) == -1) { warn("Unable to lock mailbox"); (void)Fclose(fbuf); return(-1); @@ -295,9 +299,9 @@ } (void)Fclose(obuf); if (mcount == 1) - puts("Saved 1 message in mbox"); + printf("Saved 1 message in %s\n", mbox); else - printf("Saved %d messages in mbox\n", mcount); + printf("Saved %d messages in %s\n", mcount, mbox); /* * Now we are ready to copy back preserved files to @@ -504,7 +508,11 @@ (void)Fclose(obuf); if (gotcha) { (void)rm(mailname); +#ifdef DEBIAN + puts("truncated"); +#else puts("removed"); +#endif } else puts("complete"); fflush(stdout); --- bsd-mailx-8.1.2-0.20081101cvs.orig/extern.h +++ bsd-mailx-8.1.2-0.20081101cvs/extern.h @@ -69,13 +69,13 @@ char *salloc(int); char *savestr(char *); FILE *setinput(struct message *); -char *skin(char *); +char *skin(char *, int); char *skip_comment(char *); char *snarf(char *, int *); char *username(void); char *value(char *); char *vcopy(char *); -char *yankword(char *, char *); +char *yankword(char *, char *, int); int Fclose(FILE *); int More(void *); int Pclose(FILE *); @@ -165,7 +165,7 @@ struct var * lookup(char *); int mail (struct name *, struct name *, struct name *, struct name *, - char *); + char *, char *, char *); void mail1(struct header *, int); void makemessage(FILE *, int); void mark(int); @@ -235,7 +235,7 @@ void spreserve(void); void sreset(void); pid_t start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...); -pid_t start_commandv(char *, sigset_t *, int, int, __va_list); +pid_t start_commandv(char *, sigset_t *, int, int, va_list); int statusput(struct message *, FILE *, char *); void stop(int); int stouch(void *); --- bsd-mailx-8.1.2-0.20081101cvs.orig/aux.c +++ bsd-mailx-8.1.2-0.20081101cvs/aux.c @@ -346,6 +346,7 @@ TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec); #else tv[1].tv_sec = sb.st_mtime; + tv[1].tv_usec = 0; #endif (void)utimes(name, tv); } @@ -375,7 +376,7 @@ { char *cp, *cp2; - cp = skin(name1(mp, reptype)); + cp = skin(name1(mp, reptype), reptype); if (reptype != 0 || charcount(cp, '!') < 2) return(cp); cp2 = strrchr(cp, '!'); @@ -418,7 +419,7 @@ * of "host-phrase." */ char * -skin(char *name) +skin(char *name, int reptype) { char *nbuf, *bufend, *cp, *cp2; int c, gotlt, lastsp; @@ -472,6 +473,11 @@ break; case '<': + /* in case of showname it is time to return */ + if (reptype == 0 && value("showname") != NULL) { + *cp2 = 0; + return(savestr(nbuf)); + } cp2 = bufend; gotlt++; lastsp = 0; --- bsd-mailx-8.1.2-0.20081101cvs.orig/Makefile +++ bsd-mailx-8.1.2-0.20081101cvs/Makefile @@ -1,13 +1,29 @@ # $OpenBSD: Makefile,v 1.8 1997/09/21 11:49:50 deraadt Exp $ -PROG= mail +PROG=mail +CC=gcc + +CFLAGS=-D_BSD_SOURCE -DDEBIAN -g -Wall -IEXT + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + SRCS= version.c aux.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c \ edit.c fio.c getname.c head.c v7.local.c lex.c list.c main.c names.c \ - popen.c quit.c send.c strings.c temp.c tty.c vars.c + popen.c quit.c send.c strings.c temp.c tty.c vars.c \ + EXT/strlcat.c EXT/strlcpy.c EXT/vis.c + +OBJS=$(SRCS:%.c=%.o) +LIBS=-llockfile + SFILES= mail.help mail.tildehelp EFILES= mail.rc -LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx -MLINKS= mail.1 Mail.1 mail.1 mailx.1 +MFILES= mail.1 + +all: $(PROG) beforeinstall: cd ${.CURDIR}/misc; ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ @@ -17,8 +33,23 @@ cd ${.CURDIR}/misc; ${INSTALL} ${INSTALL_COPY} -o root -g wheel \ -m 644 ${EFILES} ${DESTDIR}/etc -.if make(install) -SUBDIR+= USD.doc -.endif -.include + +$(PROG): $(OBJS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) + +.c.o: + $(CC) $(CFLAGS) -c $< -o $@ + +.y.c: + bison $< + mv -f $*.tab.c $@ + +clean: + rm -f $(PROG) $(OBJS) *~ core + +install: + install -p -c -m 755 $(PROG) $(DESTDIR)/usr/bin/bsd-mailx + install -p -c -m 644 $(MFILES) $(DESTDIR)/usr/share/man/man1/bsd-mailx.1 + cd misc && install -p -c -m 644 $(EFILES) $(DESTDIR)/etc/ + cd misc && install -p -c -m 644 $(SFILES) $(DESTDIR)/usr/share/bsd-mailx/ --- bsd-mailx-8.1.2-0.20081101cvs.orig/names.c +++ bsd-mailx-8.1.2-0.20081101cvs/names.c @@ -46,6 +46,7 @@ #include "rcv.h" #include +#include #include "extern.h" /* @@ -101,7 +102,7 @@ top = NULL; np = NULL; cp = line; - while ((cp = yankword(cp, nbuf)) != NULL) { + while ((cp = yankword(cp, nbuf, BUFSIZ)) != NULL) { t = nalloc(nbuf, ntype); if (top == NULL) top = t; @@ -162,9 +163,10 @@ * Throw away things between ()'s, and take anything between <>. */ char * -yankword(char *ap, char *wbuf) +yankword(char *ap, char *wbuf, int maxsize) { char *cp, *cp2; + int used = 0; cp = ap; for (;;) { @@ -191,10 +193,11 @@ break; } if (*cp == '<') - for (cp2 = wbuf; *cp && (*cp2++ = *cp++) != '>';) + /* Pre-increment "used" so we leave room for the trailing zero */ + for (cp2 = wbuf; *cp && (++used < maxsize) && (*cp2++ = *cp++) != '>';) ; else - for (cp2 = wbuf; *cp && !strchr(" \t,(", *cp); *cp2++ = *cp++) + for (cp2 = wbuf; *cp && (++used < maxsize) && !strchr(" \t,(", *cp); *cp2++ = *cp++) ; *cp2 = '\0'; return(cp); @@ -242,8 +245,9 @@ (void)snprintf(tempname, sizeof(tempname), "%s/mail.ReXXXXXXXXXX", tmpdir); + /* hopefully we always create the file, so I change the "a" to "w" the line below */ if ((fd = mkstemp(tempname)) == -1 || - (fout = Fdopen(fd, "a")) == NULL) { + (fout = Fdopen(fd, "w")) == NULL) { warn("%s", tempname); senderr++; goto cant; @@ -258,7 +262,8 @@ } (void)fcntl(image, F_SETFD, 1); fprintf(fout, "From %s %s", myname, date); - puthead(hp, fout, GTO|GSUBJECT|GCC|GNL); + puthead(hp, fout, + GTO|GSUBJECT|GCC|GREPLYTO|GINREPLYTO|GNL); while ((c = getc(fo)) != EOF) (void)putc(c, fout); rewind(fo); @@ -351,6 +356,7 @@ isfileaddr(char *name) { char *cp; + int ret = 0; if (*name == '+') return(1); @@ -358,9 +364,9 @@ if (*cp == '!' || *cp == '%' || *cp == '@') return(0); if (*cp == '/') - return(1); + ret=1; } - return(0); + return(ret); } /* --- bsd-mailx-8.1.2-0.20081101cvs.orig/popen.c +++ bsd-mailx-8.1.2-0.20081101cvs/popen.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "extern.h" #define READ 0 @@ -298,8 +299,12 @@ int wait_command(pid_t pid) { - - if (wait_child(pid) < 0) { + int ret; + ret = wait_child(pid); + if (ret > 0) { + printf("Fatal error, process exited with code %d.\n", ret); + return(-1); + } else if (ret < 0) { puts("Fatal error in process."); return(-1); } @@ -395,10 +400,10 @@ if (cp != NULL) delchild(cp); sigprocmask(SIG_SETMASK, &oset, NULL); - if (rv == -1 || (WIFEXITED(wait_status) && WEXITSTATUS(wait_status))) - return(-1); + if (rv >= 0 && (WIFEXITED(wait_status))) + return (WEXITSTATUS(wait_status)); else - return(0); + return(-1); } /* @@ -429,6 +434,7 @@ static int handle_spool_locks(int action) { +#ifndef DEBIAN static FILE *lockfp = NULL; if (action == 0) { @@ -457,7 +463,7 @@ if (lockfp == NULL) return(0); if (getc(lockfp) != '1') { - Pclose(lockfp); + (void)Pclose(lockfp); lockfp = NULL; return(0); } @@ -468,6 +474,68 @@ } return(1); +#else + int retval; + char lockpath[PATHSIZE]; + + snprintf(lockpath, PATHSIZE - 1, "%s.lock", mailname); + lockpath[PATHSIZE - 1] = '\0'; + + if (action == 0) { + /* Clear the lock */ + retval = lockfile_remove(lockpath); + if (retval == 0) + return(1); + else + warn("Cannot remove lockfile %s", lockpath); + + } else if (action == 1) { + + retval = lockfile_create(lockpath, 3, 0); + switch (retval) { + case L_SUCCESS: + return(1); + + case L_NAMELEN: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Recipient name too long." + ); + break; + + case L_TMPLOCK: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Error creating temporary lockfile" + ); + break; + + case L_TMPWRITE: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Failed to write pid into tmp lockfile." + ); + break; + + case L_MAXTRYS: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Failed after max tries." + ); + break; + + case L_ERROR: + default: + warn( "Cannot create lockfile %s", + lockpath + ); + break; + + } + } + + return(0); +#endif } int --- bsd-mailx-8.1.2-0.20081101cvs.orig/pathnames.h +++ bsd-mailx-8.1.2-0.20081101cvs/pathnames.h @@ -33,17 +33,47 @@ * $NetBSD: pathnames.h,v 1.4 1996/06/08 19:48:34 christos Exp $ */ -#include /* executables */ +#ifndef _PATH_SHELL +#define _PATH_SHELL "/bin/sh" +#endif +#ifndef _PATH_PAGER +#define _PATH_PAGER "/usr/bin/pager" +#endif +#ifndef _PATH_EX +#define _PATH_EX "/usr/bin/editor" +#endif +#ifndef _PATH_VI +#define _PATH_VI "/usr/bin/vi" +#endif +#ifndef _PATH_SENDMAIL +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#endif + +/* directories */ +#ifndef _PATH_TMP +#define _PATH_TMP "/tmp/" +#endif + +/* executables */ +#ifndef _PATH_LS +#define _PATH_LS "/bin/ls" +#endif + +#ifndef DEBIAN #define _PATH_EX "/usr/bin/ex" #define _PATH_MORE "/usr/bin/more" -#define _PATH_LS "/bin/ls" #define _PATH_LOCKSPOOL "/usr/libexec/lockspool" +#endif -/* directories & files */ +/* mail runtime files */ +#ifndef _PATH_MAILDIR #define _PATH_MAILDIR "/var/mail" -#define _PATH_HELP "/usr/share/misc/mail.help" -#define _PATH_TILDE "/usr/share/misc/mail.tildehelp" +#endif + +/* directories & files */ +#define _PATH_HELP "/usr/share/bsd-mailx/mail.help" +#define _PATH_TILDE "/usr/share/bsd-mailx/mail.tildehelp" #define _PATH_MASTER_RC "/etc/mail.rc" #define _PATH_LOCTMP "/tmp/local.XXXXXXXXXX" --- bsd-mailx-8.1.2-0.20081101cvs.orig/fio.c +++ bsd-mailx-8.1.2-0.20081101cvs/fio.c @@ -45,8 +45,13 @@ #include #include #include +#include #include "extern.h" +#ifdef DEBIAN +#include +#endif + /* * Mail -- a mail program * @@ -209,6 +214,7 @@ struct sigaction savehup; sigset_t oset; int n; + clearerr(ibuf); /* * Setup signal handlers if the caller asked us to catch signals. @@ -329,6 +335,14 @@ errno = EISDIR; return(-1); } +#ifdef DEBIAN + /* + * lockfile_remove can't remove a lockfile if a mailbox file + * doesn't exist, so we must not delete it (see Bug#111537). + */ + if (!strcmp (name, mailname)) + return(truncate(name, 0)); +#endif if (unlink(name) == -1) { if (errno == EPERM) return(truncate(name, (off_t)0)); @@ -422,12 +436,16 @@ { char xname[PATHSIZE]; char cmdbuf[PATHSIZE]; /* also used for file names */ +#ifdef DEBIAN + wordexp_t p; +#else pid_t pid; int l; char *cp, *shell; int pivec[2]; struct stat sbuf; extern int wait_status; +#endif /* * The order of evaluation is "%" and "#" expand into constants. @@ -463,6 +481,47 @@ } if (strpbrk(name, "~{[*?$`'\"\\") == NULL) return(name); +#ifdef DEBIAN + { + *xname = '\0'; + memset(&p, 0, sizeof(p)); + switch (wordexp(name, &p, WRDE_NOCMD)) { + case 0: /* OK */ + if (p.we_wordc == 0) { + fprintf(stderr, "\"%s\": No match.\n", name); + } else if (p.we_wordc > 1) { + fprintf(stderr, "\"%s\": Ambiguous.\n", name); + } else if (strlen(p.we_wordv[0]) >= PATHSIZE) { + fprintf(stderr, "\"%s\": Expansion buffer overflow.\n", name); + } else { + strncpy(xname, p.we_wordv[0], PATHSIZE); + }; + break; + case WRDE_NOSPACE: + fprintf(stderr, "\"%s\": Out of memory.\n", name); + break; + case WRDE_BADVAL: + case WRDE_BADCHAR: + case WRDE_SYNTAX: + fprintf(stderr, "\"%s\": Syntax error.\n", name); + break; + case WRDE_CMDSUB: + fprintf(stderr, "\"%s\": Command execution not allowed.\n", name); + break; + default: + fprintf(stderr, "\"%s\": Unknown expansion error.\n", name); + break; + } + + wordfree(&p); + if (!*xname) + return (NULL); + else + return(savestr(xname)); + + } +#else + /* XXX - just use glob(3) and env expansion instead? */ if (pipe(pivec) < 0) { warn("pipe"); @@ -505,6 +564,7 @@ return(NULL); } return(savestr(xname)); +#endif } /* --- bsd-mailx-8.1.2-0.20081101cvs.orig/lex.c +++ bsd-mailx-8.1.2-0.20081101cvs/lex.c @@ -405,7 +405,7 @@ if (c == 0) { *msgvec = first(com->c_msgflag, com->c_msgmask); - msgvec[1] = NULL; + msgvec[1] = 0; } if (*msgvec == 0) { puts("No applicable messages"); @@ -435,7 +435,7 @@ if (c == 0) { *msgvec = first(com->c_msgflag, com->c_msgmask); - msgvec[1] = NULL; + msgvec[1] = 0; } if (*msgvec == 0) { puts("No applicable messages"); --- bsd-mailx-8.1.2-0.20081101cvs.orig/send.c +++ bsd-mailx-8.1.2-0.20081101cvs/send.c @@ -38,6 +38,7 @@ #endif #endif /* not lint */ +#include #include "rcv.h" #include "extern.h" @@ -286,14 +287,17 @@ */ int mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts, - char *subject) + char *subject, char *header, char *replyto) { struct header head; head.h_to = to; head.h_subject = subject; + head.h_header = header; head.h_cc = cc; head.h_bcc = bcc; + head.h_replyto = replyto; + head.h_inreplyto = NULL; head.h_smopts = smopts; mail1(&head, 0); return(0); @@ -312,13 +316,34 @@ head.h_to = extract(str, GTO); head.h_subject = NULL; + head.h_header = NULL; head.h_cc = NULL; head.h_bcc = NULL; + head.h_replyto = value("REPLYTO"); + head.h_inreplyto = NULL; head.h_smopts = NULL; mail1(&head, 0); return(0); } +/* check if file is empty or contains only a new line */ +/* Debian Bug#355545 */ +static int fisempty(FILE *mtf) +{ + off_t size; + char c; + if ((size = fsize(mtf)) == 0) return 1; + if (size > 1) return 0; + fseek(mtf, 0, SEEK_SET); + c = fgetc(mtf); + fseek(mtf, 0, SEEK_SET); + return (c == '\n'); +} + + + + + /* * Mail a message on standard input to the people indicated * in the passed header. (Internal interface). @@ -331,6 +356,7 @@ char **namelist; struct name *to; FILE *mtf; + int w; /* * Collect user's mail from standard input. @@ -338,14 +364,15 @@ */ if ((mtf = collect(hp, printheaders)) == NULL) return; - if (fsize(mtf) == 0) { + if (fisempty(mtf) == 1) + { if (value("skipempty") != NULL) goto out; if (hp->h_subject == NULL || *hp->h_subject == '\0') puts("No message, no subject; hope that's ok"); else puts("Null message body; hope that's ok"); - } + } /* * Now, take the user names from the combined * to and cc lists and do all the alias @@ -414,10 +441,24 @@ warn("%s", cp); _exit(1); } +#ifndef DEBIAN if (value("verbose") != NULL) (void)wait_child(pid); else free_child(pid); +#else + /* + * Always wait for sendmail and check its error code. + * See: Bug#145379 + */ + if ((w = wait_child(pid))) { + fprintf(stderr, "Can't send mail: sendmail process failed"); + if (w > 0) + fprintf(stderr, " with error code %d", w); + fprintf(stderr, "\n"); + savedeadletter(mtf); + } +#endif out: (void)Fclose(mtf); } @@ -471,7 +512,8 @@ return(fi); } (void)rm(tempname); - (void)puthead(hp, nfo, GTO|GSUBJECT|GCC|GBCC|GNL|GCOMMA); + (void)puthead(hp, nfo, + GTO|GSUBJECT|GCC|GBCC|GREPLYTO|GINREPLYTO|GNL|GCOMMA); c = getc(fi); while (c != EOF) { (void)putc(c, nfo); @@ -512,8 +554,16 @@ fprintf(fo, "Subject: %s\n", hp->h_subject), gotcha++; if (hp->h_cc != NULL && w & GCC) fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++; +/* Should not put bcc into mails (Closes: Bug#75232) if (hp->h_bcc != NULL && w & GBCC) fmt("Bcc:", hp->h_bcc, fo, w&GCOMMA), gotcha++; +*/ + if (hp->h_header != NULL && w) + fprintf(fo, "%s\n", hp->h_header), gotcha++; + if (hp->h_replyto != NULL && w & GREPLYTO) + fprintf(fo, "Reply-To: %s\n", hp->h_replyto), gotcha++; + if (hp->h_inreplyto != NULL && w & GINREPLYTO) + fprintf(fo, "In-Reply-To: <%s>\n", hp->h_inreplyto), gotcha++; if (gotcha && w & GNL) (void)putc('\n', fo); return(0); --- bsd-mailx-8.1.2-0.20081101cvs.orig/edit.c +++ bsd-mailx-8.1.2-0.20081101cvs/edit.c @@ -37,6 +37,11 @@ static const char rcsid[] = "$OpenBSD: edit.c,v 1.18 2008/07/16 14:49:09 martynas Exp $"; #endif #endif /* not lint */ +#ifdef DEBIAN +/* needed for asprintf */ +#define _GNU_SOURCE +#include +#endif #include #include @@ -114,6 +119,24 @@ (void)ignoresig(SIGINT, &oact, &oset); fp = run_editor(setinput(mp), (off_t)mp->m_size, type, readonly); if (fp != NULL) { + int c1, c2; + + /* Check if the last empty line is still here. + * If no, add it. + * (closes Debian bug #71759) + */ + (void)fseek(fp, -2L, SEEK_END); + c2 = getc(fp); + c1 = getc(fp); + (void)fseek(fp, 0L, SEEK_END); + if (c1 != '\n') { + putc('\n', fp); + putc('\n', fp); + } else if (c2 != '\n') { + putc('\n', fp); + } + (void)fflush(fp); + (void)fseek(otf, 0L, SEEK_END); size = ftell(otf); mp->m_block = blockof(size); @@ -200,7 +223,22 @@ edit = _PATH_VI; } if (editit(edit, tempname) == -1) { - (void)rm(tempname); + /* + * Don't delete the file if user has changed it + * See Debian bug#148071 + * robert@debian.org, 2004.03.30 + */ + if ( !readonly && + !stat(tempname, &statb) && + (modtime != statb.st_mtime)) { + printf( + "Saved changed message in %s\n" + "Please note that this file is located in temporary\n" + "directory and may disappear without any notice\n", + tempname); + } else { + (void)rm(tempname); + } goto out; } /* --- bsd-mailx-8.1.2-0.20081101cvs.orig/head.c +++ bsd-mailx-8.1.2-0.20081101cvs/head.c @@ -68,10 +68,13 @@ fail(linebuf, "No from or date field"); return(0); } + /* be very tolerant about the date */ +#ifndef DEBIAN if (!isdate(hl.l_date)) { fail(linebuf, "Date field not legal date"); return(0); } +#endif /* * I guess we got it! */ --- bsd-mailx-8.1.2-0.20081101cvs.orig/misc/mail.rc +++ bsd-mailx-8.1.2-0.20081101cvs/misc/mail.rc @@ -1,2 +1,2 @@ -set append dot save asksub -ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via +set ask askcc append dot save crt +ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via Delivered-To --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/changelog +++ bsd-mailx-8.1.2-0.20081101cvs/debian/changelog @@ -0,0 +1,506 @@ +bsd-mailx (8.1.2-0.20081101cvs-2) unstable; urgency=low + + * Upload to unstable. + + -- Robert Luberda Sun, 09 Nov 2008 09:00:25 +0100 + +bsd-mailx (8.1.2-0.20081101cvs-1) experimental; urgency=low + + * New upstream release: + * Lower priority of mailx package to extra. + * Standards-Version: 3.8.0 (no changes). + * Remove duplicated `it' from desctiption (lintian). + + -- Robert Luberda Sat, 01 Nov 2008 12:40:12 +0100 + +bsd-mailx (8.1.2-0.20071201cvs-3) unstable; urgency=low + + * Lower priority of mailx package to optional (see #477124). + * copyright: Add a copyright notice (lintian). + * Build depend on debhelper >= 6 (lintian). + * Change doc-base section to Network/Communication (lintian). + + -- Robert Luberda Sat, 26 Apr 2008 09:52:18 +0200 + +bsd-mailx (8.1.2-0.20071201cvs-2) unstable; urgency=medium + + * Add conflict with old mailx packages (closes: #459621). + * Standards-Version: 3.7.3 (no changes). + * Fix invalid regexp in postinst. + + -- Robert Luberda Tue, 08 Jan 2008 23:01:18 +0100 + +bsd-mailx (8.1.2-0.20071201cvs-1) unstable; urgency=low + + * New upstream version. + * Rename package to bsd-mailx, and create dummy mailx package for smooth + upgrades. + * Manage /usr/bin/mailx with update-alternatives to allow other packages + like mailutils or nail to be installed together with bsd-mailx. + * Remove outdated preinst script. + + -- Robert Luberda Sat, 01 Dec 2007 12:54:13 +0100 + +mailx (1:8.1.2-0.20071017cvs-2) unstable; urgency=low + + * collect.c: Ooops, for debugging I commented out the line responsible + for removing temporary, and forgot to uncomment it... + + -- Robert Luberda Fri, 19 Oct 2007 23:10:11 +0200 + +mailx (1:8.1.2-0.20071017cvs-1) unstable; urgency=low + + * New upstream version from OpenBSD CVS repository. + * send.c: treat messages which contain only a new line sign as empty + messages (closes: #355545). + * Fix ` debian-rules-ignores-make-clean-error' lintian warning. + * Bump debhelper compat mode to v6. + + -- Robert Luberda Thu, 18 Oct 2007 23:35:53 +0200 + +mailx (1:8.1.2-0.20070424cvs-1) unstable; urgency=low + + * New upstream version from OpenBSD CVS repository. + * Standards-Version: 3.7.2. + * Lower package priority to standard to match the override file. + * main.c: Replace with spaces any embeded newline passed in arguments + for '-s' and '-a' options (closes: #419840). + * mail.1: Fix a typo (closes: #411420). + + -- Robert Luberda Thu, 03 May 2007 12:09:36 +0200 + +mailx (1:8.1.2-0.20050715cvs-1) unstable; urgency=low + + * New upstream version from OpenBSD CVS repository: + + fixed segfault in list.c (closes: #313306). + * Standard-Version: 3.6.2 (no changes). + + -- Robert Luberda Fri, 15 Jul 2005 00:28:33 +0200 + +mailx (1:8.1.2-0.20040524cvs-4) unstable; urgency=low + + * Fix documentation of sendmail options in the man page and in the + mailx's usage output (closes: #285259). + + -- Robert Luberda Sat, 18 Dec 2004 13:58:28 +0100 + +mailx (1:8.1.2-0.20040524cvs-3) unstable; urgency=medium + + * fio.c: Fix segfault on wildcard expansion introduced in previous upload. + Thanks to Yuri D'Elia for noticing this (see bug#148389). + + -- Robert Luberda Sat, 13 Nov 2004 22:23:14 +0100 + +mailx (1:8.1.2-0.20040524cvs-2) unstable; urgency=medium + + * Bugfix release (closes: #278748): + + fio.c: Use wordexpr() instead of calling /bin/echo not to allow + executing external commands while expanding shell variables + and wildcards. + + names.c: isfileaddr function return false if '@', '!' or '%' i + characters occur anywhere (e.g not only before the slash) in the + recipient name. + + -- Robert Luberda Wed, 3 Nov 2004 20:46:39 +0100 + +mailx (1:8.1.2-0.20040524cvs-1) unstable; urgency=low + + * New upstream version from OpenBSD CVS repository. + * debian/control: add exim4 alternative to mail-transport-agent + dependency (closes: #248498). + * USD.doc/mail*.nr: changed references from /usr/lib/Mail.rc to + /etc/mail.rc. + * USD.doc/Makefile, debian/rules: generate and install manual.txt + (like in the upstream version). + * Removed lintian override file, it's no longer needed. + * Add lintian source overrides for `cvsignore-file-in-source' + and `source-contains-CVS-dir'. + + -- Robert Luberda Mon, 24 May 2004 23:03:47 +0200 + +mailx (1:8.1.2-0.20031014cvs-2) unstable; urgency=medium + + * edit.c: if the external editor (called by ~e or ~v commands) fails for + some reason, don't delete the temporary file if it has been modified. + This partly fixes bug#148037. + * popen.c: print exit code of failed commands. + * quit.c: change message saying that mailbox was "removed" to "truncated" + (closes: #196682); mailx does not remove mailboxes, see the entry + for 1:8.1.2-0.20020316cvs-2 in this changelog for the reason. + + -- Robert Luberda Wed, 31 Mar 2004 23:42:19 +0200 + +mailx (1:8.1.2-0.20031014cvs-1) unstable; urgency=low + + * New upstream version from OpenBSD. + * Fix problem with building on Hurd (closes: #213929). + * mail.1: removed reference to non-existent lockspool man page. + * Standards-Version: 3.6.1 (no changes). + + -- Robert Luberda Tue, 14 Oct 2003 20:48:51 +0200 + +mailx (1:8.1.2-0.20030521cvs-1) unstable; urgency=low + + * New upstream version from OpenBSD. + * Added EXT/vis.[ch] files, needed for compiling this version. + * Minor fix in Makefile (closes: #181022). + * debian/control: Remove ending dot from synopsis line (lintian). + * Standards-Version: 3.5.10 (no changes). + + -- Robert Luberda Thu, 22 May 2003 21:12:21 +0200 + +mailx (1:8.1.2-0.20020411cvs-5) unstable; urgency=low + + * cmd1.c: Check if return value of screensize() > 0 (closes: #170784). + * Support DEB_BUILD_OPTIONS=noopt instead of debug. + * Build with debhelper v4. + * Standards-Version: 3.5.8. + + -- Robert Luberda Sat, 7 Dec 2002 11:42:34 +0100 + +mailx (1:8.1.2-0.20020411cvs-4) unstable; urgency=low + + * send.c: Always wait for a sendmail process, check its exit code + and if non-zero, print a warning message to user and save original + message to ~/dead.letter (closes: #145379). + * popen.c: Make wait_child() return an exit code of the child. + + * mail.1: s/^\.ne li$/.ne/g to fix groff warnings. + + -- Robert Luberda Sat, 24 Aug 2002 22:15:23 +0200 + +mailx (1:8.1.2-0.20020411cvs-3) unstable; urgency=low + + * aux.c: in function alter() do initialize tv_usec part of the + timeval structure used to set modification time on the mailbox + file (closes: #152038). + Thanks to John Girash for help. + + -- Robert Luberda Thu, 11 Jul 2002 05:21:34 +0200 + +mailx (1:8.1.2-0.20020411cvs-2) unstable; urgency=low + + * collect.c: return from grabh() if stdin is not a terminal. + This fixes the `-I' option (closes: #149005). + + -- Robert Luberda Tue, 18 Jun 2002 22:55:27 +0200 + +mailx (1:8.1.2-0.20020411cvs-1) unstable; urgency=high + + * New upstream CVS snapshot, with only one change, which fixes + potential security problem: + + collect.c: + Don't do tilde escapes unless we are in interactive mode. Now the + behavior matches the man page... + * Many thanks to Michal Pajak for pointing out the problem. + + -- Robert Luberda Thu, 11 Apr 2002 19:07:59 +0200 + +mailx (1:8.1.2-0.20020316cvs-3) unstable; urgency=low + + * fio.c: fixed previous patch (closes: #140527,#140485). + + -- Robert Luberda Tue, 2 Apr 2002 07:14:58 +0200 + +mailx (1:8.1.2-0.20020316cvs-2) unstable; urgency=low + + * fio.c: Don't delete mailbox file, always truncate it, because liblockfile + fails to remove the lock file if mailbox doesn't exist (closes: #111537). + + -- Robert Luberda Wed, 27 Mar 2002 09:20:08 +0100 + +mailx (1:8.1.2-0.20020316cvs-1) unstable; urgency=low + + * Applied patches from Arnaud Giersch + which fix outstanding problems: + + closes: #37104: Bug in all mailx* (tested: <=mailx_8.1.1-10). + + closes: #71759: mailx concatenates messages. + MANY THANKS FOR YOUR HELP, Arnaud! + + * New upstream version from OpenBSD CVS repository: + + closes: #34752: mail causes segmentation fault when pushing Ctrl+C. + * This version uses strlcpy&strlcat functions, appropriate files were + included in Debian patch. + * Added upstream changelog file, generated by hand from CVS logs using + `cvs2cl --no-wrap -S'. + * Makefile: added -p option to install (preserve timestamps of installed + files). + + -- Robert Luberda Tue, 26 Mar 2002 05:47:53 +0100 + +mailx (1:8.1.2-0.20010922cvs-3) unstable; urgency=low + + * debian/copyright: text of BSD license can be found in common-licences, + so do not include it here... + + -- Robert Luberda Fri, 4 Jan 2002 08:13:30 +0100 + +mailx (1:8.1.2-0.20010922cvs-2) unstable; urgency=low + + * debian/copyright: removed 3th paragraph from the text of BSD license + as suggested by Branden Robinson (closes: #123828). + * Upgraded standards version to 3.5.6 (no changes needed). + + -- Robert Luberda Sat, 22 Dec 2001 21:56:31 +0100 + +mailx (1:8.1.2-0.20010922cvs-1) unstable; urgency=low + + * New version from OpenBSD cvs repository: + + aux.c: In skin(), only add a space after a comma if there is actually a + space in the input buffer. This prevents a rare buffer overflow on very + long header lines... (closes: #108677). See #108677 for more info. + + aux.c: In skin() don't die if realloc() fails since its only purpose is + to shrink the buffer, not expand it. + + * No other changes was made, so I think this version should go to woody + as well. + + -- Robert Luberda Sun, 23 Sep 2001 21:42:22 +0200 + +mailx (1:8.1.2-0.20010705cvs-2) unstable; urgency=low + + * Removed exim from exim|mail-transport-agent dependency (closes: #106122). + * Added a lintian override file for virtual-package-without-real-package- + dependency warning. + * Fix spelling in description of the package (closes: #106449). + + -- Robert Luberda Wed, 8 Aug 2001 23:31:21 +0200 + +mailx (1:8.1.2-0.20010705cvs-1) unstable; urgency=low + + * New version from OpenBSD cvs. + * Updated copyright and README.Debian files. + * Removed IOSAFE patch - it wasn't used. + * REPLYTO can be set in ~/.mailrc too. + + -- Robert Luberda Thu, 12 Jul 2001 18:58:01 +0200 + +mailx (1:8.1.2-0.20010319cvs-4) unstable; urgency=low + + * Applied patch from Tormod Volden , which adds + "showname" option to mailx (closes: #96867). + * v7.local.c: Removed /var/spool/mail hack added by Paul in 1:8.1.1-10.1.1 + * quit.c: Use lockf instead if flock. + * quit.c: Add missing newline in `Saved ...' message. + * Added doc-base support. + * Added versioned dependency on base-files, as suggested in upgrading- + checklist for Debian Policy 3.5.4. + * Standards-Version: 3.5.5 + + -- Robert Luberda Tue, 12 Jun 2001 23:43:10 +0200 + +mailx (1:8.1.2-0.20010319cvs-3) unstable; urgency=low + + * Applied some patches from FreeBSD: + + Add Relpy-To header if REPLYTO environment variable is set. + + Add In-Reply-To header for replies (closes: #23115). + * When saving messages to mbox, print its real filename (closes: #68920). + Thanks to Tollef Fog Heen for patch. + * /etc/mail.rc: Add Delivered-To to list of ignored headers. + + -- Robert Luberda Wed, 4 Apr 2001 00:20:57 +0200 + +mailx (1:8.1.2-0.20010319cvs-2) unstable; urgency=low + + * Don't ask about (B)Cc: header twice (closes: #90822). + + -- Robert Luberda Fri, 23 Mar 2001 23:47:43 +0100 + +mailx (1:8.1.2-0.20010319cvs-1) unstable; urgency=medium + + * New maintainer (closes: #90146). + * New upstream version from OpenBSD CVS repository. + * Security fix: don't install mailx binary setgid mail. + Now the liblockfile library is used for mailbox locking. + * cmd3.c: Initialize head variable with NULLs. This should fix + problem with garbage text when replying (closes: #84166). + * Add conflicts with older suidmanager. + * Helpfiles moved to /usr/share/mailx. + * Added support for DEB_BUILD_OPTIONS=debug,nostrip. + * Updated Standards-Version: 3.5.2 + * Switch to debhelper v3. + * Updated Build-Depends field. + * Closing bugs fixed in NMUs (closes: #23901, #64238, #68725, #68745). + + -- Robert Luberda Thu, 22 Mar 2001 08:05:56 +0100 + +mailx (1:8.1.1-10.3) unstable; urgency=low + + * debian/rules: added install dependancy to binary-arch (Closes: Bug#83361). + + -- Edward Betts Sun, 28 Jan 2001 14:40:05 -0700 + +mailx (1:8.1.1-10.2) unstable; urgency=low + + * debian/control: Standards-Version updated. + * debian/control: Build-Depends added. + * debian/control: Depends line fixed (Closes: Bug#41909). + * debian/rules: rewritten, still uses debhelper. + * Makefile: man pages moved to /usr/share/man (Closes: Bug#80758). + * applied patch from Martin Schulze (Closes: Bug#23356, Bug#13756). + * applied patch from Ulf Jaenicke-Roessler + (Closes: Bug#26757, Bug#40424). + * misc/mail.help, USD.doc/mail[1568].nr: changed references from + /usr/spool/mail to /var/mail (Closes: Bug#41910). + * send.c: Comment out bcc code (Closes: Bug#75232). + * pathnames.h: Change default shell from /bin/csh to /bin/sh. + * pathnames.h: Change default pager from /bin/more to + /usr/bin/pager (Closes: Bug#41228). + * pathnames.h: Change default editor from /bin/ex to /usr/bin/editor + (Closes: Bug#66385). + * debian/rules: stop using dh_suidregister + + -- Edward Betts Sun, 14 Jan 2001 12:36:16 -0700 + +mailx (1:8.1.1-10.1.3) frozen unstable; urgency=high + + * Fix the security fix: only accept a couple environment variables + instead of blindly using them all + + -- Wichert Akkerman Tue, 8 Aug 2000 11:42:02 -0700 + +mailx (1:8.1.1-10.1.2) frozen unstable; urgency=high + + * Another security problem: refuse to get the interactive variable + from the environment by explicitly setting it in the hashtable. + + -- Wichert Akkerman Mon, 7 Aug 2000 12:36:10 -0700 + +mailx (1:8.1.1-10.1.1) frozen unstable; urgency=high + + * NMU to fix RC bug. Now accepts both /var/mail and /var/spool/mail as + allowed places for setgid file manipulation. fixes:#64238 + + -- Paul Slootman Thu, 8 Jun 2000 19:51:14 +0200 + +mailx (1:8.1.1-10.1) stable frozen unstable; urgency=high + + * Security fix for a GID=mail shell. + + -- Daniel Jacobowitz Sun, 4 Jun 2000 22:45:19 -0700 + +mailx (1:8.1.1-10) frozen unstable; urgency=high + + * correct major security flaw, patch from Alvaro Martinez Echevarria + , bug#23880, bug#23901 + + * other potential buffer overflow, patch from Juan-Mariano de Goyeneche + , bug #22937 + + + -- Loic Prylli Sun, 28 Jun 1998 20:15:18 -0400 + +mailx (1:8.1.1-9) frozen unstable; urgency=high + + * recompile without the signal handling workarounds (lo + that eliminate critical bugs where message parts can be lost + (#20798) and (#20558) + + -- Loic Prylli Thu, 9 Apr 1998 02:11:26 +0200 + +mailx (1:8.1.1-8) frozen unstable; urgency=high + + * previous patch broke most file accesses, corrected safe_open (#20634) + * try to check every access to Fopen, change "a" into "w" for new files, + to suit behaviour of safe_open. + + -- Loic Prylli Sat, 4 Apr 1998 22:01:19 +0200 + +mailx (1:8.1.1-7) frozen; urgency=medium + + * security fix for tmp races patch from Martin Schulze (#20059) + + -- Loic Prylli Mon, 23 Mar 1998 22:52:35 +0100 + +mailx (1:8.1.1-6) unstable; urgency=low + + * convert to debhelper + * changelog now compressed (bug#15431) + * removed .orig and .rej from source (bug#18409) + + -- Loic Prylli Sat, 14 Feb 1998 14:34:22 +0100 + +mailx (1:8.1.1-5) unstable; urgency=low + + * apply David Brown patch so mailx choose the right window size + (#12197) + * correct Depends: in control file. + + -- Loic Prylli Sat, 15 Nov 1997 00:30:38 +0100 + +mailx (1:8.1.1-4) unstable; urgency=high + + * mailx was sending empty message, ignoring user input + add clearerr when EAGAIN occur in "IOSAFE" code (#14263) + + -- Loic Prylli Tue, 11 Nov 1997 20:22:35 +0100 + +mailx (1:8.1.1-3.1) unstable; urgency=low + + * Non-maintainer release. + * Libc6 compile. (#11705) + * Install missing symlink to manpage. (#7274) + + -- Martin Mitchell Wed, 29 Oct 1997 04:34:39 +1100 + +mailx (1:8.1.1-3) unstable; urgency=low + + * add dpkg --assert-working-epoch in preinst bug#6850 + * add writing of pid in mailbox locking file + * fix:mailx was not removing temporary lock files + + -- Loic Prylli Sat, 1 Feb 1997 11:44:04 +0100 + +mailx (1:8.1.1-2) unstable; urgency=low + + * correct bug #2733 (occur when no space left) dans quit.c + * detection of From_ lines with tring to match the date bug#2010 + * corrected garble output bug #2284 + + -- Loic Prylli Sat, 28 Dec 1996 15:02:22 +0100 + +mailx (1:8.1.1-1) unstable; urgency=medium + + * recreate completely starting from OpenBSD mail version (we loose a lot + of extension but we have a working program now) + * OpenBSD base version is the last one in december 96 + * rechange the numbering of version, so epoch 1+8.1 is from 4.4BSD, the + last upstream digit is to change each time we update to a new openbsd + version. + * fix the problem of longjmp inside signals inside stdio calls + * reincorporate a patch to be dot file locking+setgid safe + * some fix in signal handling + + -- Loic Prylli Mon, 23 Dec 1996 01:57:44 +0100 + +Mon Apr 29 17:21:42 1996 Sven Rudolph + + * releasing 8.5.5-1 + + * added symlink /usr/bin/Mail -> /usr/bin/mailx + +Thu Apr 25 23:55:36 1996 Sven Rudolph + + * set version number to 8.5.5 because it has to superseed 8.1 + + * switched back to mailx-5.5-kw (see mailx-5.5-kw.diff.README) + + * no POP support + +mailx 8.1 Debian 5 - 10/19/95 Sven Rudolph +* uses now BSD signal emulation (/usr/include/bsd/signal.h) +* added virtual package names in Depends: and Provides fields (Bug#1460) +* added Section: field +* created symlink for mailx manpage (Bug#1114) + +mailx 8.1 Debian 4 - 5/20/95 Carl Streeter +* Added diffs from Delman Lee : + + Hi! I got mailx-8.1-3 from the Linux Debian distribution, and have + added a "hold-pop" option to hold messages on the POP server after + retrieving them. (Also fixed a minor bug with mailx thinking that there + is mail even if the POP mailbox is empty. Code around stat() below.) + +mailx 8.1 Debian 3 - 4/18/95 Carl Streeter +* Fixed control file to depend on smail|sendmail. Updated to latest + guidelines --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/bsd-mailx.postinst +++ bsd-mailx-8.1.2-0.20081101cvs/debian/bsd-mailx.postinst @@ -0,0 +1,31 @@ +#!/bin/sh +# vim:ts=2:et +# $Id: bsd-mailx.postinst,v 1.3 2008-01-08 22:01:43 robert Exp $ + +set -e + +update_alt() +{ + program="$1" + priority="$2" + + bindir=/usr/bin + mandir=/usr/share/man/man1 + if [ ! -e "$bindir/mailx" ] || ! update-alternatives --display "mailx" | grep -q "${bindir}/${program}$" ; then + update-alternatives --install "$bindir/mailx" mailx "$bindir/$program" "$priority" \ + --slave "$bindir/mail" mail "$bindir/$program" \ + --slave "$bindir/Mail" Mail "$bindir/$program" \ + --slave "$mandir/mailx.1.gz" mailx.1.gz "$mandir/$program.1.gz" \ + --slave "$mandir/mail.1.gz" mail.1.gz "$mandir/$program.1.gz" \ + --slave "$mandir/Mail.1.gz" Mail.1.gz "$mandir/$program.1.gz" + + fi +} + + +if [ "$1" = "configure" ]; then + update_alt bsd-mailx 50 +fi + +#DEBHELPER# + --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/control +++ bsd-mailx-8.1.2-0.20081101cvs/debian/control @@ -0,0 +1,25 @@ +Source: bsd-mailx +Section: mail +Priority: standard +Maintainer: Robert Luberda +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 6), groff, liblockfile-dev (>= 1.05) + +Package: bsd-mailx +Architecture: any +Depends: ${shlibs:Depends}, exim4 | mail-transport-agent, base-files (>= 2.2.0) +Provides: mail-reader, mailx +Conflicts: mailutils (<< 1:1.1+dfsg1-4), mailx (<< 1:20071201) +Replaces: mailx (<< 1:20071201) +Description: A simple mail user agent + mailx is the traditional command-line-mode mail user agent. + Even if you don't use it may be required by other programs. + + +Package: mailx +Priority: extra +Architecture: all +Depends: bsd-mailx +Description: Transitional package for mailx rename + This dummy package is provided to smooth the upgrade from mailx to + bsd-mailx and can be safely removed afterwards. --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/rules +++ bsd-mailx-8.1.2-0.20081101cvs/debian/rules @@ -0,0 +1,100 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# This file is public domain software, originally written by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +DESTDIR=$(CURDIR)/debian/$(shell dh_listpackages -a) + +# translate version: x.x.x-0.RRRRMMDDcvs-V into 1:RRRRMMDD-V +MAILXVERSION=$(shell dpkg-parsechangelog | sed -ne '/^Version:/{s/^[^-]*-0./1:/; s/cvs//; p}') + +build: build-stamp +build-stamp: + dh_testdir + + $(MAKE) + $(MAKE) -C USD.doc + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + $(MAKE) clean + $(MAKE) -C USD.doc clean + + dh_clean + +install: build + echo $(MAILXVERSION) + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs -A + + # Add here commands to install the package into debian/ + $(MAKE) install DESTDIR=$(DESTDIR) + +# install -p -m 0644 debian/lintian \ +# $(DESTDIR)/usr/share/lintian/overrides/mailx + + dh_installchangelogs -a EXT/ChangeLog + dh_installchangelogs -i + #dh_install + +# This single target is used to build all the packages, all at once, or +# one at a time. So keep in mind: any options passed to commands here will +# affect _all_ packages. Anything you want to only affect one package +# should be put in another target, such as the install target. +binary-common: + dh_testdir + dh_testroot +# dh_installchangelogs + dh_installdocs +# dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_installinit +# dh_installcron +# dh_installinfo +# dh_undocumented +# dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_makeshlibs + dh_installdeb +# dh_perl +# dh_python + dh_shlibdeps + dh_gencontrol -- $(DEBVERSION) + dh_md5sums + dh_builddeb + +# Build architecture independant packages using the common target. +binary-indep: build install + $(MAKE) -f debian/rules DH_OPTIONS=-i DEBVERSION=-v$(MAILXVERSION) binary-common + +# Build architecture dependant packages using the common target. +binary-arch: build install + $(MAKE) -f debian/rules DH_OPTIONS=-a DEBVERSION= binary-common + +# Any other binary targets build just one binary package at a time. +binary-%: build install + make -f debian/rules binary-common DH_OPTIONS=-p$* + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary-common binary install --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/compat +++ bsd-mailx-8.1.2-0.20081101cvs/debian/compat @@ -0,0 +1 @@ +6 --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/source.lintian-overrides +++ bsd-mailx-8.1.2-0.20081101cvs/debian/source.lintian-overrides @@ -0,0 +1 @@ +bsd-mailx source: source-contains-cvs-control-dir --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/bsd-mailx.dirs +++ bsd-mailx-8.1.2-0.20081101cvs/debian/bsd-mailx.dirs @@ -0,0 +1,4 @@ +etc +usr/bin +usr/share/bsd-mailx +usr/share/man/man1 --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/bsd-mailx.prerm +++ bsd-mailx-8.1.2-0.20081101cvs/debian/bsd-mailx.prerm @@ -0,0 +1,12 @@ +#!/bin/sh +# vim:ts=2:et +# $Id: bsd-mailx.prerm,v 1.2 2007-12-01 12:06:49 robert Exp $ + +set -e + +if [ "$1" = "remove" ]; then + update-alternatives --remove "mailx" "/usr/bin/bsd-mailx" +fi + +#DEBHELPER# + --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/bsd-mailx.doc-base +++ bsd-mailx-8.1.2-0.20081101cvs/debian/bsd-mailx.doc-base @@ -0,0 +1,12 @@ +Document: bsd-mailx +Title: Mail Reference Manual +Author: Kurt Shoens, Craig Leres, Mark Andrews +Abstract: This document describes how to use the Mail + program to send and receive messages. +Section: Network/Communication + +Format: PostScript +Files: /usr/share/doc/bsd-mailx/manual.ps.gz + +Format: text +Files: /usr/share/doc/bsd-mailx/manual.txt.gz --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/copyright +++ bsd-mailx-8.1.2-0.20081101cvs/debian/copyright @@ -0,0 +1,14 @@ +This package was debianized by Loic Prylli on +Mon, 23 Dec 1996 00:13:13 +0100. +The package is currently maintained by Robert Luberda + +It is now based on OpenBSD in directory src/usr.bin/mail on a lot of major +ftp sites. +See the README.Debian (and changelog.Debian) for the complicated history +of the Debian package. + +Copyright (c) 1980, 1993 The Regents of the University of California. + +This software is licensed under the BSD License. +On Debian systems, the complete text of the BSD License can be found +in `/usr/share/common-licenses/BSD'. --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/bsd-mailx.docs +++ bsd-mailx-8.1.2-0.20081101cvs/debian/bsd-mailx.docs @@ -0,0 +1,2 @@ +USD.doc/manual.ps +USD.doc/manual.txt --- bsd-mailx-8.1.2-0.20081101cvs.orig/debian/bsd-mailx.README.Debian +++ bsd-mailx-8.1.2-0.20081101cvs/debian/bsd-mailx.README.Debian @@ -0,0 +1,159 @@ +bsd-mailx for DEBIAN +---------------------- + +The history of this package is quite complicated. The changelog +includes a summary with the different maintainers. + +At the beginning of Debian, I think this package was based on a BSD 5.5 +mail version from FreeBSD. + +There has been a lot on work on the package shipped with Debian +0.93R6, which was based a BSD 8.1 mail version from BSD4.4Lite. The +extensions includes support for dotfile locking, setgid support, POP +support, signal handling hacks. + +here is a README originally found: + + README for Berkely mailx version 8.1 with POP extension + + + + This is "mailx", a simple program for sending and receiving email. + + + + This is based on mailx version 8.1 (as distributed with BSD 4.4lite). + + + + It has been extended to support the post-office protocol (POP). Run + + "mail -p" and it will retrive your email from a POP server rather than + + from your local mail queue. See the manual page for more details. + + + + The POP support was written by Jonathan I. Kamens for version mailx 5.5 + + (as distributed with BSD 4.3.) + + + + The POP support was integrated into version 8.1 by Salvatore Valente + + for no particular reason. (It would have been simpler for me to + + simply use Jonathan's 5.5 source tree. There are no major differences + + between the two versions.) + + + + Have a nice day. + + -Salvatore Valente. + + 5/12/94 + + + + + + PORTING + + + + Before attempting to compile this for _any_ system, you should do two + + things: + + + + Edit CFLAGS in Makefile. + + Edit pathnames.h. + + + + These sources are _extremely_ BSDish. I have successfully built this + + for Linux, BSD 4.3, NetBSD, Ultrix, Aix, and SunOS. I have never + + successfully gotten it to build for Solaris or any System 5ish system. + + If you want to try, here are some issues you will face: + + + + It uses BSD signal() semantics. Use sigaction(). + + It uses BSD longjmp() semantics. Use siglongjmp(). + + It uses BSD sgtty. Use termios. + + It uses BSD signal mask functions. Use posix sigmask functions. + + + + There will probably be other hurdles too. Good luck. + + +With Debian1.1 a switch was done to a version base on a BSD5.5 mail +program, because of signal handling problems (which I think were due +to bad compilation options). So no more POP support. Some patches +from Ken Whang included, the corresponding +README was: + + mailx-5.5-kw 5/30/95 + + + + + + WHAT'S IN THIS PATCH + + + + There are a bunch of little features, common in System V and SunOS + + versions of mailx, that are missing from the NetBSD-based version + + distributed with Linux. This patch attempts to fill in some of what's + + missing. + + + + Changes from debian mailx-5.5 include: + + + + 5/4/95: + + + + -- interpret prompt variable + + -- interpret ~a and ~A tilde escapes + + -- updated tildehelp list + + -- changed mail.rc to ignore nothing (just my personal preference) + + -- accept From lines with times of the form hh:mm (formerly took only hh:mm:ss) + + + + 5/7/95: + + + + -- Save (S) command saves to mailbox named after author + + -- take startup commands from file named by environment variable MAILRC + + + + 5/30/95: + + + + -- -H switch for header summary only + + + + Still to be done: + + + + -- pipe ~p output through PAGER (see type1 in cmd1.c for an example) + + -- save (s) by default to MBOX (instead of "No file specified.") + + -- ~q should save to dead.letter, ~x is not known + + -- update man page + + -- allnet and showto ("showto" shows recipient instead of sender if sender + + is current user) + + + + Possibly difficult: + + + + -- interpret editheaders variable as in SunOS version + + + + Bugs: + + + + -- ~a,~A tilde escapes leave an extra trailing blank on each line + + -- to conform to original style, I should really be using char *cp + + instead of new variables sig and prompt to be looking up variables + + -- -H switch implementation is kind of gross. grep for "hdronly" in + + source files; much room for improvement! + + + + + + HOW TO INSTALL + + + + Apply Sal Valente's debian patch first, so: + + + + tar xvfz mailx-5.5.tar.gz + + cd mailx-5.5 + + zcat ../mailx-5.5.debian.diff.gz | patch -p1 + + zcat ../mailx-5.5-kw.diff.gz | patch -p1 + + make + + + + Or you may wish to just uncompress the diff file and pick and choose + + the changes that you like. + + + + + + AUTHOR + + + + Ken Whang + +This version has no provision for the debian mail policy (permission +on /var/mail+dotfile locking), so Loic Prylli + finally recreate a package based on the OpenBSD +mail with the minimum number of patches to make it suited for debian +(see changelog). There is no more POP support, nor the added +functionality from Ken Whang, but all these patches are archived, so +mail if you want them to be incorporated. + + +Loic Prylli , Mon, 23 Dec 1996 00:13:13 +0100 + + +Sat Apr 4 14:05:38 CEST 1998: +After a security patch to fix tmp races, a number of things broke. +Here is what I have tried to fix them: +The rationale is to have all file openings go through safe_open: +File opened in mode "w", "w+", are created with O_EXCL mode, + (should coincide with temporary files or new files) +Files with "a" "a+" et "r+" mode do not require the O_EXCL files. "a+" et "r+" do not creat the file. + + +Still to do: check creat calls + + + + --- bsd-mailx-8.1.2-0.20081101cvs.orig/USD.doc/mail5.nr +++ bsd-mailx-8.1.2-0.20081101cvs/USD.doc/mail5.nr @@ -489,7 +489,7 @@ .. The .. .b local .. command is usually not used be general users since it is designed for -.. local configuration; it is usually found in the file /usr/lib/Mail.rc. +.. local configuration; it is usually found in the file /etc/mail.rc. .ip "\fBmail\fP\ \ " Send mail to one or more people. If you have the .i ask --- bsd-mailx-8.1.2-0.20081101cvs.orig/USD.doc/Makefile +++ bsd-mailx-8.1.2-0.20081101cvs/USD.doc/Makefile @@ -5,11 +5,15 @@ SRCS= mail0.nr mail1.nr mail2.nr mail3.nr mail4.nr mail5.nr mail6.nr \ mail7.nr mail8.nr mail9.nr maila.nr MACROS= -me +TBL=tbl -paper.ps: ${SRCS} - ${TBL} ${SRCS} | ${ROFF} > ${.TARGET} +all: manual.ps manual.txt -paper.txt: ${SRCS} - ${TBL} ${SRCS} | ${ROFF} -Tascii > ${.TARGET} +manual.ps: ${SRCS} + ${TBL} ${SRCS} | groff ${MACROS} -Tps > $@ -.include +manual.txt: ${SRCS} + ${TBL} ${SRCS} | groff ${MACROS} -Tascii > $@ + +clean : + -rm -f manual.ps manual.txt --- bsd-mailx-8.1.2-0.20081101cvs.orig/USD.doc/mail1.nr +++ bsd-mailx-8.1.2-0.20081101cvs/USD.doc/mail1.nr @@ -90,7 +90,7 @@ waiting in your system mailbox. If you are a .i csh user, you will be notified when new mail arrives if you inform -the shell of the location of your mailbox. On OpenBSD, +the shell of the location of your mailbox. On Debian, your system mailbox is located in the directory /var/mail in a file with your login name. If your login name is .q sam, --- bsd-mailx-8.1.2-0.20081101cvs.orig/EXT/bsd_utils.h +++ bsd-mailx-8.1.2-0.20081101cvs/EXT/bsd_utils.h @@ -0,0 +1,20 @@ +#ifndef BSD_UTLIS_H +#define BSD_UTILS_H + +/* + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. + */ +extern size_t strlcat(char *, const char *, size_t); + +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +extern size_t strlcpy(char *, const char *, size_t); + +#endif /* BSD_UTILS_H */ --- bsd-mailx-8.1.2-0.20081101cvs.orig/EXT/vis.c +++ bsd-mailx-8.1.2-0.20081101cvs/EXT/vis.c @@ -0,0 +1,219 @@ +/* $OpenBSD: vis.c,v 1.19 2005/09/01 17:15:49 millert Exp $ */ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') +#define isvisible(c) \ + (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \ + (((c) != '*' && (c) != '?' && (c) != '[' && (c) != '#') || \ + (flag & VIS_GLOB) == 0) && isgraph((u_char)(c))) || \ + ((flag & VIS_SP) == 0 && (c) == ' ') || \ + ((flag & VIS_TAB) == 0 && (c) == '\t') || \ + ((flag & VIS_NL) == 0 && (c) == '\n') || \ + ((flag & VIS_SAFE) && ((c) == '\b' || \ + (c) == '\007' || (c) == '\r' || \ + isgraph((u_char)(c))))) + +/* + * vis - visually encode characters + */ +char * +vis(char *dst, int c, int flag, int nextc) +{ + if (isvisible(c)) { + *dst++ = c; + if (c == '\\' && (flag & VIS_NOSLASH) == 0) + *dst++ = '\\'; + *dst = '\0'; + return (dst); + } + + if (flag & VIS_CSTYLE) { + switch(c) { + case '\n': + *dst++ = '\\'; + *dst++ = 'n'; + goto done; + case '\r': + *dst++ = '\\'; + *dst++ = 'r'; + goto done; + case '\b': + *dst++ = '\\'; + *dst++ = 'b'; + goto done; + case '\a': + *dst++ = '\\'; + *dst++ = 'a'; + goto done; + case '\v': + *dst++ = '\\'; + *dst++ = 'v'; + goto done; + case '\t': + *dst++ = '\\'; + *dst++ = 't'; + goto done; + case '\f': + *dst++ = '\\'; + *dst++ = 'f'; + goto done; + case ' ': + *dst++ = '\\'; + *dst++ = 's'; + goto done; + case '\0': + *dst++ = '\\'; + *dst++ = '0'; + if (isoctal(nextc)) { + *dst++ = '0'; + *dst++ = '0'; + } + goto done; + } + } + if (((c & 0177) == ' ') || (flag & VIS_OCTAL) || + ((flag & VIS_GLOB) && (c == '*' || c == '?' || c == '[' || c == '#'))) { + *dst++ = '\\'; + *dst++ = ((u_char)c >> 6 & 07) + '0'; + *dst++ = ((u_char)c >> 3 & 07) + '0'; + *dst++ = ((u_char)c & 07) + '0'; + goto done; + } + if ((flag & VIS_NOSLASH) == 0) + *dst++ = '\\'; + if (c & 0200) { + c &= 0177; + *dst++ = 'M'; + } + if (iscntrl((u_char)c)) { + *dst++ = '^'; + if (c == 0177) + *dst++ = '?'; + else + *dst++ = c + '@'; + } else { + *dst++ = '-'; + *dst++ = c; + } +done: + *dst = '\0'; + return (dst); +} + +/* + * strvis, strnvis, strvisx - visually encode characters from src into dst + * + * Dst must be 4 times the size of src to account for possible + * expansion. The length of dst, not including the trailing NULL, + * is returned. + * + * Strnvis will write no more than siz-1 bytes (and will NULL terminate). + * The number of bytes needed to fully encode the string is returned. + * + * Strvisx encodes exactly len bytes from src into dst. + * This is useful for encoding a block of data. + */ +int +strvis(char *dst, const char *src, int flag) +{ + char c; + char *start; + + for (start = dst; (c = *src);) + dst = vis(dst, c, flag, *++src); + *dst = '\0'; + return (dst - start); +} + +int +strnvis(char *dst, const char *src, size_t siz, int flag) +{ + char *start, *end; + char tbuf[5]; + int c, i; + + i = 0; + for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) { + if (isvisible(c)) { + i = 1; + *dst++ = c; + if (c == '\\' && (flag & VIS_NOSLASH) == 0) { + /* need space for the extra '\\' */ + if (dst < end) + *dst++ = '\\'; + else { + dst--; + i = 2; + break; + } + } + src++; + } else { + i = vis(tbuf, c, flag, *++src) - tbuf; + if (dst + i <= end) { + memcpy(dst, tbuf, i); + dst += i; + } else { + src--; + break; + } + } + } + if (siz > 0) + *dst = '\0'; + if (dst + i > end) { + /* adjust return value for truncation */ + while ((c = *src)) + dst += vis(tbuf, c, flag, *++src) - tbuf; + } + return (dst - start); +} + +int +strvisx(char *dst, const char *src, size_t len, int flag) +{ + char c; + char *start; + + for (start = dst; len > 1; len--) { + c = *src; + dst = vis(dst, c, flag, *++src); + } + if (len) + dst = vis(dst, *src, flag, '\0'); + *dst = '\0'; + return (dst - start); +} --- bsd-mailx-8.1.2-0.20081101cvs.orig/EXT/ChangeLog +++ bsd-mailx-8.1.2-0.20081101cvs/EXT/ChangeLog @@ -0,0 +1,1463 @@ +2008-10-09 06:48 jmc + + * main.c: + + - add -d to usage + - sync -f arg name with man page synopsis + +2008-10-08 21:05 martynas + + * mail.1: + + document -d. ok millert@ + +2008-08-05 17:15 sobrado + + * misc/mail.help: + + fix description of the mail(1) "p" command; from Aaron W. Hsu. + + ok martynas@ + +2008-08-03 14:30 martynas + + * cmdtab.c: + + make U (abbreviation of unread) work as man page says + ok millert@, jmc@. sure theo + +2008-07-16 15:14 martynas + + * send.c: + + 'no subject' check is never triggered. check if it's actually empty + ok millert@ + +2008-07-16 15:11 martynas + + * mail.1, main.c, send.c: + + add -E flag and 'skipempty' option to skip sending messages with + empty bodies. useful for sending mails from crontabs. + from rivo nurges , with missing 'skipempty' + documentation and usage update from me + ok millert@ + +2008-07-16 14:56 martynas + + * mail.1: + + man page tweaks: + - for argument of -f flag, name -> file + - document TMPDIR, better description from millert@ + ok millert@ + +2008-07-16 14:53 martynas + + * aux.c, cmd3.c, collect.c, head.c, send.c: + + - use strncmp/strncasecmp instead of comparing by character + - simplify istrlcpy, no need to check for isupper + - line[0] is redundant, because strcasecmp will take care of it + ok millert@ + +2008-07-16 14:49 martynas + + * edit.c, fio.c: + + - err with the pathbuf, if we know it + - use tmpdir instead of /tmp + ok millert@ + +2008-07-15 19:23 martynas + + * aux.c, extern.h, list.c: + + - chraise can be replaced with toupper; no need to check for islower + - remove quite some code, use strcasestr instead of reimplementing + it each time + - use strncasecmp, instead of comparing through each character + "looks fine" millert@ + +2008-07-15 19:13 martynas + + * cmd1.c: + + set cp to the value of PAGER, so that type1 doesn't try to use it + uninitialized (page=1), or use wrong previously-set value of crt + (page=0). ok millert@ + +2007-10-17 20:02 deraadt + + * edit.c: + + - Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) by + temporarily restoring default behaviour. This is not 100% ideal. + But this fixes editor handling in mail... bah, it is really unfortunate + that got broken + - refactor the restoration code as well, to make it simpler + ok ray + +2007-10-05 14:39 chl + + * fio.c: + + check if it's really a newline before removing it + + with the help of ray@ "Looks OK" millert@ + +2007-09-10 14:29 tobias + + * collect.c, edit.c, fio.c, quit.c: + + Proper use of fseek/fseeko macros. + + OK joris@, otto@ + +2007-08-31 23:14 ray + + * edit.c: + + Copy editit() from sendbug, synchronizing editor calling code. + + OK otto, millert, beck, mbalmer, deraadt. + +2007-08-06 19:16 sobrado + + * mail.1, main.c: + + the ellipsis is not an optional argument; while here, sync the usage + and synopsis of commands + + lots of good ideas by jmc@ + + ok jmc@ + +2007-06-19 05:47 ray + + * vars.c: + + Grammar-o. + + OK jmc + +2007-05-31 19:20 jmc + + * mail.1: + + convert to new .Dd format; + +2007-05-25 21:27 krw + + * fio.c: + + "interupt" -> "interrupt" in various comments. Mostly from Diego Casati. + +2007-04-03 18:01 martynas + + * cmd1.c: + + make it work with height 4 (division by zero) + ok millert@ + +2007-03-20 21:01 millert + + * send.c: + + Set umask to 077 when saving messages in the outbox (not enabled + by default). From veenhuizen at users dot sourceforge dot net + +2007-02-26 13:38 jmc + + * mail.1: + + more small fixes from Igor Sobrado, tweaked by myself; + +2007-02-26 13:17 jmc + + * mail.1: + + some small fixes from Igor Sobrado; + +2007-02-25 20:26 jmc + + * mail.1: + + remove bad comma; from Igor Sobrado + +2006-11-16 00:16 ray + + * fio.c: + + Fix undefined behavior (var = --var). + + From Alexey Dobriyan . + + OK moritz@ and jaredy@. + +2006-10-10 21:38 cloder + + * edit.c: + + fgets(3) returns NULL on error, not 0. No functional change, but it makes + the code easier to read. + OK deraadt + +2006-05-02 05:28 hugh + + * extern.h: + + Nuke a couple orphaned prototypes. + quoth deraadt: no problem + +2006-04-02 00:51 deraadt + + * fio.c: + + use SEEK_* for lseek() + +2006-03-04 16:18 miod + + * USD.doc/mail6.nr: + + the the + +2006-02-01 19:01 otto + + * quit.c: + + double semicolon; from Daniel Matic in PR 4929 + +2006-01-06 18:53 millert + + * extern.h: + + Adapt things to use __type_t instead of _BSD_TYPE_T_ + Add new sys/_types.h header + Include machine/_types.h or sys/_types.h where applicable + +2005-07-11 14:08 millert + + * list.c, tty.c: + + Fix off-by-one bug in readtty() and don't assume BUFSIZ == 1024. + Based on a patch from Ulf Harnhammar. + +2004-12-07 22:30 jmc + + * mail.1: + + remove unsupported paths; + from okan demirmen; + +2004-09-15 22:21 deraadt + + * aux.c, cmd2.c, cmdtab.c, extern.h, list.c: + + avoid aliasing against libc symbols + +2004-09-15 22:21 deraadt + + * popen.c: + + unused variable + +2004-06-04 00:07 jmc + + * mail.1: + + sync w/ usd docs; + ok millert@ + +2004-06-04 00:04 jmc + + * USD.doc/: mail0.nr, mail1.nr, mail2.nr, mail3.nr, mail4.nr, + mail5.nr, mail6.nr, mail8.nr, mail9.nr: + + update mail docs w/ reality; + help and ok millert@ + +2004-05-10 15:25 deraadt + + * edit.c, fio.c, lex.c: + + delint; millert ok + +2004-05-10 12:10 millert + + * cmd2.c, cmdtab.c, extern.h, lex.c: + + Get rid of the ancient "clobber" command. It was really only for debugging + purposes. Noticed and OK by deraadt@ + +2004-04-30 06:52 jmc + + * mail.1: + + missing full stop; + +2004-04-19 10:17 jmc + + * mail.1, main.c: + + - sort SYNOPSIS + - remove a load of unnecessary quoting and some groff cruft + - sort options list + - add usd doc to SEE ALSO + - sync usage() + +2004-02-01 15:19 jmc + + * USD.doc/Makefile: + + add paper.txt target; + +2004-01-03 20:26 millert + + * cmdtab.c: + + Silence a gcc warning: "initialization from incompatible pointer type" + The problem is that while ANSI C allows initialization of unions, + the initializer must be valid for the first member of the union. + Therefore, add a cast to quiet the compiler. Noticed and Ok pvalchev@ + +2004-01-03 20:06 millert + + * collect.c: + + Fix format type mismatch (int vs. ssize_t). + +2003-12-03 20:59 millert + + * cmd1.c: + + Change how the line output from the 'h' command is formatted. + Previously if you had an ungodly number of messages the line could + wrap the screen. We now format the line in a buffer and then only + print as many characters as will fit instead of printing the parts + piecemeal. + +2003-10-24 20:32 avsm + + * cmd2.c, collect.c, lex.c: + + dont compare int to NULL, millert@ ok + +2003-10-13 00:46 tedu + + * lex.c, list.c: + + better realloc. ok deraadt jose + +2003-09-04 22:14 jmc + + * mail.1: + + put escapes in the right place; + (i.e. stuff I got wrong the first time, or missed) + + this includes some .Cd's with missing quotes and .Nm abuse in man4; + +2003-09-04 14:09 jmc + + * mail.1: + + escape in the wrong place; + +2003-07-14 09:27 jmc + + * mail.1: + + remove some old groff macros; + +2003-07-07 21:36 deraadt + + * fio.c: + + protos + +2003-06-28 14:25 jmc + + * mail.1: + + use .Bk/.Ek to align the options in SYNOPSIS; + +2003-06-25 15:13 millert + + * def.h: + + Remove unused c_func0; noticed by deraadt@ + +2003-06-10 09:12 jmc + + * mail.1: + + - section reorder + - COMPATIBILITY merge + - macro cleanup + - kill whitespace at EOL + - new sentence, new line + + ssh pages ok markus@ + +2003-06-03 02:56 millert + + * aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, + edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, + list.c, mail.1, main.c, names.c, pathnames.h, popen.c, quit.c, + rcv.h, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, + version.c, USD.doc/mail0.nr, USD.doc/mail1.nr, USD.doc/mail2.nr, + USD.doc/mail3.nr, USD.doc/mail4.nr, USD.doc/mail5.nr, + USD.doc/mail6.nr, USD.doc/mail7.nr, USD.doc/mail8.nr, + USD.doc/mail9.nr, USD.doc/maila.nr: + + Remove the advertising clause in the UCB license which Berkeley + rescinded 22 July 1999. Proofed by myself and Theo. + +2003-05-15 02:47 pjanzen + + * cmd1.c, def.h, send.c: + + Use vis() on any remotely created input before displaying it on a screen. + deraadt@ ok + +2003-04-09 09:49 jmc + + * misc/mail.help: + + syetem -> system; + + from Marko Cehaja + closes PR 3187 + +2003-01-03 19:17 millert + + * mail.1: + + DEL hasn't sent SIGINTR in a looooong time. + +2002-11-14 02:57 deraadt + + * mail.1: + + use $ or # before commands in examples + +2002-10-07 22:45 vincent + + * getname.c: + + tyop + + ok deraadt@ + +2002-08-12 00:42 aaron + + * cmd3.c, vars.c: + + Swap args to calloc(3) so they are in the correct order; art@ ok. + +2002-06-14 21:35 todd + + * head.c: + + spelling; from Brian Poole + +2002-06-12 06:07 mpech + + * popen.c: + + a real pid_t cleanup. + + espie@ ok for make/, + deraadt@ one extra eye, + millert@ ok + +2002-04-13 19:09 millert + + * collect.c: + + Errata #23: + mail(1) will process tilde escapes even in non-interactive + mode. This can lead to a local root compromise. + Don't do tilde escapes unless we are in interactive mode. Now the + behavior matches the man page... + +2002-04-11 23:33 miod + + * collect.c: + + Errata #23: + mail(1) will process tilde escapes even in non-interactive + mode. This can lead to a local root compromise. + Fix (millert): + Don't do tilde escapes unless we are in interactive mode. Now the + behavior matches the man page... + +2002-04-08 20:27 millert + + * collect.c: + + Don't do tilde escapes unless we are in interactive mode. Now the + behavior matches the man page... + +2002-03-14 06:51 mpech + + * fio.c: + + Remove \n from err/errx/warn/warnx(). + + millert@ ok + +2002-02-16 21:27 millert + + * def.h: + + Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically. + +2002-01-24 23:01 millert + + * temp.c: + + Fix `necesary' typos; Alexander Yurchenko + + Alas many of these were introduced by yours truly as necessary + just doesn't look right to me for some reason ;-) + +2002-01-24 20:33 mickey + + * mail.1: + + fix the history refs + +2001-12-18 16:55 millert + + * fio.c: + + We need to adjust where "dot" points when we realloc(message). + Problem found by Mike Heffner of the FreeBSD project. + +2001-11-28 01:26 millert + + * extern.h, send.c: + + Catch SIGINT in sendmessage() so user can interupt a long message + that is being output. + + Make statusput() return an int and return -1 if ferror() + +2001-11-28 01:04 millert + + * tty.c: + + Fix typo; SIGTTIN where SIGINT meant and rename a variable for clarity. + +2001-11-23 00:03 millert + + * popen.c: + + Revert change to Popen() to only wrap command in a shell if it + contains meta characters since people may expect their aliases to + work. + Instead, just remove the "kill(lock_pid, SIGTERM);" since lockspool + now does the right thing when the pipe is closed. + +2001-11-21 20:41 millert + + * cmd1.c, cmd2.c, cmd3.c, lex.c, list.c, names.c, popen.c, tty.c, + vars.c: + + o kill strcpy() + o check return values of malloc and friends + o use strdup() when sensible + +2001-11-21 18:43 millert + + * names.c: + + fix arg reversal that was introduced during ANSIfication + +2001-11-21 15:28 millert + + * main.c: + + Fix extern decl of version missed in previous commit. + +2001-11-21 15:26 millert + + * aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, + edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, + list.c, main.c, names.c, popen.c, quit.c, send.c, strings.c, + temp.c, tty.c, v7.local.c, vars.c, version.c: + + o ANSIfy + o Style nits + o Use const to silent stupid -Wall warnings + o strnc{py,at} -> strlc{py,at} + o Use strpbrk() instead of homegrown anyof() + o Use NULL instead of #defines with 0 cast to a pointer + This still could use a proper audit + +2001-11-20 23:19 millert + + * popen.c: + + In private version of popen(), only wrap a command to be run in a + shell if it contains meta chars. Sneaky hack to work around a ksh + bug. + +2001-11-20 20:50 millert + + * aux.c, cmd1.c, cmd3.c, collect.c, def.h, edit.c, extern.h, fio.c, + glob.h, lex.c, main.c, quit.c, tty.c: + + Major signal overhaul. We no longer longjmp all over the place. + Instead, routines responsible to gathering user input (or in some + cases outputting data) catch the signals and set flags as needed. + Because of this some handlers are install without the SA_RESTART + flag so syscalls are not restarted and we can check the flag. All + signal handlers are now safe. + + This should make the flow of control a bit more grokable but the + code is still ugly. + +2001-11-17 19:10 deraadt + + * lex.c: + + properly bail out of incfile(); millert ok + +2001-11-16 17:10 millert + + * cmd1.c, extern.h: + + Instead of using a longjmp to catch SIGPIPE, just set to SIG_IGN and + check the return value on writes for error. + + Save and restore terminal modes when piping to a command so we end + up with a known good state if the command terminates uncleanly. + +2001-10-11 20:59 millert + + * main.c: + + missing arg to errx + +2001-10-04 04:23 pvalchev + + * pathnames.h: + + Fix path to /bin/ls; ok millert + +2001-09-16 16:12 millert + + * aux.c: + + Optimize space-eating loop since we've already checked that the + first char is a space. Patch from sacrificial-spam-address@horizon.com + +2001-09-16 15:27 millert + + * aux.c: + + 1) In skin(), only add a space after a comma if there is actually a space + in the input buffer. This prevents a rare buffer overflow on very long + header lines where one or more entries has a comment in it but the + entries have no space after the comma *and* the amount of extra space + needed to add a space after each comma is greater than the length of + the comments that will be removed. This is debian bug #108677 + + 2) In skin(), use a temporary variable in the realloc() and don't + die if realloc() fails since its only purpose is to shrink the + buffer, not expand it (and thus is not fatal). + +2001-09-07 01:19 millert + + * main.c: + + Sanity check length of -u argument to avoid truncation later on. + +2001-09-04 23:16 millert + + * popen.c: + + Fix bogus use of snprintf return value. Since we know the max + length of a username we can use that as part of the buffer size. + +2001-06-23 23:04 millert + + * cmd1.c, collect.c, lex.c, tty.c: + + Remove evil #ifdef __GNUC__ garbage to avoid longjmp clobbering and + use volatile instead. + +2001-01-19 04:11 millert + + * cmd3.c, edit.c, head.c, popen.c: + + More fixes from Don Beusee: + - edit and other interactive commands have no stdin (making the + command completely broken). + - messages with "From " line having date format with -0800 type of timezone + are not recognized correctly. + +2001-01-16 05:36 millert + + * aux.c, cmd1.c, cmd3.c, cmdtab.c, collect.c, def.h, extern.h, + fio.c, lex.c, list.c, names.c, pathnames.h, popen.c, quit.c, + send.c, vars.c, version.c: + + Changes from Don Beusee: + o escape From line with a leading '>' when needed + o only print To: address and Subject lines if actually present + o new variable 'allnet' to treat user@foo and user@bar as the same "user" + o folders command now takes an optional argument like ls. + o new "pipe" (|) command to pipe the message through an arbitrary command + o make header display format the same as SunOS 4.1.3 /usr/ucb/mail + o tilde commands work regardless of interactive mode. + o fix "read: Interrupted system call" error by retrying if EINTR + o expanded help file + Changes by me: + o read the help file via the PAGER as it is now more than 24 lines long + +2001-01-16 04:04 millert + + * misc/: mail.help, mail.tildehelp: + + Changes from Don Beusee: + o escape From line with a leading '>' when needed + o only print To: address and Subject lines if actually present + o new variable 'allnet' to treat user@foo and user@bar as the same "user" + o folders command now takes an optional argument like ls. + o new "pipe" (|) command to pipe the message through an arbitrary command + o make header display format the same as SunOS 4.1.3 /usr/ucb/mail + o tilde commands work regardless of interactive mode. + o fix "read: Interrupted system call" error by retrying if EINTR + o expanded help file + Changes by me: + o read the help file via the PAGER as it is now more than 24 lines long + +2000-11-09 17:52 aaron + + * mail.1: + + Change all option list specifications to ".Bl -tag -width Ds". Most man + pages just needed their -width parameter tweaked to "Ds", which provides + a nice width of 6 constant characters. For consistency more than anything. + +2000-10-06 21:16 jason + + * cmd1.c, cmd3.c, collect.c, names.c, popen.c, aux.c, edit.c, + lex.c, main.c, quit.c, send.c: + + Pull in patch from current (even more to come): + Fix (millert): + warnx?/errx? paranoia (use "%s" not a bare string unless it is a + constant). These are not security holes but it is worth fixing + them anyway both for robustness and so folks looking for examples + in the tree are not misled into doing something potentially dangerous. + Furthermore, it is a bad idea to assume that pathnames will not + include '%' in them and that error routines don't return strings + with '%' in them (especially in light of the possibility of locales). + +2000-08-23 21:24 mickey + + * extern.h, names.c, send.c: + + repair sendmail options handling + +2000-08-02 04:10 millert + + * cmd3.c, fio.c, temp.c: + + $HOME paranoia: never use getenv("HOME") w/o checking for NULL and non-zero + +2000-07-06 06:24 deraadt + + * lex.c: + + printf with % for the prompt + +2000-06-30 16:00 millert + + * cmd3.c, names.c, collect.c, aux.c, cmd1.c, edit.c, popen.c, + quit.c, send.c, lex.c, main.c: + + warnx?/errx? paranoia (use "%s" not a bare string unless it is a + constant). These are not security holes but it is worth fixing + them anyway both for robustness and so folks looking for examples + in the tree are not misled into doing something potentially dangerous. + Furthermore, it is a bad idea to assume that pathnames will not + include '%' in them and that error routines don't return strings + with '%' in them (especially in light of the possibility of locales). + +2000-06-26 23:18 hugh + + * mail.1: + + fix pasto; noted by art + +2000-06-11 21:03 millert + + * mail.1: + + newaliases(1) -> newaliases(8) + +2000-05-15 06:55 deraadt + + * mail.1: + + /etc/mail/aliases + +2000-04-26 15:47 millert + + * cmd1.c, cmd2.c, collect.c, extern.h, quit.c, send.c: + + Change the name of mail's send() function to sendmessages() to + avoid shadowing the libc send(2); gadams@avernus.com + +2000-04-25 16:42 millert + + * aux.c, cmd1.c, cmd3.c, extern.h, lex.c: + + When incorporating new messages, clear the "new" count before the + inc so the count of new messages is useful afterwards. This makes + mail behave more like the SunOS version in this respect. + +2000-04-12 21:47 aaron + + * mail.1: + + Trailing whitespace begone! + +2000-03-24 21:41 aaron + + * mail.1: + + Correct the HISTORY section to note that this command appeared in Version 5 + of AT&T UNIX, not Version 6. Verified by strings(1)'ing a .dsk file (PDP-11 + executable) containing the v5 sources, obtainable at gatekeeper.dec.com in the + directory /pub/DEC/sim/software. Idea from NetBSD PR/4790. + +2000-03-23 19:32 millert + + * names.c: + + When calling sendmail, use "--" to indicate end of command line arguments. + This prevents someone from sneaking arbitrary args to sendmail via + the Reply-To: or From: lines. + +2000-03-10 19:07 aaron + + * mail.1: + + Various cleanups and standardization. + +2000-03-04 20:02 aaron + + * mail.1: + + Try to standardize the options list introduction; it should read "The options + are as follows:", except in special cases. + +1999-10-16 20:47 aaron + + * mail.1: + + Formatting fixes. + +1999-06-05 01:21 aaron + + * mail.1: + + - remove trailing white space + - remove arguments from .Os macros + - remove arguments from .Nm macros, where appropriate + - some more Dq/Sq/Ql insanity + - still lots to do in the usr.bin tree... :/ + +1999-05-12 13:26 aaron + + * mail.1: + + grammar police: do not hyphenate compound words that act as adjectives if the + first word ends in -ly + + i.e., fully-qualified, newly-created, globally-visible, etc. are wrong + +1998-11-19 23:23 aaron + + * mail.1: + + significant cleanup; also s/INTRODUCTION/DESCRIPTION/, in particular for man -h + +1998-11-11 23:01 aaron + + * mail.1: + + remove redundant .Pp macros + +1998-09-27 21:20 millert + + * mail.1: + + mail -u foo is not really the same as mail -f /var/mail/foo + +1998-09-27 21:16 millert + + * glob.h, main.c, popen.c: + + Use new username option to lockspool for 'mail -u'. + +1998-09-26 19:55 aaron + + * mail.1: + + usr.bin/ man page fixes, f-m. + +1998-09-13 03:50 aaron + + * mail.1: + + typos + +1998-09-12 22:55 todd + + * misc/mail.help: + + document reality. + +1998-09-10 16:47 millert + + * mail.1: + + .Xr lockspool 1 + +1998-09-10 16:18 millert + + * popen.c, quit.c: + + Fix comments + +1998-09-10 16:06 millert + + * popen.c: + + If a child has not been waited on via the SIGCHLD handler, wait for it + ourselves instead of playing games with sigsuspend. This may fix PR 588. + +1998-09-10 16:04 millert + + * mail.1: + + make mail.1 nroff'able again + +1998-09-08 15:24 millert + + * popen.c: + + repair order of signal blocking that got changed in conversion to POSIX signals + +1998-09-08 14:59 millert + + * lex.c: + + Fix comments in .mailrc where there is no space after the hash (#). Noted by pjanzen@foatdi.harvard.edu + +1998-09-07 16:44 aaron + + * mail.1: + + More man page fixes. Particularly fix uses of it's/its, affect/effect, + then/than and such. Other miscellaneous problems fixed across these source + files. + +1998-09-06 22:23 aaron + + * mail.1: + + More man page fixes. Spelling, grammar, some typos. Lots of double-word + occurrences squashed as well. + +1998-09-01 16:38 deraadt + + * mail.1: + + more man page fixes; aaron@ug.cs.dal.ca + +1998-08-15 23:17 millert + + * pathnames.h, popen.c: + + use lockspool for locking, not 'mail.local -H' + +1998-07-16 06:05 millert + + * mail.1: + + mention MAIL environment variable + +1998-06-25 07:29 deraadt + + * mail.1: + + and mailx too.. + +1998-06-12 18:07 millert + + * collect.c, lex.c, popen.c: + + back out some signal changes that can cause mail to hang when quitting due to SIGCHLD blockage + +1998-06-12 17:51 millert + + * v7.local.c, fio.c, quit.c, popen.c: + + Don't call truncate() directly; have rm() do it if we get EPERM on unlink() + In popen.c, findchild() may return NULL so catch that case. + +1998-06-12 17:15 millert + + * v7.local.c: + + Properly delete messages that the user has deleted in his/her spool. + I fudged up the logic when I replaced an unlink with a truncate. + +1998-06-11 06:20 deraadt + + * fio.c: + + Don't segfault just because a line starts with NUL; ross + +1998-05-11 04:15 millert + + * cmd1.c: + + fix scrolling and 'z' command; matt debergalis + +1998-05-04 05:37 millert + + * collect.c, lex.c, popen.c, v7.local.c: + + Never remove a mail spool, as we may not have proper prics, just truncate. Also block signals in a few critical areas + +1998-04-25 00:41 deraadt + + * mail.1: + + doc startup behaviour; koshy@india.hp.com + +1998-04-25 00:19 deraadt + + * mail.1: + + fix usage; ru@ucb.crimea.ua + +1998-03-24 05:40 deraadt + + * mail.1: + + prettty + +1998-02-15 21:20 niklas + + * popen.c: + + Remove one case of malloc call from sighandler + +1997-11-14 00:23 millert + + * aux.c, cmd1.c, cmd2.c, cmd3.c, collect.c, edit.c, extern.h, + fio.c, head.c, lex.c, list.c, mail.1, main.c, names.c, popen.c, + quit.c, send.c, strings.c, temp.c, tty.c, vars.c: + + NetBSD changes (mostly comsmetic): + replace panic() with calls to err()/errx() + use S_IS* instead of doing by hand with S_IF*. + Use TIMESPEC_TO_TIMEVAL() and gettimeofday instead of time(2) + Use _POSIX_VDISABLE, not 0 + Kill register + +1997-11-13 03:30 millert + + * tty.c: + + Add back EXTPROC code now that tty_pty.c has the lite2 fix. + +1997-11-04 08:34 deraadt + + * mail.1: + + unbalanced parenthesis around command abbreviation in mail.1; h-nokubi@nmit.tmg.nec.co.jp + +1997-09-21 11:49 deraadt + + * Makefile: + + $OpenBSD$ + +1997-09-04 20:44 millert + + * fio.c: + + Deal with pairs in mailboxes so we can work with eudora mail + spools mounted from DOS/Windoze. From Matt Thomas . + +1997-08-31 14:32 millert + + * cmd2.c, fio.c, popen.c: + + Kill union wait. + +1997-08-05 04:00 deraadt + + * popen.c: + + pull errno.h in + +1997-08-04 19:25 deraadt + + * popen.c: + + save errno in sigchld handlers + +1997-08-04 17:30 millert + + * aux.c, list.c: + + Fix a problem in skin() that was introduced with the buffer oflow + fix. Could end up realloc'ing the wrong thing. + +1997-07-31 17:55 millert + + * tty.c: + + Remove TIOCEXT added in lite2 merge for now. Causes problems when + mail(1) is used over a telnet session. + +1997-07-31 02:48 millert + + * names.c: + + Another static buffer bytes the dust. + +1997-07-31 02:36 millert + + * aux.c, list.c: + + Document an assumption and kill a static buffer. + +1997-07-30 07:19 millert + + * aux.c, cmd2.c, cmd3.c, collect.c, extern.h, lex.c: + + Make istrcpy() take a size (not length) field, now called istrncpy(). + Change some strcpy() -> strncpy() out of paranoia. + +1997-07-30 06:32 millert + + * cmd1.c, cmd3.c, collect.c, extern.h, lex.c, main.c, tty.c, + v7.local.c: + + Fix one possible oflow (not exploitable) and do a wee bit of KNF. + Much more remains to be done. + +1997-07-28 15:20 millert + + * aux.c, fio.c: + + Dynamically allocate space for addr header strings instead of using + BUFSIZ. We know that the end size will be <= to the start size + so it is simple to preallocate enough space. Fixes NetBSD PR#3028 + +1997-07-28 10:01 deraadt + + * Makefile: + + install mail.rc at distribution time; bug found by explorer@flame.org + +1997-07-25 21:05 mickey + + * aux.c: + + #if __STDC__ --> #ifdef __STDC__ + +1997-07-24 17:27 millert + + * cmd1.c, collect.c, edit.c, extern.h, fio.c, lex.c, names.c, + quit.c, send.c, temp.c: + + tempnam(3) goes bye bye. + +1997-07-24 16:23 millert + + * extern.h, fio.c, lex.c, quit.c, temp.c: + + Replace 3 tempnam()'s with mkstemp. The two left look tricky. + +1997-07-22 19:13 millert + + * lex.c: + + incfile() needs to lock the mail spool so it doesn't get partial messages. + Noticed by Theo. + +1997-07-22 19:09 deraadt + + * dotlock.c: + + locking is done differently now + +1997-07-22 18:54 millert + + * cmd1.c, collect.c, extern.h, send.c, tty.c: + + grabh() now returns SIGINT if it was interrupted (previously always + returned 0 and the return val was always ignored). + Add gethfromtty() to get a header (using grabh) from the tty and + quit on two ^C's. + Use gethfromtty() when getting Subject, Cc, and Bcc headers so + we can quit nicely. Closes PR #291. + Don't use longs where it doesn't make sense. + +1997-07-22 18:26 millert + + * collect.c: + + Only require 2 ^C's at Subject: prompt to quit as it is supposed to. + Also in Subject: prompt, when we get that first ^C re-prompt for + the Subject: like SunOS does so the user knows what is going on. + +1997-07-22 06:46 millert + + * lex.c: + + Release signals when we get an error condition in incfile(). + +1997-07-18 18:12 millert + + * glob.h: + + Change jmp_buf to sigjmp_buf that I missed in the last sweep. + +1997-07-14 16:09 millert + + * popen.c: + + Don't call it a mask when it is a sigset_t (cosmetic changes only). + +1997-07-14 15:56 millert + + * collect.c, main.c, popen.c, send.c, tty.c: + + Convert remaining sigsetmask() -> sigprocmask() (POSIX style) + in collect.c and fix up some signal botches elsewhere. + +1997-07-14 00:24 millert + + * aux.c, cmd1.c, cmd2.c, cmd3.c, collect.c, def.h, edit.c, fio.c, + getname.c, head.c, lex.c, list.c, main.c, names.c, popen.c, + quit.c, send.c, strings.c, temp.c, tty.c, v7.local.c: + + NOSTR -> NULL + Use sigsetjmp/siglongjmp instead of sigjmp/longjmp for portability. + +1997-07-13 23:53 millert + + * aux.c, cmd1.c, cmd2.c, cmd3.c, collect.c, dotlock.c, edit.c, + fio.c, lex.c, main.c, names.c, popen.c, quit.c, send.c, + strings.c, tty.c, vars.c: + + bcopy() -> memcpy() and fix some casts. + +1997-07-13 23:35 millert + + * USD.doc/: Makefile, mail2.nr, mail4.nr, mail5.nr, mail6.nr, + mail8.nr, mail9.nr: + + Update from 44.BSD-lite2 + +1997-07-13 21:21 millert + + * aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, + dotlock.c, edit.c, extern.h, fio.c, getname.c, head.c, lex.c, + list.c, mail.1, main.c, names.c, popen.c, quit.c, send.c, + strings.c, temp.c, tty.c, v7.local.c, vars.c: + + Merge in NetBSD and 4.4BSD-lite2 changes as well as some of my own. + - handle long lines safely (from NetBSD) + - use puts/fputs and putchar/putc when it makes sense + - use err/errx and warn/warnx when it makes sense + - make return() and sizeof() style consisten + - some more buffer safety + +1997-06-18 23:52 deraadt + + * version.c: + + crank version number, we have made a few changes... + +1997-06-16 20:57 millert + + * v7.local.c: + + Use buflen, not sizeof(buf) as buf is a pointer. + +1997-06-02 17:00 dm + + * v7.local.c: + + buflen != sizeof (char *) + +1997-05-30 08:51 deraadt + + * aux.c, cmd1.c, cmd3.c, extern.h, fio.c, lex.c, list.c, popen.c, + v7.local.c: + + overflows abound + +1997-04-27 20:56 millert + + * Makefile: + + COPY -> INSTALL_COPY and STRIP -> INSTALL_STRIP + This fixes namespace problems where STRIP is sometimes used as + the name of the strip(1) to use and other times used as + the flag to send install(1) when stripping (or not). + COPY doesn't have this problem (yet) but was poorly named. + +1997-04-13 20:32 deraadt + + * collect.c: + + single ^C on a pipe + +1997-04-13 20:22 deraadt + + * collect.c: + + do not (continue) on a stdin pipe + +1997-04-10 15:33 deraadt + + * collect.c: + + how is this for fast bug fixing response! revert to sigblock() since the + sigprocmask() code was not equivelant. report from grr@shandakor.tharsis.com, + PR#154 + +1997-03-29 03:01 millert + + * Makefile, cmd1.c, cmd3.c, def.h, extern.h, fio.c, pathnames.h, + popen.c, quit.c, temp.c: + + Use ``mail.local -H'' to do dot locking so we can have mode 755 mail + spool, change an occurrence of tempnam() to mkstemp(), change some + longs and shorts to ints. Mail is now usable again. + +1997-02-03 00:25 deraadt + + * def.h: + + use a long line counter, netbsd pr#3083, rhialto@polder.ubc.kun.nl + +1997-01-17 07:12 millert + + * aux.c, fio.c, lex.c, list.c, names.c: + + r?index -> strr?chr + +1997-01-15 23:42 millert + + * main.c: + + getopt(3) returns -1 when out of args, not EOF, whee! + +1997-01-13 20:36 deraadt + + * mail.1: + + doc "more" command; jdc@orthanc.ncl.ac.uk + +1996-12-08 14:32 downsj + + * Makefile: + + install -> ${INSTALL}, -c -> ${COPY} + +1996-10-28 00:42 millert + + * temp.c: + + Ignore $HOME if > MAXPATHLEN + +1996-10-26 05:11 millert + + * mail.1, v7.local.c: + + honor $LOGNAME + +1996-09-16 02:26 deraadt + + * main.c, temp.c: + + _PATH_TMP -> _PATH_TMPFILE; avoid /tmp//fooXXXX where possible too + +1996-06-26 21:22 dm + + * popen.c: + + Accept NULL nset in prepare child (as run_editor will try to use one). + +1996-06-11 12:53 deraadt + + * Makefile, aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, + def.h, dotlock.c, edit.c, extern.h, fio.c, getname.c, glob.h, + head.c, lex.c, list.c, mail.1, main.c, names.c, pathnames.h, + popen.c, quit.c, rcv.h, send.c, strings.c, temp.c, tty.c, + v7.local.c, vars.c, version.c, USD.doc/Makefile, + USD.doc/mail0.nr, USD.doc/mail1.nr, USD.doc/mail2.nr, + USD.doc/mail3.nr, USD.doc/mail4.nr, USD.doc/mail5.nr, + USD.doc/mail6.nr, USD.doc/mail7.nr, USD.doc/mail8.nr, + USD.doc/mail9.nr, USD.doc/maila.nr: + + from christos; + - Fix PR/105: Implement dot locking protocol and check return value of flock. + - Fix PR/2247: Don't call unknown users "ubluit". Issue an error message. + - Fix/add prototypes. + - Fix warnings. + - Use POSIX signal mask calls. + +1996-03-27 19:32 niklas + + * Makefile, cmd1.c, cmdtab.c, extern.h, lex.c: + + From NetBSD: merge of 960317 + +1995-10-18 08:45 deraadt + + * Makefile, aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, + def.h, edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, + list.c, mail.1, main.c, names.c, pathnames.h, popen.c, quit.c, + rcv.h, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, + version.c, USD.doc/Makefile, USD.doc/mail0.nr, USD.doc/mail1.nr, + USD.doc/mail2.nr, USD.doc/mail3.nr, USD.doc/mail4.nr, + USD.doc/mail5.nr, USD.doc/mail6.nr, USD.doc/mail7.nr, + USD.doc/mail8.nr, USD.doc/mail9.nr, USD.doc/maila.nr, + misc/mail.help, misc/mail.rc, misc/mail.tildehelp: + + Initial revision + +1995-10-18 08:45 deraadt + + * Makefile, aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, + def.h, edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, + list.c, mail.1, main.c, names.c, pathnames.h, popen.c, quit.c, + rcv.h, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, + version.c, USD.doc/Makefile, USD.doc/mail0.nr, USD.doc/mail1.nr, + USD.doc/mail2.nr, USD.doc/mail3.nr, USD.doc/mail4.nr, + USD.doc/mail5.nr, USD.doc/mail6.nr, USD.doc/mail7.nr, + USD.doc/mail8.nr, USD.doc/mail9.nr, USD.doc/maila.nr, + misc/mail.help, misc/mail.rc, misc/mail.tildehelp: + + initial import of NetBSD tree + --- bsd-mailx-8.1.2-0.20081101cvs.orig/EXT/vis.h +++ bsd-mailx-8.1.2-0.20081101cvs/EXT/vis.h @@ -0,0 +1,90 @@ +/* $OpenBSD: vis.h,v 1.11 2005/08/09 19:38:31 millert Exp $ */ +/* $NetBSD: vis.h,v 1.4 1994/10/26 00:56:41 cgd Exp $ */ + +/*- + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)vis.h 5.9 (Berkeley) 4/3/91 + */ + +#ifndef _VIS_H_ +#define _VIS_H_ + +/* + * to select alternate encoding format + */ +#define VIS_OCTAL 0x01 /* use octal \ddd format */ +#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */ + +/* + * to alter set of characters encoded (default is to encode all + * non-graphic except space, tab, and newline). + */ +#define VIS_SP 0x04 /* also encode space */ +#define VIS_TAB 0x08 /* also encode tab */ +#define VIS_NL 0x10 /* also encode newline */ +#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL) +#define VIS_SAFE 0x20 /* only encode "unsafe" characters */ + +/* + * other + */ +#define VIS_NOSLASH 0x40 /* inhibit printing '\' */ +#define VIS_GLOB 0x100 /* encode glob(3) magics and '#' */ + +/* + * unvis return codes + */ +#define UNVIS_VALID 1 /* character valid */ +#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */ +#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */ +#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */ +#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */ + +/* + * unvis flags + */ +#define UNVIS_END 1 /* no more characters */ + +#include + +__BEGIN_DECLS +char *vis(char *, int, int, int); +int strvis(char *, const char *, int); +int strnvis(char *, const char *, size_t, int) +/* __attribute__ ((__bounded__(__string__,1,3)))*/; +int strvisx(char *, const char *, size_t, int) +/* __attribute__ ((__bounded__(__string__,1,3)))*/; +int strunvis(char *, const char *); +int unvis(char *, char, int *, int); +ssize_t strnunvis(char *, const char *, size_t) +/* __attribute__ ((__bounded__(__string__,1,3)))*/; + +__END_DECLS + +#endif /* !_VIS_H_ */ --- bsd-mailx-8.1.2-0.20081101cvs.orig/EXT/strlcpy.c +++ bsd-mailx-8.1.2-0.20081101cvs/EXT/strlcpy.c @@ -0,0 +1,51 @@ +/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ + +/* + * Copyright (c) 1998 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +size_t +strlcpy(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0) { + while (--n != 0) { + if ((*d++ = *s++) == '\0') + break; + } + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +} --- bsd-mailx-8.1.2-0.20081101cvs.orig/EXT/README +++ bsd-mailx-8.1.2-0.20081101cvs/EXT/README @@ -0,0 +1,13 @@ +This directory is not part of upstream source, but it contains files +which are needed to compile current CVS snapshots of mailx. + +Files strlcat.c and strlcmp.c were taken from OpenBSD CVS repository +module src/lib/libc/string. +File vis.c was taken from module src/lib/libc/gen, and vis.h from +module src/include. + +File bsd_utils.h was written by me. + +ChangeLog was generated using `cvs2cl --no-wrap --gmt -S' command. + +-- Robert Luberda Thu, 22 May 2003 21:01:53 +0200 --- bsd-mailx-8.1.2-0.20081101cvs.orig/EXT/strlcat.c +++ bsd-mailx-8.1.2-0.20081101cvs/EXT/strlcat.c @@ -0,0 +1,55 @@ +/* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */ + +/* + * Copyright (c) 1998 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include + +/* + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. + */ +size_t +strlcat(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + size_t dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; + + if (n == 0) + return(dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; + + return(dlen + (s - src)); /* count does not include NUL */ +}