]> git.ipfire.org Git - thirdparty/fcron.git/commitdiff
added error_pame
authorThibault Godouet <yo8192@users.noreply.github.com>
Mon, 29 Oct 2001 13:21:02 +0000 (13:21 +0000)
committerThibault Godouet <yo8192@users.noreply.github.com>
Mon, 29 Oct 2001 13:21:02 +0000 (13:21 +0000)
log.c
log.h

diff --git a/log.c b/log.c
index 533eeccc405262620edca172ce01d030df47987d..8fc1cfdf9cd72f8260e8015382de75c2d543d9f2 100644 (file)
--- 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 <itzur@actcom.co.il> */
@@ -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 c422f4aa50179426272e7bcc46cca0a2be93c8f3..91092499b097bedc10304a5fc237d60017713e90 100644 (file)
--- a/log.h
+++ b/log.h
  *  `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, ...);