Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#8162 closed defect (fixed)

Parsing AddrMapEvent fails because attribute is not always quoted

Reported by: Desoxy Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Stem Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


The AddrMapEvent class expects that "expiry" is a QUOTED argument, but according to the spec it is either quoted or the value NEVER:

     "650" SP "ADDRMAP" SP Address SP NewAddress SP Expiry
       [SP "error=" ErrorCode] [SP "EXPIRES=" UTCExpiry] CRLF

     NewAddress = Address / "<error>"
     Expiry = DQUOTE ISOTime DQUOTE / "NEVER"

     ErrorCode = "yes" / "internal" / "Unable to launch resolve request"
     UTCExpiry = DQUOTE IsoTime DQUOTE

Tor seems to return the value NEVER when the result is already in the DNS cache because of a query made by another control connection.

desoxy@localhost:~/git/stem$ ./ ; ./ 
Exception in thread Event Notifier:
Traceback (most recent call last):
  File "/usr/lib/python2.6/", line 532, in __bootstrap_inner
  File "/usr/lib/python2.6/", line 484, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./stem/stem/", line 602, in _event_loop
  File "./stem/stem/", line 2004, in _handle_event
    stem.response.convert("EVENT", event_message, arrived_at = time.time())
  File "./stem/stem/response/", line 117, in convert
  File "./stem/stem/response/", line 55, in _parse_message
  File "./stem/stem/response/", line 100, in _parse_standard_attr
    raise stem.ProtocolError("The %s value should be quoted, but didn't have a starting quote: %s" % (attr_name, self))
ProtocolError: The expiry value should be quoted, but didn't have a starting quote: ADDRMAP NEVER 

Child Tickets

Attachments (1) (238 bytes) - added by Desoxy 8 years ago.
Will trigger the bug when executed twice

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by Desoxy

Attachment: added

Will trigger the bug when executed twice

comment:1 Changed 7 years ago by atagar

Resolution: fixed
Status: newclosed

Thanks for the catch! I wasn't able to repro this with that script, but added something for this in our unit tests...

comment:2 Changed 7 years ago by Desoxy

I can confirm that this fixes the problem using Tor v0.2.3.25 (git-3fed5eb096d2d187) running on Linux.

Note: See TracTickets for help on using tickets.