I've looked into this a bit more and found out that the quotes make the resolver misbehave, so they should be stripped, even for the search entry in /etc/resolv.conf.
The proposed fix sanitizes both the search entry, by removing the quotes, and the domain entry, by removing quotes and stripping all but the first domain - at least that's my interpretation of how it should be, from reading resolv.conf(5). I tested it with quoted and unquoted DNSDOMAIN values, and also with multiple domain entries and a single entry (which is the case for most networks).
I've looked into this a bit more and found out that the quotes make the resolver misbehave, so they should be stripped, even for the search entry in /etc/resolv.conf.
The proposed fix sanitizes both the search entry, by removing the quotes, and the domain entry, by removing quotes and stripping all but the first domain - at least that's my interpretation of how it should be, from reading resolv.conf(5). I tested it with quoted and unquoted DNSDOMAIN values, and also with multiple domain entries and a single entry (which is the case for most networks).