From af58b15fa7f20e33736d79c6a4b3becb568517ca Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 17 Jul 2013 16:10:51 +0200 Subject: 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 ccbb69ce..c4f00d66 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 0939c31e..7a727719 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 ec2b1935..491482d8 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 c32ccc31..d4a1f804 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 a922ee36..5cf08084 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__ */ -- cgit