Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 1 | #include "includes.h" |
| 2 | |
| 3 | #ifdef _AIX |
| 4 | |
| 5 | #include <uinfo.h> |
Ben Lindstrom | 127398c | 2002-02-24 20:25:46 +0000 | [diff] [blame] | 6 | #include <../xmalloc.h> |
Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 7 | |
Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 8 | /* |
| 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 | */ |
| 13 | void |
Ben Lindstrom | 127398c | 2002-02-24 20:25:46 +0000 | [diff] [blame] | 14 | aix_usrinfo(struct passwd *pw, char *tty, int ttyfd) |
Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 15 | { |
Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 16 | u_int i; |
Ben Lindstrom | 127398c | 2002-02-24 20:25:46 +0000 | [diff] [blame] | 17 | char *cp=NULL; |
Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 18 | |
Ben Lindstrom | 127398c | 2002-02-24 20:25:46 +0000 | [diff] [blame] | 19 | if (ttyfd == -1) |
| 20 | tty[0] = '\0'; |
| 21 | cp = xmalloc(22 + strlen(tty) + 2 * strlen(pw->pw_name)); |
Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 22 | i = sprintf(cp, "LOGNAME=%s%cNAME=%s%cTTY=%s%c%c", pw->pw_name, 0, |
Ben Lindstrom | 127398c | 2002-02-24 20:25:46 +0000 | [diff] [blame] | 23 | pw->pw_name, 0, tty, 0, 0); |
Ben Lindstrom | a9c039c | 2002-02-19 20:27:55 +0000 | [diff] [blame] | 24 | 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 | |