summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-01-21 16:19:38 +0000
committerdes <des@FreeBSD.org>2002-01-21 16:19:38 +0000
commit99b518cd8be15a8078a9fe7958314af3dff0c021 (patch)
tree4c4b0568a272953dbfe147a945b410810bbb7109
parent8d3eaf171b8426e26b2c400ab0af8e9100e9793f (diff)
downloadFreeBSD-src-99b518cd8be15a8078a9fe7958314af3dff0c021.zip
FreeBSD-src-99b518cd8be15a8078a9fe7958314af3dff0c021.tar.gz
When running on a local terminal, set PAM_RHOST to the local hostname.
Sponsored by: DARPA, NAI Labs
-rw-r--r--usr.bin/login/login.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 59707b5..1dcd150 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -1,6 +1,13 @@
/*-
* Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2002 Networks Associates Technologies, Inc.
+ * All rights reserved.
+ *
+ * Portions of this software were developed for the FreeBSD Project by
+ * ThinkSec AS and NAI Labs, the Security Research Division of Network
+ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -763,8 +770,9 @@ auth_pam()
pam_strerror(pamh, e));
return -1;
}
- if (hostname != NULL &&
- (e = pam_set_item(pamh, PAM_RHOST, full_hostname)) != PAM_SUCCESS) {
+ if (hostname == NULL)
+ gethostname(full_hostname, sizeof full_hostname);
+ if ((e = pam_set_item(pamh, PAM_RHOST, full_hostname)) != PAM_SUCCESS) {
syslog(LOG_ERR, "pam_set_item(PAM_RHOST): %s",
pam_strerror(pamh, e));
return -1;
OpenPOWER on IntegriCloud