diff options
author | Steve Langasek <vorlon@debian.org> | 2000-12-13 23:31:09 +0000 |
---|---|---|
committer | Steve Langasek <vorlon@debian.org> | 2000-12-13 23:31:09 +0000 |
commit | 64adffdf31943da265afc4f8d82de49038fafc05 (patch) | |
tree | 456218247d3b53fe3aea0fd5f091ce88bac23fec | |
parent | bc2dabd9ac9892cb7c1a6a436c6250fafabd7d25 (diff) | |
download | pam-64adffdf31943da265afc4f8d82de49038fafc05.tar.gz pam-64adffdf31943da265afc4f8d82de49038fafc05.tar.bz2 pam-64adffdf31943da265afc4f8d82de49038fafc05.zip |
Relevant BUGIDs: 125704, 124930
Purpose of commit: portable handling of utmp in pam_unix
Commit summary:
---------------
Fixes problem with PAM_getlogin() on Solaris (and hopefully other Unices),
as per David Lee's report.
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | modules/pam_unix/support.c | 8 |
2 files changed, 6 insertions, 4 deletions
@@ -35,6 +35,8 @@ Where you should replace XXXXX with a bug-id. 0.74: please submit patches for this section with actual code/doc patches! +* improved portability of pam_unix by eliminating Linux-specific utmp + defines in PAM_getlogin() (Bug 125704 - vorlon) * removed static variables from pam_tally (Bug 117434 - agmorgan) * added copyright message to pam_access module from original logdaemon sources (Bug 125022 - agmorgan) diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c index a0f2c52d..db147b31 100644 --- a/modules/pam_unix/support.c +++ b/modules/pam_unix/support.c @@ -94,14 +94,14 @@ int _make_remark(pam_handle_t * pamh, unsigned int ctrl } /* - * Beacause getlogin() is fucked in a weird way, and - * sometimes it just don't work, we reimplement it here. + * Beacause getlogin() is braindead and sometimes it just + * doesn't work, we reimplement it here. */ char *PAM_getlogin(void) { struct utmp *ut, line; char *curr_tty, *retval; - static char curr_user[UT_NAMESIZE + 4]; + static char curr_user[sizeof(ut->ut_user) + 4]; retval = NULL; @@ -112,7 +112,7 @@ char *PAM_getlogin(void) setutent(); strncpy(line.ut_line, curr_tty, sizeof line.ut_line); if ((ut = getutline(&line)) != NULL) { - strncpy(curr_user, ut->ut_user, UT_NAMESIZE); + strncpy(curr_user, ut->ut_user, sizeof(ut->ut_user)); retval = curr_user; } endutent(); |