Skip to content

Commit

Permalink
* fixed ensuring that the domain names we receive are FQDNs.
Browse files Browse the repository at this point in the history
  - I thought that I fixed this long ago...?
  • Loading branch information
johanix committed Jun 12, 2024
1 parent 5e7f01d commit ae9e8b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/dnstapir/tapir"
"github.com/miekg/dns"
)

func (td *TemData) CreateMqttEngine(clientid string, lg *log.Logger) error {
Expand Down Expand Up @@ -88,7 +89,7 @@ func (td *TemData) ProcessTapirUpdate(tpkg tapir.MqttPkg) (bool, error) {
for _, tname := range tpkg.Data.Added {
ttl := time.Duration(tname.TTL) * time.Second
tmp := tapir.TapirName{
Name: tname.Name,
Name: dns.Fqdn(tname.Name),
TimeAdded: tname.TimeAdded,
TTL: ttl,
TagMask: tname.TagMask,
Expand Down Expand Up @@ -135,7 +136,7 @@ func (td *TemData) ProcessTapirUpdate(tpkg tapir.MqttPkg) (bool, error) {
}

for _, tname := range tpkg.Data.Removed {
delete(wbgl.Names, tname.Name)
delete(wbgl.Names, dns.Fqdn(tname.Name))
}

ixfr, err := td.GenerateRpzIxfr(&tpkg.Data)
Expand Down
2 changes: 2 additions & 0 deletions rpz.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ func (td *TemData) GenerateRpzIxfr(data *tapir.TapirMsg) (RpzIxfr, error) {
var removeData, addData []*tapir.RpzName
td.Policy.Logger.Printf("GenerateRpzIxfr: %d removed names and %d added names", len(data.Removed), len(data.Added))
for _, tn := range data.Removed {
tn.Name = dns.Fqdn(tn.Name)
td.Policy.Logger.Printf("GenerateRpzIxfr: evaluating removed name %s", tn.Name)
if cur, exist := td.Rpz.Axfr.Data[tn.Name]; exist {
newAction := td.ComputeRpzAction(tn.Name)
Expand Down Expand Up @@ -228,6 +229,7 @@ func (td *TemData) GenerateRpzIxfr(data *tapir.TapirMsg) (RpzIxfr, error) {

var addtorpz bool
for _, tn := range data.Added {
tn.Name = dns.Fqdn(tn.Name)
td.Policy.Logger.Printf("GenerateRpzIxfr: evaluating added name %s", tn.Name)
addtorpz = false
newAction := td.ComputeRpzAction(tn.Name)
Expand Down

0 comments on commit ae9e8b7

Please sign in to comment.