>From c66ee81f1b58494f9988bfe573b37439286a450f Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 17 Jul 2013 16:10:51 +0200 Subject: [PATCH 16/19] Fix formating of variables with type: id_t --- src/external/sizes.m4 | 3 +++ src/providers/ldap/sdap_idmap.c | 12 +++++++----- src/providers/proxy/proxy_init.c | 2 ++ src/tests/krb5_child-test.c | 2 +- src/util/sss_format.h | 26 +++++++++++++++++++++++++- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/external/sizes.m4 b/src/external/sizes.m4 index ccbb69ce3d3a7e0d8f5d879bdcc42b66a74cae0d..c4f00d66ff43d227b6e902ef0ee570e0092df92a 100644 --- a/src/external/sizes.m4 +++ b/src/external/sizes.m4 @@ -6,6 +6,9 @@ AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) +AC_CHECK_SIZEOF(uid_t) +AC_CHECK_SIZEOF(gid_t) +AC_CHECK_SIZEOF(id_t) if test $ac_cv_sizeof_long_long -lt 8 ; then AC_MSG_ERROR([SSSD requires long long of 64-bits]) diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c index 0939c31e45a081a8494f4efa82ac1608314b82a3..7a7277197d89d6071cc8105b1d33f5b098ac5399 100644 --- a/src/providers/ldap/sdap_idmap.c +++ b/src/providers/ldap/sdap_idmap.c @@ -159,7 +159,8 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx, || (idmap_upper-idmap_lower) < rangesize) { DEBUG(SSSDBG_FATAL_FAILURE, - ("Invalid settings for range selection: [%d][%d][%d]\n", + ("Invalid settings for range selection: " + "[%"SPRIid"][%"SPRIid"][%"SPRIid"]\n", idmap_lower, idmap_upper, rangesize)); ret = EINVAL; goto done; @@ -254,7 +255,8 @@ sdap_idmap_init(TALLOC_CTX *mem_ctx, sid_str, slice_num); if (ret != EOK) { DEBUG(SSSDBG_CRIT_FAILURE, - ("Could not add domain [%s][%s][%u] to ID map: [%s]\n", + ("Could not add domain [%s][%s][%"SPRIid"] " + "to ID map: [%s]\n", dom_name, sid_str, slice_num, strerror(ret))); goto done; } @@ -333,13 +335,13 @@ sdap_idmap_add_domain(struct sdap_idmap_ctx *idmap_ctx, goto done; } DEBUG(SSSDBG_TRACE_LIBS, - ("Adding domain [%s] as slice [%llu]\n", dom_sid, slice)); + ("Adding domain [%s] as slice [%"SPRIid"]\n", dom_sid, slice)); if (range.max > idmap_upper) { /* This should never happen */ DEBUG(SSSDBG_CRIT_FAILURE, - ("BUG: Range maximum exceeds the global maximum: %d > %d\n", - range.max, idmap_upper)); + ("BUG: Range maximum exceeds the global maximum: " + "%d > %"SPRIid"\n", range.max, idmap_upper)); ret = EINVAL; goto done; } diff --git a/src/providers/proxy/proxy_init.c b/src/providers/proxy/proxy_init.c index ec2b193569baefd4cb2f617ed8e15bdcf547f736..491482d8c9022836f8ea891070a7ca3fb780ad15 100644 --- a/src/providers/proxy/proxy_init.c +++ b/src/providers/proxy/proxy_init.c @@ -22,6 +22,8 @@ along with this program. If not, see . */ +#include "config.h" + #include "util/sss_format.h" #include "providers/proxy/proxy.h" diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c index c32ccc318e9826d598bb29a766ed1839fd9bf066..d4a1f804972b72c240a281dd2771e4fd97c4ee8b 100644 --- a/src/tests/krb5_child-test.c +++ b/src/tests/krb5_child-test.c @@ -261,7 +261,7 @@ create_dummy_req(TALLOC_CTX *mem_ctx, const char *user, } if (!kr->ccname) goto fail; - DEBUG(SSSDBG_FUNC_DATA, ("ccname [%s] uid [%llu] gid [%llu]\n", + DEBUG(SSSDBG_FUNC_DATA, ("ccname [%s] uid [%u] gid [%u]\n", kr->ccname, kr->uid, kr->gid)); ret = sss_krb5_precreate_ccache(kr->ccname, diff --git a/src/util/sss_format.h b/src/util/sss_format.h index a922ee367860e85f458672feab4eb3fcd3744b04..5cf080842ea0061ed371f6ae4b9629449dd1b9b7 100644 --- a/src/util/sss_format.h +++ b/src/util/sss_format.h @@ -36,7 +36,31 @@ * It seems that sizeof(rlim_t) is 8. It may be platform dependent, therefore * the same format will be used like with uint64_t. */ - #define SPRIrlim PRIu64 +#if SIZEOF_ID_T == 8 +# define SPRIid PRIu64 +#elif SIZEOF_ID_T == 4 +# define SPRIid PRIu32 +#else +# error Unexpected sizeof id_t +#endif /* SIZEOF_ID_T */ + +#if SIZEOF_UID_T == 8 +# define SPRIuid PRIu64 +#elif SIZEOF_UID_T == 4 +# define SPRIuid PRIu32 +#else +# error Unexpected sizeof uid_t +#endif /* SIZEOF_UID_T */ + +#if SIZEOF_GID_T == 8 +# define SPRIgid PRIu64 +#elif SIZEOF_GID_T == 4 +# define SPRIgid PRIu32 +#else +# error Unexpected sizeof gid_t +#endif /* SIZEOF_GID_T */ + + #endif /* __SSS_FORMAT_H__ */ -- 1.8.3.1