[23318] in Source-Commits
/svn/athena r22974 - in trunk/athena/bin/session: . debian
daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Mon May 12 13:38:53 2008
Date: Mon, 12 May 2008 13:38:42 -0400 (EDT)
From: ghudson@MIT.EDU
Message-Id: <200805121738.NAA19594@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: ghudson
Date: 2008-05-12 13:38:40 -0400 (Mon, 12 May 2008)
New Revision: 22974
Modified:
trunk/athena/bin/session/debian/changelog
trunk/athena/bin/session/session_gate.c
Log:
In session:
* For bash users, execute .bash_logout instead of .logout.
* Execute the logout dotfile in the user's shell.
Modified: trunk/athena/bin/session/debian/changelog
===================================================================
--- trunk/athena/bin/session/debian/changelog 2008-05-10 17:05:46 UTC (rev 22973)
+++ trunk/athena/bin/session/debian/changelog 2008-05-12 17:38:40 UTC (rev 22974)
@@ -1,3 +1,10 @@
+debathena-session (10.0.0-0debathena1) unstable; urgency=low
+
+ * For bash users, execute .bash_logout instead of .logout.
+ * Execute the logout dotfile in the user's shell.
+
+ -- Greg Hudson <ghudson@mit.edu> Mon, 12 May 2008 13:36:50 -0400
+
debathena-session (9.4.0-0debathena1) unstable; urgency=low
* Initial release.
Modified: trunk/athena/bin/session/session_gate.c
===================================================================
--- trunk/athena/bin/session/session_gate.c 2008-05-10 17:05:46 UTC (rev 22973)
+++ trunk/athena/bin/session/session_gate.c 2008-05-12 17:38:40 UTC (rev 22974)
@@ -331,6 +331,8 @@
{
int f;
struct sigaction sa;
+ char* shell;
+ char* logoutname;
/* Ignore Alarm in child since HUP probably arrived during
* sleep() in main loop.
@@ -340,7 +342,14 @@
sa.sa_handler = SIG_IGN;
sigaction(SIGALRM, &sa, NULL);
unlink(filename);
- f = open(".logout", O_RDONLY, 0);
+ shell = getenv("SHELL");
+ if (!shell)
+ shell = "/bin/athena/tcsh";
+ if (strlen(shell) >= 5 && strcmp(shell + strlen(shell) - 5, "/bash") == 0)
+ logoutname = ".bash_logout";
+ else
+ logoutname = ".logout";
+ f = open(logoutname, O_RDONLY, 0);
if (f >= 0) {
char buf[2];
@@ -348,11 +357,11 @@
exit(0);
lseek(f, 0, SEEK_SET);
if (!memcmp(buf, "#!", 2))
- execl(".logout", ".logout", 0);
+ execl(logoutname, logoutname, 0);
/* if .logout wasn't executable, silently fall through to
old behavior */
dup2(f, 0);
- execl("/bin/athena/tcsh", "logout", 0);
+ execl(shell, "logout", 0);
}
exit(0);
}