Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Dec 2009 09:20:33 -0800 (PST)
From:      Nate Eldredge <nate@thatsmathematics.com>
To:        Holger Kunst <hkunst@moneyfitness.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Email sent from "at" command going to the wrong account
Message-ID:  <Pine.GSO.4.64.0912140919480.5432@zeno.ucsd.edu>
In-Reply-To: <4B265E27.8050906@moneyfitness.com>
References:  <4B265E27.8050906@moneyfitness.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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