port-aix.c revision 98937
1219820Sjeff#include "includes.h"
2219820Sjeff
3219820Sjeff#ifdef _AIX
4219820Sjeff
5271127Shselasky#include <uinfo.h>
6219820Sjeff#include <../xmalloc.h>
7219820Sjeff
8219820Sjeff/*
9219820Sjeff * AIX has a "usrinfo" area where logname and
10219820Sjeff * other stuff is stored - a few applications
11219820Sjeff * actually use this and die if it's not set
12219820Sjeff */
13219820Sjeffvoid
14219820Sjeffaix_usrinfo(struct passwd *pw, char *tty, int ttyfd)
15219820Sjeff{
16219820Sjeff	u_int i;
17219820Sjeff	char *cp=NULL;
18219820Sjeff
19219820Sjeff	if (ttyfd == -1)
20219820Sjeff		tty[0] = '\0';
21219820Sjeff	cp = xmalloc(22 + strlen(tty) + 2 * strlen(pw->pw_name));
22219820Sjeff	i = sprintf(cp, "LOGNAME=%s%cNAME=%s%cTTY=%s%c%c", pw->pw_name, 0,
23219820Sjeff	    pw->pw_name, 0, tty, 0, 0);
24219820Sjeff	if (usrinfo(SETUINFO, cp, i) == -1)
25219820Sjeff		fatal("Couldn't set usrinfo: %s", strerror(errno));
26219820Sjeff	debug3("AIX/UsrInfo: set len %d", i);
27219820Sjeff	xfree(cp);
28219820Sjeff}
29219820Sjeff
30219820Sjeff#endif /* _AIX */
31219820Sjeff
32219820Sjeff