Clean up dispatch lookaside code slightly
authorGreg Hudson <ghudson@mit.edu>
Thu, 26 Jan 2012 22:05:25 +0000 (22:05 +0000)
committerGreg Hudson <ghudson@mit.edu>
Thu, 26 Jan 2012 22:05:25 +0000 (22:05 +0000)
Always log when we get a lookaside cache hit, eliminating a confusing
conditional.  This is a slight behavior change because we never used
to log a lookaside cache hit when we can't deliver the response via
UDP, but that was never really deliberate or important--we log all
sorts of stuff about responses which might turn out to be too big.

Also eliminate a signed/unsigned comparison warning in
finish_dispatch.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25661 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/dispatch.c

index efe709881439fd88415f4a0090f68707370da04e..adbb0c3bfea2d6dd9debf31010a13fed05d4824f 100644 (file)
@@ -51,7 +51,7 @@ finish_dispatch(struct dispatch_state *state, krb5_error_code code,
     void *oldarg = state->arg;
 
     if (state->is_tcp == 0 && response &&
-        response->length > max_dgram_reply_size) {
+        response->length > (unsigned int)max_dgram_reply_size) {
         krb5_free_data(kdc_context, response);
         response = NULL;
         code = make_too_big_error(&response);
@@ -114,22 +114,19 @@ dispatch(void *cb, struct sockaddr *local_saddr,
         const char *name = 0;
         char buf[46];
 
-        if (!response || is_tcp != 0 ||
-            response->length <= max_dgram_reply_size) {
-            name = inet_ntop (ADDRTYPE2FAMILY (from->address->addrtype),
-                              from->address->contents, buf, sizeof (buf));
-            if (name == 0)
-                name = "[unknown address type]";
-            if (response)
-                krb5_klog_syslog(LOG_INFO,
-                                 "DISPATCH: repeated (retransmitted?) request "
-                                 "from %s, resending previous response", name);
-            else
-                krb5_klog_syslog(LOG_INFO,
-                                 "DISPATCH: repeated (retransmitted?) request "
-                                 "from %s during request processing, dropping "
-                                 "repeated request", name);
-        }
+        name = inet_ntop (ADDRTYPE2FAMILY (from->address->addrtype),
+                          from->address->contents, buf, sizeof (buf));
+        if (name == 0)
+            name = "[unknown address type]";
+        if (response)
+            krb5_klog_syslog(LOG_INFO,
+                             "DISPATCH: repeated (retransmitted?) request "
+                             "from %s, resending previous response", name);
+        else
+            krb5_klog_syslog(LOG_INFO,
+                             "DISPATCH: repeated (retransmitted?) request "
+                             "from %s during request processing, dropping "
+                             "repeated request", name);
 
         finish_dispatch(state, response ? 0 : KRB5KDC_ERR_DISCARD, response);
         return;