summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-aix.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-19 00:13:38 +1000
committerDamien Miller <djm@mindrot.org>2003-05-19 00:13:38 +1000
commit317412502b900ddecdafdfa171da99271846478b (patch)
tree2e04f618288cdf0c16a98b675b28b8287a15a0c6 /openbsd-compat/port-aix.c
parente323df6c4851b04386e747a009474f469fe97137 (diff)
- (djm) Big KNF on openbsd-compat/
Diffstat (limited to 'openbsd-compat/port-aix.c')
-rw-r--r--openbsd-compat/port-aix.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index cddc0907..7a42810e 100644
--- a/openbsd-compat/port-aix.c
+++ b/openbsd-compat/port-aix.c
@@ -46,14 +46,18 @@ void
aix_usrinfo(struct passwd *pw)
{
u_int i;
+ size_t len;
char *cp;
- cp = xmalloc(16 + 2 * strlen(pw->pw_name));
- i = sprintf(cp, "LOGNAME=%s%cNAME=%s%c", pw->pw_name, 0,
- pw->pw_name, 0);
+ len = sizeof("LOGNAME= NAME= ") + (2 * strlen(pw->pw_name));
+ cp = xmalloc(len);
+
+ i = snprintf(cp, "LOGNAME=%s%cNAME=%s%c", pw->pw_name, '\0',
+ pw->pw_name, '\0', len);
if (usrinfo(SETUINFO, cp, i) == -1)
fatal("Couldn't set usrinfo: %s", strerror(errno));
debug3("AIX/UsrInfo: set len %d", i);
+
xfree(cp);
}
@@ -64,8 +68,9 @@ aix_usrinfo(struct passwd *pw)
void
record_failed_login(const char *user, const char *ttyname)
{
- loginfailed(user,
- get_canonical_hostname(options.verify_reverse_mapping), ttyname);
+ char *hostname = get_canonical_hostname(options.verify_reverse_mapping);
+
+ loginfailed(user, hostname, ttyname);
}
# endif /* CUSTOM_FAILED_LOGIN */
#endif /* _AIX */