summaryrefslogtreecommitdiffstats
path: root/src/providers
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2016-01-11 13:00:39 +0100
committerJakub Hrozek <jhrozek@redhat.com>2016-02-23 12:26:22 +0100
commit21274963b575262b566115008119ef836c4db211 (patch)
tree608700357b3917230cb7a2c21e855572cdbab6ed /src/providers
parentd833f316243f4ccd52b9b53dbd6e91c784825479 (diff)
downloadsssd-21274963b575262b566115008119ef836c4db211.tar.gz
sssd-21274963b575262b566115008119ef836c4db211.tar.xz
sssd-21274963b575262b566115008119ef836c4db211.zip
HBAC: Check format string in hbac log function
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ipa/hbac_evaluator.c2
-rw-r--r--src/providers/ipa/ipa_hbac.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/providers/ipa/hbac_evaluator.c b/src/providers/ipa/hbac_evaluator.c
index 026502f3..f4b76d8e 100644
--- a/src/providers/ipa/hbac_evaluator.c
+++ b/src/providers/ipa/hbac_evaluator.c
@@ -23,6 +23,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h" /* for HAVE_FUNCTION_ATTRIBUTE_FORMAT in "ipa_hbac.h" */
+
#include <stdlib.h>
#include <string.h>
#include <errno.h>
diff --git a/src/providers/ipa/ipa_hbac.h b/src/providers/ipa/ipa_hbac.h
index 09da919e..ee5f1919 100644
--- a/src/providers/ipa/ipa_hbac.h
+++ b/src/providers/ipa/ipa_hbac.h
@@ -50,13 +50,19 @@ enum hbac_debug_level {
HBAC_DBG_TRACE /** Verbose description of rules. */
};
+#ifdef HAVE_FUNCTION_ATTRIBUTE_FORMAT
+#define HBAC_ATTRIBUTE_PRINTF(a1, a2) __attribute__((format(printf, a1, a2)))
+#else
+#define HABC_ATTRIBUTE_PRINTF(a1, a2)
+#endif
+
/**
* Function pointer to HBAC external debugging function.
*/
typedef void (*hbac_debug_fn_t)(const char *file, int line,
const char *function,
enum hbac_debug_level, const char *format,
- ...);
+ ...) HBAC_ATTRIBUTE_PRINTF(5, 6);
/**
* HBAC uses external_debug_fn for logging messages.