ndb/dns: use decimal encoding for txt rr string escapes
rfc883 suggests to use decimal digits to escape txt rr strings, and unix dig appears to use the same. so change from octal to decimal.
This commit is contained in:
parent
6285c19b33
commit
c37de33463
2 changed files with 5 additions and 5 deletions
|
@ -459,10 +459,10 @@ txtrr(Ndbtuple*, Ndbtuple *pair)
|
|||
for(i = 0; i < n && sofar < len; i++){
|
||||
uint c = pair->val[sofar++];
|
||||
if(c == '\\' && sofar < len){
|
||||
if(pair->val[sofar] >= '0' && pair->val[sofar] <= '7'){
|
||||
if(pair->val[sofar] >= '0' && pair->val[sofar] <= '9'){
|
||||
c = pair->val[sofar++] - '0';
|
||||
while(pair->val[sofar] >= '0' && pair->val[sofar] <= '7')
|
||||
c = (c << 3) | (pair->val[sofar++] - '0');
|
||||
while(pair->val[sofar] >= '0' && pair->val[sofar] <= '9')
|
||||
c = (c * 10) + (pair->val[sofar++] - '0');
|
||||
} else {
|
||||
c = pair->val[sofar++];
|
||||
}
|
||||
|
|
|
@ -1201,7 +1201,7 @@ idnname(DN *dn, char *buf, int nbuf)
|
|||
* control characters and double quotes (") which would
|
||||
* collide with ndb(6) format.
|
||||
* escape special characters by encoding them as: \DDD
|
||||
* where D is a octal digit. backslash (\) is escaped
|
||||
* where D is a decimal digit. backslash (\) is escaped
|
||||
* by doubling. valid utf8 is encoded verbatim.
|
||||
*/
|
||||
int
|
||||
|
@ -1227,7 +1227,7 @@ bslashfmt(Fmt *f)
|
|||
}
|
||||
c = *data;
|
||||
if(c < ' ' || c == '"' || c > '~')
|
||||
out += fmtprint(f, "\\%.3o", c);
|
||||
out += fmtprint(f, "\\%.3d", c);
|
||||
else if(c == '\\')
|
||||
out += fmtprint(f, "\\\\");
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue