From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 14 16:15:11 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 783091065676 for ; Mon, 14 Dec 2009 16:15:11 +0000 (UTC) (envelope-from hkunst@moneyfitness.com) Received: from mail.truebridge.com (mail.truebridge.com [216.75.192.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0E8A68FC1E for ; Mon, 14 Dec 2009 16:15:10 +0000 (UTC) Received: (qmail 21964 invoked from network); 14 Dec 2009 10:48:29 -0500 Received: from static-71-243-118-33.bos.east.verizon.net (HELO ?192.168.199.40?) (hkunst@71.243.118.33) by mail.truebridge.com with SMTP; 14 Dec 2009 10:48:29 -0500 Message-ID: <4B265E27.8050906@moneyfitness.com> Date: Mon, 14 Dec 2009 10:47:51 -0500 From: Holger Kunst User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091204 Lightning/1.0pre Thunderbird/3.0 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Mon, 14 Dec 2009 17:11:36 +0000 Subject: 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 16:15:11 -0000 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 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. Best regards, Holger Kunst