summaryrefslogtreecommitdiffstats
path: root/lib/libpam/modules/pam_lastlog/pam_lastlog.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-04-30 00:44:05 +0000
committerdes <des@FreeBSD.org>2003-04-30 00:44:05 +0000
commit4f251ebb977bb8290036b334a92ab0ad273a972d (patch)
treeddfe4bbdabb2f5dcd1eb53956ec434e9c1decf19 /lib/libpam/modules/pam_lastlog/pam_lastlog.c
parent668955a3c5893b64f588c8be729010bc97bd313e (diff)
downloadFreeBSD-src-4f251ebb977bb8290036b334a92ab0ad273a972d.zip
FreeBSD-src-4f251ebb977bb8290036b334a92ab0ad273a972d.tar.gz
Treat an empty PAM_RHOST the same as a NULL one.
PR: bin/51508
Diffstat (limited to 'lib/libpam/modules/pam_lastlog/pam_lastlog.c')
-rw-r--r--lib/libpam/modules/pam_lastlog/pam_lastlog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpam/modules/pam_lastlog/pam_lastlog.c b/lib/libpam/modules/pam_lastlog/pam_lastlog.c
index 66f61d3..200f489 100644
--- a/lib/libpam/modules/pam_lastlog/pam_lastlog.c
+++ b/lib/libpam/modules/pam_lastlog/pam_lastlog.c
@@ -129,7 +129,7 @@ pam_sm_open_session(pam_handle_t *pamh, int flags,
/* note: does not need to be NUL-terminated */
strncpy(ll.ll_line, tty, sizeof(ll.ll_line));
- if (rhost != NULL)
+ if (rhost != NULL && *rhost != '\0')
/* note: does not need to be NUL-terminated */
strncpy(ll.ll_host, rhost, sizeof(ll.ll_host));
@@ -145,7 +145,7 @@ pam_sm_open_session(pam_handle_t *pamh, int flags,
utmp.ut_time = time(NULL);
/* note: does not need to be NUL-terminated */
strncpy(utmp.ut_name, user, sizeof(utmp.ut_name));
- if (rhost != NULL)
+ if (rhost != NULL && *rhost != '\0')
strncpy(utmp.ut_host, rhost, sizeof(utmp.ut_host));
(void)strncpy(utmp.ut_line, tty, sizeof(utmp.ut_line));
login(&utmp);
OpenPOWER on IntegriCloud