On (27/08/14 14:44), Sumit Bose wrote:
On Wed, Aug 27, 2014 at 12:06:54PM +0200, Lukas Slebodnik wrote:
> On (26/08/14 17:44), Sumit Bose wrote:
> >Hi,
> >
> >this patch fixes a issue with sss_log() which was introduced recently
> >and I think is only in master. So far I only tested it with syslog, if
> >would be nice if someone can test the journald code path as well.
> >
> >bye,
> >Sumit
>
> Nice catch.
> It needn't be noticed if message does not contain format strings.
>
> >From cb4a1788cc8d4fd4251de2ee83ff760b740a68d6 Mon Sep 17 00:00:00 2001
> >From: Sumit Bose <sbose(a)redhat.com>
> >Date: Tue, 26 Aug 2014 17:29:08 +0200
> >Subject: [PATCH] sss_log: fix handling of variable argument lists
> >
> >SSSD has two public calls to send messages to syslog sss_log() and
> >sss_log_ext() which both expect besides other arguments a printf format
> >string and a variable list of arguments depending on the format.
> >Currently sss_log() calls sss_log_ext() internally after calling
> >va_start(ap, format) and hands over ap as the last argument. This does
> >not work because there is a difference between a varying number of
> >arguments and a va_list type.
> >
> >To fix this I added a new private call which expects a va_list as the
> >last argument and is called by sss_log() and sss_log_ext() after calling
> >va_start().
> >---
> > src/util/sss_log.c | 28 +++++++++++++++++++---------
> > 1 file changed, 19 insertions(+), 9 deletions(-)
> >
> >diff --git a/src/util/sss_log.c b/src/util/sss_log.c
> >index 7a2dce6..b0c3f99 100644
> >--- a/src/util/sss_log.c
> >+++ b/src/util/sss_log.c
> >@@ -57,28 +57,40 @@ static int sss_to_syslog(int priority)
> > }
> > }
> >
> >+static void sss_log_ext_int(int priority, int facility, const char *format,
> >+ va_list ap);
> >+
> just one nitpick.
>
> Could you rename this static function to sss_log_internal. (or choose better name)
> In my opinion, it is better than sss_log_ext_int and we don't have
> two versions of internal function. "_ext" is redundant.
Thank you, I wasn't happy with the name either, but couldn't think of
anything better. New version with your suggestion attached.
From b416be1d9070b1f90f88d9db55c8184adadc3808 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose(a)redhat.com>
Date: Tue, 26 Aug 2014 17:29:08 +0200
Subject: [PATCH] sss_log: fix handling of variable argument lists
SSSD has two public calls to send messages to syslog sss_log() and
sss_log_ext() which both expect besides other arguments a printf format
string and a variable list of arguments depending on the format.
Currently sss_log() calls sss_log_ext() internally after calling
va_start(ap, format) and hands over ap as the last argument. This does
not work because there is a difference between a varying number of
arguments and a va_list type.
To fix this I added a new private call which expects a va_list as the
last argument and is called by sss_log() and sss_log_ext() after calling
va_start().
---
Works fine with journald.
tested with diff in the function server_setup.
setenv("_SSS_LOOPS", "NO", 0);
+ sss_log(SSS_LOG_NOTICE, "server setup for name: %s, flags:%#x, conf_entry"
+ ": %s\n", name, flags, conf_entry);
+
ACK
LS