From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 14 17:20:34 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E26C1065672 for ; Mon, 14 Dec 2009 17:20:34 +0000 (UTC) (envelope-from nate@thatsmathematics.com) Received: from euclid.ucsd.edu (euclid.ucsd.edu [132.239.145.52]) by mx1.freebsd.org (Postfix) with ESMTP id 3FE978FC08 for ; Mon, 14 Dec 2009 17:20:33 +0000 (UTC) Received: from zeno.ucsd.edu (zeno.ucsd.edu [132.239.145.22]) by euclid.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id nBEHKXo20901; Mon, 14 Dec 2009 09:20:33 -0800 (PST) Received: from localhost (neldredg@localhost) by zeno.ucsd.edu (8.11.7p3+Sun/8.11.7) with ESMTP id nBEHKXU10966; Mon, 14 Dec 2009 09:20:33 -0800 (PST) X-Authentication-Warning: zeno.ucsd.edu: neldredg owned process doing -bs Date: Mon, 14 Dec 2009 09:20:33 -0800 (PST) From: Nate Eldredge X-X-Sender: neldredg@zeno.ucsd.edu To: Holger Kunst In-Reply-To: <4B265E27.8050906@moneyfitness.com> Message-ID: References: <4B265E27.8050906@moneyfitness.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: Email sent from "at" command going to the wrong account X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Dec 2009 17:20:34 -0000 On Mon, 14 Dec 2009, Holger Kunst wrote: > Hi, > > The "at" command sends an email with the output of the scheduled job. I've > experienced inconsistent results when running jobs, receiving emails in > accounts not associated with the user currently logged in. > > To reproduce in FreeBSD 7.2-RELEASE-p2 > > Case #1 > login as user a (new shell through ssh) > echo "echo 1" | at now > --> user a will receive an email containing "1" - this is as expected > > Case #2 > login as user a (new shell through ssh) > login as user b How are you accomplishing this? > exit > echo "echo 1" | at now > --> user b will receive an email containing "1" - this is not as expected, > since I am user a again > > A look at the source for "at" reveals that "at" is getting the mailname from > getlogin(). Running a small test program that outputs getlogin(), confirms > the above behavior: A log-in and out of another account makes getlogin() > return that account's name, even though the shell has been closed and we are > back to the original shell and the original user a. > > Is this the intended behavior? Any hints would be appreciated. -- Nate Eldredge nate@thatsmathematics.com