Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000058 [MyDNS-NG] Global major always 2010-07-15 16:18 2010-11-09 19:35
Reporter joezhou View Status public  
Assigned To
Priority normal Resolution fixed  
Status closed   Product Version 1.2.8.27
Summary 0000058: MyDNS-NG not parsing NAPTR records correctly
Description Problem is in the subroutine STRSEP_QUOTES, if you just insert a simple statement and see what is being passed in, you can see that STRSEP_QUOTES is not stepping through the '"' after flags correctly. Then MyDNS complains that service field is missing. This behavior still exists after applying the patch suggested in 0000023. Thanks.

STRSEP_QUOTES2 100 90 "U" "E2U+sip" "!^.*$!sip:customer-service@example.com!i" .
STRSEP_QUOTES2 90 "U" "E2U+sip" "!^.*$!sip:customer-service@example.com!i" .
STRSEP_QUOTES "U" "E2U+sip" "!^.*$!sip:customer-service@example.com!i" .
STRSEP_QUOTES2 " "E2U+sip" "!^.*$!sip:customer-service@example.com!i" .
STRSEP_QUOTES2 E2U+sip" "!^.*$!sip:customer-service@example.com!i" .
STRSEP_QUOTES2 "!^.*$!sip:customer-service@example.com!i" .
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0000160)
joezhou (reporter)
2010-07-15 17:37

Why are we doing this in STRSEP_QUOTES?

  /* Terminate token and set *stringp past NUL */
  *end++ = '\0';

This would effectively truncate the input string after the flags. Then I get this error message from mydnscheck.

STRSEP_QUOTES2 100 90 "U
STRSEP_QUOTES2 90 "U
STRSEP_QUOTES2 "U
STRSEP_QUOTES2
'service' field missing from NAPTR record 60 574 example.com. 14400 NAPTR 100 90 "U
(0000169)
itamarjp (developer)
2010-11-01 04:13

are you able to write a patch ?
(0000170)
joezhou (reporter)
2010-11-01 15:04

I would like to try a fix for this. Is there a document on how to patch my-dns? Thanks.
(0000171)
itamarjp (developer)
2010-11-01 18:25

you can contact me


msn, google talk, skype - > : itamar@ispbrasil.com.br


and I will provide the details.


the easy way is to create a git branch for you, make changes on it, and after working merge the changes to trunk .


you can access mydns-ng in sourceforge and look about git.
(0000172)
joezhou (reporter)
2010-11-08 21:38

As demonstrated above, the function strsep_quotes truncates the string that is passed into it. This may not be a problem for mydns itself and other dns records because a rr record is no longer needed once it is parsed. But for NAPTR records, mydnscheck is parsing the rr record again to check for errors, and it has problem with a truncated string. For example,

rr.c mydns_rr_parse_naptr original: 100 10 "U" "E2U+email" "!^.*$!mailto:information@example.com!i" .
rr.c mydns_rr_parse_naptr order: 100
rr.c mydns_rr_parse_naptr preference: 10
rr.c mydns_rr_parse_naptr flags: U
rr.c mydns_rr_parse_naptr service: E2U+email
rr.c mydns_rr_parse_naptr regex: !^.*$!mailto:information@example.com!i
rr.c mydns_rr_parse_naptr replacement: .
check.c check_rr_naptr original: 100 10 "U
check.c check_rr_naptr order: 100
check.c check_rr_naptr preference: 10
check.c check_rr_naptr flags: U
'service' field missing from NAPTR record 138 2143 test.test. 86400 NAPTR 100 10 "U
mydnscheck[12036]: test.test.: 3 resource records
mydnscheck[12036]: Syntax errors: 1

So we may need to make a copy of the original rr record and parse the copy. In rr.c, function mydns_rr_parse_naptr, at first, we make a copy,

  char *int_tmp, *p, *data_copy;

  data_copy = STRNDUP(__MYDNS_RR_DATA_VALUE(rr), __MYDNS_RR_DATA_LENGTH(rr));
  p = data_copy;

And after we parsed it, we release the copy.

  RELEASE(data_copy);

Now mydnscheck seems to be happy.

rr.c mydns_rr_parse_naptr original: 100 10 "U" "E2U+email" "!^.*$!mailto:information@example.com!i" .
rr.c mydns_rr_parse_naptr order: 100
rr.c mydns_rr_parse_naptr preference: 10
rr.c mydns_rr_parse_naptr flags: U
rr.c mydns_rr_parse_naptr service: E2U+email
rr.c mydns_rr_parse_naptr regex: !^.*$!mailto:information@example.com!i
rr.c mydns_rr_parse_naptr replacement: .
check.c check_rr_naptr original: 100 10 "U" "E2U+email" "!^.*$!mailto:information@example.com!i" .
check.c check_rr_naptr order: 100
check.c check_rr_naptr preference: 10
check.c check_rr_naptr flags: U
check.c check_rr_naptr service: E2U+email
check.c check_rr_naptr regexp: !^.*$!mailto:information@example.com!i
check.c check_rr_naptr replacement: .
mydnscheck[13884]: test.test.: 3 resource records
mydnscheck[13884]: No errors
(0000173)
joezhou (reporter)
2010-11-08 21:40

Earlier, we had a segmentation fault because mydns_rr_parse_naptr released a string when mydnscheck still needs it.

  //__MYDNS_RR_DATA_LENGTH(rr) = 0;
// RELEASE(__MYDNS_RR_DATA_VALUE(rr));
(0000174)
joezhou (reporter)
2010-11-08 21:55

Pushed changes to git repo. The only file that has been changed is

mydns-ng/mydns/branches/joe/src/lib/rr.c
(0000175)
itamarjp (developer)
2010-11-09 19:13

commited to git.

- Issue History
Date Modified Username Field Change
2010-07-15 16:18 joezhou New Issue
2010-07-15 17:37 joezhou Note Added: 0000160
2010-11-01 04:13 itamarjp Note Added: 0000169
2010-11-01 15:04 joezhou Note Added: 0000170
2010-11-01 18:25 itamarjp Note Added: 0000171
2010-11-08 21:38 joezhou Note Added: 0000172
2010-11-08 21:40 joezhou Note Added: 0000173
2010-11-08 21:55 joezhou Note Added: 0000174
2010-11-09 19:13 itamarjp Note Added: 0000175
2010-11-09 19:35 itamarjp Status new => closed
2010-11-09 19:35 itamarjp Resolution open => fixed
2010-11-09 19:35 itamarjp Fixed in Version => Trunk


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker