blob: ca0a88e692ac3a797ca3a5e2f315ed012db562cc [file] [log] [blame]
Ben Lindstroma9c039c2002-02-19 20:27:55 +00001#include "includes.h"
2
3#ifdef _AIX
4
5#include <uinfo.h>
Ben Lindstrom127398c2002-02-24 20:25:46 +00006#include <../xmalloc.h>
Ben Lindstroma9c039c2002-02-19 20:27:55 +00007
Ben Lindstroma9c039c2002-02-19 20:27:55 +00008/*
9 * AIX has a "usrinfo" area where logname and
10 * other stuff is stored - a few applications
11 * actually use this and die if it's not set
12 */
13void
Ben Lindstrom127398c2002-02-24 20:25:46 +000014aix_usrinfo(struct passwd *pw, char *tty, int ttyfd)
Ben Lindstroma9c039c2002-02-19 20:27:55 +000015{
Ben Lindstroma9c039c2002-02-19 20:27:55 +000016 u_int i;
Ben Lindstrom127398c2002-02-24 20:25:46 +000017 char *cp=NULL;
Ben Lindstroma9c039c2002-02-19 20:27:55 +000018
Ben Lindstrom127398c2002-02-24 20:25:46 +000019 if (ttyfd == -1)
20 tty[0] = '\0';
21 cp = xmalloc(22 + strlen(tty) + 2 * strlen(pw->pw_name));
Ben Lindstroma9c039c2002-02-19 20:27:55 +000022 i = sprintf(cp, "LOGNAME=%s%cNAME=%s%cTTY=%s%c%c", pw->pw_name, 0,
Ben Lindstrom127398c2002-02-24 20:25:46 +000023 pw->pw_name, 0, tty, 0, 0);
Ben Lindstroma9c039c2002-02-19 20:27:55 +000024 if (usrinfo(SETUINFO, cp, i) == -1)
25 fatal("Couldn't set usrinfo: %s", strerror(errno));
26 debug3("AIX/UsrInfo: set len %d", i);
27 xfree(cp);
28}
29
30#endif /* _AIX */
31