From 10940060429c610c3937fc4af2c32b23abc0d8c1 Mon Sep 17 00:00:00 2001 From: Thibault Godouet Date: Mon, 29 Oct 2001 13:21:02 +0000 Subject: [PATCH] added error_pame --- log.c | 18 +++++++++++++++++- log.h | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/log.c b/log.c index 533eecc..8fc1cfd 100644 --- a/log.c +++ b/log.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: log.c,v 1.9 2001-09-12 13:37:13 thib Exp $ */ + /* $Id: log.c,v 1.10 2001-10-29 13:21:02 thib Exp $ */ /* This code is inspired by Anacron's sources of Itai Tzur */ @@ -157,6 +157,7 @@ log_pame(int priority, pam_handle_t *pamh, int pamerrno, char *fmt, va_list args strftime(date, sizeof(date), "%H:%M:%S", ft); fprintf(stderr, "%s %s: %s\n", date, msg, pam_strerror(pamh, pamerrno)); } + xcloselog(); } #endif @@ -233,6 +234,21 @@ error_e(char *fmt, ...) } +#ifdef HAVE_LIBPAM +/* Log a "complain" level message, with a PAM error description */ +void +error_pame(pam_handle_t *pamh, int pamerrno, char *fmt, ...) +{ + va_list args; + + xcloselog(); /* PAM is likely to have used openlog() */ + + va_start(args, fmt); + log_pame(COMPLAIN_LEVEL, pamh, pamerrno, fmt, args); + va_end(args); +} +#endif + /* Log a "complain" level message, and exit */ void die(char *fmt, ...) diff --git a/log.h b/log.h index c422f4a..9109249 100644 --- a/log.h +++ b/log.h @@ -21,14 +21,13 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: log.h,v 1.3 2001-09-12 13:37:31 thib Exp $ */ + /* $Id: log.h,v 1.4 2001-10-29 13:21:16 thib Exp $ */ #ifndef __LOG_H__ #define __LOG_H__ /* functions prototypes */ extern void xcloselog(void); -extern char *make_msg(char *fmt, va_list args); extern void explain(char *fmt, ...); extern void explain_e(char *fmt, ...); extern void warn(char *fmt, ...); @@ -38,6 +37,7 @@ extern void error_e(char *fmt, ...); extern void die(char *fmt, ...); extern void die_e(char *fmt, ...); #ifdef HAVE_LIBPAM +extern void error_pame(pam_handle_t *pamh, int pamerrno, char *fmt, ...); extern void die_pame(pam_handle_t *pamh, int pamerrno, char *fmt, ...); #endif extern void Debug(char *fmt, ...); -- 2.47.3