dns.forwarding: Fix bug (cache-message crashes for nx names)

db4
Eduardo Cavazos 2008-10-18 16:18:31 -05:00
parent 00adf0c6bf
commit fd889b3686
1 changed files with 26 additions and 3 deletions

View File

@ -62,12 +62,35 @@ IN: dns.forwarding
: message-soa ( message -- rr/soa ) : message-soa ( message -- rr/soa )
authority-section>> [ type>> SOA = ] filter first ; authority-section>> [ type>> SOA = ] filter first ;
! :: cache-message ( MSG -- msg )
! MSG rcode>> NAME-ERROR =
! [
! [let | NAME [ MSG message-query name>> ]
! TTL [ MSG message-soa ttl>> ] |
! NAME TTL cache-non-existent-name
! ]
! ]
! when
! MSG answer-section>> [ cache-add ] each
! MSG authority-section>> [ cache-add ] each
! MSG additional-section>> [ cache-add ] each
! MSG ;
:: cache-message ( MSG -- msg ) :: cache-message ( MSG -- msg )
MSG rcode>> NAME-ERROR = MSG rcode>> NAME-ERROR =
[ [
[let | NAME [ MSG message-query name>> ] [let | RR/SOA [ MSG
TTL [ MSG message-soa ttl>> ] | authority-section>>
NAME TTL cache-non-existent-name [ type>> SOA = ] filter
dup empty? [ drop f ] [ first ] if ] |
RR/SOA
[
[let | NAME [ MSG message-query name>> ]
TTL [ MSG message-soa ttl>> ] |
NAME TTL cache-non-existent-name
]
]
when
] ]
] ]
when when