From lha at h5l.org Sat Nov 24 17:39:19 2012 From: lha at h5l.org (lha at h5l.org) Date: Sat, 24 Nov 2012 17:39:19 +0100 (CET) Subject: [Heimdal-source-changes] [Heimdal] branch heimdal-1-5-branch updated. heimdal-1.5-78-g0055626 Message-ID: <20121124163921.5D8AF73839@svn.h5l.org> 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 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 #include +#ifdef HAVE_POLL_H #include +#endif #include 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 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 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 Date: Thu Nov 22 11:20:48 2012 +0800 Fix typo with return values in realloc_descrs. Signed-off-by: Love Hörnquist Åstrand 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(-) From lha at h5l.org Sat Nov 24 17:39:21 2012 From: lha at h5l.org (lha at h5l.org) Date: Sat, 24 Nov 2012 17:39:21 +0100 (CET) Subject: [Heimdal-source-changes] [Heimdal] branch master updated. heimdal-1.5pre2-761-g6294c36 Message-ID: <20121124163929.A6DB973839@svn.h5l.org> The branch master has been updated via 6294c36 avoid -Wshadow via a95cae1 Fix typo with return values in realloc_descrs. from 9ad7632 fix -Wshadow 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 a95cae113dcb043e5a32d6576db82daaf4569ab2 Author: Dana Koch Date: Thu Nov 22 11:20:48 2012 +0800 Fix typo with return values in realloc_descrs. Signed-off-by: Love Hörnquist Åstrand a95cae113dcb043e5a32d6576db82daaf4569ab2 diff --git a/kdc/connect.c b/kdc/connect.c index 3df9b5a..9083b85 100644 --- a/kdc/connect.c +++ b/kdc/connect.c @@ -832,7 +832,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); @@ -842,7 +842,7 @@ realloc_descrs(struct descr **d, unsigned int *ndescr) *ndescr += 4; - return FALSE; + return TRUE; } int ----------------------------------------------------------------------- commit 6294c365269260904a928da30b8b3c595382e4e5 Author: Love Hörnquist Åstrand Date: Thu Nov 22 17:27:21 2012 -0800 avoid -Wshadow 6294c365269260904a928da30b8b3c595382e4e5 diff --git a/lib/ipc/server.c b/lib/ipc/server.c index d53a1ed..2fcc548 100644 --- a/lib/ipc/server.c +++ b/lib/ipc/server.c @@ -336,14 +336,14 @@ mach_init(const char *service, mach_port_t sport, heim_sipc ctx) }); dispatch_source_set_cancel_handler(s->source, ^{ - heim_sipc ctx = dispatch_get_context(dispatch_get_current_queue()); - struct mach_service *st = ctx->mech; + heim_sipc sctx = dispatch_get_context(dispatch_get_current_queue()); + struct mach_service *st = sctx->mech; mach_port_mod_refs(mach_task_self(), st->sport, MACH_PORT_RIGHT_RECEIVE, -1); dispatch_release(st->queue); dispatch_release(st->source); free(st); - free(ctx); + free(sctx); }); dispatch_resume(s->source); ----------------------------------------------------------------------- Summary of changes: kdc/connect.c | 4 ++-- lib/ipc/server.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)