krb5 commit: Report KDC response sizes in trace logs

Greg Hudson ghudson at MIT.EDU
Wed Aug 7 14:29:40 EDT 2013


https://github.com/krb5/krb5/commit/941f3d999ad403f327c0a7ccc5c1f71347a6221a
commit 941f3d999ad403f327c0a7ccc5c1f71347a6221a
Author: Greg Hudson <ghudson at mit.edu>
Date:   Wed Aug 7 14:16:18 2013 -0400

    Report KDC response sizes in trace logs

 src/include/k5-trace.h       |    4 ++--
 src/lib/krb5/os/sendto_kdc.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/include/k5-trace.h b/src/include/k5-trace.h
index 70151c6..16e5965 100644
--- a/src/include/k5-trace.h
+++ b/src/include/k5-trace.h
@@ -312,8 +312,8 @@ void krb5int_trace(krb5_context context, const char *fmt, ...);
     TRACE(c, "Response was{str} from master KDC", (master) ? "" : " not")
 #define TRACE_SENDTO_KDC_RESOLVING(c, hostname)         \
     TRACE(c, "Resolving hostname {str}", hostname)
-#define TRACE_SENDTO_KDC_RESPONSE(c, raddr)             \
-    TRACE(c, "Received answer from {raddr}", raddr)
+#define TRACE_SENDTO_KDC_RESPONSE(c, len, raddr)                        \
+    TRACE(c, "Received answer ({int} bytes) from {raddr}", len, raddr)
 #define TRACE_SENDTO_KDC_TCP_CONNECT(c, raddr)                  \
     TRACE(c, "Initiating TCP connection to {raddr}", raddr)
 #define TRACE_SENDTO_KDC_TCP_DISCONNECT(c, raddr)               \
diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c
index d7a5346..e0f360a 100644
--- a/src/lib/krb5/os/sendto_kdc.c
+++ b/src/lib/krb5/os/sendto_kdc.c
@@ -1091,7 +1091,6 @@ k5_sendto(krb5_context context, const krb5_data *message,
         goto cleanup;
     }
     /* Success!  */
-    TRACE_SENDTO_KDC_RESPONSE(context, &winner->addr);
     reply->data = winner->x.in.buf;
     reply->length = winner->x.in.pos - winner->x.in.buf;
     retval = 0;
@@ -1100,6 +1099,7 @@ k5_sendto(krb5_context context, const krb5_data *message,
         *server_used = winner->server_index;
     if (remoteaddr != NULL && remoteaddrlen != 0 && *remoteaddrlen > 0)
         (void)getpeername(winner->fd, remoteaddr, remoteaddrlen);
+    TRACE_SENDTO_KDC_RESPONSE(context, reply->length, &winner->addr);
 
 cleanup:
     for (state = conns; state != NULL; state = next) {


More information about the cvs-krb5 mailing list