>From 687b81137d759bc3e5bdb5f7fb64e94d3abef6c1 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 17 Jul 2013 16:10:51 +0200 Subject: [PATCH 16/20] Fix formating of variables with type: id_t --- src/external/sizes.m4 | 3 +++ src/providers/ldap/sdap_async_initgroups_ad.c | 2 +- src/providers/ldap/sdap_idmap.c | 12 +++++++----- src/providers/proxy/proxy_init.c | 2 ++ src/providers/simple/simple_access_check.c | 8 ++++---- src/tests/krb5_child-test.c | 2 +- src/util/sss_format.h | 26 +++++++++++++++++++++++++- 7 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/external/sizes.m4 b/src/external/sizes.m4 index 53df61dedc3ae748c50ca9a3935632087834155d..5fc5fead71feefb8d030ae804b0ad934e4ad5541 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_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c index efaa247dd22d2ae100e8881c010dfe26a9a10cca..5f2465ca6d8aef7fc486a033e7d3759050c0dec8 100644 --- a/src/providers/ldap/sdap_async_initgroups_ad.c +++ b/src/providers/ldap/sdap_async_initgroups_ad.c @@ -472,7 +472,7 @@ sdap_get_ad_tokengroups_initgroups_lookup_done(struct tevent_req *subreq) } DEBUG(SSSDBG_TRACE_LIBS, - ("Processing membership GID [%lu]\n", + ("Processing membership GID [%u]\n", gid)); /* Check whether this GID already exists in the sysdb */ diff --git a/src/providers/ldap/sdap_idmap.c b/src/providers/ldap/sdap_idmap.c index 0939c31e45a081a8494f4efa82ac1608314b82a3..0666199f96879bafd40b9be44477edb401ee2901 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: " + "[%"PRIid"][%"PRIid"][%"PRIid"]\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][%"PRIid"] " + "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 [%"PRIid"]\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 > %"PRIid"\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/providers/simple/simple_access_check.c b/src/providers/simple/simple_access_check.c index 7335135ea5dedecdb5ba2be60a57d18eb897a960..1509c9df40c197376b982d9e0041a7690a44a1ef 100644 --- a/src/providers/simple/simple_access_check.c +++ b/src/providers/simple/simple_access_check.c @@ -245,7 +245,7 @@ simple_resolve_group_check(struct simple_resolve_group_state *state) group_attrs, &group); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not look up group by gid [%lu]: [%d][%s]\n", + ("Could not look up group by gid [%u]: [%d][%s]\n", state->gid, ret, sss_strerror(ret))); return ret; } @@ -470,7 +470,7 @@ static void simple_check_get_groups_next(struct tevent_req *subreq) talloc_zfree(subreq); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not resolve name of group with GID %llu\n", + ("Could not resolve name of group with GID %u\n", state->lookup_gids[state->giter])); tevent_req_error(req, ret); return; @@ -545,7 +545,7 @@ simple_check_process_group(struct simple_check_groups_state *state, /* Non-posix group with a GID. Needs resolving */ state->lookup_gids[state->num_gids] = gid; - DEBUG(SSSDBG_TRACE_INTERNAL, ("Adding GID %llu\n", gid)); + DEBUG(SSSDBG_TRACE_INTERNAL, ("Adding GID %u\n", gid)); state->num_gids++; return EOK; } @@ -564,7 +564,7 @@ simple_check_get_groups_primary(struct simple_check_groups_state *state, gid, group_attrs, &msg); if (ret != EOK) { DEBUG(SSSDBG_OP_FAILURE, - ("Could not look up primary group [%lu]: [%d][%s]\n", + ("Could not look up primary group [%u]: [%d][%s]\n", gid, ret, sss_strerror(ret))); /* We have to treat this as non-fatal, because the primary * group may be local to the machine and not available in diff --git a/src/tests/krb5_child-test.c b/src/tests/krb5_child-test.c index 24d077289d64d52488a3419ffc4494f59d6bc5df..f5b8174b20f3c018a0c964187fedb8bbef385c22 100644 --- a/src/tests/krb5_child-test.c +++ b/src/tests/krb5_child-test.c @@ -284,7 +284,7 @@ create_dummy_req(TALLOC_CTX *mem_ctx, const char *user, kr->krb5_ctx->cc_be = &file_cc; break; } - 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 = kr->krb5_ctx->cc_be->create(kr->ccname, diff --git a/src/util/sss_format.h b/src/util/sss_format.h index 67194393be0d4401f3bd2cf1476fedff23b5f727..2683b203810c3edbed4515f00d90c89eec8098a4 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 PRIrlim PRIu64 +#if SIZEOF_ID_T == 8 +# define PRIid PRIu64 +#elif SIZEOF_ID_T == 4 +# define PRIid PRIu32 +#else +# error Unexpected sizeof id_t +#endif /* SIZEOF_ID_T */ + +#if SIZEOF_UID_T == 8 +# define PRIuid PRIu64 +#elif SIZEOF_UID_T == 4 +# define PRIuid PRIu32 +#else +# error Unexpected sizeof uid_t +#endif /* SIZEOF_UID_T */ + +#if SIZEOF_GID_T == 8 +# define PRIgid PRIu64 +#elif SIZEOF_GID_T == 4 +# define PRIgid PRIu32 +#else +# error Unexpected sizeof gid_t +#endif /* SIZEOF_GID_T */ + + #endif /* __SSS_FORMAT_H__ */ -- 1.8.3.1