diff --git a/ChangeLog b/ChangeLog index 1d61ae639..efbc64644 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20010317 + - Support usrinfo() on AIX. Based on patch from Gert Doering + + 20010315 - OpenBSD CVS Sync - markus@cvs.openbsd.org 2001/03/14 08:57:14 @@ -4559,4 +4563,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.960 2001/03/15 00:09:15 mouring Exp $ +$Id: ChangeLog,v 1.961 2001/03/16 23:29:50 djm Exp $ diff --git a/session.c b/session.c index 4562b6d72..3c53f5cc1 100644 --- a/session.c +++ b/session.c @@ -89,6 +89,10 @@ RCSID("$OpenBSD: session.c,v 1.59 2001/03/04 01:46:30 djm Exp $"); # define S_UNOFILE_HARD S_UNOFILE "_hard" #endif +#ifdef _AIX +# include +#endif + /* types */ #define TTYSZ 64 @@ -1136,6 +1140,23 @@ do_child(const char *command, struct passwd * pw, const char *term, } #endif /* WITH_IRIX_AUDIT */ +#ifdef _AIX + /* + * AIX has a "usrinfo" area where logname and + * other stuff is stored - a few applications + * actually use this and die if it's not set + */ + cp = xmalloc(22 + strlen(ttyname) + + 2 * strlen(pw->pw_name)); + i = sprintf(cp, "LOGNAME=%s%cNAME=%s%cTTY=%s%c%c", + pw->pw_name, 0, pw->pw_name, 0, ttyname, 0,0); + if (usrinfo(SETUINFO, cp, i) == -1) + fatal("Couldn't set usrinfo: %s", + strerror(errno)); + debug3("AIX/UsrInfo: set len %d", i); + xfree(cp); +#endif + /* Permanently switch to the desired uid. */ permanently_set_uid(pw->pw_uid); # endif /* HAVE_LOGIN_CAP */