From 19261b6fefc31f4a36f72a8de39ed5c92873f53e Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 15 Mar 2014 10:51:32 +0100 Subject: [PATCH] reject renewal of subscribtion that already timeouted --- miniupnpd/Changelog.txt | 5 ++++- miniupnpd/upnpevents.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index 6fe9f06..497ea1d 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -1,4 +1,7 @@ -$Id: Changelog.txt,v 1.363 2014/03/13 10:53:40 nanard Exp $ +$Id: Changelog.txt,v 1.365 2014/03/14 21:26:34 nanard Exp $ + +2014/03/14: + reject renewal of subscribtion that already timeouted 2014/03/13: fix getifaddr_in6() (used for PCP) diff --git a/miniupnpd/upnpevents.c b/miniupnpd/upnpevents.c index 617da21..673fc46 100644 --- a/miniupnpd/upnpevents.c +++ b/miniupnpd/upnpevents.c @@ -1,7 +1,7 @@ -/* $Id: upnpevents.c,v 1.28 2014/03/13 10:53:40 nanard Exp $ */ +/* $Id: upnpevents.c,v 1.30 2014/03/14 22:26:07 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2008-2013 Thomas Bernard + * (c) 2008-2014 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -149,6 +149,11 @@ renewSubscription(const char * sid, int sidlen, int timeout) struct subscriber * sub; for(sub = subscriberlist.lh_first; sub != NULL; sub = sub->entries.le_next) { if((sidlen == 41) && (memcmp(sid, sub->uuid, 41) == 0)) { +#ifdef UPNP_STRICT + /* check if the subscription already timeouted */ + if(sub->timeout && time(NULL) > sub->timeout) + continue; +#endif sub->timeout = (timeout ? time(NULL) + timeout : 0); return 0; } @@ -542,6 +547,8 @@ void upnpevents_processfds(fd_set *readset, fd_set *writeset) for(sub = subscriberlist.lh_first; sub != NULL; ) { subnext = sub->entries.le_next; if(sub->timeout && curtime > sub->timeout && sub->notify == NULL) { + syslog(LOG_INFO, "subscriber timeouted : %u > %u SID=%s", + (unsigned)curtime, (unsigned)sub->timeout, sub->uuid); LIST_REMOVE(sub, entries); free(sub); }