Bug 617 - protocal and services in wks record can only be recognized in lowercase
protocal and services in wks record can only be recognized in lowercase
Status: RESOLVED FIXED
Product: ldns
Classification: Unclassified
Component: library
1.6.x
Other Linux
: P5 enhancement
Assigned To: LDNS dev team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-11 09:46 CEST by Xiali Yan
Modified: 2017-02-14 11:23 CET (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xiali Yan 2014-10-11 09:46:06 CEST
For a wks record, if any uppercase letter exists in protocol or service, ldns can not recognized it correctly.

For example:
a. protocol contains uppercase letters.
microsoft.test.com. WKS  10.0.0.1 TCP ( telnet smtp ftp )

You'll get the answer section for wks query as follow:
microsoft.test.com.     3600    IN      WKS     10.0.0.1 6 0

While the right answer is:
microsoft.test.com.     3600    IN      WKS     10.0.0.1 6 21 23 25


b. one of the services contains uppercase letters.
microsoft.test.com. WKS  10.0.0.1 tcp ( Telnet smtp FTP )

You'll get the answer section for wks query as follow:
microsoft.test.com.     3600    IN      WKS     10.0.0.1 6 0 25

While the right answer is:
microsoft.test.com.     3600    IN      WKS     10.0.0.1 6 21 23 25
Comment 1 Willem Toorop 2014-11-19 15:51:59 CET
Thanks Xiali Yan,

ldns uses getservbyname and getprotobyname under the hood which seem to be case sensitive.  Other DNS software that I had my hands on and looked at did the same b.t.w.

Still I can appreciate your issue because the other mnemonics *are* parsed case insensitive.

I have to admit I was a bit set back when I looked at the ldns_str2rdf_wks function that would have to be altered for it though.  The implementation could be significantly simpler when I do some other work (import the new ldns core functions that are already defined in unbound) first.  I'll leave this bug open pending for that.

-- Willem
Comment 2 Willem Toorop 2017-02-14 11:23:20 CET
Thanks Xiali

I've decided to do a intermediate fix anyway.
I noticed that my /etc/services and /etc/protocols all contained lower case names,  so I've made a retry with a protocol and service name lookup by first lowercasing them.  This seems to work for the examples you gave.  At least with me.

see: https://git.nlnetlabs.nl/?p=ldns.git;a=commitdiff;h=bd8dd94f


Regards,
-- Willem