From 0c0b9daba7668971b5211c6cedef5e536e2b0433 Mon Sep 17 00:00:00 2001 From: spz Date: Tue, 17 Jun 2014 07:08:47 +0000 Subject: [PATCH] make sure we have a log message at the appropriate level (error) on why pam is failing in the case of an included pam config file missing. example: instead of logging with the default log settings: Jun 17 08:49:37 tucana su: pam_start failed: system error it will log: Jun 17 08:55:49 tucana su: in openpam_parse_chain(): failed loading include for service gibbetnich in /etc/pam.d/su(15): No such file or directory Jun 17 08:55:49 tucana su: pam_start failed: system error --- external/bsd/openpam/dist/lib/openpam_configure.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/external/bsd/openpam/dist/lib/openpam_configure.c b/external/bsd/openpam/dist/lib/openpam_configure.c index 3d969d174eba..9b81fe64981d 100644 --- a/external/bsd/openpam/dist/lib/openpam_configure.c +++ b/external/bsd/openpam/dist/lib/openpam_configure.c @@ -1,4 +1,4 @@ -/* $NetBSD: openpam_configure.c,v 1.9 2014/06/03 20:22:54 christos Exp $ */ +/* $NetBSD: openpam_configure.c,v 1.10 2014/06/17 07:08:47 spz Exp $ */ /*- * Copyright (c) 2001-2003 Networks Associates Technology, Inc. @@ -229,8 +229,19 @@ openpam_parse_chain(pam_handle_t *pamh, * outer loop does not just ignore the * error and keep searching. */ - if (errno == ENOENT) + 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;