Module Name: src Committed By: tls Date: Sun Aug 10 07:10:01 UTC 2014
Modified Files: src/external/bsd/openpam/dist/doc/man [tls-earlyentropy]: openpam.3 pam.3 src/external/bsd/openpam/dist/lib [tls-earlyentropy]: openpam_configure.c Log Message: Rebase. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.2.1 src/external/bsd/openpam/dist/doc/man/openpam.3 \ src/external/bsd/openpam/dist/doc/man/pam.3 cvs rdiff -u -r1.7 -r1.7.2.1 \ src/external/bsd/openpam/dist/lib/openpam_configure.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/bsd/openpam/dist/doc/man/openpam.3 diff -u src/external/bsd/openpam/dist/doc/man/openpam.3:1.5 src/external/bsd/openpam/dist/doc/man/openpam.3:1.5.2.1 --- src/external/bsd/openpam/dist/doc/man/openpam.3:1.5 Fri Dec 27 20:10:20 2013 +++ src/external/bsd/openpam/dist/doc/man/openpam.3 Sun Aug 10 07:10:01 2014 @@ -1,10 +1,11 @@ -.\" $NetBSD: openpam.3,v 1.5 2013/12/27 20:10:20 christos Exp $ +.\" $NetBSD: openpam.3,v 1.5.2.1 2014/08/10 07:10:01 tls Exp $ .\" .\" Generated by gendoc.pl .Dd September 7, 2013 .Dt OPENPAM 3 .Os .Sh NAME +.Nm pam .Nd Pluggable Authentication Modules Library .Sh LIBRARY .Lb libpam Index: src/external/bsd/openpam/dist/doc/man/pam.3 diff -u src/external/bsd/openpam/dist/doc/man/pam.3:1.5 src/external/bsd/openpam/dist/doc/man/pam.3:1.5.2.1 --- src/external/bsd/openpam/dist/doc/man/pam.3:1.5 Fri Dec 27 20:10:20 2013 +++ src/external/bsd/openpam/dist/doc/man/pam.3 Sun Aug 10 07:10:01 2014 @@ -1,10 +1,11 @@ -.\" $NetBSD: pam.3,v 1.5 2013/12/27 20:10:20 christos Exp $ +.\" $NetBSD: pam.3,v 1.5.2.1 2014/08/10 07:10:01 tls Exp $ .\" .\" Generated by gendoc.pl .Dd September 7, 2013 .Dt PAM 3 .Os .Sh NAME +.Nm openpam .Nd Pluggable Authentication Modules Library .Sh LIBRARY .Lb libpam Index: src/external/bsd/openpam/dist/lib/openpam_configure.c diff -u src/external/bsd/openpam/dist/lib/openpam_configure.c:1.7 src/external/bsd/openpam/dist/lib/openpam_configure.c:1.7.2.1 --- src/external/bsd/openpam/dist/lib/openpam_configure.c:1.7 Fri Jan 3 22:49:21 2014 +++ src/external/bsd/openpam/dist/lib/openpam_configure.c Sun Aug 10 07:10:01 2014 @@ -1,8 +1,8 @@ -/* $NetBSD: openpam_configure.c,v 1.7 2014/01/03 22:49:21 joerg Exp $ */ +/* $NetBSD: openpam_configure.c,v 1.7.2.1 2014/08/10 07:10:01 tls Exp $ */ /*- * Copyright (c) 2001-2003 Networks Associates Technology, Inc. - * Copyright (c) 2004-2012 Dag-Erling Smørgrav + * Copyright (c) 2004-2014 Dag-Erling Smørgrav * All rights reserved. * * This software was developed for the FreeBSD Project by ThinkSec AS and @@ -195,6 +195,7 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid facility", filename, lineno); + errno = EINVAL; goto fail; } if (facility != fclt && facility != PAM_FACILITY_ANY) { @@ -210,18 +211,39 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid service name", filename, lineno); + errno = EINVAL; goto fail; } if (wordv[i] != NULL) { openpam_log(PAM_LOG_ERROR, "%s(%d): garbage at end of line", filename, lineno); + errno = EINVAL; goto fail; } ret = openpam_load_chain(pamh, servicename, fclt); FREEV(wordc, wordv); - if (ret < 0) + if (ret < 0) { + /* + * Bogus errno, but this ensures that the + * outer loop does not just ignore the + * error and keep searching. + */ + if (errno == ENOENT) { + /* + * we're failing load, make sure + * there's a log message of severity + * higher than debug + */ + openpam_log(PAM_LOG_ERROR, + "failed loading include for service " + "%s in %s(%d): %s", + servicename, filename, lineno, + strerror(errno)); + errno = EINVAL; + } goto fail; + } continue; } @@ -231,6 +253,7 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid control flag", filename, lineno); + errno = EINVAL; goto fail; } @@ -240,6 +263,7 @@ openpam_parse_chain(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "%s(%d): missing or invalid module name", filename, lineno); + errno = EINVAL; goto fail; } @@ -249,8 +273,11 @@ openpam_parse_chain(pam_handle_t *pamh, this->flag = ctlf; /* load module */ - if ((this->module = openpam_load_module(modulename)) == NULL) + if ((this->module = openpam_load_module(modulename)) == NULL) { + if (errno == ENOENT) + errno = ENOEXEC; goto fail; + } /* * The remaining items in wordv are the module's @@ -283,7 +310,11 @@ openpam_parse_chain(pam_handle_t *pamh, * The loop ended because openpam_readword() returned NULL, which * can happen for four different reasons: an I/O error (ferror(f) * is true), a memory allocation failure (ferror(f) is false, - * errno is non-zero) + * feof(f) is false, errno is non-zero), the file ended with an + * unterminated quote or backslash escape (ferror(f) is false, + * feof(f) is true, errno is non-zero), or the end of the file was + * reached without error (ferror(f) is false, feof(f) is true, + * errno is zero). */ if (ferror(f) || errno != 0) goto syserr; @@ -404,6 +435,9 @@ openpam_load_chain(pam_handle_t *pamh, } ret = openpam_load_file(pamh, service, facility, filename, style); + /* success */ + if (ret > 0) + RETURNN(ret); /* the file exists, but an error occurred */ if (ret == -1 && errno != ENOENT) RETURNN(ret); @@ -413,7 +447,8 @@ openpam_load_chain(pam_handle_t *pamh, } /* no hit */ - RETURNN(0); + errno = ENOENT; + RETURNN(-1); } /* @@ -434,8 +469,10 @@ openpam_configure(pam_handle_t *pamh, openpam_log(PAM_LOG_ERROR, "invalid service name"); RETURNC(PAM_SYSTEM_ERR); } - if (openpam_load_chain(pamh, service, PAM_FACILITY_ANY) < 0) - goto load_err; + if (openpam_load_chain(pamh, service, PAM_FACILITY_ANY) < 0) { + if (errno != ENOENT) + goto load_err; + } for (fclt = 0; fclt < PAM_NUM_FACILITIES; ++fclt) { if (pamh->chains[fclt] != NULL) continue; @@ -444,18 +481,19 @@ openpam_configure(pam_handle_t *pamh, } #ifdef __NetBSD__ /* - * On NetBSD we require the AUTH chain to have a binding - * or a required module. + * On NetBSD we require the AUTH chain to have a binding, + * a required, or requisite module. */ { pam_chain_t *this = pamh->chains[PAM_AUTH]; for (; this != NULL; this = this->next) if (this->flag == PAM_BINDING || - this->flag == PAM_REQUIRED) + this->flag == PAM_REQUIRED || + this->flag == PAM_REQUISITE) break; if (this == NULL) { openpam_log(PAM_LOG_ERROR, - "No required or binding component " + "No required, requisite, or binding component " "in service %s, facility %s", service, pam_facility_name[PAM_AUTH]); goto load_err;