summaryrefslogtreecommitdiffstats
path: root/Makefile.am
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2014-01-07 14:44:11 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-01-12 15:24:26 +0100
commitb9d8c6172e48a2633ebe196b2e88bebdf9523c20 (patch)
tree3ea801f4dbba0a859cbe44f8c3e1affe5fb108ba /Makefile.am
parent4b8021779e4db2a212a8214c17e778e843ae2b3a (diff)
downloadsssd-b9d8c6172e48a2633ebe196b2e88bebdf9523c20.tar.gz
sssd-b9d8c6172e48a2633ebe196b2e88bebdf9523c20.tar.xz
sssd-b9d8c6172e48a2633ebe196b2e88bebdf9523c20.zip
util: A safe printf for user provided format strings
Since the default printf(3) implementation cannot safely be used on user (or admin) provided input, this is a safe implementation. This will be used in later patches by the full_name_format option The implementation came from realmd, but only has libc dependencies. The number of fields is pre-defined, and safe printf fails if an invalid field is accessed. Only string fields are supported, and only flags relevant to string fields are supported. Width and precision work as expected, but precision cannot read from a field. Tests are included, and ported to the check based testing that sssd uses.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am16
1 files changed, 15 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 2733d4f6d..9c155d68c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,7 +136,8 @@ if HAVE_CHECK
debug-tests \
ipa_hbac-tests \
sss_idmap-tests \
- responder_socket_access-tests
+ responder_socket_access-tests \
+ safe-format-tests
if BUILD_SSH
non_interactive_check_based_tests += sysdb_ssh-tests
@@ -401,6 +402,7 @@ dist_noinst_HEADERS = \
src/util/util.h \
src/util/io.h \
src/util/util_errors.h \
+ src/util/safe-format-string.h \
src/util/strtonum.h \
src/util/sss_endian.h \
src/util/sss_nss.h \
@@ -573,6 +575,7 @@ libsss_util_la_SOURCES = \
src/sbus/sssd_dbus_server.c \
src/util/util.c \
src/util/memory.c \
+ src/util/safe-format-string.c \
src/util/server.c \
src/util/signal.c \
src/util/usertools.c \
@@ -1180,6 +1183,17 @@ util_tests_LDADD = \
$(SSSD_INTERNAL_LTLIBS) \
libsss_test_common.la
+safe_format_tests_SOURCES = \
+ src/tests/safe-format-tests.c
+safe_format_tests_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(CHECK_CFLAGS)
+safe_format_tests_LDADD = \
+ $(SSSD_LIBS) \
+ $(CHECK_LIBS) \
+ $(SSSD_INTERNAL_LTLIBS) \
+ libsss_test_common.la
+
debug_tests_SOURCES = \
src/tests/debug-tests.c \
src/tests/common.c