miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Serious bug on read forwards from lease file

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs
View previous topic :: View next topic  
Author Message
Padavan



Joined: 24 Feb 2012
Posts: 2
Location: Russia

PostPosted: Fri Feb 24, 2012 1:13 pm    Post subject: Serious bug on read forwards from lease file Reply with quote

miniupnpd cannot correct read forwards from lease file.
1) read field "iport" instead of "timestamp" (bad timestamp input from file)
2) leaseduration always negative and NAT-PMP forwards with non-null timestamp always deleted.

miniupnpd version 1.6.20120207 (and earler)

source file
upnpredirect.c

function
int reload_from_lease_file()

Code:

      iport = (unsigned short)atoi(p);  // !!! exchange timestamp and iport bug. Padavan fixed
      p = strchr(p, ':');
      if(!p) {
         syslog(LOG_ERR, "unrecognized data in lease file");
         continue;
      }
      *(p++) = '\0';
      desc = strchr(p, ':');
      if(!desc) {
         syslog(LOG_ERR, "unrecognized data in lease file");
         continue;
      }
      *(desc++) = '\0';
      timestamp = (unsigned int)atoi(p);  // !!! exchange timestamp and iport bug. Padavan fixed
      /* trim description */
      while(isspace(*desc))
         desc++;
      p = desc;
      while(*(p+1))
         p++;
      while(isspace(*p) && (p > desc))
         *(p--) = '\0';
 
      if(timestamp > 0) {
         if(timestamp <= current_time) {
            syslog(LOG_NOTICE, "already expired lease in lease file");
            continue;
         } else {
            leaseduration = timestamp - current_time;  // !!! always negative leaseduration. Padavan fixed
         }
      } else {
         leaseduration = 0;   /* default value */
      }

Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1500

PostPosted: Mon Mar 05, 2012 4:40 am    Post subject: Reply with quote

thank you.
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1500

PostPosted: Mon Mar 05, 2012 9:04 pm    Post subject: Reply with quote

miniupnpd-1.6.20120305.tar.gz
_________________
Main miniUPnP author.
http://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Padavan



Joined: 24 Feb 2012
Posts: 2
Location: Russia

PostPosted: Tue Mar 06, 2012 3:38 pm    Post subject: Reply with quote

miniupnp
Thanks! Cool
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpd Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.