[SSSD] [PATCHES] Enable printf format string checking
Lukas Slebodnik
lslebodn at redhat.com
Wed Sep 11 14:57:57 UTC 2013
On (10/09/13 17:12), Jakub Hrozek wrote:
>On Wed, Sep 04, 2013 at 06:34:52PM +0200, Lukas Slebodnik wrote:
>> On (03/09/13 00:25), Jakub Hrozek wrote:
>> >On Wed, Aug 21, 2013 at 03:35:11PM +0200, Lukas Slebodnik wrote:
>> >> On (21/08/13 13:46), Jakub Hrozek wrote:
>> >> >Sorry it took so long before we got to another review of the patch. The
>> >> >ticket is targeted for 1.12 so initially I was thinking of the patchset
>> >> >as lower priority than the other work.
>> >> >
>> >> >On Wed, Jul 24, 2013 at 10:32:29AM +0200, Lukas Slebodnik wrote:
>> >> >> On (24/07/13 09:41), Ondrej Kos wrote:
>> >> >> >On 07/23/2013 06:21 PM, Lukas Slebodnik wrote:
>> >> >> >>ehlo,
>> >> >> >>
>> >> >> >>It would be great to have enabled printf format string checking in RHEL7.
>> >> >> >>Therefore I decided to send pateches for ticket
>> >> >> >>https://fedorahosted.org/sssd/ticket/1945
>> >> >> >>
>> >> >> >>Patch 0001 -- Even if this patch is first, it should be applied in upstream as
>> >> >> >> last.
>> >> >
>> >> > ^^^^ Does it matter? I'll apply the whole set anyway..
>> >> It can make a big noise in case of bisecting.
>> >> I moved this patch to the end.
>> >
>> >Thanks. I'll try to remember to ask someone to double-check before pushing
>> >:-)
>> >
>> >>
>> >> >
>> >> >Some comments below..
>> >> >
>> >> >> >>
>> >> >> >>Patch 0002 - 0006 -- trivial
>> >> >> >>Patch 0007 -- ssize_t is not defined in ANSI c99, IIRC it is defined in posix
>> >> >> >> as a signed type, therefore format should be used "zd"
>> >> >> >>Patch 0008 -- size_t is defined in ANSI c99 as unzigned type -> "zu"
>> >> >
>> >> >btw size_t seems to be part of standard library, not the language
>> >> >specification per se. Not that it matters for the patch :)
>> >> size_t can be part of standard library, but ANSI c99 says size_t is unsigned
>> >> type.
>> >>
>> >> Problem is that sizeof(size_t) is different on 32-bit platform and 64-bit
>> >> platform
>> >
>> >OK
>> >
>> >>
>> >> >
>> >> >> >>Patch 0009 -- wrapper for inttypes.h and for future format macros.
>> >> >> >>Patch 0012 -- formating types defined in stdint.h uint_32_t ...
>> >> >> >> -- there are used macros defined in inttypes.h
>> >> >> >>Patches 0010 - 0015 fix formating for special variables (key_serial_t, rlim_t...)
>> >> >> >> and for some types I created macros in sss_format.h
>> >> >> >>Patch 0010 -- key_serial_t is typedef of int32_t, but it could be defined
>> >> >> >> differently in another (platforms/ implemantations of kerberos)
>> >> >> >>Patch 0011 -- it seems that rlim_t us the same as uint64_t, but it was defined
>> >> >> >> using conditional build an not a typedef of std types.
>> >> >> >>Patch 0013 -- time_t is defined as "long int" sizeof_i386(time_t) != sizeof_x86_64(time_t)
>> >> >> >>Patch 0014 -- ber_int and ber_tag are typedef for int and unsigned long
>> >> >> >>Patch 0015 -- gid_t and uid_t are typedef as unsigned
>> >> >> >> (I checked linux 32 bit, linu 64_bit and freebsd 64 bit)
>> >> >
>> >> >Actually /usr/include/bits/typesizes.h says:
>> >> >#define __UID_T_TYPE __U32_TYPE
>> >> and you forgot to add:
>> >> shell$ grep -RniI __U32_TYPE
>> >> bits/types.h:101:#define __U32_TYPE unsigned int
>> >
>> >I think this is lucky coincidence where unsigned int is 32bits wide.
>> >
>> >But to be honest I haven't found any information that would state that
>> >uid_t or gid_t is guaranteed to be 32bit (even though some places in the
>> >SSSD rely on uid_t == uint32_t). As far as I can see, POSIX simply says
>> >that both are opaque numeric types. Too bad the system headers don't
>> >provide some kind of format specifier..
>> >
>> >I wonder if we should check the width during configure and define our
>> >own specifier based on what we discover?
>> >
>> >>
>> >> >
>> >> >(and then defines __UID_T_TYPE to __uid_t which in turn gets typedefed to uid_t)
>> >> >
>> >
>> >[snip]
>> >
>> >> >> Subject: [PATCH 10/16] Fix formating of variables with type: key_serial_t
>> >> >> Subject: [PATCH 11/16] Fix formating of variables with type: rlim_t
>> >> >> Subject: [PATCH 12/16] Fix formating of variables with type defined in stdint.h
>> >> >
>> >> >Nice, I didn't know these existed. But to be honest, these format specifiers
>> >> >seem ugly to me..wouldn't it be nicer to cast the variables to a larger type
>> >> >(long or unsigned long) and then use plan C conversion?
>> >> I agree with Stephen casting is not very portable.
>> >> Some platforms needn't have defned long long unsigend or there can be another
>> >> type which is bigger.
>> >>
>> >> uintmax_t/intmax_t could be used as the larget type.
>> >> In this case modifier "j" should be used
>> >> format_fun("%jd %ju\n" (uintmax_t) uint_8_var, (intmax_t)int8_t_var)
>> >> but it is overkill to cast uint_8_var to 64_vit variable (or in future 128 bit:-)
>> >>
>> >> And last point. I don't like casting of argumets in formating functions.
>> >>
>> >> ------------------
>> >> "man inttypes.h" is very helpful
>> >> ------------------
>> >
>> >OK, I'm convinced :-)
>> >
>> >>
>> >> >> Subject: [PATCH 13/16] Fix formating of variables with type: time_t
>> >> >I think this is OK, my C reference says that time_t can be of "any arithmetic
>> >> >type" but also states that long is traditionally used.
>> >> >
>> >> >> Subject: [PATCH 14/16] Fix formating of variables with ber_ type
>> >> >ACK
>> >> >
>> >> >> Subject: [PATCH 15/16] Fix formating of variables with type: [gu]?id_t
>> >> >
>> >> >This is the main point of discussion in the patchset I think. IIRC POSIX
>> >> >states that IDs are 32bit unsigned integers. That's precisely why we have
>> >> >casted them up to unsigned (long) long. Did you see warnings with some
>> >> >strict combination of CFLAGS?
>> >> >
>> >> -Wformat is automatically enabled by -Wall, There is no problem with CFLAGS.
>> >> You can try to revert this patch (or do not apply this patch)
>> >> And warnings will appear. clang gives more hints.
>> >>
>> >> But it is possibel to add another macro to header file sss_format.h
>> >>
>> >> >> Subject: [PATCH 16/16] Fix warning: data argument not used by format string
>> >> >Oof, these are bad. Thank you. ACK.
>> >> Those fixes are not critical, only unsufficient information will be printed.
>> >>
>> >> Updated patches are attached.
>> >>
>> >> LS
>> >
>> >Sorry the review has stalled for a bit. I think that once we resolve the
>> >uid_t patch, we can push the whole patchset.
>>
>> I added 3 new macros for formating [ug]?id types: PRIid, PRIgid, PRIuid
>
>I like this approach. I just wonder if we should namespace these to say
>SPRI instead? Would it be too much work or doable with a
>search-and-replace?
>
>>
>> BTW: I rebased patches and spot 3 new warnings :-)
>>
>
>Yeah, we really need to push these patches..
>
>> 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));
>>
>
>This change is overwritten in a later patch.
>
>I couldn't apply patches 7 and 16, can you rebase?
Attached patches are rebased on top of current master.
All macros from sss_format.h were renamed from PRI -> SPRI
LS
-------------- next part --------------
>From 24706e6b5cd581c37de69be60268f83e911e29c9 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 13 Jul 2013 15:25:47 +0200
Subject: [PATCH 01/19] Fix formating of variables with type: long
---
src/krb5_plugin/sssd_krb5_locator_plugin.c | 2 +-
src/providers/krb5/krb5_child.c | 2 +-
src/providers/krb5/krb5_common.c | 2 +-
src/providers/ldap/ldap_auth.c | 7 ++++---
src/providers/ldap/ldap_common.c | 5 +++--
src/providers/ldap/sdap_access.c | 7 ++++---
src/util/util.h | 4 ++--
7 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/krb5_plugin/sssd_krb5_locator_plugin.c b/src/krb5_plugin/sssd_krb5_locator_plugin.c
index 402fd03e7e45644c65581c7c6f14fe8d7bf2e894..725687ddcf559e251ee54d1005f862bd6d0af4f8 100644
--- a/src/krb5_plugin/sssd_krb5_locator_plugin.c
+++ b/src/krb5_plugin/sssd_krb5_locator_plugin.c
@@ -171,7 +171,7 @@ static int get_krb5info(const char *realm, struct sssd_ctx *ctx,
}
if (port < 0 || port > 65535) {
- PLUGIN_DEBUG(("Illegal port number [%d], assuming default.\n",
+ PLUGIN_DEBUG(("Illegal port number [%ld], assuming default.\n",
port));
port = 0;
}
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index 4f56736de152d1443add8b69db261faf3b75529f..8738be163157a355009228cb410303e87868bc7b 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -127,7 +127,7 @@ static void sss_krb5_expire_callback_func(krb5_context context, void *data,
DEBUG(1, ("Time to expire out of range.\n"));
return;
}
- DEBUG(SSSDBG_TRACE_INTERNAL, ("exp_time: [%d]\n", exp_time));
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("exp_time: [%ld]\n", exp_time));
blob = talloc_array(kr->pd, uint32_t, 2);
if (blob == NULL) {
diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c
index dedb734fc397d3df3eb7717b19c56051fb2243bb..80eaeb56fac7a81446c04c58d63d47914de739d0 100644
--- a/src/providers/krb5/krb5_common.c
+++ b/src/providers/krb5/krb5_common.c
@@ -653,7 +653,7 @@ static errno_t _krb5_servers_init(struct be_ctx *ctx,
}
if (port < 1 || port > 65535) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Illegal port number [%d].\n", port));
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Illegal port number [%ld].\n", port));
ret = EINVAL;
goto done;
}
diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c
index e5b6365816af6bcf42554da7f6491b98241c5c45..dcaea75c0b7833b8a1eb00232ab92ea09f7a7f00 100644
--- a/src/providers/ldap/ldap_auth.c
+++ b/src/providers/ldap/ldap_auth.c
@@ -115,9 +115,10 @@ static errno_t check_pwexpire_kerberos(const char *expire_date, time_t now,
tzset();
expire_time -= timezone;
- DEBUG(9, ("Time info: tzname[0] [%s] tzname[1] [%s] timezone [%d] "
- "daylight [%d] now [%d] expire_time [%d].\n", tzname[0],
- tzname[1], timezone, daylight, now, expire_time));
+ DEBUG(SSSDBG_TRACE_ALL,
+ ("Time info: tzname[0] [%s] tzname[1] [%s] timezone [%ld] "
+ "daylight [%d] now [%d] expire_time [%d].\n", tzname[0],
+ tzname[1], timezone, daylight, now, expire_time));
if (difftime(now, expire_time) > 0.0) {
DEBUG(4, ("Kerberos password expired.\n"));
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index f7ad71182a4f46a20386e70ffda129347c5e3d87..0df5afe8eab3f68f56dd47b1c01f2692b612c160 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -1578,8 +1578,9 @@ errno_t string_to_shadowpw_days(const char *s, long *d)
}
if (l < -1) {
- DEBUG(1, ("Input string contains not allowed negative value [%d].\n",
- l));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Input string contains not allowed negative value [%ld].\n",
+ l));
return EINVAL;
}
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index 53df7b0eeb3bb2bdbede6c126fb004658dea2656..b381fc40570fb1fabe88255a6543c06453a7d9ce 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -433,9 +433,10 @@ static bool nds_check_expired(const char *exp_time_str)
tzset();
expire_time -= timezone;
now = time(NULL);
- DEBUG(9, ("Time info: tzname[0] [%s] tzname[1] [%s] timezone [%d] "
- "daylight [%d] now [%d] expire_time [%d].\n", tzname[0],
- tzname[1], timezone, daylight, now, expire_time));
+ DEBUG(SSSDBG_TRACE_ALL,
+ ("Time info: tzname[0] [%s] tzname[1] [%s] timezone [%ld] "
+ "daylight [%d] now [%d] expire_time [%d].\n", tzname[0],
+ tzname[1], timezone, daylight, now, expire_time));
if (difftime(now, expire_time) > 0.0) {
DEBUG(4, ("NDS account expired.\n"));
diff --git a/src/util/util.h b/src/util/util.h
index c2c31f5d50e86315a3e751daf49cf594550bc7c6..67f60a5862b2d6c77b0e26b100a8e66f5ae9032f 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -128,7 +128,7 @@ errno_t set_debug_file_from_fd(const int fd);
memcpy(__debug_macro_datetime, ctime(&__debug_macro_tv.tv_sec), 19); \
__debug_macro_datetime[19] = '\0'; \
if (debug_microseconds) { \
- debug_fn("(%s:%.6d %d) [%s] [%s] (%#.4x): ", \
+ debug_fn("(%s:%.6ld %d) [%s] [%s] (%#.4x): ", \
__debug_macro_datetime, __debug_macro_tv.tv_usec, \
__debug_macro_year, debug_prg_name, \
__FUNCTION__, __debug_macro_newlevel); \
@@ -169,7 +169,7 @@ errno_t set_debug_file_from_fd(const int fd);
memcpy(__debug_macro_datetime, ctime(&__debug_macro_tv.tv_sec), 19); \
__debug_macro_datetime[19] = '\0'; \
if (debug_microseconds) { \
- debug_fn("(%s:%.6d %d) [%s] [%s] (%#.4x): %s\n", \
+ debug_fn("(%s:%.6ld %d) [%s] [%s] (%#.4x): %s\n", \
__debug_macro_datetime, __debug_macro_tv.tv_usec, \
__debug_macro_year, debug_prg_name, \
function, __debug_macro_newlevel, message); \
--
1.8.3.1
-------------- next part --------------
>From a9f40342b7a1ac5d70a6d7f4b2da1b0e5d90d67f Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 13 Jul 2013 15:40:29 +0200
Subject: [PATCH 02/19] Fix formating of variables with type: unsigned long
---
src/providers/proxy/proxy_auth.c | 2 +-
src/responder/common/responder_dp.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c
index 99b1a76c705975da91594eabd70e6a1a94eb6c18..61fec63aa416315546309035cfbe603d6a527329 100644
--- a/src/providers/proxy/proxy_auth.c
+++ b/src/providers/proxy/proxy_auth.c
@@ -167,7 +167,7 @@ static struct tevent_req *proxy_child_send(TALLOC_CTX *mem_ctx,
value.type = HASH_VALUE_PTR;
value.ptr = req;
- DEBUG(8, ("Queueing request [%d]\n", key.ul));
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("Queueing request [%lu]\n", key.ul));
hret = hash_enter(auth_ctx->request_table,
&key, &value);
if (hret != HASH_SUCCESS) {
diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c
index c5e8fc8baecc02a789eba53937d3760c6cb8dde7..e73e1e6b6233ac234bbcb991519fc6842634dde4 100644
--- a/src/responder/common/responder_dp.c
+++ b/src/responder/common/responder_dp.c
@@ -116,7 +116,7 @@ static int sss_dp_req_destructor(void *ptr)
if (hret != HASH_SUCCESS) {
/* This should never happen */
DEBUG(SSSDBG_TRACE_INTERNAL,
- ("BUG: Could not clear [%d:%d:%s] from request queue: [%s]\n",
+ ("BUG: Could not clear [%d:%lu:%s] from request queue: [%s]\n",
sdp_req->key->type, sdp_req->key->ul, sdp_req->key->str,
hash_error_string(hret)));
return -1;
--
1.8.3.1
-------------- next part --------------
>From fde74c0a4a9b275b3bec8af819eb8dc55be456e1 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 13 Jul 2013 15:46:09 +0200
Subject: [PATCH 03/19] Fix formating of variables with type: int
---
src/providers/ldap/sdap_async_connection.c | 2 +-
src/providers/ldap/sdap_fd_events.c | 5 +++--
src/util/sss_ldap.c | 5 +++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index e97bcf15e1f43432520ca85fa18d26c630893c0d..cc3e13d097d33dc7c44e1f1fecccd152ceb6cf67 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -294,7 +294,7 @@ static void sdap_sys_connect_done(struct tevent_req *subreq)
&ber_sasl_minssf);
if (lret != LDAP_OPT_SUCCESS) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to set LDAP MIN SSF option "
- "to %lu\n", sasl_minssf));
+ "to %d\n", sasl_minssf));
goto fail;
}
}
diff --git a/src/providers/ldap/sdap_fd_events.c b/src/providers/ldap/sdap_fd_events.c
index 190019471c45c30b88425c606d212616e5681779..5e4ea79b3e39e827ad0ad9db552dd1a0c94af90b 100644
--- a/src/providers/ldap/sdap_fd_events.c
+++ b/src/providers/ldap/sdap_fd_events.c
@@ -301,8 +301,9 @@ errno_t sdap_call_conn_cb(const char *uri,int fd, struct sdap_handle *sh)
ret = ldap_url_parse(uri, &lud);
if (ret != 0) {
ber_sockbuf_free(sb);
- DEBUG(1, ("ldap_url_parse failed to validate [%s] on fd [%ld].\n",
- uri, fd));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("ldap_url_parse failed to validate [%s] on fd [%d].\n",
+ uri, fd));
return EFAULT;
}
diff --git a/src/util/sss_ldap.c b/src/util/sss_ldap.c
index dea38eaa98e073a6d70918b8b32cd08b4a7eee05..6d7b0907ca2fa48d9cff5257ab6bbba0ae7dd5c6 100644
--- a/src/util/sss_ldap.c
+++ b/src/util/sss_ldap.c
@@ -420,8 +420,9 @@ static void sss_ldap_init_sys_connect_done(struct tevent_req *subreq)
lret = ldap_init_fd(state->sd, LDAP_PROTO_TCP, state->uri, &state->ldap);
if (lret != LDAP_SUCCESS) {
- DEBUG(1, ("ldap_init_fd failed: %s. [%ld][%s]\n",
- sss_ldap_err2string(lret), state->sd, state->uri));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("ldap_init_fd failed: %s. [%d][%s]\n",
+ sss_ldap_err2string(lret), state->sd, state->uri));
ret = lret == LDAP_SERVER_DOWN ? ETIMEDOUT : EIO;
goto fail;
}
--
1.8.3.1
-------------- next part --------------
>From e9f8297da317f5bf5802096fb2968aae99314578 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 13 Jul 2013 16:29:59 +0200
Subject: [PATCH 04/19] Fix pointer formatting
---
src/sbus/sssd_dbus_connection.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/sbus/sssd_dbus_connection.c b/src/sbus/sssd_dbus_connection.c
index 9077b81c13b826326c616402e9ecfe0f924012de..ccea88e6d72dc78829c368bf46dd374043d9728e 100644
--- a/src/sbus/sssd_dbus_connection.c
+++ b/src/sbus/sssd_dbus_connection.c
@@ -54,7 +54,7 @@ static void sbus_dispatch(struct tevent_context *ev,
conn = talloc_get_type(data, struct sbus_connection);
dbus_conn = conn->dbus.conn;
- DEBUG(9, ("dbus conn: %lX\n", dbus_conn));
+ DEBUG(SSSDBG_TRACE_ALL, ("dbus conn: %p\n", dbus_conn));
if (conn->retries > 0) {
DEBUG(6, ("SBUS is reconnecting. Deferring.\n"));
@@ -162,7 +162,7 @@ int sbus_init_connection(TALLOC_CTX *ctx,
struct sbus_connection *conn;
int ret;
- DEBUG(5,("Adding connection %lX\n", dbus_conn));
+ DEBUG(SSSDBG_TRACE_FUNC,("Adding connection %p\n", dbus_conn));
conn = talloc_zero(ctx, struct sbus_connection);
conn->ev = ev;
@@ -296,7 +296,7 @@ int sbus_default_connection_destructor(void *ctx)
struct sbus_connection *conn;
conn = talloc_get_type(ctx, struct sbus_connection);
- DEBUG(5, ("Invoking default destructor on connection %lX\n",
+ DEBUG(SSSDBG_TRACE_FUNC, ("Invoking default destructor on connection %p\n",
conn->dbus.conn));
if (conn->connection_type == SBUS_CONN_TYPE_PRIVATE) {
/* Private connections must be closed explicitly */
@@ -334,7 +334,7 @@ void sbus_disconnect (struct sbus_connection *conn)
return;
}
- DEBUG(5,("Disconnecting %lX\n", conn->dbus.conn));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Disconnecting %p\n", conn->dbus.conn));
/*******************************
* Referencing conn->dbus.conn */
@@ -374,7 +374,7 @@ void sbus_disconnect (struct sbus_connection *conn)
/* Unreferenced conn->dbus_conn *
******************************/
- DEBUG(5,("Disconnected %lX\n", conn->dbus.conn));
+ DEBUG(SSSDBG_TRACE_FUNC ,("Disconnected %p\n", conn->dbus.conn));
}
static int sbus_reply_internal_error(DBusMessage *message,
--
1.8.3.1
-------------- next part --------------
>From 713476f93c39d1555186133502c828d1e88e9a6e Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 13 Jul 2013 15:34:00 +0200
Subject: [PATCH 05/19] Use the same variable type like in struct
ldb_message_element
struct ldb_message_element.num_values is unsigned
This patch indirectly fixes printf format string warning.
---
src/providers/ldap/sdap_async_groups.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index a2e5106f00368d00984bc2371ff7be1c1bf130fc..bec27e0a7c7101f5a31c45cc0056b1c9ee2667cf 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -1056,7 +1056,7 @@ done:
static int
sdap_process_missing_member_2307bis(struct tevent_req *req,
char *user_dn,
- int num_users)
+ unsigned num_users)
{
struct sdap_process_group_state *grp_state =
tevent_req_data(req, struct sdap_process_group_state);
--
1.8.3.1
-------------- next part --------------
>From 0b50dab7ac97d38e8ee1da33404fc6593bd34f86 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 13:00:49 +0200
Subject: [PATCH 06/19] Fix formating of variables with type: ssize_t
---
src/providers/ipa/ipa_selinux.c | 4 ++--
src/providers/krb5/krb5_child_handler.c | 2 +-
src/providers/krb5/krb5_common.c | 4 ++--
src/tools/files.c | 2 +-
src/util/backup_file.c | 2 +-
src/util/child_common.c | 3 ++-
src/util/server.c | 4 ++--
7 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index 39bebebfd8f4880c4093dfd922f2dfaa79c38a2e..5f734338b8fb43d6d99ba9adcb25c655f8cb1951 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -672,7 +672,7 @@ static errno_t write_selinux_login_file(const char *username, char *string)
char *path = NULL;
char *tmp_path = NULL;
ssize_t written;
- int len;
+ size_t len;
int fd = -1;
mode_t oldmask;
TALLOC_CTX *tmp_ctx;
@@ -743,7 +743,7 @@ static errno_t write_selinux_login_file(const char *username, char *string)
}
if (written != len) {
- DEBUG(SSSDBG_OP_FAILURE, ("Expected to write %d bytes, wrote %d",
+ DEBUG(SSSDBG_OP_FAILURE, ("Expected to write %zd bytes, wrote %zu",
written, len));
ret = EIO;
goto done;
diff --git a/src/providers/krb5/krb5_child_handler.c b/src/providers/krb5/krb5_child_handler.c
index 8117d1e5db01cfe0684ee4d7f3e4acf8ff1e4768..20b83d1372fdf0026b36a4b9877673d3dce25ddd 100644
--- a/src/providers/krb5/krb5_child_handler.c
+++ b/src/providers/krb5/krb5_child_handler.c
@@ -538,7 +538,7 @@ parse_krb5_child_response(TALLOC_CTX *mem_ctx, uint8_t *buf, ssize_t len,
msg_status, msg_type, msg_len));
if ((p + msg_len) > len) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("message format error [%d] > [%d].\n",
+ DEBUG(SSSDBG_CRIT_FAILURE, ("message format error [%d] > [%zd].\n",
p+msg_len, len));
return EINVAL;
}
diff --git a/src/providers/krb5/krb5_common.c b/src/providers/krb5/krb5_common.c
index 80eaeb56fac7a81446c04c58d63d47914de739d0..c40f0dd493a6df5091553044b99d1f8807de7fd6 100644
--- a/src/providers/krb5/krb5_common.c
+++ b/src/providers/krb5/krb5_common.c
@@ -410,7 +410,7 @@ errno_t write_krb5info_file(const char *realm, const char *server,
char *krb5info_name = NULL;
TALLOC_CTX *tmp_ctx = NULL;
const char *name_tmpl = NULL;
- int server_len;
+ size_t server_len;
ssize_t written;
mode_t old_umask;
@@ -471,7 +471,7 @@ errno_t write_krb5info_file(const char *realm, const char *server,
if (written != server_len) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Write error, wrote [%d] bytes, expected [%d]\n",
+ ("Write error, wrote [%zd] bytes, expected [%zu]\n",
written, server_len));
ret = EIO;
goto done;
diff --git a/src/tools/files.c b/src/tools/files.c
index ff04d09f8ba14802098b8177dc7c905fa75f4e80..7fc8422817f0cb4365da6404b7eb15c6e3bfb253 100644
--- a/src/tools/files.c
+++ b/src/tools/files.c
@@ -408,7 +408,7 @@ copy_file(int ifd,
if (written != cnt) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Wrote %d bytes, expected %d\n", written, cnt));
+ ("Wrote %zd bytes, expected %zd\n", written, cnt));
goto done;
}
}
diff --git a/src/util/backup_file.c b/src/util/backup_file.c
index edbf868cb8f68ca534c257a6dfc761dc9fd025f2..316c1cfe8023c90b3ceb4d6a514754999f87c45b 100644
--- a/src/util/backup_file.c
+++ b/src/util/backup_file.c
@@ -103,7 +103,7 @@ int backup_file(const char *src_file, int dbglvl)
}
if (written != numread) {
- DEBUG(dbglvl, ("Wrote %d bytes expected %d bytes\n",
+ DEBUG(dbglvl, ("Wrote %zd bytes expected %zd bytes\n",
written, numread));
ret = EIO;
goto done;
diff --git a/src/util/child_common.c b/src/util/child_common.c
index 2bd2bbc3a557ea61c3bcf517a48b3673bd3d6d4f..28358606b0ba8b5fa6a28450f3111b68f8668fbf 100644
--- a/src/util/child_common.c
+++ b/src/util/child_common.c
@@ -484,7 +484,8 @@ static void read_pipe_handler(struct tevent_context *ev,
return;
} else {
- DEBUG(1, ("unexpected return value of read [%d].\n", size));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("unexpected return value of read [%zd].\n", size));
tevent_req_error(req, EINVAL);
return;
}
diff --git a/src/util/server.c b/src/util/server.c
index 9d3c9cb04dcac2f823982c31cac832fb473b720c..a33207b3da8a713d90dbd840475ecdb75f1fff0c 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -147,7 +147,7 @@ int pidfile(const char *path, const char *name)
int fd;
int ret, err;
ssize_t len;
- ssize_t size;
+ size_t size;
ssize_t written;
ssize_t pidlen = sizeof(pid_str) - 1;
@@ -227,7 +227,7 @@ int pidfile(const char *path, const char *name)
if (written != size) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Wrote %d bytes expected %d\n", written, size));
+ ("Wrote %zd bytes expected %zu\n", written, size));
close(fd);
return EIO;
}
--
1.8.3.1
-------------- next part --------------
>From 6d843172df607a90c7aaae94e7d68823f3d8b621 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 12:41:33 +0200
Subject: [PATCH 07/19] Fix formating of variables with type: size_t
---
src/db/sysdb_autofs.c | 2 +-
src/db/sysdb_ops.c | 2 +-
src/db/sysdb_search.c | 2 +-
src/providers/ad/ad_srv.c | 4 ++--
src/providers/fail_over_srv.c | 2 +-
src/providers/ipa/ipa_config.c | 2 +-
src/providers/ipa/ipa_idmap.c | 2 +-
src/providers/ipa/ipa_netgroups.c | 6 ++++--
src/providers/ipa/ipa_selinux.c | 4 ++--
src/providers/ipa/ipa_selinux_maps.c | 4 ++--
src/providers/ipa/ipa_srv.c | 2 +-
src/providers/ipa/ipa_subdomains_ext_groups.c | 2 +-
src/providers/krb5/krb5_child.c | 6 +++---
src/providers/krb5/krb5_child_handler.c | 2 +-
src/providers/krb5/krb5_renew_tgt.c | 3 ++-
src/providers/ldap/ldap_child.c | 6 +++---
src/providers/ldap/ldap_id_cleanup.c | 4 ++--
src/providers/ldap/sdap_access.c | 9 +++++----
src/providers/ldap/sdap_async_autofs.c | 8 ++++----
src/providers/ldap/sdap_async_groups.c | 19 +++++++++++--------
src/providers/ldap/sdap_async_groups_ad.c | 2 +-
src/providers/ldap/sdap_async_initgroups.c | 17 ++++++++++-------
src/providers/ldap/sdap_async_initgroups_ad.c | 2 +-
src/providers/ldap/sdap_async_nested_groups.c | 2 +-
src/providers/ldap/sdap_async_netgroups.c | 10 ++++++----
src/providers/ldap/sdap_async_services.c | 8 ++++----
src/providers/ldap/sdap_async_sudo.c | 2 +-
src/providers/ldap/sdap_async_users.c | 5 +++--
src/providers/ldap/sdap_child_helpers.c | 2 +-
src/providers/simple/simple_access_check.c | 4 ++--
src/responder/nss/nsssrv_mmap_cache.c | 2 +-
src/responder/pam/pamsrv_cmd.c | 2 +-
src/util/child_common.c | 2 +-
33 files changed, 82 insertions(+), 69 deletions(-)
diff --git a/src/db/sysdb_autofs.c b/src/db/sysdb_autofs.c
index cc44c350b744fc01f3a081c4a3de57b879a2693a..cb9685623c34ca4330b6e0278a3e7a4300f6b26d 100644
--- a/src/db/sysdb_autofs.c
+++ b/src/db/sysdb_autofs.c
@@ -407,7 +407,7 @@ sysdb_autofs_entries_by_map(TALLOC_CTX *mem_ctx,
*_count = count;
*_entries = talloc_steal(mem_ctx, msgs);
ret = EOK;
- DEBUG(SSSDBG_TRACE_INTERNAL, ("found %d entries for map %s\n",
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("found %zu entries for map %s\n",
count, mapname));
done:
talloc_free(tmp_ctx);
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index d97c914c2bf34141cc6569f6fa7eadf2a03a0cee..03f45de730be815d9cc9e42b6239ab6a7c04601b 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -175,7 +175,7 @@ int sysdb_delete_recursive(struct sysdb_ctx *sysdb,
goto done;
}
- DEBUG(9, ("Found [%d] items to delete.\n", msgs_count));
+ DEBUG(SSSDBG_TRACE_ALL, ("Found [%zu] items to delete.\n", msgs_count));
qsort(msgs, msgs_count,
sizeof(struct ldb_message *), compare_ldb_dn_comp_num);
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index d70d0cc3eee6fe5fa55bee6a36d4e8382d69c3ab..8dfaf1f2ada22db5e70ebe18bee1ee299e4767dd 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -972,7 +972,7 @@ errno_t sysdb_get_direct_parents(TALLOC_CTX *mem_ctx,
}
direct_parents[pi] = NULL;
- DEBUG(7, ("%s is a member of %d sysdb groups\n",
+ DEBUG(SSSDBG_TRACE_LIBS, ("%s is a member of %zu sysdb groups\n",
name, direct_sysdb_count));
*_direct_parents = talloc_steal(mem_ctx, direct_parents);
ret = EOK;
diff --git a/src/providers/ad/ad_srv.c b/src/providers/ad/ad_srv.c
index 3d545c43af01ad67cfc1c12b8cef4b3b79ecff37..a238c192e495c3ff6330123d8e53d7d480e88e1b 100644
--- a/src/providers/ad/ad_srv.c
+++ b/src/providers/ad/ad_srv.c
@@ -184,7 +184,7 @@ static void ad_get_dc_servers_done(struct tevent_req *subreq)
goto done;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("Found %lu domain controllers in domain %s\n",
+ DEBUG(SSSDBG_TRACE_FUNC, ("Found %zu domain controllers in domain %s\n",
state->num_servers, domain));
done:
@@ -830,7 +830,7 @@ static void ad_srv_plugin_servers_done(struct tevent_req *subreq)
return;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("Got %lu primary and %lu backup servers\n",
+ DEBUG(SSSDBG_TRACE_FUNC, ("Got %zu primary and %zu backup servers\n",
state->num_primary_servers, state->num_backup_servers));
ret = ad_sort_servers_by_dns(state, state->discovery_domain,
diff --git a/src/providers/fail_over_srv.c b/src/providers/fail_over_srv.c
index de3b7f9ce92000252e6ae036febaa5a614ca244f..543516ef19e288556e39e61b400a628c94e2817b 100644
--- a/src/providers/fail_over_srv.c
+++ b/src/providers/fail_over_srv.c
@@ -110,7 +110,7 @@ static void fo_discover_srv_done(struct tevent_req *subreq)
state->num_servers++;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("Got %lu servers\n", state->num_servers));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Got %zu servers\n", state->num_servers));
state->servers = talloc_array(state, struct fo_server_info,
state->num_servers);
diff --git a/src/providers/ipa/ipa_config.c b/src/providers/ipa/ipa_config.c
index 05231cc763c28c2867688530a6d4c17d2fd30933..0b392f5129ce895af2c0ca88286981a79cc5f4bc 100644
--- a/src/providers/ipa/ipa_config.c
+++ b/src/providers/ipa/ipa_config.c
@@ -125,7 +125,7 @@ static void ipa_get_config_done(struct tevent_req *subreq)
if (reply_count != 1) {
DEBUG(SSSDBG_OP_FAILURE, ("Unexpected number of results, expected 1, "
- "got %d.\n", reply_count));
+ "got %zu.\n", reply_count));
ret = EINVAL;
goto done;
}
diff --git a/src/providers/ipa/ipa_idmap.c b/src/providers/ipa/ipa_idmap.c
index c108ca75b84005c3d5957cd45ca89209d59f59ff..69ab55c92fcd274836b36d68ec08ac3b67b53685 100644
--- a/src/providers/ipa/ipa_idmap.c
+++ b/src/providers/ipa/ipa_idmap.c
@@ -194,7 +194,7 @@ errno_t ipa_idmap_init(TALLOC_CTX *mem_ctx,
}
DEBUG(SSSDBG_CONF_SETTINGS,
- ("Initializing [%d] domains for ID-mapping\n", range_count));
+ ("Initializing [%zu] domains for ID-mapping\n", range_count));
for (c = 0; c < range_count; c++) {
diff --git a/src/providers/ipa/ipa_netgroups.c b/src/providers/ipa/ipa_netgroups.c
index 0f36fc9f542f7b58ebb45664edc0e964ad2f92ff..0deb3944ef93ae1c1175f9e1c5526274cc849986 100644
--- a/src/providers/ipa/ipa_netgroups.c
+++ b/src/providers/ipa/ipa_netgroups.c
@@ -315,7 +315,8 @@ static void ipa_get_netgroups_process(struct tevent_req *subreq)
goto done;
}
- DEBUG(6, ("Search for netgroups, returned %d results.\n", netgroups_count));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Search for netgroups, returned %zu results.\n",
+ netgroups_count));
if (netgroups_count == 0) {
/* No netgroups found in this search */
@@ -575,7 +576,8 @@ static void ipa_netgr_members_process(struct tevent_req *subreq)
goto fail;
}
- DEBUG(SSSDBG_TRACE_INTERNAL, ("Found %u members in current search base\n", count));
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("Found %zu members in current search base\n",
+ count));
next_call = NULL;
/* While processing a batch of entities from one search base,
diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index 5f734338b8fb43d6d99ba9adcb25c655f8cb1951..c227db937a84228c0f3945dbe11ba904c7ad9744 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -1163,7 +1163,7 @@ static void ipa_get_selinux_maps_done(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_FUNC,
- ("Found %d SELinux user maps\n", state->nmaps));
+ ("Found %zu SELinux user maps\n", state->nmaps));
check_hbac = false;
for (i = 0; i < state->nmaps; i++) {
@@ -1222,7 +1222,7 @@ static void ipa_get_selinux_hbac_done(struct tevent_req *subreq)
ret = ipa_hbac_rule_info_recv(subreq, state, &state->hbac_rule_count,
&state->hbac_rules);
DEBUG(SSSDBG_TRACE_INTERNAL,
- ("Received %d HBAC rules\n", state->hbac_rule_count));
+ ("Received %zu HBAC rules\n", state->hbac_rule_count));
talloc_free(subreq);
if (ret != EOK) {
diff --git a/src/providers/ipa/ipa_selinux_maps.c b/src/providers/ipa/ipa_selinux_maps.c
index b0a2c8f727be2af0a4eb878f4b5b56a7b0ef11bd..1a210689b17b674158420c48ead7e9011cc35764 100644
--- a/src/providers/ipa/ipa_selinux_maps.c
+++ b/src/providers/ipa/ipa_selinux_maps.c
@@ -165,8 +165,8 @@ static void ipa_selinux_get_maps_done(struct tevent_req *subreq)
}
if (count > 0) {
- DEBUG(SSSDBG_TRACE_FUNC, ("Found %d user maps in current search base\n",
- count));
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("Found %zu user maps in current search base\n", count));
total_count = count + state->map_count;
state->maps = talloc_realloc(state, state->maps, struct sysdb_attrs *, total_count);
diff --git a/src/providers/ipa/ipa_srv.c b/src/providers/ipa/ipa_srv.c
index d604871a277574c93e2c7adf59cf6fa5065c89b7..aa07cf0542d294118728c7706bbfa50092d43b3b 100644
--- a/src/providers/ipa/ipa_srv.c
+++ b/src/providers/ipa/ipa_srv.c
@@ -173,7 +173,7 @@ static void ipa_srv_plugin_done(struct tevent_req *subreq)
return;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("Got %lu primary and %lu backup servers\n",
+ DEBUG(SSSDBG_TRACE_FUNC, ("Got %zu primary and %zu backup servers\n",
state->num_primary_servers, state->num_backup_servers));
tevent_req_done(req);
diff --git a/src/providers/ipa/ipa_subdomains_ext_groups.c b/src/providers/ipa/ipa_subdomains_ext_groups.c
index b87d22484f12e6dd2b04e8426a7357ebd2502f9f..a217c6a8ceeee6ce40fbef0007c39b9b8296e5d4 100644
--- a/src/providers/ipa/ipa_subdomains_ext_groups.c
+++ b/src/providers/ipa/ipa_subdomains_ext_groups.c
@@ -594,7 +594,7 @@ static void ipa_get_ext_groups_done(struct tevent_req *subreq)
return;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("[%d] external groups found.\n",
+ DEBUG(SSSDBG_TRACE_FUNC, ("[%zu] external groups found.\n",
state->reply_count));
ret = process_ext_groups(state->server_mode->ext_groups,
diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c
index 8738be163157a355009228cb410303e87868bc7b..f896332d60626149e188703a7ddf182bdd47443d 100644
--- a/src/providers/krb5/krb5_child.c
+++ b/src/providers/krb5/krb5_child.c
@@ -583,7 +583,7 @@ static errno_t pack_response_packet(TALLOC_CTX *mem_ctx, errno_t error,
safealign_memcpy(&buf[p], pdr->data, pdr->len, &p);
}
- DEBUG(SSSDBG_TRACE_INTERNAL, ("response packet size: [%d]\n", p));
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("response packet size: [%zu]\n", p));
*_buf = buf;
*_len = p;
@@ -637,7 +637,7 @@ static errno_t k5c_send_data(struct krb5_req *kr, int fd, errno_t error)
if (written != len) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Write error, wrote [%d] bytes, expected [%d]\n",
+ ("Write error, wrote [%zu] bytes, expected [%zu]\n",
written, len));
return EOK;
}
@@ -1405,7 +1405,7 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size,
struct pam_data *pd;
errno_t ret;
- DEBUG(SSSDBG_TRACE_LIBS, ("total buffer size: [%d]\n", size));
+ DEBUG(SSSDBG_TRACE_LIBS, ("total buffer size: [%zu]\n", size));
if (!offline || !kr) return EINVAL;
diff --git a/src/providers/krb5/krb5_child_handler.c b/src/providers/krb5/krb5_child_handler.c
index 20b83d1372fdf0026b36a4b9877673d3dce25ddd..9aa5c346acde17e1ea74d7a2ab231a6a9eebdb94 100644
--- a/src/providers/krb5/krb5_child_handler.c
+++ b/src/providers/krb5/krb5_child_handler.c
@@ -538,7 +538,7 @@ parse_krb5_child_response(TALLOC_CTX *mem_ctx, uint8_t *buf, ssize_t len,
msg_status, msg_type, msg_len));
if ((p + msg_len) > len) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("message format error [%d] > [%zd].\n",
+ DEBUG(SSSDBG_CRIT_FAILURE, ("message format error [%zu] > [%zd].\n",
p+msg_len, len));
return EINVAL;
}
diff --git a/src/providers/krb5/krb5_renew_tgt.c b/src/providers/krb5/krb5_renew_tgt.c
index d6cdff8f8c0efc98445363c0a12a7ec19d12477f..9102f8ca37668abbcef99b78e8c042ebab32025f 100644
--- a/src/providers/krb5/krb5_renew_tgt.c
+++ b/src/providers/krb5/krb5_renew_tgt.c
@@ -412,7 +412,8 @@ static errno_t check_ccache_files(struct renew_tgt_ctx *renew_tgt_ctx)
ret = EOK;
goto done;
}
- DEBUG(9, ("Found [%d] entries with ccache file in cache.\n", msgs_count));
+ DEBUG(SSSDBG_TRACE_ALL,
+ ("Found [%zu] entries with ccache file in cache.\n", msgs_count));
for (c = 0; c < msgs_count; c++) {
user_name = ldb_msg_find_attr_as_string(msgs[c], SYSDB_NAME, NULL);
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 9d82e7cf7c7a556c0e9f124c60a90170e21135b3..19c838dacc10bfa0428d96e2d8497d4b25b07079 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -57,7 +57,7 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size,
size_t p = 0;
uint32_t len;
- DEBUG(SSSDBG_TRACE_LIBS, ("total buffer size: %d\n", size));
+ DEBUG(SSSDBG_TRACE_LIBS, ("total buffer size: %zu\n", size));
/* realm_str size and length */
SAFEALIGN_COPY_UINT32_CHECK(&len, buf + p, size, &p);
@@ -112,7 +112,7 @@ static int pack_buffer(struct response *r, int result, krb5_error_code krberr,
r->size = 2 * sizeof(uint32_t) + sizeof(krb5_error_code) +
len + sizeof(time_t);
- DEBUG(SSSDBG_TRACE_INTERNAL, ("response size: %d\n",r->size));
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("response size: %zu\n",r->size));
r->buf = talloc_array(r, uint8_t, r->size);
if(!r->buf) {
@@ -540,7 +540,7 @@ int main(int argc, const char *argv[])
}
if (written != resp->size) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Expected to write %d bytes, wrote %d\n",
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Expected to write %zu bytes, wrote %zu\n",
resp->size, written));
goto fail;
}
diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c
index 1fd2ff49fe7e80fc9856eb7fadb9017145fb4b45..c13d1714287645f0e168e25d5ef2e86e3116c7f6 100644
--- a/src/providers/ldap/ldap_id_cleanup.c
+++ b/src/providers/ldap/ldap_id_cleanup.c
@@ -226,7 +226,7 @@ static int cleanup_users(struct sdap_options *opts,
goto done;
}
- DEBUG(4, ("Found %d expired user entries!\n", count));
+ DEBUG(SSSDBG_FUNC_DATA, ("Found %zu expired user entries!\n", count));
if (count == 0) {
ret = EOK;
@@ -348,7 +348,7 @@ static int cleanup_groups(TALLOC_CTX *memctx,
goto done;
}
- DEBUG(4, ("Found %d expired group entries!\n", count));
+ DEBUG(SSSDBG_FUNC_DATA, ("Found %zu expired group entries!\n", count));
if (count == 0) {
ret = EOK;
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index b381fc40570fb1fabe88255a6543c06453a7d9ce..9ea9077551b71d494947c7bfd7477ac8ddf227a2 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -464,8 +464,9 @@ static bool nds_check_time_map(const struct ldb_val *time_map)
}
if (time_map->length != 42) {
- DEBUG(4, ("Allowed time map has the wrong size, "
- "got [%d], expected 42.\n", time_map->length));
+ DEBUG(SSSDBG_FUNC_DATA,
+ ("Allowed time map has the wrong size, "
+ "got [%zu], expected 42.\n", time_map->length));
return true;
}
@@ -477,7 +478,7 @@ static bool nds_check_time_map(const struct ldb_val *time_map)
if (map_index > 335) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Unexpected index value [%d] for time map.\n", map_index));
+ ("Unexpected index value [%zu] for time map.\n", map_index));
return true;
}
@@ -485,7 +486,7 @@ static bool nds_check_time_map(const struct ldb_val *time_map)
if (q.quot > 41 || q.quot < 0 || q.rem > 7 || q.rem < 0) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Unexpected result of div(), [%d][%d][%d].\n",
+ ("Unexpected result of div(), [%zu][%d][%d].\n",
map_index, q.quot, q.rem));
return true;
}
diff --git a/src/providers/ldap/sdap_async_autofs.c b/src/providers/ldap/sdap_async_autofs.c
index ae70e703564acebaa1ca9adfb2395ca1c06fd802..4886150f92ec08ee82f9736a7b0cfd52bea7ff91 100644
--- a/src/providers/ldap/sdap_async_autofs.c
+++ b/src/providers/ldap/sdap_async_autofs.c
@@ -394,7 +394,7 @@ automntmaps_process_members_done(struct tevent_req *subreq)
DEBUG(SSSDBG_TRACE_INTERNAL, ("No more search bases to try\n"));
DEBUG(SSSDBG_TRACE_FUNC,
- ("Search for autofs entries, returned %d results.\n",
+ ("Search for autofs entries, returned %zu results.\n",
state->entries_count));
tevent_req_done(req);
@@ -549,7 +549,7 @@ sdap_get_automntmap_process(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_FUNC,
- ("Search for autofs maps, returned %d results.\n", state->count));
+ ("Search for autofs maps, returned %zu results.\n", state->count));
if (state->count == 0) {
/* No maps found in this search */
@@ -801,7 +801,7 @@ sdap_autofs_setautomntent_save(struct tevent_req *req)
if (!tmp_ctx) return ENOMEM;
DEBUG(SSSDBG_TRACE_LIBS,
- ("Got %d map entries from LDAP\n", state->entries_count));
+ ("Got %zu map entries from LDAP\n", state->entries_count));
if (state->entries_count == 0) {
/* No entries for this map in LDAP.
* We need to ensure that there are no entries
@@ -866,7 +866,7 @@ sdap_autofs_setautomntent_save(struct tevent_req *req)
goto done;
}
- DEBUG(SSSDBG_TRACE_LIBS, ("Got %d map entries from sysdb\n", count));
+ DEBUG(SSSDBG_TRACE_LIBS, ("Got %zu map entries from sysdb\n", count));
if (count == 0) {
/* No map members for this map in sysdb currently */
sysdb_entrylist = NULL;
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index bec27e0a7c7101f5a31c45cc0056b1c9ee2667cf..2ce1d5dd6020ca7b81ab0d09ddd28412fe6dc555 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -377,7 +377,7 @@ sdap_process_ghost_members(struct sysdb_attrs *attrs,
ghostel->num_values = gh->num_values;
cnt = ghostel->num_values + memberel->num_values;
- DEBUG(SSSDBG_TRACE_FUNC, ("Group has %d members\n", cnt));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Group has %zu members\n", cnt));
/* Now process RFC2307bis ghost hash table */
if (ghosts && cnt > 0) {
@@ -1072,8 +1072,9 @@ sdap_process_missing_member_2307bis(struct tevent_req *req,
if (grp_state->check_count > GROUPMEMBER_REQ_PARALLEL) {
DEBUG(7, (" queueing search for: %s\n", user_dn));
if (!grp_state->queued_members) {
- DEBUG(7, ("Allocating queue for %d members\n",
- num_users - grp_state->check_count));
+ DEBUG(SSSDBG_TRACE_LIBS,
+ ("Allocating queue for %zu members\n",
+ num_users - grp_state->check_count));
grp_state->queued_members = talloc_array(grp_state, char *,
num_users - grp_state->check_count + 1);
@@ -1349,7 +1350,7 @@ static void sdap_process_group_members(struct tevent_req *subreq)
uint8_t* name_string;
state->check_count--;
- DEBUG(9, ("Members remaining: %d\n", state->check_count));
+ DEBUG(SSSDBG_TRACE_ALL, ("Members remaining: %zu\n", state->check_count));
ret = sdap_get_generic_recv(subreq, state, &count, &usr_attrs);
talloc_zfree(subreq);
@@ -1358,7 +1359,8 @@ static void sdap_process_group_members(struct tevent_req *subreq)
}
if (count != 1) {
ret = EINVAL;
- DEBUG(7, ("Expected one user entry and got %d\n", count));
+ DEBUG(SSSDBG_TRACE_LIBS,
+ ("Expected one user entry and got %zu\n", count));
goto next;
}
ret = sysdb_attrs_get_el(usr_attrs[0],
@@ -1584,7 +1586,8 @@ static void sdap_get_groups_process(struct tevent_req *subreq)
return;
}
- DEBUG(6, ("Search for groups, returned %d results.\n", count));
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("Search for groups, returned %zu results.\n", count));
if (!state->enumeration && count > 1) {
DEBUG(SSSDBG_MINOR_FAILURE,
@@ -1747,7 +1750,7 @@ static void sdap_get_groups_done(struct tevent_req *subreq)
}
state->check_count--;
- DEBUG(9, ("Groups remaining: %d\n", state->check_count));
+ DEBUG(SSSDBG_TRACE_ALL, ("Groups remaining: %zu\n", state->check_count));
if (state->check_count == 0) {
@@ -1765,7 +1768,7 @@ static void sdap_get_groups_done(struct tevent_req *subreq)
tevent_req_error(req, ret);
return;
}
- DEBUG(9, ("Saving %d Groups - Done\n", state->count));
+ DEBUG(SSSDBG_TRACE_ALL, ("Saving %zu Groups - Done\n", state->count));
sysret = sysdb_transaction_commit(state->sysdb);
if (sysret != EOK) {
DEBUG(0, ("Couldn't commit transaction\n"));
diff --git a/src/providers/ldap/sdap_async_groups_ad.c b/src/providers/ldap/sdap_async_groups_ad.c
index 1268f7e7de30849d1948265e50a327501982749d..9b61c697d5789c3ec3467ec52a7171f6a640ce9e 100644
--- a/src/providers/ldap/sdap_async_groups_ad.c
+++ b/src/providers/ldap/sdap_async_groups_ad.c
@@ -189,7 +189,7 @@ sdap_get_ad_match_rule_members_step(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_LIBS,
- ("Search for users returned %d results\n", count));
+ ("Search for users returned %zu results\n", count));
/* Add this batch of users to the list */
if (count > 0) {
diff --git a/src/providers/ldap/sdap_async_initgroups.c b/src/providers/ldap/sdap_async_initgroups.c
index aa0ea4c1b28fa2a69390605d3fff3cfff1642aa1..a0df82ca54c89f1df0e301d4e0bae439c97f20f7 100644
--- a/src/providers/ldap/sdap_async_initgroups.c
+++ b/src/providers/ldap/sdap_async_initgroups.c
@@ -954,8 +954,9 @@ static void sdap_initgr_nested_search(struct tevent_req *subreq)
groups[0]);
state->groups_cur++;
} else {
- DEBUG(2, ("Search for group %s, returned %d results. Skipping\n",
- state->group_dns[state->cur], count));
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("Search for group %s, returned %zu results. Skipping\n",
+ state->group_dns[state->cur], count));
}
state->cur++;
@@ -1619,7 +1620,7 @@ static void sdap_initgr_rfc2307bis_process(struct tevent_req *subreq)
return;
}
DEBUG(SSSDBG_TRACE_LIBS,
- ("Found %d parent groups for user [%s]\n", count, state->name));
+ ("Found %zu parent groups for user [%s]\n", count, state->name));
/* Add this batch of groups to the list */
if (count > 0) {
@@ -2128,7 +2129,8 @@ struct tevent_req *rfc2307bis_nested_groups_send(
struct sdap_rfc2307bis_nested_ctx *state;
DEBUG(SSSDBG_TRACE_INTERNAL,
- ("About to process %d groups in nesting level %d\n", num_groups, nesting));
+ ("About to process %zu groups in nesting level %zu\n",
+ num_groups, nesting));
req = tevent_req_create(mem_ctx, &state,
struct sdap_rfc2307bis_nested_ctx);
@@ -2376,7 +2378,7 @@ static void rfc2307bis_nested_groups_process(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_LIBS,
- ("Found %d parent groups of [%s]\n", count, state->orig_dn));
+ ("Found %zu parent groups of [%s]\n", count, state->orig_dn));
ngr = state->processed_groups[state->group_iter];
/* Add this batch of groups to the list */
@@ -2405,7 +2407,7 @@ static void rfc2307bis_nested_groups_process(struct tevent_req *subreq)
ngr->ldap_parents[ngr->parents_count] = NULL;
DEBUG(SSSDBG_TRACE_INTERNAL,
- ("Total of %d direct parents after this iteration\n",
+ ("Total of %zu direct parents after this iteration\n",
ngr->parents_count));
}
@@ -2727,7 +2729,8 @@ static void sdap_get_initgr_user(struct tevent_req *subreq)
return;
}
} else if (count != 1) {
- DEBUG(2, ("Expected one user entry and got %d\n", count));
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("Expected one user entry and got %zu\n", count));
tevent_req_error(req, EINVAL);
return;
}
diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c
index e5649a2b9793253a55c48fba69cd3a902c0dc967..efaa247dd22d2ae100e8881c010dfe26a9a10cca 100644
--- a/src/providers/ldap/sdap_async_initgroups_ad.c
+++ b/src/providers/ldap/sdap_async_initgroups_ad.c
@@ -212,7 +212,7 @@ sdap_get_ad_match_rule_initgroups_step(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_LIBS,
- ("Search for users returned %d results\n", count));
+ ("Search for users returned %zu results\n", count));
/* Add this batch of groups to the list */
if (count > 0) {
diff --git a/src/providers/ldap/sdap_async_nested_groups.c b/src/providers/ldap/sdap_async_nested_groups.c
index 0147a607f75302ce1d05c1385d717156c7a3184e..6e7056618d801f84a706c06cefd9a9854b469222 100644
--- a/src/providers/ldap/sdap_async_nested_groups.c
+++ b/src/providers/ldap/sdap_async_nested_groups.c
@@ -2036,7 +2036,7 @@ sdap_nested_group_deref_direct_process(struct tevent_req *subreq)
goto done;
}
- DEBUG(SSSDBG_TRACE_INTERNAL, ("Received %d dereference results, "
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("Received %zu dereference results, "
"about to process them\n", num_entries));
/*
diff --git a/src/providers/ldap/sdap_async_netgroups.c b/src/providers/ldap/sdap_async_netgroups.c
index 81e53c842706d47fa563f893413e4e87078974c0..099955a641f073b59620e7582fc33f9dcefe17b4 100644
--- a/src/providers/ldap/sdap_async_netgroups.c
+++ b/src/providers/ldap/sdap_async_netgroups.c
@@ -492,8 +492,9 @@ static void netgr_translate_members_ldap_done(struct tevent_req *subreq)
}
break;
default:
- DEBUG(1, ("Unexpected number of results [%d] for base search.\n",
- count));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Unexpected number of results [%zu] for base search.\n",
+ count));
}
if (state->dn_item->cn == NULL) {
@@ -661,7 +662,8 @@ static void sdap_get_netgroups_process(struct tevent_req *subreq)
return;
}
- DEBUG(6, ("Search for netgroups, returned %d results.\n", state->count));
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("Search for netgroups, returned %zu results.\n", state->count));
if (state->count == 0) {
/* No netgroups found in this search */
@@ -725,7 +727,7 @@ static void netgr_translate_members_done(struct tevent_req *subreq)
}
}
- DEBUG(9, ("Saving %d Netgroups - Done\n", state->count));
+ DEBUG(SSSDBG_TRACE_ALL, ("Saving %zu Netgroups - Done\n", state->count));
tevent_req_done(req);
}
diff --git a/src/providers/ldap/sdap_async_services.c b/src/providers/ldap/sdap_async_services.c
index d637d22e59a68a0957ce01f92ddb99ee8d111f5f..c4245f0574200bca5d3c5770eeefb5b03445393c 100644
--- a/src/providers/ldap/sdap_async_services.c
+++ b/src/providers/ldap/sdap_async_services.c
@@ -177,7 +177,7 @@ sdap_get_services_process(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_FUNC,
- ("Search for services, returned %d results.\n",
+ ("Search for services, returned %zu results.\n",
count));
if (state->enumeration || count == 0) {
@@ -240,7 +240,7 @@ sdap_get_services_process(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_INTERNAL,
- ("Saving %d services - Done\n", state->count));
+ ("Saving %zu services - Done\n", state->count));
tevent_req_done(req);
}
@@ -292,10 +292,10 @@ sdap_save_services(TALLOC_CTX *mem_ctx,
* Just report the failure to save and go on */
if (ret) {
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Failed to store service %d. Ignoring.\n", i));
+ ("Failed to store service %zu. Ignoring.\n", i));
} else {
DEBUG(SSSDBG_TRACE_INTERNAL,
- ("Service [%lu/%lu] processed!\n", i, num_services));
+ ("Service [%zu/%zu] processed!\n", i, num_services));
}
if (usn_value) {
diff --git a/src/providers/ldap/sdap_async_sudo.c b/src/providers/ldap/sdap_async_sudo.c
index ed4cf75ad5e38df3b955f5fe061a8b188fe89927..0d4882bd119dd4d4d217163f97cad275921adf8d 100644
--- a/src/providers/ldap/sdap_async_sudo.c
+++ b/src/providers/ldap/sdap_async_sudo.c
@@ -477,7 +477,7 @@ static void sdap_sudo_refresh_load_done(struct tevent_req *subreq)
goto done;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("Received %d rules\n", rules_count));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Received %zu rules\n", rules_count));
/* start transaction */
ret = sysdb_transaction_start(state->sysdb);
diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index 353dc3992f4124187daeb90419d010253a00f63f..860e8feaf1bfcc99ce0640be417acc2bbf563887 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -697,7 +697,8 @@ static void sdap_get_users_process(struct tevent_req *subreq)
return;
}
- DEBUG(6, ("Search for users, returned %d results.\n", count));
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("Search for users, returned %zu results.\n", count));
if (state->enumeration || count == 0) {
/* No users found in this search or enumerating */
@@ -758,7 +759,7 @@ static void sdap_get_users_process(struct tevent_req *subreq)
return;
}
- DEBUG(9, ("Saving %d Users - Done\n", state->count));
+ DEBUG(SSSDBG_TRACE_ALL, ("Saving %zu Users - Done\n", state->count));
tevent_req_done(req);
}
diff --git a/src/providers/ldap/sdap_child_helpers.c b/src/providers/ldap/sdap_child_helpers.c
index e57313442fec1723e3cbcc186d9720b7e9a6ce89..9aaff785b789139dee033ecf73d1f74917d9a94c 100644
--- a/src/providers/ldap/sdap_child_helpers.c
+++ b/src/providers/ldap/sdap_child_helpers.c
@@ -160,7 +160,7 @@ static errno_t create_tgt_req_send_buffer(TALLOC_CTX *mem_ctx,
buf->size += strlen(keytab_name);
}
- DEBUG(7, ("buffer size: %d\n", buf->size));
+ DEBUG(SSSDBG_TRACE_FUNC, ("buffer size: %zu\n", buf->size));
buf->data = talloc_size(buf, buf->size);
if (buf->data == NULL) {
diff --git a/src/providers/simple/simple_access_check.c b/src/providers/simple/simple_access_check.c
index dc5f3676484c3748186cbe69fd4260ee329568a6..7335135ea5dedecdb5ba2be60a57d18eb897a960 100644
--- a/src/providers/simple/simple_access_check.c
+++ b/src/providers/simple/simple_access_check.c
@@ -389,7 +389,7 @@ simple_check_get_groups_send(TALLOC_CTX *mem_ctx,
}
DEBUG(SSSDBG_TRACE_FUNC,
- ("User %s is a member of %d supplemental groups\n",
+ ("User %s is a member of %zu supplemental groups\n",
username, group_count));
/* One extra space for terminator, one extra space for private group */
@@ -435,7 +435,7 @@ simple_check_get_groups_send(TALLOC_CTX *mem_ctx,
goto done;
}
- DEBUG(SSSDBG_TRACE_FUNC, ("Need to resolve %d groups\n", state->num_gids));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Need to resolve %zu groups\n", state->num_gids));
state->giter = 0;
subreq = simple_resolve_group_send(req, state->ev, state->ctx,
state->lookup_gids[state->giter]);
diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
index a22bbd5947cf67ffa1b8275e8608607e9a3ba39f..4e45405ad7f13438a9a7b03bb6f22047625e9676 100644
--- a/src/responder/nss/nsssrv_mmap_cache.c
+++ b/src/responder/nss/nsssrv_mmap_cache.c
@@ -1211,7 +1211,7 @@ errno_t sss_mmap_cache_init(TALLOC_CTX *mem_ctx, const char *name,
MAP_SHARED, mc_ctx->fd, 0);
if (mc_ctx->mmap_base == MAP_FAILED) {
ret = errno;
- DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to mmap file %s(%ld): %d(%s)\n",
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Failed to mmap file %s(%zu): %d(%s)\n",
mc_ctx->file, mc_ctx->mmap_size,
ret, strerror(ret)));
goto done;
diff --git a/src/responder/pam/pamsrv_cmd.c b/src/responder/pam/pamsrv_cmd.c
index 085bd8869b34de9aa6782618dc76dcaec8e74139..32efc4ba85d0f29dd3a52fc2d217c079ec480b2d 100644
--- a/src/responder/pam/pamsrv_cmd.c
+++ b/src/responder/pam/pamsrv_cmd.c
@@ -610,7 +610,7 @@ static void pam_reply(struct pam_auth_req *preq)
}
sss_packet_get_body(cctx->creq->out, &body, &blen);
- DEBUG(4, ("blen: %d\n", blen));
+ DEBUG(SSSDBG_FUNC_DATA, ("blen: %zu\n", blen));
p = 0;
memcpy(&body[p], &pd->pam_status, sizeof(int32_t));
diff --git a/src/util/child_common.c b/src/util/child_common.c
index 28358606b0ba8b5fa6a28450f3111b68f8668fbf..55b3672f4ec948c9c832b4af0a9b5a61519091eb 100644
--- a/src/util/child_common.c
+++ b/src/util/child_common.c
@@ -382,7 +382,7 @@ static void write_pipe_handler(struct tevent_context *ev,
}
if (state->len != state->written) {
- DEBUG(SSSDBG_CRIT_FAILURE, ("Wrote %d bytes, expected %d\n",
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Wrote %zu bytes, expected %zu\n",
state->written, state->len));
tevent_req_error(req, EIO);
return;
--
1.8.3.1
-------------- next part --------------
>From d534ee7e09d4551743913e8bf41c9cd4d7fe350b Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Thu, 18 Jul 2013 08:52:15 +0200
Subject: [PATCH 08/19] Adding new header for printf formating macros
---
Makefile.am | 1 +
src/util/sss_format.h | 32 ++++++++++++++++++++++++++++++++
src/util/util.h | 1 +
3 files changed, 34 insertions(+)
create mode 100644 src/util/sss_format.h
diff --git a/Makefile.am b/Makefile.am
index 25a4cbf83c790b85fab9ccccd611f59704a5b301..bbc8415e6acbbb0008ed120978e1aaed66245294 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -397,6 +397,7 @@ dist_noinst_HEADERS = \
src/util/sss_utf8.h \
src/util/sss_ssh.h \
src/util/sss_ini.h \
+ src/util/sss_format.h \
src/util/refcount.h \
src/util/find_uid.h \
src/util/user_info_msg.h \
diff --git a/src/util/sss_format.h b/src/util/sss_format.h
new file mode 100644
index 0000000000000000000000000000000000000000..db1a5051ff99171f84f53f10a1e9bc4726dde843
--- /dev/null
+++ b/src/util/sss_format.h
@@ -0,0 +1,32 @@
+/*
+ SSSD
+
+ sss_format.h
+
+ Authors:
+ Lukas Slebodnik <lslebodn at redhat.com>
+
+ Copyright (C) 2013 Red Hat
+
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#ifndef __SSS_FORMAT_H__
+#define __SSS_FORMAT_H__
+
+#include <inttypes.h>
+
+#endif /* __SSS_FORMAT_H__ */
diff --git a/src/util/util.h b/src/util/util.h
index 67f60a5862b2d6c77b0e26b100a8e66f5ae9032f..ff54048bfdd6455ad5491aff499d725657b9847b 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -47,6 +47,7 @@
#include "util/atomic_io.h"
#include "util/util_errors.h"
#include "util/util_safealign.h"
+#include "util/sss_format.h"
#define _(STRING) gettext (STRING)
--
1.8.3.1
-------------- next part --------------
>From 72994fb5a84a7daec76c67ee3b10e9a233e788db Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 16:40:26 +0200
Subject: [PATCH 09/19] Fix formating of variables with type: key_serial_t
---
src/providers/krb5/krb5_delayed_online_authentication.c | 3 ++-
src/util/sss_format.h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/providers/krb5/krb5_delayed_online_authentication.c b/src/providers/krb5/krb5_delayed_online_authentication.c
index 87e0f3c631def0d437aa4268e8a3cfcb439be7e0..46ed6f65c7ad97c47db57cfe97b33e6dd7e3b074 100644
--- a/src/providers/krb5/krb5_delayed_online_authentication.c
+++ b/src/providers/krb5/krb5_delayed_online_authentication.c
@@ -279,7 +279,8 @@ errno_t add_user_to_delayed_online_authentication(struct krb5_ctx *krb5_ctx,
talloc_free(new_pd);
return ret;
}
- DEBUG(9, ("Saved authtok of user [%s] with serial [%ld].\n",
+ DEBUG(SSSDBG_TRACE_ALL,
+ ("Saved authtok of user [%s] with serial [%"SPRIkey_ser"].\n",
new_pd->user, new_pd->key_serial));
sss_authtok_set_empty(new_pd->authtok);
#endif
diff --git a/src/util/sss_format.h b/src/util/sss_format.h
index db1a5051ff99171f84f53f10a1e9bc4726dde843..ac3d382893fc0a3d623bfdc86ea0efc569e0a725 100644
--- a/src/util/sss_format.h
+++ b/src/util/sss_format.h
@@ -29,4 +29,7 @@
#include <inttypes.h>
+/* key_serial_t is defined in keyutils.h as typedef int32_t */
+#define SPRIkey_ser PRId32
+
#endif /* __SSS_FORMAT_H__ */
--
1.8.3.1
-------------- next part --------------
>From 2746a7dba87c53cd810a285ab2f3f2ac7a0d1e35 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 16:18:04 +0200
Subject: [PATCH 10/19] Fix formating of variables with type: rlim_t
---
src/responder/common/responder_common.c | 10 +++++-----
src/util/sss_format.h | 7 +++++++
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
index 58a92f973114c83a44049fc91f11702bc4e45435..908031a0de7fb4df0f415b9b4adf94457d7f7e26 100644
--- a/src/responder/common/responder_common.c
+++ b/src/responder/common/responder_common.c
@@ -999,7 +999,7 @@ void responder_set_fd_limit(rlim_t fd_limit)
limret = setrlimit(RLIMIT_NOFILE, &new_limit);
if (limret == 0) {
DEBUG(SSSDBG_CONF_SETTINGS,
- ("Maximum file descriptors set to [%d]\n",
+ ("Maximum file descriptors set to [%"SPRIrlim"]\n",
new_limit.rlim_cur));
return;
}
@@ -1012,7 +1012,7 @@ void responder_set_fd_limit(rlim_t fd_limit)
limret = getrlimit(RLIMIT_NOFILE, ¤t_limit);
if (limret == 0) {
DEBUG(SSSDBG_TRACE_INTERNAL,
- ("Current fd limit: [%d]\n",
+ ("Current fd limit: [%"SPRIrlim"]\n",
current_limit.rlim_cur));
/* Choose the lesser of the requested and the hard limit */
if (current_limit.rlim_max < fd_limit) {
@@ -1025,12 +1025,12 @@ void responder_set_fd_limit(rlim_t fd_limit)
limret = setrlimit(RLIMIT_NOFILE, &new_limit);
if (limret == 0) {
DEBUG(SSSDBG_CONF_SETTINGS,
- ("Maximum file descriptors set to [%d]\n",
+ ("Maximum file descriptors set to [%"SPRIrlim"]\n",
new_limit.rlim_cur));
} else {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("Could not set new fd limits. Proceeding with [%d]\n",
- current_limit.rlim_cur));
+ ("Could not set new fd limits. Proceeding with "
+ "[%"SPRIrlim"]\n", current_limit.rlim_cur));
}
} else {
DEBUG(SSSDBG_CRIT_FAILURE,
diff --git a/src/util/sss_format.h b/src/util/sss_format.h
index ac3d382893fc0a3d623bfdc86ea0efc569e0a725..a922ee367860e85f458672feab4eb3fcd3744b04 100644
--- a/src/util/sss_format.h
+++ b/src/util/sss_format.h
@@ -32,4 +32,11 @@
/* key_serial_t is defined in keyutils.h as typedef int32_t */
#define SPRIkey_ser PRId32
+/* rlim_t is defined with conditional build as unsigned type.
+ * 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
+
#endif /* __SSS_FORMAT_H__ */
--
1.8.3.1
-------------- next part --------------
>From 3d2e8fd24e52738a982f4d35d3fdf5121599ff94 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 14:03:41 +0200
Subject: [PATCH 11/19] Fix formating of variables with type defined in
stdint.h
---
src/providers/ldap/sdap_access.c | 5 +++--
src/providers/proxy/proxy_child.c | 4 ++--
src/providers/proxy/proxy_init.c | 3 ++-
src/responder/nss/nsssrv_services.c | 13 +++++++------
4 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index 9ea9077551b71d494947c7bfd7477ac8ddf227a2..a4c6386501d785090a301ae70b9f961bef4b1355 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -338,8 +338,9 @@ static errno_t sdap_account_expired_ad(struct pam_data *pd,
expiration_time = ldb_msg_find_attr_as_uint64(user_entry,
SYSDB_AD_ACCOUNT_EXPIRES, 0);
- DEBUG(9, ("Expiration time for user [%s] is [%lld].\n",
- pd->user, expiration_time));
+ DEBUG(SSSDBG_TRACE_ALL,
+ ("Expiration time for user [%s] is [%"PRIu64"].\n",
+ pd->user, expiration_time));
if (uac & UAC_ACCOUNTDISABLE) {
diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c
index 6f95ede6af78f0286933fc4259dd258ef69f2d37..66afcfb64fde68af2a7f0b820db185d4158aaf48 100644
--- a/src/providers/proxy/proxy_child.c
+++ b/src/providers/proxy/proxy_child.c
@@ -430,8 +430,8 @@ int proxy_child_send_id(struct sbus_connection *conn,
return ENOMEM;
}
- DEBUG(4, ("Sending ID to Proxy Backend: (%d,%ld)\n",
- version, id));
+ DEBUG(SSSDBG_FUNC_DATA, ("Sending ID to Proxy Backend: (%d,%"PRIu32")\n",
+ version, id));
ret = dbus_message_append_args(msg,
DBUS_TYPE_UINT16, &version,
diff --git a/src/providers/proxy/proxy_init.c b/src/providers/proxy/proxy_init.c
index 2b154a0703c686c0c2e5074f20bf1690bc5242cb..ec2b193569baefd4cb2f617ed8e15bdcf547f736 100644
--- a/src/providers/proxy/proxy_init.c
+++ b/src/providers/proxy/proxy_init.c
@@ -22,6 +22,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "util/sss_format.h"
#include "providers/proxy/proxy.h"
static int client_registration(DBusMessage *message,
@@ -415,7 +416,7 @@ static int client_registration(DBusMessage *message,
return EIO;
}
- DEBUG(4, ("Proxy client [%ld] connected\n", cli_id));
+ DEBUG(SSSDBG_FUNC_DATA, ("Proxy client [%"PRIu32"] connected\n", cli_id));
/* Check the hash table */
key.type = HASH_KEY_ULONG;
diff --git a/src/responder/nss/nsssrv_services.c b/src/responder/nss/nsssrv_services.c
index dccc2f40789ead31b8d76bf9a6c1f0e53334cfbb..79caa7d08cdfff25112eedab98a0419f1b1d154e 100644
--- a/src/responder/nss/nsssrv_services.c
+++ b/src/responder/nss/nsssrv_services.c
@@ -225,7 +225,7 @@ getserv_send(TALLOC_CTX *mem_ctx,
/* If negatively cached, return we didn't find it */
if (ret == EEXIST) {
DEBUG(SSSDBG_TRACE_FUNC,
- ("Service [%lu:%s] does not exist in [%s]! "
+ ("Service [%"PRIu16":%s] does not exist in [%s]! "
"(negative cache)\n",
port,
SVC_PROTO_CASED ? SVC_PROTO_CASED : "<ANY>",
@@ -248,7 +248,7 @@ getserv_send(TALLOC_CTX *mem_ctx,
/* Check the cache */
DEBUG(SSSDBG_TRACE_FUNC,
- ("Checking cache for [%lu:%s@%s]\n",
+ ("Checking cache for [%"PRIu16":%s@%s]\n",
port,
SVC_PROTO_CASED ? SVC_PROTO_CASED : "<ANY>",
dom->name));
@@ -291,7 +291,8 @@ getserv_send(TALLOC_CTX *mem_ctx,
* We'll log an error and continue.
*/
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not set negative cache for [%lu][%s]\n",
+ ("Could not set negative cache for "
+ "[%"PRIu16"][%s]\n",
state->port, SVC_PROTO_CASED));
}
}
@@ -502,7 +503,7 @@ static void lookup_service_done(struct tevent_req *subreq)
&state->res);
} else {
DEBUG(SSSDBG_TRACE_FUNC,
- ("Re-checking cache for [%lu:%s@%s]\n",
+ ("Re-checking cache for [%"PRIu16":%s@%s]\n",
state->port,
SVC_PROTO_CASED ? SVC_PROTO_CASED : "<ANY>",
dom->name));
@@ -540,7 +541,7 @@ static void lookup_service_done(struct tevent_req *subreq)
* We'll log an error and continue.
*/
DEBUG(SSSDBG_MINOR_FAILURE,
- ("Could not set negative cache for [%lu][%s]\n",
+ ("Could not set negative cache for [%"PRIu16"][%s]\n",
state->port, SVC_PROTO_CASED));
}
}
@@ -1146,7 +1147,7 @@ int nss_cmd_getservbyport(struct cli_ctx *cctx)
dctx->protocol = service_protocol;
DEBUG(SSSDBG_TRACE_FUNC,
- ("Requesting info for service on port [%lu/%s]\n",
+ ("Requesting info for service on port [%"PRIu16"/%s]\n",
port, service_protocol ? service_protocol : "<ANY>"));
/* All port lookups are multidomain searches */
--
1.8.3.1
-------------- next part --------------
>From 9e0ae64f4e1e231221b3f3098030705d36b88804 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 15:27:20 +0200
Subject: [PATCH 12/19] Fix formating of variables with type: time_t
---
src/providers/fail_over.c | 5 +++--
src/providers/krb5/krb5_child_handler.c | 2 +-
src/providers/ldap/ldap_auth.c | 2 +-
src/providers/ldap/sdap_access.c | 2 +-
src/providers/ldap/sdap_async_connection.c | 2 +-
src/providers/ldap/sdap_async_sudo_timer.c | 2 +-
src/providers/ldap/sdap_sudo.c | 4 ++--
7 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/providers/fail_over.c b/src/providers/fail_over.c
index 537a9aa95a13a5d35895d7a310aab6ae758ebc39..98c20065989bad86acff2b9984726a9176089c44 100644
--- a/src/providers/fail_over.c
+++ b/src/providers/fail_over.c
@@ -154,8 +154,9 @@ fo_context_init(TALLOC_CTX *mem_ctx, struct fo_options *opts)
ctx->opts->family_order = opts->family_order;
ctx->opts->service_resolv_timeout = opts->service_resolv_timeout;
- DEBUG(SSSDBG_TRACE_FUNC, ("Created new fail over context, retry timeout is %d\n",
- ctx->opts->retry_timeout));
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("Created new fail over context, retry timeout is %ld\n",
+ ctx->opts->retry_timeout));
return ctx;
}
diff --git a/src/providers/krb5/krb5_child_handler.c b/src/providers/krb5/krb5_child_handler.c
index 9aa5c346acde17e1ea74d7a2ab231a6a9eebdb94..aa72c07ce28ef09fa7363d1512742b5c981f435d 100644
--- a/src/providers/krb5/krb5_child_handler.c
+++ b/src/providers/krb5/krb5_child_handler.c
@@ -564,7 +564,7 @@ parse_krb5_child_response(TALLOC_CTX *mem_ctx, uint8_t *buf, ssize_t len,
tgtt.endtime = int64_to_time_t(time_data);
SAFEALIGN_COPY_INT64(&time_data, buf+p+3*sizeof(int64_t), NULL);
tgtt.renew_till = int64_to_time_t(time_data);
- DEBUG(SSSDBG_TRACE_LIBS, ("TGT times are [%d][%d][%d][%d].\n",
+ DEBUG(SSSDBG_TRACE_LIBS, ("TGT times are [%ld][%ld][%ld][%ld].\n",
tgtt.authtime, tgtt.starttime, tgtt.endtime, tgtt.renew_till));
}
diff --git a/src/providers/ldap/ldap_auth.c b/src/providers/ldap/ldap_auth.c
index dcaea75c0b7833b8a1eb00232ab92ea09f7a7f00..f9bab4b2b72a061c88fbf18d3f8401b673f79619 100644
--- a/src/providers/ldap/ldap_auth.c
+++ b/src/providers/ldap/ldap_auth.c
@@ -117,7 +117,7 @@ static errno_t check_pwexpire_kerberos(const char *expire_date, time_t now,
expire_time -= timezone;
DEBUG(SSSDBG_TRACE_ALL,
("Time info: tzname[0] [%s] tzname[1] [%s] timezone [%ld] "
- "daylight [%d] now [%d] expire_time [%d].\n", tzname[0],
+ "daylight [%d] now [%ld] expire_time [%ld].\n", tzname[0],
tzname[1], timezone, daylight, now, expire_time));
if (difftime(now, expire_time) > 0.0) {
diff --git a/src/providers/ldap/sdap_access.c b/src/providers/ldap/sdap_access.c
index a4c6386501d785090a301ae70b9f961bef4b1355..9d1315fab9b838e3f955e82c38ce88a97cb9cd0a 100644
--- a/src/providers/ldap/sdap_access.c
+++ b/src/providers/ldap/sdap_access.c
@@ -436,7 +436,7 @@ static bool nds_check_expired(const char *exp_time_str)
now = time(NULL);
DEBUG(SSSDBG_TRACE_ALL,
("Time info: tzname[0] [%s] tzname[1] [%s] timezone [%ld] "
- "daylight [%d] now [%d] expire_time [%d].\n", tzname[0],
+ "daylight [%d] now [%ld] expire_time [%ld].\n", tzname[0],
tzname[1], timezone, daylight, now, expire_time));
if (difftime(now, expire_time) > 0.0) {
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index cc3e13d097d33dc7c44e1f1fecccd152ceb6cf67..17d03c3206b61fa442616c57fbc735f87fa6452f 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -1773,7 +1773,7 @@ static void sdap_cli_auth_step(struct tevent_req *req)
|| (state->sh->expire_time > (now + expire_timeout))) {
state->sh->expire_time = now + expire_timeout;
DEBUG(SSSDBG_TRACE_LIBS,
- ("the connection will expire at %d\n", state->sh->expire_time));
+ ("the connection will expire at %ld\n", state->sh->expire_time));
}
if (!state->do_auth ||
diff --git a/src/providers/ldap/sdap_async_sudo_timer.c b/src/providers/ldap/sdap_async_sudo_timer.c
index ed32cd901bc145b10f3613366b24f29e9100bc11..27dd41f06e0a20c8a672a466535debc45e9f8ea2 100644
--- a/src/providers/ldap/sdap_async_sudo_timer.c
+++ b/src/providers/ldap/sdap_async_sudo_timer.c
@@ -170,7 +170,7 @@ static void sdap_sudo_timer_timeout(struct tevent_context *ev,
state = tevent_req_data(req, struct sdap_sudo_timer_state);
DEBUG(SSSDBG_CRIT_FAILURE, ("Request timed out. Is timeout too small?"
- " (%ds)!\n", state->timeout));
+ " (%lds)!\n", state->timeout));
talloc_zfree(state->subreq);
diff --git a/src/providers/ldap/sdap_sudo.c b/src/providers/ldap/sdap_sudo.c
index f6fa2347c2cecb3de660f6d8f59e140f76ffa716..b8bc409efd48a6e21f8d4fee2f010c5539b24e32 100644
--- a/src/providers/ldap/sdap_sudo.c
+++ b/src/providers/ldap/sdap_sudo.c
@@ -227,7 +227,7 @@ static int sdap_sudo_setup_periodical_refresh(struct sdap_sudo_ctx *sudo_ctx)
smart_default = id_ctx->opts->basic[SDAP_SUDO_SMART_REFRESH_INTERVAL].def_val.number;
DEBUG(SSSDBG_MINOR_FAILURE, ("At least one periodical update has to be "
- "enabled. Setting smart refresh interval to default value (%d).\n",
+ "enabled. Setting smart refresh interval to default value (%ld).\n",
smart_default));
ret = dp_opt_set_int(id_ctx->opts->basic,
@@ -1072,7 +1072,7 @@ schedule:
}
DEBUG(SSSDBG_TRACE_FUNC, ("Data provider is offline. "
- "Scheduling another full refresh in %lld minutes.\n", delay));
+ "Scheduling another full refresh in %ld minutes.\n", delay));
ret = sdap_sudo_schedule_refresh(sudo_ctx, sudo_ctx,
SDAP_SUDO_REFRESH_FULL,
--
1.8.3.1
-------------- next part --------------
>From 92d52e970c33b0e6c3126577a8f283d811128ff1 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 16:27:43 +0200
Subject: [PATCH 13/19] Fix formating of variables with ber_ type
---
src/providers/ldap/sdap_async.c | 2 +-
src/providers/ldap/sdap_async_connection.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c
index bdd3c3c8b2ed4cc7246c008ddbfe531b82d880bc..09275dd65fe87b792df592cad28ae440435475f8 100644
--- a/src/providers/ldap/sdap_async.c
+++ b/src/providers/ldap/sdap_async.c
@@ -1424,7 +1424,7 @@ static void sdap_get_generic_ext_done(struct sdap_op *op,
tevent_req_error(req, EIO);
return;
}
- DEBUG(7, ("Total count [%lu]\n", total_count));
+ DEBUG(SSSDBG_TRACE_INTERNAL, ("Total count [%d]\n", total_count));
if (cookie.bv_val != NULL && cookie.bv_len > 0) {
/* Cookie contains data, which means there are more requests
diff --git a/src/providers/ldap/sdap_async_connection.c b/src/providers/ldap/sdap_async_connection.c
index 17d03c3206b61fa442616c57fbc735f87fa6452f..0a7746088906346ea60884484e38457d39e7d933 100644
--- a/src/providers/ldap/sdap_async_connection.c
+++ b/src/providers/ldap/sdap_async_connection.c
@@ -1987,8 +1987,9 @@ static int synchronous_tls_setup(LDAP *ldap)
lret = ldap_result(ldap, msgid, 1, NULL, &result);
if (lret != LDAP_RES_EXTENDED) {
- DEBUG(2, ("Unexpected ldap_result, expected [%d] got [%d].\n",
- LDAP_RES_EXTENDED, lret));
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("Unexpected ldap_result, expected [%lu] got [%d].\n",
+ LDAP_RES_EXTENDED, lret));
lret = LDAP_PARAM_ERROR;
goto done;
}
--
1.8.3.1
-------------- next part --------------
>From e3dad3f64585f342c8e4448d99c8ec7fccba0318 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jul 2013 17:15:58 +0200
Subject: [PATCH 14/19] Fix warning: data argument not used by format string
---
src/providers/ldap/sdap_async_groups.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index 2ce1d5dd6020ca7b81ab0d09ddd28412fe6dc555..b111895074710ecff9f85ff7cd48828d357384fe 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -1382,7 +1382,9 @@ static void sdap_process_group_members(struct tevent_req *subreq)
next:
if (ret) {
- DEBUG(7, ("Error reading group member. Skipping\n", ret));
+ DEBUG(SSSDBG_TRACE_FUNC,
+ ("Error reading group member[%d]: %s. Skipping\n",
+ ret, strerror(ret)));
state->count--;
}
/* Are there more searches for uncached users to submit ? */
@@ -2064,7 +2066,8 @@ static errno_t sdap_nested_group_populate_users(TALLOC_CTX *mem_ctx,
ret = sss_filter_sanitize(tmp_ctx, original_dn,
&clean_orig_dn);
if (ret != EOK) {
- DEBUG(1, ("Cannot sanitize originalDN\n", i));
+ DEBUG(SSSDBG_CRIT_FAILURE,
+ ("Cannot sanitize originalDN [%s]\n", original_dn));
goto done;
}
--
1.8.3.1
-------------- next part --------------
>From d576f3eb1c340188b6d5eb2e83ccd69f878eaa7f Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 4 Sep 2013 10:16:18 +0200
Subject: [PATCH 15/19] Use right formating to print string
format specifies type 'int' but the argument has type 'const char *'
---
src/providers/ipa/ipa_subdomains_ext_groups.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/providers/ipa/ipa_subdomains_ext_groups.c b/src/providers/ipa/ipa_subdomains_ext_groups.c
index a217c6a8ceeee6ce40fbef0007c39b9b8296e5d4..7df3dbbb2f8f61a6a13e032a3bdc42636e08040e 100644
--- a/src/providers/ipa/ipa_subdomains_ext_groups.c
+++ b/src/providers/ipa/ipa_subdomains_ext_groups.c
@@ -204,7 +204,7 @@ static errno_t find_ipa_ext_memberships(TALLOC_CTX *mem_ctx,
}
if (result->count == 0) {
- DEBUG(SSSDBG_MINOR_FAILURE, ("User [%d] not found in cache.\n",
+ DEBUG(SSSDBG_MINOR_FAILURE, ("User [%s] not found in cache.\n",
user_name));
ret = EOK;
goto done;
--
1.8.3.1
-------------- next part --------------
>From c66ee81f1b58494f9988bfe573b37439286a450f Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
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 <http://www.gnu.org/licenses/>.
*/
+#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
-------------- next part --------------
>From 8e5ef8ec9f642f8245d21a499f751acf4ac6d452 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 4 Sep 2013 16:28:06 +0200
Subject: [PATCH 17/19] Fix formating of variables with type: uid_t
---
src/db/sysdb_ops.c | 5 +++--
src/monitor/monitor.c | 3 ++-
src/monitor/monitor_netlink.c | 5 +++--
src/providers/krb5/krb5_become_user.c | 5 +++--
src/providers/krb5/krb5_utils.c | 4 ++--
src/providers/proxy/proxy_id.c | 11 +++++++----
src/responder/common/negcache.c | 4 ++--
src/tools/sss_seed.c | 5 +++--
src/tools/tools_util.c | 3 ++-
9 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 03f45de730be815d9cc9e42b6239ab6a7c04601b..4e5451e3fe35d03df5994b8b3480f55541c69d78 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1198,8 +1198,9 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
if (domain->id_max != 0 && uid != 0 &&
(uid < domain->id_min || uid > domain->id_max)) {
- DEBUG(2, ("Supplied uid [%d] is not in the allowed range [%d-%d].\n",
- uid, domain->id_min, domain->id_max));
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("Supplied uid [%"SPRIuid"] is not in the allowed range "
+ "[%d-%d].\n", uid, domain->id_min, domain->id_max));
return ERANGE;
}
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index d8bbfbcbe7666cef43fcc3597103beabea634800..3d8ba26285b6a8fc60ccb695f8b10ae1714ac918 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2695,7 +2695,8 @@ int main(int argc, const char *argv[])
uid = getuid();
if (uid != 0) {
- DEBUG(SSSDBG_FATAL_FAILURE, ("Running under %d, must be root\n", uid));
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ ("Running under %"SPRIuid", must be root\n", uid));
sss_log(SSS_LOG_ALERT, "sssd must be run as root");
return 8;
}
diff --git a/src/monitor/monitor_netlink.c b/src/monitor/monitor_netlink.c
index 932a6bf330a80e8c0f7cd506a0ae50a49e9ce38f..c013423780f318f2a0f12dd5fa50babe12cdcd18 100644
--- a/src/monitor/monitor_netlink.c
+++ b/src/monitor/monitor_netlink.c
@@ -472,8 +472,9 @@ static int event_msg_recv(struct nl_msg *msg, void *arg)
creds = nlmsg_get_creds(msg);
if (!creds || creds->uid != 0) {
- DEBUG(9, ("Ignoring netlink message from UID %d",
- creds ? creds->uid : -1));
+ DEBUG(SSSDBG_TRACE_ALL,
+ ("Ignoring netlink message from UID %"SPRIuid,
+ creds ? creds->uid : (uid_t)-1));
return NL_SKIP;
}
diff --git a/src/providers/krb5/krb5_become_user.c b/src/providers/krb5/krb5_become_user.c
index 567cf237569f70a6b0fd500327438f2dbb08d24d..d549d838487ea31f795cd26c77c57d1f3c45d8c8 100644
--- a/src/providers/krb5/krb5_become_user.c
+++ b/src/providers/krb5/krb5_become_user.c
@@ -30,12 +30,13 @@ errno_t become_user(uid_t uid, gid_t gid)
uid_t cuid;
int ret;
- DEBUG(SSSDBG_FUNC_DATA, ("Trying to become user [%d][%d].\n", uid, gid));
+ DEBUG(SSSDBG_FUNC_DATA,
+ ("Trying to become user [%"SPRIuid"][%d].\n", uid, gid));
/* skip call if we already are the requested user */
cuid = geteuid();
if (uid == cuid) {
- DEBUG(SSSDBG_FUNC_DATA, ("Already user [%d].\n", uid));
+ DEBUG(SSSDBG_FUNC_DATA, ("Already user [%"SPRIuid"].\n", uid));
return EOK;
}
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index d09687356f84e0d4e3ed81d8b3b9bb38f2c506cd..9dd9882de1f468cbcf07cf2a656e3c61267e5301 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -242,7 +242,7 @@ char *expand_ccname_template(TALLOC_CTX *mem_ctx, struct krb5child_req *kr,
"because uid is invalid.\n"));
goto done;
}
- result = talloc_asprintf_append(result, "%s%d", p,
+ result = talloc_asprintf_append(result, "%s%"SPRIuid, p,
kr->uid);
if (!file_mode) *private_path = true;
break;
@@ -386,7 +386,7 @@ static errno_t check_parent_stat(bool private_path, struct stat *parent_stat,
if (!((parent_stat->st_uid == 0 && parent_stat->st_gid == 0) ||
parent_stat->st_uid == uid)) {
DEBUG(1, ("Private directory can only be created below a "
- "directory belonging to root or to [%d][%d].\n",
+ "directory belonging to root or to [%"SPRIuid"][%d].\n",
uid, gid));
return EINVAL;
}
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index b5d63ecfd280c65e15714ccc98edcc639d7c852d..4ac1c8dcb6efd240dacc8a820e2f60611b35e657 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -22,6 +22,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
+
+#include "util/sss_format.h"
#include "util/strtonum.h"
#include "providers/proxy/proxy.h"
@@ -166,7 +169,7 @@ handle_getpw_result(enum nss_status status, struct passwd *pwd,
case NSS_STATUS_SUCCESS:
- DEBUG(SSSDBG_TRACE_FUNC, ("User found: (%s, %d, %d)\n",
+ DEBUG(SSSDBG_TRACE_FUNC, ("User found: (%s, %"SPRIuid", %d)\n",
pwd->pw_name, pwd->pw_uid, pwd->pw_gid));
/* uid=0 or gid=0 are invalid values */
@@ -314,7 +317,7 @@ static int get_pw_uid(TALLOC_CTX *mem_ctx,
bool del_user = false;
int ret;
- DEBUG(SSSDBG_TRACE_FUNC, ("Searching user by uid (%d)\n", uid));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Searching user by uid (%"SPRIuid")\n", uid));
tmpctx = talloc_new(NULL);
if (!tmpctx) {
@@ -354,7 +357,7 @@ done:
talloc_zfree(tmpctx);
if (ret) {
DEBUG(SSSDBG_CRIT_FAILURE,
- ("proxy -> getpwuid_r failed for '%d' <%d>: %s\n",
+ ("proxy -> getpwuid_r failed for '%"SPRIuid"' <%d>: %s\n",
uid, ret, strerror(ret)));
}
return ret;
@@ -453,7 +456,7 @@ static int enum_users(TALLOC_CTX *mem_ctx,
case NSS_STATUS_SUCCESS:
- DEBUG(SSSDBG_TRACE_LIBS, ("User found (%s, %d, %d)\n",
+ DEBUG(SSSDBG_TRACE_LIBS, ("User found (%s, %"SPRIuid", %d)\n",
pwd->pw_name, pwd->pw_uid, pwd->pw_gid));
/* uid=0 or gid=0 are invalid values */
diff --git a/src/responder/common/negcache.c b/src/responder/common/negcache.c
index 769346370b8366a687b63a1a844dde8f083d0154..a1f44789bac9e9818dfc09cf48c105b36eb5e3b5 100644
--- a/src/responder/common/negcache.c
+++ b/src/responder/common/negcache.c
@@ -379,7 +379,7 @@ int sss_ncache_check_uid(struct sss_nc_ctx *ctx, int ttl, uid_t uid)
char *str;
int ret;
- str = talloc_asprintf(ctx, "%s/%u", NC_UID_PREFIX, uid);
+ str = talloc_asprintf(ctx, "%s/%"SPRIuid, NC_UID_PREFIX, uid);
if (!str) return ENOMEM;
ret = sss_ncache_check_str(ctx, str, ttl);
@@ -510,7 +510,7 @@ int sss_ncache_set_uid(struct sss_nc_ctx *ctx, bool permanent, uid_t uid)
char *str;
int ret;
- str = talloc_asprintf(ctx, "%s/%u", NC_UID_PREFIX, uid);
+ str = talloc_asprintf(ctx, "%s/%"SPRIuid, NC_UID_PREFIX, uid);
if (!str) return ENOMEM;
ret = sss_ncache_set_str(ctx, str, permanent);
diff --git a/src/tools/sss_seed.c b/src/tools/sss_seed.c
index 75f7e8c520593a0eeb5133ce8749106f951a98cf..78e0274210d70d195b7667026f38a4ae88ca1b4c 100644
--- a/src/tools/sss_seed.c
+++ b/src/tools/sss_seed.c
@@ -166,8 +166,9 @@ static int seed_id_input(const char *req,
return ret;
}
if (*endptr != '\0') {
- DEBUG(SSSDBG_MINOR_FAILURE, ("extra characters [%s] after "
- "ID [%d]\n", endptr, *_id_input));
+ DEBUG(SSSDBG_MINOR_FAILURE,
+ ("extra characters [%s] after ID [%"SPRIuid"]\n",
+ endptr, *_id_input));
}
} else {
ret = EINVAL;
diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c
index 6798b6589668b1335a7a5ada59b08cf92a2bbf1f..0e1b3b40704bb7eb7e574e497477410eca968c18 100644
--- a/src/tools/tools_util.c
+++ b/src/tools/tools_util.c
@@ -360,7 +360,8 @@ static int remove_mail_spool(TALLOC_CTX *mem_ctx,
case 0:
break;
case -1:
- DEBUG(3, ("%s not owned by %d, not removing\n",
+ DEBUG(SSSDBG_MINOR_FAILURE,
+ ("%s not owned by %"SPRIuid", not removing\n",
spool_file, uid));
ret = EACCES;
/* FALLTHROUGH */
--
1.8.3.1
-------------- next part --------------
>From b1d6fb719d0a188fe0b49b62c6b1909cb00ebc2c Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 4 Sep 2013 16:52:34 +0200
Subject: [PATCH 18/19] Fix formating of variables with type: gid_t
---
src/db/sysdb_ops.c | 10 ++++++----
src/providers/krb5/krb5_become_user.c | 2 +-
src/providers/krb5/krb5_utils.c | 4 ++--
src/providers/ldap/sdap_async_initgroups_ad.c | 3 +--
src/providers/proxy/proxy_id.c | 21 +++++++++++----------
src/providers/simple/simple_access_check.c | 8 ++++----
src/responder/common/negcache.c | 4 ++--
7 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index 4e5451e3fe35d03df5994b8b3480f55541c69d78..0197d8e0c844a549f8d09d472a65cc16460bf966 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -1206,8 +1206,9 @@ int sysdb_add_user(struct sysdb_ctx *sysdb,
if (domain->id_max != 0 && gid != 0 &&
(gid < domain->id_min || gid > domain->id_max)) {
- DEBUG(2, ("Supplied gid [%d] is not in the allowed range [%d-%d].\n",
- gid, domain->id_min, domain->id_max));
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("Supplied gid [%"SPRIgid"] is not in the allowed range "
+ "[%d-%d].\n", gid, domain->id_min, domain->id_max));
return ERANGE;
}
@@ -1391,8 +1392,9 @@ int sysdb_add_group(struct sysdb_ctx *sysdb,
if (domain->id_max != 0 && gid != 0 &&
(gid < domain->id_min || gid > domain->id_max)) {
- DEBUG(2, ("Supplied gid [%d] is not in the allowed range [%d-%d].\n",
- gid, domain->id_min, domain->id_max));
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("Supplied gid [%"SPRIgid"] is not in the allowed range "
+ "[%d-%d].\n", gid, domain->id_min, domain->id_max));
return ERANGE;
}
diff --git a/src/providers/krb5/krb5_become_user.c b/src/providers/krb5/krb5_become_user.c
index d549d838487ea31f795cd26c77c57d1f3c45d8c8..8cbeb1ce7ef1fe33389fb5def0836fc566ea5c0d 100644
--- a/src/providers/krb5/krb5_become_user.c
+++ b/src/providers/krb5/krb5_become_user.c
@@ -31,7 +31,7 @@ errno_t become_user(uid_t uid, gid_t gid)
int ret;
DEBUG(SSSDBG_FUNC_DATA,
- ("Trying to become user [%"SPRIuid"][%d].\n", uid, gid));
+ ("Trying to become user [%"SPRIuid"][%"SPRIgid"].\n", uid, gid));
/* skip call if we already are the requested user */
cuid = geteuid();
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index 9dd9882de1f468cbcf07cf2a656e3c61267e5301..e1daf6bfad86784f5a0ed228cd60f17691f84690 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -386,8 +386,8 @@ static errno_t check_parent_stat(bool private_path, struct stat *parent_stat,
if (!((parent_stat->st_uid == 0 && parent_stat->st_gid == 0) ||
parent_stat->st_uid == uid)) {
DEBUG(1, ("Private directory can only be created below a "
- "directory belonging to root or to [%"SPRIuid"][%d].\n",
- uid, gid));
+ "directory belonging to root or to "
+ "[%"SPRIuid"][%"SPRIgid"].\n", uid, gid));
return EINVAL;
}
diff --git a/src/providers/ldap/sdap_async_initgroups_ad.c b/src/providers/ldap/sdap_async_initgroups_ad.c
index efaa247dd22d2ae100e8881c010dfe26a9a10cca..f6d236dea24f63dd6aa0a9d54c320a82c2a0fb7d 100644
--- a/src/providers/ldap/sdap_async_initgroups_ad.c
+++ b/src/providers/ldap/sdap_async_initgroups_ad.c
@@ -472,8 +472,7 @@ sdap_get_ad_tokengroups_initgroups_lookup_done(struct tevent_req *subreq)
}
DEBUG(SSSDBG_TRACE_LIBS,
- ("Processing membership GID [%lu]\n",
- gid));
+ ("Processing membership GID [%"SPRIgid"]\n", gid));
/* Check whether this GID already exists in the sysdb */
ret = sysdb_search_group_by_gid(tmp_ctx, state->sysdb, state->domain,
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index 4ac1c8dcb6efd240dacc8a820e2f60611b35e657..963aad2d0676a665d69be2ea2996ad49cb2bacc6 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -169,7 +169,7 @@ handle_getpw_result(enum nss_status status, struct passwd *pwd,
case NSS_STATUS_SUCCESS:
- DEBUG(SSSDBG_TRACE_FUNC, ("User found: (%s, %"SPRIuid", %d)\n",
+ DEBUG(SSSDBG_TRACE_FUNC, ("User found: (%s, %"SPRIuid", %"SPRIgid")\n",
pwd->pw_name, pwd->pw_uid, pwd->pw_gid));
/* uid=0 or gid=0 are invalid values */
@@ -456,8 +456,9 @@ static int enum_users(TALLOC_CTX *mem_ctx,
case NSS_STATUS_SUCCESS:
- DEBUG(SSSDBG_TRACE_LIBS, ("User found (%s, %"SPRIuid", %d)\n",
- pwd->pw_name, pwd->pw_uid, pwd->pw_gid));
+ DEBUG(SSSDBG_TRACE_LIBS,
+ ("User found (%s, %"SPRIuid", %"SPRIgid")\n",
+ pwd->pw_name, pwd->pw_uid, pwd->pw_gid));
/* uid=0 or gid=0 are invalid values */
/* also check that the id is in the valid range for this domain
@@ -752,7 +753,7 @@ handle_getgr_result(enum nss_status status, struct group *grp,
break;
case NSS_STATUS_SUCCESS:
- DEBUG(SSSDBG_FUNC_DATA, ("Group found: (%s, %d)\n",
+ DEBUG(SSSDBG_FUNC_DATA, ("Group found: (%s, %"SPRIgid")\n",
grp->gr_name, grp->gr_gid));
/* gid=0 is an invalid value */
@@ -922,7 +923,7 @@ static int get_gr_gid(TALLOC_CTX *mem_ctx,
bool delete_group = false;
int ret;
- DEBUG(SSSDBG_TRACE_FUNC, ("Searching group by gid (%d)\n", gid));
+ DEBUG(SSSDBG_TRACE_FUNC, ("Searching group by gid (%"SPRIgid")\n", gid));
tmpctx = talloc_new(mem_ctx);
if (!tmpctx) {
@@ -957,8 +958,8 @@ static int get_gr_gid(TALLOC_CTX *mem_ctx,
if (delete_group) {
DEBUG(SSSDBG_TRACE_FUNC,
- ("Group %d does not exist (or is invalid) on remote server,"
- " deleting!\n", gid));
+ ("Group %"SPRIgid" does not exist (or is invalid) on remote "
+ "server, deleting!\n", gid));
ret = sysdb_delete_group(sysdb, dom, NULL, gid);
if (ret == ENOENT) {
@@ -978,7 +979,7 @@ done:
talloc_zfree(tmpctx);
if (ret) {
DEBUG(SSSDBG_OP_FAILURE,
- ("proxy -> getgrgid_r failed for '%d' <%d>: %s\n",
+ ("proxy -> getgrgid_r failed for '%"SPRIgid"' <%d>: %s\n",
gid, ret, strerror(ret)));
}
return ret;
@@ -1077,7 +1078,7 @@ static int enum_groups(TALLOC_CTX *mem_ctx,
case NSS_STATUS_SUCCESS:
- DEBUG(SSSDBG_OP_FAILURE, ("Group found (%s, %d)\n",
+ DEBUG(SSSDBG_OP_FAILURE, ("Group found (%s, %"SPRIgid")\n",
grp->gr_name, grp->gr_gid));
/* gid=0 is an invalid value */
@@ -1334,7 +1335,7 @@ static int get_initgr_groups_process(TALLOC_CTX *memctx,
case NSS_STATUS_NOTFOUND:
DEBUG(SSSDBG_FUNC_DATA, ("The initgroups call returned 'NOTFOUND'. "
"Assume the user is only member of its "
- "primary group (%d)\n", pwd->pw_gid));
+ "primary group (%"SPRIgid")\n", pwd->pw_gid));
/* fall through */
case NSS_STATUS_SUCCESS:
DEBUG(SSSDBG_CONF_SETTINGS, ("User [%s] appears to be member of %lu"
diff --git a/src/providers/simple/simple_access_check.c b/src/providers/simple/simple_access_check.c
index 7335135ea5dedecdb5ba2be60a57d18eb897a960..5c2884abe86936e9b69e212518c79cad318deed4 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 [%"SPRIgid"]: [%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 %"SPRIgid"\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 %"SPRIgid"\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 [%"SPRIgid"]: [%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/responder/common/negcache.c b/src/responder/common/negcache.c
index a1f44789bac9e9818dfc09cf48c105b36eb5e3b5..1f95b1b6dd7a3c333eb21d54e873b8003ddde45c 100644
--- a/src/responder/common/negcache.c
+++ b/src/responder/common/negcache.c
@@ -393,7 +393,7 @@ int sss_ncache_check_gid(struct sss_nc_ctx *ctx, int ttl, gid_t gid)
char *str;
int ret;
- str = talloc_asprintf(ctx, "%s/%u", NC_GID_PREFIX, gid);
+ str = talloc_asprintf(ctx, "%s/%"SPRIgid, NC_GID_PREFIX, gid);
if (!str) return ENOMEM;
ret = sss_ncache_check_str(ctx, str, ttl);
@@ -524,7 +524,7 @@ int sss_ncache_set_gid(struct sss_nc_ctx *ctx, bool permanent, gid_t gid)
char *str;
int ret;
- str = talloc_asprintf(ctx, "%s/%u", NC_GID_PREFIX, gid);
+ str = talloc_asprintf(ctx, "%s/%"SPRIgid, NC_GID_PREFIX, gid);
if (!str) return ENOMEM;
ret = sss_ncache_set_str(ctx, str, permanent);
--
1.8.3.1
-------------- next part --------------
>From f2422c68b2b7218ec8a19de620350c1910896085 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Thu, 23 May 2013 13:14:37 +0200
Subject: [PATCH 19/19] Enable printf format string checking
https://fedorahosted.org/sssd/ticket/1945
---
configure.ac | 18 ++++++++++++++++++
src/util/util.h | 10 ++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index ebce20254268f2428340825e989263503c7492f5..c389bec4f2600568e73be4034d29ebcc44bb047f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -268,6 +268,24 @@ if test x"$sss_client_cv_attribute_destructor" = xyes ; then
[whether compiler supports __attribute__((destructor))])
fi
+AC_CACHE_CHECK([whether compiler supports __attribute__((format))],
+ sss_cv_attribute_format,
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE(
+ [void debug_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));]
+ )],
+ [sss_cv_attribute_format=yes],
+ [
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([compiler does NOT support __attribute__((format))])
+ ])
+ ])
+
+if test x"$sss_cv_attribute_format" = xyes ; then
+ AC_DEFINE(HAVE_FUNCTION_ATTRIBUTE_FORMAT, 1,
+ [whether compiler supports __attribute__((format))])
+fi
+
PKG_CHECK_MODULES([CHECK], [check >= 0.9.5], [have_check=1], [have_check=])
if test x$have_check = x; then
AC_MSG_WARN([Without the 'CHECK' libraries, you will be unable to run all tests in the 'make check' suite])
diff --git a/src/util/util.h b/src/util/util.h
index ff54048bfdd6455ad5491aff499d725657b9847b..cae4a49ab5bb487b3212a3567ccabbcaf20226c9 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -55,13 +55,19 @@
#define CLEAR_MC_FLAG "clear_mc_flag"
+#ifdef HAVE_FUNCTION_ATTRIBUTE_FORMAT
+#define SSS_ATTRIBUTE_PRINTF(a1, a2) __attribute__ ((format (printf, a1, a2)))
+#else
+#define SSS_ATTRIBUTE_PRINTF(a1, a2)
+#endif
+
extern const char *debug_prg_name;
extern int debug_level;
extern int debug_timestamps;
extern int debug_microseconds;
extern int debug_to_file;
extern const char *debug_log_file;
-void debug_fn(const char *format, ...);
+void debug_fn(const char *format, ...) SSS_ATTRIBUTE_PRINTF(1, 2);
int debug_get_level(int old_level);
int debug_convert_old_level(int old_level);
errno_t set_debug_file_from_fd(const int fd);
@@ -274,7 +280,7 @@ void talloc_log_fn(const char *msg);
#define SSS_LOG_INFO 6 /* informational */
#define SSS_LOG_DEBUG 7 /* debug-level messages */
-void sss_log(int priority, const char *format, ...);
+void sss_log(int priority, const char *format, ...) SSS_ATTRIBUTE_PRINTF(2, 3);
/* from server.c */
struct main_context {
--
1.8.3.1
More information about the sssd-devel
mailing list