summaryrefslogtreecommitdiff
path: root/usr/src/lib/pam_modules
diff options
context:
space:
mode:
authorgww <gww@eng.sun.com>2010-04-12 16:53:16 -0700
committergww <gww@eng.sun.com>2010-04-12 16:53:16 -0700
commit91b2cbb33f0dcb9fb5a72db1795003e07afeded9 (patch)
tree527dac9a1fd2fb993c7123f4f869453c0e1003b5 /usr/src/lib/pam_modules
parentb5875ddd9f650174db2616fc7cc262d30eb77bf0 (diff)
downloadillumos-joyent-91b2cbb33f0dcb9fb5a72db1795003e07afeded9.tar.gz
6935410 setting audit context when audit is not enabled should be more tolerant of getaddrinfo failure
Diffstat (limited to 'usr/src/lib/pam_modules')
-rw-r--r--usr/src/lib/pam_modules/unix_cred/unix_cred.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/usr/src/lib/pam_modules/unix_cred/unix_cred.c b/usr/src/lib/pam_modules/unix_cred/unix_cred.c
index d862b2f652..c7c35c70a7 100644
--- a/usr/src/lib/pam_modules/unix_cred/unix_cred.c
+++ b/usr/src/lib/pam_modules/unix_cred/unix_cred.c
@@ -19,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#include <nss_dbdefs.h>
@@ -264,31 +263,45 @@ pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv)
errno = 0;
if ((rhost == NULL || *rhost == '\0')) {
if (adt_load_ttyname(tty, &termid) != 0) {
- if (errno != 0)
+ if (errno == ENETDOWN) {
+ /*
+ * tolerate not being able to
+ * translate local hostname
+ * to a termid -- it will be
+ * "loopback".
+ */
+ syslog(LOG_AUTH | LOG_ERR,
+ "pam_unix_cred: cannot load "
+ "ttyname: %m, continuing.");
+ goto adt_setuser;
+ } else if (errno != 0) {
syslog(LOG_AUTH | LOG_ERR,
"pam_unix_cred: cannot load "
"ttyname: %m.");
- else
+ } else {
syslog(LOG_AUTH | LOG_ERR,
"pam_unix_cred: cannot load "
"ttyname.");
+ }
ret = PAM_SYSTEM_ERR;
goto adt_done;
}
} else {
if (adt_load_hostname(rhost, &termid) != 0) {
- if (errno != 0)
+ if (errno != 0) {
syslog(LOG_AUTH | LOG_ERR,
"pam_unix_cred: cannot load "
"hostname: %m.");
- else
+ } else {
syslog(LOG_AUTH | LOG_ERR,
"pam_unix_cred: cannot load "
"hostname.");
+ }
ret = PAM_SYSTEM_ERR;
goto adt_done;
}
}
+adt_setuser:
if ((auser != NULL) && (*auser != '\0') &&
(getpwnam_r(auser, &apwd, apwbuf,
sizeof (apwbuf)) != NULL)) {