From 168a700cc6ac55ed7b0682f60c7fe7f4d73a0116 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sat, 17 Mar 2001 10:29:50 +1100 Subject: - Support usrinfo() on AIX. Based on patch from Gert Doering --- session.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'session.c') 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 */ -- cgit v1.2.3