diff options
author | gww <gww@eng.sun.com> | 2010-04-12 16:53:16 -0700 |
---|---|---|
committer | gww <gww@eng.sun.com> | 2010-04-12 16:53:16 -0700 |
commit | 91b2cbb33f0dcb9fb5a72db1795003e07afeded9 (patch) | |
tree | 527dac9a1fd2fb993c7123f4f869453c0e1003b5 /usr/src/lib/pam_modules | |
parent | b5875ddd9f650174db2616fc7cc262d30eb77bf0 (diff) | |
download | illumos-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.c | 25 |
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)) { |