[Heimdal-source-changes] [Heimdal] branch heimdal-1-5-branch updated. heimdal-1.5-78-g0055626

lha at h5l.org lha at h5l.org
Sat Nov 24 17:39:19 CET 2012


The branch heimdal-1-5-branch has been updated
       via 0055626 Fix typo with return values in realloc_descrs.
       via 4b52ce7 If multiple accept's happen during a select, make sure it gets stored correctly, and does not clobber an existing open descriptor.
       via d179ef9 Windows doesn't support poll(2) or fcntl(2) so #ifdef it out in send_to_kdc.c.
      from a888d57 Test that we copy forwardable/renewable flags from TGT in TGS-REQ

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------

commit d179ef910c0a4fb9ba468e1fe7d062a61bcce2cd
Author: Roland C. Dowdeswell <elric at imrryr.org>
Date:   Tue Aug 14 22:50:33 2012 +0100

    Windows doesn't support poll(2) or fcntl(2) so #ifdef it out in send_to_kdc.c.

d179ef910c0a4fb9ba468e1fe7d062a61bcce2cd
diff --git a/lib/krb5/krb5_locl.h b/lib/krb5/krb5_locl.h
index e148b4e..083d9d2 100644
--- a/lib/krb5/krb5_locl.h
+++ b/lib/krb5/krb5_locl.h
@@ -47,7 +47,9 @@
 #include <stdlib.h>
 #include <limits.h>
 
+#ifdef HAVE_POLL_H
 #include <sys/poll.h>
+#endif
 
 #include <krb5-types.h>
 
diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c
index fdf8a0c..a68084b 100644
--- a/lib/krb5/send_to_kdc.c
+++ b/lib/krb5/send_to_kdc.c
@@ -47,6 +47,7 @@ struct send_to_kdc {
 static int
 timed_connect(int s, struct addrinfo *addr, time_t tmout)
 {
+#ifdef HAVE_POLL
     socklen_t sl;
     int err;
     int flags;
@@ -88,6 +89,9 @@ timed_connect(int s, struct addrinfo *addr, time_t tmout)
 	return -1;
 
     return 0;
+#else
+    return connect(s, addr->ai_addr, addr->ai_addrlen);
+#endif
 }
 
 /*

-----------------------------------------------------------------------

commit 4b52ce7548a2f2fbb28bab9ebcc9b237f56bc6c2
Author: Dana Koch <dsk at google.com>
Date:   Sat Nov 17 08:09:45 2012 +0800

    If multiple accept's happen during a select, make sure it gets stored correctly, and does not clobber an existing open descriptor.
    
    Signed-off-by: Love Hörnquist Åstrand <lha at h5l.org>

4b52ce7548a2f2fbb28bab9ebcc9b237f56bc6c2
diff --git a/kdc/connect.c b/kdc/connect.c
index 8ecf375..49bb446 100644
--- a/kdc/connect.c
+++ b/kdc/connect.c
@@ -838,6 +838,48 @@ handle_tcp(krb5_context context,
     }
 }
 
+krb5_boolean
+realloc_descrs(struct descr **d, unsigned int *ndescr)
+{
+    struct descr *tmp;
+    size_t i;
+
+    tmp = realloc(*d, (*ndescr + 4) * sizeof(**d));
+    if(tmp == NULL)
+        return TRUE;
+
+    *d = tmp;
+    reinit_descrs (*d, *ndescr);
+    memset(*d + *ndescr, 0, 4 * sizeof(**d));
+    for(i = *ndescr; i < *ndescr + 4; i++)
+        init_descr (*d + i);
+
+    *ndescr += 4;
+
+    return FALSE;
+}
+
+int
+next_min_free(krb5_context context, struct descr **d, unsigned int *ndescr)
+{
+    size_t i;
+    int min_free;
+
+    for(i = 0; i < *ndescr; i++) {
+        int s = (*d + i)->s;
+        if(rk_IS_BAD_SOCKET(s))
+            return i;
+    }
+
+    min_free = *ndescr;
+    if(!realloc_descrs(d, ndescr)) {
+        min_free = -1;
+        krb5_warnx(context, "No memory");
+    }
+
+    return min_free;
+}
+
 void
 loop(krb5_context context,
      krb5_kdc_configuration *config)
@@ -876,22 +918,6 @@ loop(krb5_context context,
 #endif
 #endif
 		FD_SET(d[i].s, &fds);
-	    } else if(min_free < 0 || i < (size_t)min_free)
-		min_free = i;
-	}
-	if(min_free == -1){
-	    struct descr *tmp;
-	    tmp = realloc(d, (ndescr + 4) * sizeof(*d));
-	    if(tmp == NULL)
-		krb5_warnx(context, "No memory");
-	    else {
-		d = tmp;
-		reinit_descrs (d, ndescr);
-		memset(d + ndescr, 0, 4 * sizeof(*d));
-		for(i = ndescr; i < ndescr + 4; i++)
-		    init_descr (&d[i]);
-		min_free = ndescr;
-		ndescr += 4;
 	    }
 	}
 
@@ -907,10 +933,12 @@ loop(krb5_context context,
 	default:
 	    for(i = 0; i < ndescr; i++)
 		if(!rk_IS_BAD_SOCKET(d[i].s) && FD_ISSET(d[i].s, &fds)) {
-		    if(d[i].type == SOCK_DGRAM)
-			handle_udp(context, config, &d[i]);
-		    else if(d[i].type == SOCK_STREAM)
-			handle_tcp(context, config, d, i, min_free);
+            min_free = next_min_free(context, &d, &ndescr);
+
+            if(d[i].type == SOCK_DGRAM)
+                handle_udp(context, config, &d[i]);
+            else if(d[i].type == SOCK_STREAM)
+                handle_tcp(context, config, d, i, min_free);
 		}
 	}
     }

-----------------------------------------------------------------------

commit 0055626fef8f950493b2cb49765ff8ba215d4079
Author: Dana Koch <dsk at google.com>
Date:   Thu Nov 22 11:20:48 2012 +0800

    Fix typo with return values in realloc_descrs.
    
    Signed-off-by: Love Hörnquist Åstrand <lha at h5l.org>

0055626fef8f950493b2cb49765ff8ba215d4079
diff --git a/kdc/connect.c b/kdc/connect.c
index 49bb446..903a3a4 100644
--- a/kdc/connect.c
+++ b/kdc/connect.c
@@ -846,7 +846,7 @@ realloc_descrs(struct descr **d, unsigned int *ndescr)
 
     tmp = realloc(*d, (*ndescr + 4) * sizeof(**d));
     if(tmp == NULL)
-        return TRUE;
+        return FALSE;
 
     *d = tmp;
     reinit_descrs (*d, *ndescr);
@@ -856,7 +856,7 @@ realloc_descrs(struct descr **d, unsigned int *ndescr)
 
     *ndescr += 4;
 
-    return FALSE;
+    return TRUE;
 }
 
 int

-----------------------------------------------------------------------

Summary of changes:
 kdc/connect.c          |   68 +++++++++++++++++++++++++++++++++--------------
 lib/krb5/krb5_locl.h   |    2 +
 lib/krb5/send_to_kdc.c |    4 +++
 3 files changed, 54 insertions(+), 20 deletions(-)


More information about the Heimdal-source-changes mailing list