alexreinert / ARSoft.Tools.Net

This project contains a complete managed .Net SPF validation, SenderID validation and a dns client and dns server implementation written in C#.
Apache License 2.0
168 stars 81 forks source link

RFC2136 delete operations not working #28

Closed WouterTinus closed 1 year ago

WouterTinus commented 1 year ago

Hi, I'm trying to use your library to implement Let's Encrypt validation, which requires me to add and delete TXT records. Adding works fine, but I don't seem to be able to delete the records afterwards.

If I send a DeleteAllRecordsUpdate the server returns a FormatError. If I send a DeleteRecordUpdate it only changes the TTL to 0. Server logs confirm that the DeleteRecordUpdate looks exactly the same as an AddRecordUpdate. I tried to make sense of the code, but there doesn't seem to be any difference between those two classes, except for the TTL thing.

What seems to be missing is some property or logic to change the command from add to delete for both of those update types.

https://github.com/win-acme/win-acme/issues/2364

WouterTinus commented 1 year ago

After digging through the RFC a bit, I think this is possibly due to the fact that RecordClass needs to be set to Any for the delete directives, but unfortunately that can't be done elegantly from my code because it's protected, internal and/or readonly everywhere. I tried inheriting from DeleteRecordUpdate to do

protected override RecordClass RecordClassInternal => RecordClass.Any;

But that lead to a FormatError again, maybe because there's a mismatch between the update message and the inner record.

alexreinert commented 1 year ago

I will have a look and provide a new version, soon.

WouterTinus commented 1 year ago

I just opened a PR for you to review, I've confirmed it to work for my case by means of reflection, but you might have additional tests that you'd want to perform.

alexreinert commented 1 year ago

Sorry, for some legal reasons I cannot accept any PR for this project.

alexreinert commented 1 year ago

Fixed in 3.2.0

WouterTinus commented 1 year ago

Thanks!