ó ŌnüQc@sÖddlZddlZddlZddlZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZeZdd,d„ƒYZd„Zdd-d„ƒYZdd.d„ƒYZd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d„Z#d „Z$d!„Z%d"„Z&d#„Z'd$„Z(d%„Z)d&„Z*d'„Z+e,d(krŅe-Zd)GHe+e.ej/ƒdkr³ej/dp¶d*eeƒZ0ej1d+ƒndS(/i’’’’Niiiii’iii i i i iii!tDNSQueryHeadercBs2eZdZd„Zd„Zd„Zd„ZRS(s!HBBHHHHcCsyd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ dS(Ni( tdns_idtdns_rdtdns_tctdns_aat dns_opcodetdns_qrt dns_rcodetdns_ztdns_rat dns_qdcountt dns_ancountt dns_nscountt dns_arcount(tself((s"/usr/share/authconfig/dnsclient.pyt__init__/s            c Csœtjtj|j|jd@|jd@d>B|jd@d>B|jd@d>B|j d@d>B|j d@|j d@d>B|j d@d>B|j |j|j|jƒS(Niiiiii(tstructtpackRtFORMATRRRRRRRRR R R R R (R((s"/usr/share/authconfig/dnsclient.pyR>s 7cCsŹtjtj|d|jƒ!ƒ\|_}}|_|_|_|_ |d@|_ |d?d@|_ |d?d@|_ |d?d@|_ |d?d@|_|d@|_|d?d@|_|d?d@|_dS(Niiiiiii(RtunpackRRtsizeRR R R R RRRRRRRR (Rtdatatbyte1tbyte2((s"/usr/share/authconfig/dnsclient.pyRNsF  cCstjtjƒS(N(RtcalcsizeRR(R((s"/usr/share/authconfig/dnsclient.pyRZs(t__name__t __module__RRRRR(((s"/usr/share/authconfig/dnsclient.pyR-s    cCstƒ}|j|ƒ|S(N(RR(Rtheader((s"/usr/share/authconfig/dnsclient.pytunpackQueryHeader]s  t DNSResultcBsAeZdZdZd„Zd„Zd„Zd„Zd„ZRS(s!HHIHs!HHcCs:d|_d|_d|_d|_d|_d|_dS(Nti(tdns_nametdns_typet dns_classtdns_ttlt dns_rlengthtNonetrdata(R((s"/usr/share/authconfig/dnsclient.pyRes      cCs>tjtj|d|jƒ!ƒ\|_|_|_|_dS(Ni( RRRRRR R!R"R#(RR((s"/usr/share/authconfig/dnsclient.pyRmscCs2tjtj|d|jƒ!ƒ\|_|_dS(Ni(RRRtQFORMATtqsizeR R!(RR((s"/usr/share/authconfig/dnsclient.pytqunpackqscCstjtjƒS(N(RRRR(R((s"/usr/share/authconfig/dnsclient.pyRtscCstjtjƒS(N(RRRR&(R((s"/usr/share/authconfig/dnsclient.pyR'ws( RRRR&RRR(RR'(((s"/usr/share/authconfig/dnsclient.pyRbs    tDNSRDatacBseZd„ZRS(cCsdS(N((R((s"/usr/share/authconfig/dnsclient.pyR{s(RRR(((s"/usr/share/authconfig/dnsclient.pyR)zscCsDd}|jdƒ}x(|D] }|tt|ƒƒ|7}qW|S(NRt.(tsplittchrtlen(tnametouttpart((s"/usr/share/authconfig/dnsclient.pytdnsNameToLabel°s  cCs°tƒ}d|_d|_d|_d|_d|_t|ƒ}|sLdS|jƒ|}|t|d?ƒ7}|t|d@ƒ7}|t|d?ƒ7}|t|d@ƒ7}|S(NiiRii’( RRRRRR R1RR,(tquerytqclasstqtypeRtqlabelR/((s"/usr/share/authconfig/dnsclient.pytdnsFormatQuery·s       cCs|s d Sd}|}d}d}yŌxĶt|dƒrōt|dƒd@r•|t|dƒd@d>t|dƒ}|r‰|d7}nd}q(n||dt|dƒd!d7}|rŁ|t|dƒd7}n|t|dƒd}q(WWntk r d SX||||fS( NRiiiĄi?iiR*(RN(RN(R$tordt IndexError(tlabeltbasetupdatetresttoutputtskip((s"/usr/share/authconfig/dnsclient.pyt dnsParseLabelĢs** #  cCsætƒ}t|ƒdkr(d|_dSt|dƒd>t|dƒd>Bt|dƒd>Bt|dƒd>B|_tr»d t|dƒt|dƒt|dƒt|dƒfGHn|S( NiiiiiiiisA = %d.%d.%d.%d.(R)R-taddressR$R7tDEBUG_DNSCLIENT(RR:R%((s"/usr/share/authconfig/dnsclient.pyt dnsParseAęs  M@cCs]t|ƒdkrdSt|dƒ}t|ƒ|dkr@dS||d|d|d!fS(NiRi(RN(RN(R-R$R7(Rttlen((s"/usr/share/authconfig/dnsclient.pyt dnsParseTextņs cCs:tƒ}t||ƒ\}|_tr6d|jGHn|S(NsNS DNAME = "%s".(R)R?tnsdnameRA(RR:R%R<((s"/usr/share/authconfig/dnsclient.pyt dnsParseNSśs  cCs:tƒ}t||ƒ\}|_tr6d|jGHn|S(Ns CNAME = "%s".(R)R?tcnameRA(RR:R%R<((s"/usr/share/authconfig/dnsclient.pyt dnsParseCNAMEs  cCs"tƒ}d}t||ƒ\}|_|jdkr:dSt||ƒ\}|_|jdkredSt|ƒtj|ƒkr„dStj||tj|ƒ ƒ\|_ |_ |_ |_ |_ trd|jGHd|jGHd|j GHd|j GHd|j GHd|j GHd|j GHn|S( Ns!IIIIIsSOA(mname) = "%s".sSOA(rname) = "%s".sSOA(serial) = %d.sSOA(refresh) = %d.sSOA(retry) = %d.sSOA(expire) = %d.sSOA(minimum) = %d.(R)R?tmnameR$trnameR-RRRtserialtrefreshtretrytexpiretminimumRA(RR:R%tformatR<((s"/usr/share/authconfig/dnsclient.pyt dnsParseSOAs( =      cCsdS(N(R$(RR:((s"/usr/share/authconfig/dnsclient.pyt dnsParseNULL"scCsdS(N(R$(RR:((s"/usr/share/authconfig/dnsclient.pyt dnsParseWKS&scCsatƒ}t|ƒ\}|_|r<t|ƒ\}|_ntr]d|jGHd|jGHn|S(NsHINFO(cpu) = "%s".sHINFO(os) = "%s".(R)RDtcputosRA(RR:R%R<((s"/usr/share/authconfig/dnsclient.pyt dnsParseHINFO)s  cCs…tƒ}t|ƒdkrdSt|dƒd>t|dƒB|_t|d|ƒ\}|_trd|jGHd|jGHn|S(NiiiisMX(exchanger) = "%s".sMX(preference) = %d.(R)R-R$R7t preferenceR?texchangeRA(RR:R%R<((s"/usr/share/authconfig/dnsclient.pyt dnsParseMX3s % cCs7tƒ}t|ƒ\}|_tr3d|jGHn|S(Ns TXT = "%s".(R)RDRRA(RR:R%R<((s"/usr/share/authconfig/dnsclient.pyt dnsParseTXT>s  cCs:tƒ}t||ƒ\}|_tr6d|jGHndS(Ns PTR = "%s".(R)R?tptrdnameRA(RR:R%R<((s"/usr/share/authconfig/dnsclient.pyt dnsParsePTREs cCsµtƒ}d}tj|ƒ}t|ƒ|kr4dStj||| ƒ\|_|_|_t |||ƒ\}|_ t r±d|j GHd|jGHd|jGHd|jGHn|S(Ns!HHHsSRV(server) = "%s".sSRV(weight) = %d.sSRV(priority) = %d.sSRV(port) = %d.( R)RRR-R$RtprioritytweighttportR?tserverRA(RR:R%RPtflenR<((s"/usr/share/authconfig/dnsclient.pyt dnsParseSRVKs (   cCsĘyt|ƒ}Wntjk r'gSX|jdkr;gS|jdkrNgS||jƒ}g}x©t|jƒD]˜}|s„gStƒ}t ||ƒ\}}|dkr²gSt |ƒ|j ƒkrĪgS|j |ƒ||j ƒ}trtd||j|jfGHqtqtWxt|j|j|jƒD]~}t ||ƒ\}}|dkrYgStƒ}||_t |ƒ|jƒkr‡gS|j|ƒ||jƒ}trŃd||j|j|j|jfGHnt |ƒ|jkrųtrōdGHngSi tt6tt6tt6tt6t t!6t"t#6t$t%6t&t'6t(t)6t*t+6t,t-6}|j|krrtr’d|jGHq’n ||j||j |ƒ|_.||j}||g7}q.W|sĀ|g}n|S(Niis(Queried for '%s', class = %d, type = %d.s4Answer %d for '%s', class = %d, type = %d, ttl = %d.sAnswer too short.s#Don't know how to parse RR type %d!(/RRterrorRRRtxrangeR RR?R$R-R'R(RAR!R R R R RRR"R#RBtDNS_T_ARFtDNS_T_NSRHt DNS_T_CNAMERQt DNS_T_SOARRt DNS_T_NULLRSt DNS_T_WKSR\t DNS_T_PTRRVt DNS_T_HINFORYtDNS_T_MXRZt DNS_T_TXTRbt DNS_T_SRVR%(tresultsRR<trrlisttitrrR9tfmap((s"/usr/share/authconfig/dnsclient.pytdnsParseResults[sr   $        cCs?t|||ƒ}|sgStj|ƒ}|s5gSt|ƒS(N(R6tacutiltres_sendRu(R2R3R4tqdatatanswer((s"/usr/share/authconfig/dnsclient.pyR2®st__main__sSending query.sdevserv.devel.redhat.com.i((((2RtsockettsysRvtDNS_C_INtDNS_C_CSt DNS_C_CHAOStDNS_C_HSt DNS_C_ANYReRfRgRhRiRjRkRlRmRnRot DNS_T_ANYtFalseRARRRR)R1R6R?RBRDRFRHRQRRRSRVRYRZR\RbRuR2RtTrueR-targvRstexit(((s"/usr/share/authconfig/dnsclient.pyts`    0 6             S (