Date: Thu, 12 Nov 1998 06:45:40 -0800 (PST) From: odip@bionet.nsc.ru To: freebsd-gnats-submit@FreeBSD.ORG Subject: bin/8665: /usr/bin/mail -u user not worked if exists $MAIL Message-ID: <199811121445.GAA13023@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 8665 >Category: bin >Synopsis: /usr/bin/mail -u user not worked if exists $MAIL >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 12 06:50:01 PST 1998 >Last-Modified: >Originator: Grigorovich Dmitry >Organization: ICiG >Release: 3.0-RELEASE >Environment: FreeBSD ghost.bionet.nsc.ru 3.0-RELEASE FreeBSD 3.0-RELEASE #0: Thu Nov 5 17:36 :19 NS 1998 root@ghost.bionet.nsc.ru:/usr/src/sys/compile/ODIPN i386 >Description: In FreeBSD 3.0-RELEASE ( and lower versions ! ) if environment variable MAIL exists, then "/usr/bin/mail -u user" always open mailbox ${MAIL} In FreeBSD 3.0 by default exists $MAIL ( via /etc/login.conf ) "/usr/bin/mail -u user" under root always open MAIL=/var/mail/root, though "/usr/bin/mail -f /var/mail/user" worked fine Also in "man mail" we reading: -u Is equivalent to: mail -f /var/mail/user I look at code of mail program and found that this is not true, if exists environment variable $MAIL >How-To-Repeat: Under root and /bin/sh type: MAIL=/var/mail/root mail -u user where user - some user in your system Always opened /var/mail/root file ! >Fix: --- /usr/src/usr.bin/mail/main.c.orig Fri Jan 2 22:43:50 1998 +++ /usr/src/usr.bin/mail/main.c Sun Nov 1 03:18:09 1998 @@ -64,6 +64,7 @@ char *subject, *replyto; char *ef, *cp; char nosrc = 0; + char xname[PATHSIZE]; void hdrstop(); sig_t prevint; void sigchild(); @@ -110,6 +111,8 @@ * Next argument is person to pretend to be. */ myname = optarg; + snprintf( xname, sizeof(xname), "%s/%s", _PATH_MAILDIR, myname ); + ef= xname; break; case 'i': /* >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811121445.GAA13023>