pike.git / lib / modules / Protocols.pmod / DNS.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:425:    error("Only T_LOC version 1 is supported");    return sprintf("%1c%1c%1c%1c%4c%4c%4c",    0, // Only version that currently exists    encode_T_LOC_tinyfloat(entry->size? entry->size:100.0), //Default is 1M    encode_T_LOC_tinyfloat(entry->h_prec? entry->h_prec:1000*100.0), // Default is 10KM    encode_T_LOC_tinyfloat(entry->v_prec? entry->v_prec:10*100.0), // Default is 10M    entry->lat?(int)(entry->lat*3600000.0)+(2<<30):2<<30, // Default is 2<<30 which is 0.0    entry->long?(int)(entry->long*3600000.0)+(2<<30):2<<30, // Default is 2<<30 which is 0.0    entry->alt?(int)((entry->alt+100000)*100):100000, // Default to 0 WGS84 (which is 100000)    ); +  case T_CAA: +  if (entry->tag == "" || !entry->tag) +  error("An empty tag is not permitted.\n"); +  return sprintf("%c%H%s", entry->flags | (!!entry->critical << 7), +  entry->tag, entry->value || "");    default:    return "";    }    }       protected private string encode_entries(array(mapping) entries, int pos,    mapping(string:int) comp)    {    string res="";    foreach(entries, mapping entry) {
pike.git/lib/modules/Protocols.pmod/DNS.pmod:690:    //! When receiving decoded DNS data from a client, txta is    //! the array of all strings in the record. When sending    //! multiple strings in a TXT record in a server, please    //! supply an array as "txt" containing the strings, txta    //! will be ignored.    //! @endmapping    //! @value T_SPF    //! @mapping    //! @member string "spf"    //! @endmapping +  //! @value T_CAA +  //! @mapping +  //! @member int "critical" +  //! Sets the critical bit of the flag field. +  //! @member int "flags" +  //! +  //! @member string "tag" +  //! Cannot be empty. +  //! @member string "value" +  //! @endmapping    //! @endint    //! @endarray    array decode_entries(string s,int num, array(int) next)    {    array(string) ret=({});    for(int e=0;e<num && next[0]<sizeof(s);e++)    {    mapping m=([]);    m->name=decode_domain(s,next);    sscanf(s[next[0]..next[0]+10],
pike.git/lib/modules/Protocols.pmod/DNS.pmod:802:    while (tlen < m->len) {    m->txta += ({ decode_string(s, next) });    tlen += sizeof(m->txta[-1]) + 1;    }    m->txt = m->txta[0];    }    break;    case T_SPF:    m->spf = decode_string(s, next);    break; +  case T_CAA: +  { +  string tag; +  +  m->critical = !!((m->flags = decode_byte(s, next)) & 0x80); +  tag = m->tag = decode_string(s, next); +  m->value = s[next[0]..next[0] + m->len - 3 - sizeof(tag)];    } -  +  break; +  }       next[0]=tmp+m->len;    ret+=({m});    }    return ret;    }       mapping decode_res(string s)    {    mapping m=([]);