+
    4Ssi                        ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHt ^ RIt^ R	IHtHt ^ R
IHt ^ RIHt ^ RIHtHtHtHt ^ RIHtH t  ^ RI!H"t"H#t#H$t$ ^ RI!H%t% R t& ! R R4      t'R t(R t)R t*R t+R t,R t-R t.R t/R t0R t1R t2R t3R t4R  t5R! t6R" t7R# t8R$ t9R% t:R& t;R' t<R( t= ! R) R*]4      t>R+ t? ! R, R-]4      t@ ! R. R/]4      tA ! R0 R1]4      tB ! R2 R3]4      tC ! R4 R5]4      tD ! R6 R7]4      tE ! R8 R9]4      tF ! R: R;]4      tG ! R< R=]4      tH ! R> R?]4      tI ! R@ RA]4      tJ ! RB RC]4      tKR# )D    N)WERRORError)werror)pack)	inet_ntop	inet_pton)AF_INET)AF_INET6)
ndr_unpackndr_pack)	remove_dcdsdb_dns)SamDB)system_session)CommandCommandErrorOptionSuperCommand)dnsp	dnsserver)record_from_stringDNSParseErrorflag_from_string)dns_record_matchc                     V P                  4       R 8X  d   Rp RV ,          p \        P                  ! W1V4      pV#   \         d   p\        RT : RT: 24      hRp?ii ; i)	localhostz	127.0.0.1zncacn_ip_tcp:%s[sign]zConnecting to DNS RPC server z failed with N)lowerr   RuntimeErrorr   )serverlpcredsbinding_strdns_connes   &&&   2/usr/lib/python3/dist-packages/samba/netcmd/dns.pydns_connectr%   /   sc    ||~$)F2K[&&{> O  [vWXYZZ[s   ; AAAc            
          a  ] tR t^;t o Rt]P                  R]P                  R]P                  R]P                  R]P                  R/tR tR tR	tV tR
# )DnsConnWrappera  A wrapper around a dnsserver.dnsserver connection that makes it
harder not to report friendly messages.

If, rather than

    dns_conn = dns_connect(server, lp, creds)

you use

    dns_conn = DnsConnWrapper(server, lp, creds)

then various common errors (for example, misspelled zones) on
common operations will raise CommandErrors that turn into
relatively nice messages (when compared to tracebacks).

In addition, if you provide a messages keyword argument, it will
override the defaults. Note that providing None will turn off the
default, letting the original exception shine through.

    messages = {
        werror.WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST: (
            f'Zone {zone} does not exist and so could not be deleted.'),
        werror.WERR_DNS_ERROR_NAME_DOES_NOT_EXIST: None
    }
    res = dns_conn.DnssrvOperation2( # ...
                                    messages=messages)

This example changes the message for ZONE_DOES_NOT_EXIST and
avoids catching NAME_DOES_NOT_EXIST.

Only WERRORErrors are intercepted.
zCould not contact RPC serverzZone already existszThe record does not existzThe zone does not existzInsufficient permissionsc                (    \        WV4      V n        R # N)r%   r"   )selfr   r   r    s   &&&&r$   __init__DnsConnWrapper.__init__e   s    #F6    c                ^   a a \        S P                  V4      oVR9  d   S# RR/VV 3R llpV# )DnssrvComplexOperation2messagesNc                   < V f   / p  S! V!  #   \          dl   pTP                  w  r4Y09   d   Tf   h \        Y,           RT R2T4      hTSP                  9   d$   \        SP                  T,           RT R2T4      hh R p?ii ; i)N [])r   argsr   default_messages)r0   r4   r#   werrerrstrattrr*   s   $*   r$   f%DnsConnWrapper.__getattr__.<locals>.fr   s    T{" 	 vv#|&(.)9F81'EqII4000&$*?*?*E)FbPQ'RTUVV	s    BA&B  B>   DnssrvQuery2DnssrvOperation2DnssrvEnumRecords2DnssrvUpdateRecord2r/   )getattrr"   )r*   namer9   r8   s   f& @r$   __getattr__DnsConnWrapper.__getattr__h   s?    t}}d+ ' ' K	d 	 	" r-   )r"   N)__name__
__module____qualname____firstlineno____doc__r   WERR_DNS_ERROR_DS_UNAVAILABLE"WERR_DNS_ERROR_ZONE_ALREADY_EXISTS$WERR_DNS_ERROR_RECORD_DOES_NOT_EXIST"WERR_DNS_ERROR_NAME_DOES_NOT_EXISTWERR_ACCESS_DENIEDr5   r+   rA   __static_attributes____classdictcell____classdict__s   @r$   r'   r'   ;   s`     D 	,,.L113H335P114M!!#=7 r-   r'   c                 D    V ^ 8X  d   RpV# V ^8X  d   RpV# RV ,          pV# )r   FALSETRUEUNKNOWN (0x%x) )flagrets   & r$   bool_stringrX      s;    qy
 J	 
 J %Jr-   c                 f    R pV F  pV\        W4      8X  g   K  Tp M	  V'       g
   RV,          pV# )NrT   r?   )module	enum_defsvaluerW   r#   s   &&&  r$   enum_stringr^      s:    
CGF&&C  &Jr-   c                     R pV F-  pV\        W4      ,          '       g   K  VRV,          ,          pK/  	  V'       g   RpV# ) z%s NONErZ   )r[   bitmap_defsr]   rW   bs   &&&  r$   bitmap_stringrd      s>    
C76%%%519C  Jr-   c                 *    . ROp\        \        W4      # )DNS_BOOT_METHOD_UNINITIALIZED)rf   DNS_BOOT_METHOD_FILEDNS_BOOT_METHOD_REGISTRYDNS_BOOT_METHOD_DIRECTORYr^   r   )boot_methodr\   s   & r$   boot_method_stringrl      s    JIy)99r-   c                 *    . ROp\        \        W4      # )DNS_ALLOW_RFC_NAMES_ONLY)rn   DNS_ALLOW_NONRFC_NAMESDNS_ALLOW_MULTIBYTE_NAMESDNS_ALLOW_ALL_NAMESrj   )
check_flagr\   s   & r$   name_check_flag_stringrs      s    EIy)88r-   c                 *    . ROp\        \        W4      # )DNS_ZONE_TYPE_CACHE)ru   DNS_ZONE_TYPE_PRIMARYDNS_ZONE_TYPE_SECONDARYDNS_ZONE_TYPE_STUBDNS_ZONE_TYPE_FORWARDERDNS_ZONE_TYPE_SECONDARY_CACHEr^   r   )	zone_typer\   s   & r$   zone_type_stringr}      s    MI tY22r-   c                 *    . ROp\        \        W4      # )DNS_ZONE_UPDATE_OFF)r   DNS_ZONE_UPDATE_UNSECUREDNS_ZONE_UPDATE_SECUREr{   )zone_updater\   s   & r$   zone_update_stringr      s    +ItY44r-   c                 *    . ROp\        \        W4      # )DNS_ZONE_SECSECURE_NO_SECURITY)r   DNS_ZONE_SECSECURE_NS_ONLYDNS_ZONE_SECSECURE_LIST_ONLYDNS_ZONE_SECSECURE_NO_XFERrj   )securityr\   s   & r$   zone_secondary_security_stringr      s    OIy)66r-   c                 *    . ROp\        \        W4      # )DNS_ZONE_NOTIFY_OFF)r   DNS_ZONE_NOTIFY_ALL_SECONDARIESDNS_ZONE_NOTIFY_LIST_ONLYrj   )notify_levelr\   s   & r$   zone_notify_level_stringr      s    .Iy)::r-   c                 *    . ROp\        \        W4      # )DNS_DP_AUTOCREATED)r   DNS_DP_LEGACYDNS_DP_DOMAIN_DEFAULTDNS_DP_FOREST_DEFAULTDNS_DP_ENLISTEDDNS_DP_DELETEDrd   r   )dp_flagsrb   s   & r$   dp_flags_stringr      s    QKK::r-   c                 *    . ROp\        \        W4      # )DNS_RPC_ZONE_PAUSED)	r   DNS_RPC_ZONE_SHUTDOWNDNS_RPC_ZONE_REVERSEDNS_RPC_ZONE_AUTOCREATEDDNS_RPC_ZONE_DSINTEGRATEDDNS_RPC_ZONE_AGINGDNS_RPC_ZONE_UPDATE_UNSECUREDNS_RPC_ZONE_UPDATE_SECUREDNS_RPC_ZONE_READONLYr   )flagsrb   s   & r$   zone_flags_stringr      s    ,K
 K77r-   c           	          . pV '       g   V# \        V P                  4       F?  p\        \        \	        R V P
                  V,          4      4      pVP                  V4       KA  	  V# )I)range	AddrCountr   r   r   	AddrArrayappend)arrayrW   iaddrs   &   r$   ip4_array_stringr      sQ    
C
5??#$sEOOA,>"?@

4 $ Jr-   c                 N   . pV '       g   V# \        V P                  4       F  pV P                  V,          P                  ^ ,          ^8X  dL   \        P
                  ! R.V P                  V,          P                  R,          O5!  p\        \        V4      pMvV P                  V,          P                  ^ ,          ^8X  dL   \        P
                  ! R.V P                  V,          P                  R,          O5!  p\        \        V4      pMRpVP                  V4       EK  	  V# )r   4B:      N16B:r      NUNKNOWN)
r   r   r   MaxSastructr   r   r   r	   r   )r   rW   r   xr   s   &    r$   dns_addr_array_stringr      s    
C
5??#??1##A&$.DA5??1#5#;#;C#@AAWa(D__Q%%a(D0ECEOOA$6$<$<T$BCAXq)DD

4 $ Jr-   c                 f     \        V 4      #   \         d   p\        TP                  !  hR p?ii ; ir)   )r   r   r   r4   )rec_typer#   s   & r$   dns_type_flagr      s1    $)) $AFF##$s   
 0+0c                     V P                  4       pVR 8X  d   \        P                  pV# VR8X  d   \        P                  pV# VR8X  d   \        P                  pV# \        RV ,          4      h)W2KDOTNETLONGHORNzUnknown client version %s)upperr   DNS_CLIENT_VERSION_W2KDNS_CLIENT_VERSION_DOTNETDNS_CLIENT_VERSION_LONGHORNr   )cli_versionversionclient_versions   &  r$   dns_client_versionr      sx    !G%"99  
H	"<<
 	 
J	">>  6DEEr-   c                    V P                  R VP                  ,          4       V P                  R\        VP                  4      ,          4       V P                  R\	        VP
                  4      ,          4       V P                  R\	        VP                  4      ,          4       V P                  R\	        VP                  4      ,          4       V P                  RVP                  ,          4       V P                  RVP                  ,          4       V\        P                  8w  d   V P                  R\        VP                  4      ,          4       V P                  R\        VP                  4      ,          4       V P                  R	\        VP                  4      ,          4       MV P                  R\!        VP                  4      ,          4       V P                  R\!        VP                  4      ,          4       V P                  R	\!        VP                  4      ,          4       V P                  R
VP"                  ,          4       V P                  RVP$                  ,          4       V P                  RVP&                  ,          4       V P                  RVP(                  ,          4       V P                  R\+        VP,                  4      ,          4       V P                  RVP.                  ,          4       V P                  RVP0                  ,          4       V P                  RVP2                  ,          4       V P                  RVP4                  ,          4       V P                  RVP6                  ,          4       V P                  RVP8                  ,          4       V P                  RVP:                  ,          4       V P                  RVP<                  ,          4       V P                  R\	        VP>                  4      ,          4       V P                  R\	        VP@                  4      ,          4       V P                  R\	        VPB                  4      ,          4       V P                  R\	        VPD                  4      ,          4       V P                  R\	        VPF                  4      ,          4       V P                  R\	        VPH                  4      ,          4       V P                  R\	        VPJ                  4      ,          4       V P                  R\	        VPL                  4      ,          4       V P                  R\	        VPN                  4      ,          4       V P                  R \	        VPP                  4      ,          4       V P                  R!\	        VPR                  4      ,          4       V P                  R"\	        VPT                  4      ,          4       V P                  R#\	        VPV                  4      ,          4       V\        PX                  8w  Ed   V P                  R$VPZ                  ,          4       V P                  R%\!        VP\                  4      ,          4       V P                  R&VP^                  ,          4       V P                  R'VP`                  ,          4       V P                  R(VPb                  ,          4       V P                  R)VPd                  ,          4       V P                  R*VPf                  ,          4       V P                  R+VPh                  ,          4       V P                  R,VPj                  ,          4       V P                  R-VPl                  ,          4       V P                  R.VPn                  ,          4       V P                  R/VPp                  ,          4       V P                  R0VPr                  ,          4       V P                  R1VPt                  ,          4       V\        P                  8X  d.   V P                  R2\	        VPv                  4      ,          4       R3# R3# )4z%  dwVersion                   : 0x%x
z#  fBootMethod                 : %s
z#  fAdminConfigured            : %s
#  fAllowUpdate                : %s
z#  fDsAvailable                : %s
z#  pszServerName               : %s
z#  pszDsContainer              : %s
z#  aipServerAddrs              : %s
z#  aipListenAddrs              : %s
z#  aipForwarders               : %s
z#  dwLogLevel                  : %d
z#  dwDebugLevel                : %d
z#  dwForwardTimeout            : %d
z%  dwRpcPrototol               : 0x%x
z#  dwNameCheckFlag             : %s
z#  cAddressAnswerLimit         : %d
z#  dwRecursionRetry            : %d
z#  dwRecursionTimeout          : %d
z#  dwMaxCacheTtl               : %d
z#  dwDsPollingInterval         : %d
z#  dwScavengingInterval        : %d
z#  dwDefaultRefreshInterval    : %d
z#  dwDefaultNoRefreshInterval  : %d
z#  fAutoReverseZones           : %s
z#  fAutoCacheUpdate            : %s
z#  fRecurseAfterForwarding     : %s
z#  fForwardDelegations         : %s
z#  fNoRecursion                : %s
z#  fSecureResponses            : %s
z#  fRoundRobin                 : %s
z#  fLocalNetPriority           : %s
z#  fBindSecondaries            : %s
z#  fWriteAuthorityNs           : %s
z#  fStrictFileParsing          : %s
z#  fLooseWildcarding           : %s
z#  fDefaultAgingState          : %s
%  dwRpcStructureVersion       : 0x%x
z#  aipLogFilter                : %s
z#  pwszLogFilePath             : %s
z#  pszDomainName               : %s
z#  pszForestName               : %s
z#  pszDomainDirectoryPartition : %s
z#  pszForestDirectoryPartition : %s
z%  dwLocalNetPriorityNetMask   : 0x%x
z#  dwLastScavengeTime          : %d
z#  dwEventLogLevel             : %d
z#  dwLogFileMaxSize            : %d
z#  dwDsForestVersion           : %d
z#  dwDsDomainVersion           : %d
z#  dwDsDsaVersion              : %d
z#  fReadOnlyDC                 : %s
N)<write	dwVersionrl   fBootMethodrX   fAdminConfiguredfAllowUpdatefDsAvailablepszServerNamepszDsContainerr   DNSSRV_TYPEID_SERVER_INFOr   aipServerAddrsaipListenAddrsaipForwardersr   
dwLogLeveldwDebugLeveldwForwardTimeoutdwRpcProtocolrs   dwNameCheckFlagcAddressAnswerLimitdwRecursionRetrydwRecursionTimeoutdwMaxCacheTtldwDsPollingIntervaldwScavengingIntervaldwDefaultRefreshIntervaldwDefaultNoRefreshIntervalfAutoReverseZonesfAutoCacheUpdatefRecurseAfterForwardingfForwardDelegationsfNoRecursionfSecureResponsesfRoundRobinfLocalNetPriorityfBindSecondariesfWriteAuthorityNsfStrictFileParsingfLooseWildcardingfDefaultAgingStateDNSSRV_TYPEID_SERVER_INFO_W2KdwRpcStructureVersionaipLogFilterpwszLogFilePathpszDomainNamepszForestNamepszDomainDirectoryPartitionpszForestDirectoryPartitiondwLocalNetPriorityNetMaskdwLastScavengeTimedwEventLogLeveldwLogFileMaxSizedwDsForestVersiondwDsDomainVersiondwDsDsaVersionfReadOnlyDC)outftypeid
serverinfos   &&&r$   print_serverinfor    s   JJ7*:N:NNOJJ58J:KaKa8bbcJJ5JD_D_8``aJJ5JD[D[8\\]JJ5JD[D[8\\]JJ5
8P8PPQJJ5
8Q8QQR444

9#J$=$=>? 	@

9#J$=$=>? 	@

9#J$<$<=> 	? 	

9()B)BCD 	E

9()B)BCD 	E

9()A)ABC 	D 	JJ5
8M8MMNJJ5
8O8OOPJJ5
8S8SSTJJ7*:R:RRSJJ58NzOiOi8jjkJJ5
8V8VVWJJ5
8S8SSTJJ5
8U8UUVJJ5
8P8PPQJJ5
8V8VVWJJ5
8W8WWXJJ5
8[8[[\JJ5
8]8]]^JJ5JD`D`8aabJJ5JD_D_8``aJJ5JDfDf8gghJJ5JDbDb8ccdJJ5JD[D[8\\]JJ5JD_D_8``aJJ5JDZDZ8[[\JJ5JD`D`8aabJJ5JD_D_8``aJJ5JD`D`8aabJJ5JDaDa8bbcJJ5JD`D`8aabJJ5JDaDa8bbc888

;j>^>^^_

9<QR\RiRi<jjk

9J<V<VVW

9J<T<TTU

9J<T<TTU

9J<b<bbc

9J<b<bbc

;j>b>bbc

9J<Y<YYZ

9J<V<VVW

9J<W<WWX

9J<X<XXY

9J<X<XXY

9J<U<UUV444

9K
H^H^<__` 5r-   c                    V P                  R VP                  ,          4       V P                  R\        VP                  4      ,          4       V P                  R\	        VP
                  4      ,          4       V P                  R\        VP                  4      ,          4       V P                  R\	        VP                  4      ,          4       V P                  R\	        VP                  4      ,          4       V P                  R\	        VP                  4      ,          4       V P                  R\	        VP                  4      ,          4       V P                  RVP                  ,          4       V\        P                  8w  d-   V P                  R	\        VP                   4      ,          4       M+V P                  R	\#        VP                   4      ,          4       V P                  R
\%        VP&                  4      ,          4       V P                  R\)        VP*                  4      ,          4       V\        P                  8w  dX   V P                  R\        VP,                  4      ,          4       V P                  R\        VP.                  4      ,          4       MVV P                  R\#        VP,                  4      ,          4       V P                  R\#        VP.                  4      ,          4       V P                  R\	        VP0                  4      ,          4       V P                  R\	        VP2                  4      ,          4       V P                  R\	        VP4                  4      ,          4       V P                  RVP6                  ,          4       V P                  RVP8                  ,          4       V P                  RVP:                  ,          4       V\        P                  8w  d-   V P                  R\        VP<                  4      ,          4       M+V P                  R\#        VP<                  4      ,          4       V\        P>                  8w  Ed   V P                  RVP@                  ,          4       V P                  RVPB                  ,          4       V P                  RVPD                  ,          4       V\        P                  8w  d-   V P                  R\        VPF                  4      ,          4       M+V P                  R\#        VPF                  4      ,          4       V P                  R\I        VPJ                  4      ,          4       V P                  RVPL                  ,          4       V P                  RVPN                  ,          4       V P                  RVPP                  ,          4       V P                  RVPR                  ,          4       V\        P                  8X  d   V P                  R\	        VPT                  4      ,          4       V P                  R\	        VPV                  4      ,          4       V P                  R \	        VPX                  4      ,          4       V P                  R!VPZ                  ,          4       V P                  R"VP\                  ,          4       R## R## )$#  pszZoneName                 : %s
z#  dwZoneType                  : %s
z#  fReverse                    : %s
r   z#  fPaused                     : %s
z#  fShutdown                   : %s
z#  fAutoCreated                : %s
z#  fUseDatabase                : %s
z#  pszDataFile                 : %s
z#  aipMasters                  : %s
z#  fSecureSecondaries          : %s
z#  fNotifyLevel                : %s
z#  aipSecondaries              : %s
z#  aipNotify                   : %s
z#  fUseWins                    : %s
z#  fUseNbstat                  : %s
z#  fAging                      : %s
z#  dwNoRefreshInterval         : %d
z#  dwRefreshInterval           : %d
z#  dwAvailForScavengeTime      : %d
z#  aipScavengeServers          : %s
r   z#  dwForwarderTimeout          : %d
z#  fForwarderSlave             : %d
z#  aipLocalMasters             : %s
#  dwDpFlags                   : %s
#  pszDpFqdn                   : %s
z#  pwszZoneDn                  : %s
z#  dwLastSuccessfulSoaCheck    : %d
z#  dwLastSuccessfulXfr         : %d
z#  fQueuedForBackgroundLoad    : %s
z#  fBackgroundLoadInProgress   : %s
z#  fReadOnlyZone               : %s
z#  dwLastXfrAttempt            : %d
z#  dwLastXfrResult             : %d
N)/r   pszZoneNamer}   
dwZoneTyperX   fReverser   r   fPaused	fShutdownfAutoCreatedfUseDatabasepszDataFiler   DNSSRV_TYPEID_ZONE_INFOr   
aipMastersr   r   fSecureSecondariesr   fNotifyLevelaipSecondaries	aipNotifyfUseWins
fUseNbstatfAgingdwNoRefreshIntervaldwRefreshIntervaldwAvailForScavengeTimeaipScavengeServersDNSSRV_TYPEID_ZONE_INFO_W2Kr   dwForwarderTimeoutfForwarderSlaveaipLocalMastersr   	dwDpFlags	pszDpFqdn
pwszZoneDndwLastSuccessfulSoaCheckdwLastSuccessfulXfrfQueuedForBackgroundLoadfBackgroundLoadInProgressfReadOnlyZonedwLastXfrAttemptdwLastXfrResult)r  r  zoneinfos   &&&r$   print_zoneinfor0  P  s   JJ58L8LLMJJ58HI\I\8]]^JJ5HDUDU8VVWJJ58J8K`K`8aabJJ5HDTDT8UUVJJ5HDVDV8WWXJJ5HDYDY8ZZ[JJ5HDYDY8ZZ[JJ58L8LLM222

9#H$7$789 	: 	

9()<)<=> 	?JJ58VW_WrWr8sstJJ58PQYQfQf8ggh222

9#H$;$;<= 	>

9#H$6$678 	9 	

9()@)@AB 	C

9(););<= 	>JJ5HDUDU8VVWJJ5HDWDW8XXYJJ5HOO8TTUJJ58T8TTUJJ58R8RRSJJ58W8WWX222

9#H$?$?@A 	B 	

9()D)DEF 	G 666

;h>\>\\]

9H<W<WWX

9H<T<TTUY666JJ='(@(@AB C JJ=,X-E-EFG H

9OHL^L^<__`

9H<N<NNO

9H<O<OOP

9H<]<]]^

9H<X<XXY222

9KHiHi<jjk

9KHjHj<kkl

9KH^H^<__`

9H<U<UUV

9H<T<TTU 3r-   c                    V P                  R VP                  ,          4       V P                  R\        VP                  4      ,          4       V P                  R\	        VP
                  4      ,          4       V P                  RVP                  ,          4       V\        P                  8w  dP   V P                  R\        VP                  4      ,          4       V P                  RVP                  ,          4       R# R# )r	  z#  Flags                       : %s
z#  ZoneType                    : %s
z#  Version                     : %s
r
  r  N)r   r  r   Flagsr}   ZoneTypeVersionr   DNSSRV_TYPEID_ZONE_W2Kr   r%  r&  )r  r  zones   &&&r$   
print_zoner7    s    JJ58H8HHIJJ58I$**8UUVJJ58H8WWXJJ5DE111

9ODNN<[[\

9DNNJK 2r-   c                     V P                  R VP                  ,          4       VP                   F   pV P                  R4       \        WV4       K"  	  R# )z  %d zone(s) found

N)r   dwZoneCount	ZoneArrayr7  )r  r  zonesr6  s   &&& r$   print_enumzonesr=    s>    JJ%(9(99:

44&  r-   c                    VP                   \        P                  8X  d   R VP                  ,          pEMVP                   \        P                  8X  d   RVP                  ,          pEMVP                   \        P
                  8X  d    RVP                  P                  ,          pEMVP                   \        P                  8X  d    RVP                  P                  ,          pEMcVP                   \        P                  8X  d    RVP                  P                  ,          pEM%VP                   \        P                  8X  d   RVP                  P                  VP                  P                  VP                  P                  VP                  P                  VP                  P                  VP                  P                  P                  VP                  P                   P                  3,          pEMTVP                   \        P"                  8X  d?   RVP                  P$                  P                  VP                  P&                  3,          pMVP                   \        P(                  8X  di   RVP                  P*                  P                  VP                  P,                  VP                  P.                  VP                  P0                  3,          pMpVP                   \        P2                  8X  dP   VP                  P                   Uu. uF  pRVP                  ,          NK  	  ppR	R
P5                  V4      ,          pMRpV P7                  RW!P8                  VP:                  VP<                  3,          4       R# u upi )zA: %szAAAA: %szPTR: %szNS: %sz	CNAME: %szKSOA: serial=%d, refresh=%d, retry=%d, expire=%d, minttl=%d, ns=%s, email=%szMX: %s (%d)zSRV: %s (%d, %d, %d)z"%s"zTXT: %s,z	Unknown: z%    %s (flags=%x, serial=%d, ttl=%d)
N)wTyper   
DNS_TYPE_AdataDNS_TYPE_AAAADNS_TYPE_PTRstrDNS_TYPE_NSDNS_TYPE_CNAMEDNS_TYPE_SOA
dwSerialNo	dwRefreshdwRetrydwExpiredwMinimumTtlNamePrimaryServerZoneAdministratorEmailDNS_TYPE_MXnameExchangewPreferenceDNS_TYPE_SRV
nameTargetwPort	wPrioritywWeightDNS_TYPE_TXTjoinr   dwFlagsdwSerialdwTtlSeconds)r  recmesgr@   slists   &&   r$   print_dns_recordr`    sQ   
yyDOO##((#	d((	(SXX&	d''	'CHHLL)	d&&	&388<<(	d))	)chhll+	d''	'\HH''HH&&HH$$HH%%HH))HH..22HH3377`9 9 
d&&	& 5 5 9 9388;O;OPP	d''	'%)<)<)@)@#((..),););SXX=M=M)O O	d''	'/2xx||<|t$((""|<388E?*JJ7kk3<<1A1A;C C D	 =s   Nc                     VP                    Fd  pV P                  R VP                  P                  VP                  VP
                  3,          4       VP                   F  p\        W4       K  	  Kf  	  R# )z#  Name=%s, Records=%d, Children=%d
N)r]  r   dnsNodeNamerE  wRecordCountdwChildCountrecordsr`  )r  re  r]  dns_recs   &&  r$   print_dnsrecordsrg    s`    {{

9OO''$$$$=& & 	' {{G / # r-   c                 l     \        W4      pV#   \         d   p\        TP                  !  R hR p?ii ; ir)   )r   r   r   r4   )record_typerB  r]  r#   s   &&  r$   data_to_dns_recordrj    s;    . 3 J  .AFF#-.s    3.3c            	          a  ] tR tRt o RtRtR.tR]P                  R]P                  R]P                  /t]! RR	R
R. RORR7      .tRR ltRtV tR# )cmd_serverinfoi  zQuery for Server information.%prog <server> [options]r   	sambaoptsversionoptscredopts--client-versionClient Versionlonghornw2k|dotnet|longhorncli_verhelpdefaultmetavarchoicesdestNc                    VP                  4       V n        VP                  V P                  4      V n        \	        WP                  V P                  4      p\        V4      pVP                  V^ VRR4      w  r\        V P                  W4       R# )r   N
ServerInfo)	get_loadparmr   get_credentialsr    r'   r   r;   r  r  )
r*   r   ru  rn  rp  ro  r"   r   r  ress
   &&&&&&    r$   runcmd_serverinfo.run  sr    ((*--dgg6
!&''4::>+G4++NAv,0,@F0r-   r    r   w2kdotnetrs  NNNrC   rD   rE   rF   rG   synopsis
takes_argsoptionsSambaOptionsVersionOptionsCredentialsOptionstakes_optiongroupsr   takes_optionsr  rM   rN   rO   s   @r$   rl  rl    sl     ')HJ 	W))w--G.. 	!(8!+@49	FM
1 
1r-   rl  c           
         V  FY  w  r4rVRVP                  4       ,           p\        VV RV RV R2RVR7      pVP                  V4       VP                  W5Wg34       K[  	  R# )z$Generate options for cmd_zoneoptionsz--r2   -r3   int)rw  typer{  N)r   r   r   )	tabler  integer_propertieskdoc_min_maxoopts	   &&&      r$   _add_integer_optionsr    sl    #1779a!U"TF!D63  	S!!!1D"45 $r-   c                   .  a  ] tR tRt o RtRtRR.tR]P                  R]P                  R]P                  /t]! R	R
RR. R$ORR7      ]! RRRR7      ]! RRRR7      ]! RRRR7      ]! RRRRR7      .t. t]! . R%O]]4       R&R ltR tR  tR! tR" tR#tV tR# )'cmd_zoneoptionsi  zChange zone aging options.%prog <server> <zone> [options]r   r6  rn  ro  rp  rq  rr  rs  rt  ru  rv  z--mark-old-records-staticz
YYYY-MM-DDz0Make records older than this (YYYY-MM-DD) static)ry  rw  z--mark-records-static-regexREGEXPz4Make records matching this regular expression staticz--mark-records-dynamic-regexz5Make records matching this regular expression dynamicz-nz	--dry-run
store_truez,Don't change anything, say what would happen)actionrw  Nc                   VP                  4       V n        VP                  V P                  4      V n        \	        WP                  V P                  4      p\        V4      p\        P                  pV P                   F  w  ppppVP                  V4      f   K  W,          pVe   VV8  d   \        V RV 24      hVe   VV8  d   \        V RV 24      h\        P                  ! 4       pVVn        VVn        V'       d#   \        RV RV RV 2V P                  R7       K   VP!                  V^ VV^ RVV4       \        R	T RT 2T P                  R7       K  	  ^ pVV	V
3 F  pVf   K	  V^,          pK  	  V^8  d   \        R
4      hVe   V P%                  WVV4       V	e   V P'                  VVV	V4       V
e   V P)                  VVV
V4       R # R #   \"         d   p\        RT RT 24      R hR p?ii ; i)Nz must be at least z can't exceed z
would set z to z for fileResetDwordPropertyzCould not set zSet z(Multiple --mark-* options will not work
)r~  r   r  r    r'   r   r   DNSSRV_TYPEID_NAME_AND_PARAMr  getr   DNS_RPC_NAME_AND_PARAMdwParampszNodeNameprintr  r<   r   mark_old_records_staticmark_records_static_regexmark_records_dynamic_regex)r*   r   r6  ru  rn  rp  ro  dry_runr  r  r  kwargsr"   r   nap_typer  r  r  r  v
name_paramr#   n_mark_optionsr   s   &&&&&&&&&&&,            r$   r  cmd_zoneoptions.run5  s+    ((*--dgg6
!&''4::>+G499 $ 7 7AtT1zz!}$	AAH"aS(:4&#ABBAH"aStf#=>>"99;J!"J%&J"
1#T!E$8tyyI
J)).*+*0*.*+*>*2*46 D4s#$))47 !8@ )+,.A }!#	. AJKK".(()@)02 %0**6+/+D+24
 &1++F,0,F,35 2;  J"^A3d1##>?TIJs   &GG;$G66G;c                    \        R V,          \        4       V P                  V P                  R7      pRV RVP	                  4        2pVP                  V\        P                  RRR.R7      pW53# )	ldap://%surlsession_infocredentialsr   zDC=z#,CN=MicrosoftDNS,DC=DomainDNSZones,z/(&(objectClass=dnsNode)(!(dNSTombstoned=TRUE)))	dnsRecordr@   )basescope
expressionattrs)r   r   r    r   get_default_basednsearchldbSCOPE_SUBTREE)r*   r   	zone_namesamdbzone_dnnodess   &&&   r$   _get_dns_nodescmd_zoneoptions._get_dns_nodes~  s    +.#1#3"&**: #F..013 '#&#4#4*D$/#8	  :
 |r-   c                    \         P                  ! VR 4      p\         P                  ! V4      p\
        P                  ! \        T4      4      pT P                  Y4      w  rT
 EFk  pRT9  d   K  \        TR,          4      p^ p\        T4       Fb  w  r\        \        P                  T4      pTP                  T8  g   K2  TP                  ^ 8w  g   KE  ^ Tn        \        T4      Y&   T^,          pKd  	  T^ 8X  d   K  TR,          ^ ,          P!                  4       pT'       d0   \#        RT R\%        T4       RT R	T R	2	T P&                  R
7       K  \(        P*                  P-                  T	RTP.                  RT/\(        P0                  4      pT	P3                  T4       \#        RT R\%        T4       RT R	T R	2	T P&                  R
7       EKn  	  R#   \         d   p\	        RT R24      hRp?ii ; i)z%Y-%m-%dzInvalid date z: should be YYY-MM-DDNr  r@   would make / records static on .r  dnmade )timestrptimemktime
ValueErrorr   r   unix_to_dns_timestampr  r  list	enumerater
   r   DnssrvRpcRecorddwTimeStampr   decoder  lenr  r  Message	from_dictr  FLAG_MOD_REPLACEmodify)r*   r   r  date_stringr  tstr#   	thresholdr  r  nodevalueschangesr   r  r]  r@   msgs   &&&&&              r$   r  'cmd_zoneoptions.mark_old_records_static  s   	S{J7BBA 223q6:	**6=D$&${+,FG!&) !5!5q9??Y.3??a3G&'CO (FIqLG * !|<?))+DG9Ac&k] ; 69+Q06:iiA++'')-tww)4f)* ),(<(<	>C
 LLE'!CK=0CF!I;a)/3yy: :;   	S{m;PQRR	Ss   -G G4 G//G4c                n   \         P                  ! V4      pV P                  W4      w  rgV EF  pVR,          ^ ,          P                  4       p	VP	                  V	4      '       g   K;  RV9  d   KD  \        VR,          4      p
\        V
4      ^ 8X  d   Kh  ^ p\        V
4       FO  w  r\        \        P                  V4      pVP                  ^ 8w  g   K2  ^ Vn        \        V4      W&   V^,          pKQ  	  V^ 8X  d   K  V'       d1   \        RV R\        V
4       RV	 RV R2	V P                  R7       EK	  \        P                   P#                  VRVP$                  RV
/\        P&                  4      pVP)                  V4       \        R	V R\        V
4       RV	 RV R2	V P                  R7       EK  	  R
# )z>Make the records of nodes with matching names static.
        r@   r  r  r  r  r  r  r  r  N)recompiler  r  r  r  r  r  r
   r   r  r  r   r  r  r  r  r  r  r  r  )r*   r   r  regexr  rr  r  r  r@   r  r  r   r  r]  r  s   &&&&&           r$   r  )cmd_zoneoptions.mark_records_static_regex  s    JJu**6=D<?))+D88D>>$&${+,F6{aG!&) !5!5q9??a'&'CO (FIqLG * !|G9Ac&k] ; 69+Q06:iiA++'')-tww)4f)* ),(<(<	>C
 LLE'!CK=0CF!I;a)/3yy: :C r-   c                \   \         P                  ! V4      pV P                  W4      w  rg\        P                  ! 4       p\        P
                  ! \        V4      4      p	\        P                  \        P                  \        P                  0p
V EF  pVR,          ^ ,          P                  4       pVP                  V4      '       g   K;  RV9  d   KD  \        VR,          4      p\        V4      ^ 8X  d   Kh  ^ p\        V4       Fc  w  pp\!        \        P"                  V4      pVP$                  V
9   g   K3  VP&                  ^ 8X  g   KF  V	Vn        \)        V4      W&   V^,          pKe  	  V^ 8X  d   K  V'       d1   \+        RV R\        V4       RV RV R2	V P,                  R7       EK  \.        P0                  P3                  VRVP4                  RV/\.        P6                  4      pVP9                  V4       \+        R	V R\        V4       RV RV R2	V P,                  R7       EK  	  R
# )zMake the records of nodes with matching names dynamic, with a
current timestamp. In this case we only adjust the A, AAAA,
and TXT records.
r@   r  r  r  z records dynamic on r  r  r  r  N)r  r  r  r  r   r  r  r   rA  rC  rX  r  r  r  r  r  r
   r  r@  r  r   r  r  r  r  r  r  r  r  )r*   r   r  r  r  r  r  r  nowdns_timestampsafe_wtypesr  r@   r  r  r   r  r]  r  s   &&&&&              r$   r  *cmd_zoneoptions.mark_records_dynamic_regex  s   
 JJu**6=iik 66s3x@OO
 D<?))+D88D>>$&${+,F6{aG!&)1 !5!5q999+10D&3CO (FIqLG * !|G9Ac&k] ; 69+Q06:iiA++'')-tww)4f)* ),(<(<	>C
 LLE'!CK=0DF!I;a)/3yy: :C r-   r  r  ))AgingzEnable record agingr      )NoRefreshIntervalz3Aging no refresh interval in hours (0: use default)r   0V )RefreshIntervalz0Aging refresh interval in hours (0: use default)r   r  )NNNFNNN)rC   rD   rE   rF   rG   r  r  r  r  r  r  r  r   r  r  r  r  r  r  r  r  rM   rN   rO   s   @r$   r  r    s     $0HF#J 	W))w--G.. 	!(8!+@49	F 	*LF	H,hJ	L-xK	Mt[B	DM   	 '+-F5R(:T(:T1: 1:r-   r  c            	          a  ] tR tRt o RtRtRR.tR]P                  R]P                  R]P                  /t]! R	R
RR. RORR7      .tRR ltRtV tR# )cmd_zoneinfoi  zQuery for zone information.r  r   r6  rn  ro  rp  rq  rr  rs  rt  ru  rv  Nc                   VP                  4       V n        VP                  V P                  4      V n        \	        WP                  V P                  4      p\        V4      pVP                  V^ WR4      w  r\        V P                  W4       R# )r   ZoneInfoN)	r~  r   r  r    r'   r   r;   r0  r  )r*   r   r6  ru  rn  rp  ro  r"   r   r  r  s   &&&&&&&    r$   r  cmd_zoneinfo.run(  so    ((*--dgg6
!&''4::>+G4++NAv,68tyy&.r-   r  r  r  r  rO   s   @r$   r  r    so     %0HF#J 	W))w--G.. 	!(8!+@49	FM
/ 
/r-   r  c                   V  a  ] tR tRt o RtRtR.tR]P                  R]P                  R]P                  /t]! RR	R
R. R+ORR7      ]! RRRRR7      ]! RRRRR7      ]! RRRRR7      ]! RRRRR7      ]! RRRRR7      ]! RR RR!R7      ]! R"R#RR$R7      ]! R%R&RR'R7      .	tR,R) ltR*tV tR(# )-cmd_zonelisti5  zQuery for zones.rm  r   rn  ro  rp  rq  rr  rs  rt  ru  rv  z	--primaryzList primary zones (default)r  primaryrw  r  r{  z--secondaryzList secondary zones	secondary--cachezList cached zonescachez--autoz List automatically created zonesautoz	--forwardzList forward zonesforwardz	--reversezList reverse zonesreversez--dszList directory integrated zonesdsz--non-dszList non-directory zonesnondsNc           	        ^ pV'       d   V\         P                  ,          pV'       d   V\         P                  ,          pV'       d   V\         P                  ,          pV'       d   V\         P                  ,          pV'       d   V\         P
                  ,          pV'       d   V\         P                  ,          pV	'       d   V\         P                  ,          pV
'       d   V\         P                  ,          pV^ 8X  d   \         P                  pVP                  4       V n
        VP                  V P                  4      V n        \        WP                  V P                  4      p\        V4      pVP                  V^ VRR\         P                   V4      w  ppV\         P"                  8X  d   \         P$                  pM\         P&                  p\)        V P*                  VV4       R# )r   N	EnumZones)r   DNS_ZONE_REQUEST_PRIMARYDNS_ZONE_REQUEST_SECONDARYDNS_ZONE_REQUEST_CACHEDNS_ZONE_REQUEST_AUTODNS_ZONE_REQUEST_FORWARDDNS_ZONE_REQUEST_REVERSEDNS_ZONE_REQUEST_DSDNS_ZONE_REQUEST_NON_DSr~  r   r  r    r'   r   r/   DNSSRV_TYPEID_DWORDr   r5  DNSSRV_TYPEID_ZONEr=  r  )r*   r   ru  r  r  r  r  r	  r
  r  r  rn  rp  ro  request_filterr"   r   r  r  s   &&&&&&&&&&&&&&     r$   r  cmd_zonelist.runX  s[    i@@@NiBBBNi>>>Ni===Ni@@@Ni@@@Ni;;;Ni???NQ&??N((*--dgg6
!&''4::>+G466~78&$7B7@7T7T7E	G Y===55F11F		63/r-   r  r  )FFFFFFFFNNNr  rO   s   @r$   r  r  5  s     )HJ 	W))w--G.. 	!(8!+@49	F 	{!?"	4}#9"	6y2"	2x@"	1{!5"	4{!5"	4v="	/z :"	2%M,)0 )0r-   r  c            
          a  ] tR tRt o RtRtRR.tR]P                  R]P                  R]P                  /t]! R	R
RR. RORR7      ]! RRRRRR.RR7      .tRR ltRtV tR# )cmd_zonecreatei  zCreate a zone.r  r   r6  rn  ro  rp  rq  rr  rs  rt  ru  rv  z--dns-directory-partitionzSpecify the naming context for the new zone, which affects the replication scope (domain or forest wide replication, default: domain).domainzdomain|forestforestdns_dpNc                   VP                  4       V n        VP                  V P                  4      V n        \	        WP                  V P                  4      pVP                  4       p\        P                  p	VR 8X  d   \        P                  p	\        V4      p
V
\        P                  8X  dW   \        P                  p\        P                  ! 4       pW,n        \        P                  Vn        ^ Vn        ^Vn        ^Vn        MV
\        P(                  8X  d]   \        P*                  p\        P,                  ! 4       pW,n        \        P                  Vn        ^ Vn        ^Vn        ^Vn        Wn        M[\        P0                  p\        P2                  ! 4       pW,n        \        P                  Vn        ^ Vn        ^Vn        ^Vn        Wn        VP5                  V
^ VR^ RVV4       \        P6                  p\        P8                  ! 4       pRVn        \        P<                  Vn        \@        PB                  RV R2/pVP5                  V
^ W^ RVWR7	       V PD                  PG                  RV,          4       R# )	r  N
ZoneCreateAllowUpdatezZone "z" already exists.r  r0   zZone %s created successfully
)$r~  r   r  r    r'   r   r   r   r   r   r   DNSSRV_TYPEID_ZONE_CREATE_W2KDNS_RPC_ZONE_CREATE_INFO_W2Kr  r   rv   r  r  fDsIntegratedfLoadExistingr    DNSSRV_TYPEID_ZONE_CREATE_DOTNETDNS_RPC_ZONE_CREATE_INFO_DOTNETr%  DNSSRV_TYPEID_ZONE_CREATE!DNS_RPC_ZONE_CREATE_INFO_LONGHORNr<   r  r  r  r   r  r   rI   r  r   )r*   r   r6  ru  r  rn  rp  ro  r"   dns_directorypartitionr   r  zone_create_infoname_and_paramr0   s   &&&&&&&&       r$   r  cmd_zonecreate.run  s(    ((*--dgg6
!&''4::>zz|!*!@!@X%.%D%D"+G4Y===<<F(EEG+/(*.*D*D'&'#-.*-.*yBBB??F(HHJ+/(*.*D*D'&'#-.*-.*)?&88F(JJL+/(*.*D*D'&'#-.*-.*)?&!!.!VT"#\6"2	4 77"99;%2"!%!<!< 55/0

 	!!.!V"#%96"0 	" 	E 			84?@r-   r  r  r  r  rO   s   @r$   r  r    s     0HF#J 	W))w--G.. 	!(8!+@49	F 	*5  & (+		M@A @Ar-   r  c                      a  ] tR tRt o RtRtRR.tR]P                  R]P                  R]P                  /tRR
 ltRtV tR	# )cmd_zonedeletei  zDelete a zone.r  r   r6  rn  ro  rp  Nc                   VP                  4       V n        VP                  V P                  4      V n        \	        WP                  V P                  4      pVP                  4       p\        P                  R V R2/pVP                  \        P                  ^ W^ R\        P                  RVR7	      pV P                  P                  RV,          4       R# )Zone z, does not exist and so could not be deleted.DeleteZoneFromDsNr#  zZone %s deleted successfully
)r~  r   r  r    r'   r   r   "WERR_DNS_ERROR_ZONE_DOES_NOT_EXISTr<   r   r   DNSSRV_TYPEID_NULLr  r   )	r*   r   r6  rn  rp  ro  r"   r0   r  s	   &&&&&&   r$   r  cmd_zonedelete.run  s     ((*--dgg6
!&''4::>zz| 55vIJ
 ''	(M(M()6<N(1(D(D(,x ( A
 			84?@r-   r  r  rC   rD   rE   rF   rG   r  r  r  r  r  r  r  r  rM   rN   rO   s   @r$   r1  r1    sN     0HF#J 	W))w--G..A Ar-   r1  c                   $  a  ] tR tRt o RtRt. R!OtR]P                  R]P                  R]P                  /t]! RRR	R
R7      ]! RRR	RR7      ]! RRR	RR7      ]! RRR	RR7      ]! RRR	RR7      ]! RRR	RR7      ]! RRR	RR7      .tR"R ltR tV tR# )#	cmd_queryi  zQuery a name.zO%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|MX|NS|SOA|SRV|TXT|ALL> [options]rn  ro  rp  z--authorityz&Search authoritative records (default)r  	authorityr  r  zSearch cached recordsr  z--gluezSearch glue recordsgluez--rootzSearch root hintsrootz--additionalzList additional records
additionalz--no-childrenzDo not list childrenno_childrenz--only-childrenzList only childrenonly_childrenNc                   \        V4      pVP                  R 4      R8w  d#   V P                  P                  RV,          4       ^ pV'       d   V\        P
                  ,          pV'       d   V\        P                  ,          pV'       d   V\        P                  ,          pV'       d   V\        P                  ,          pV	'       d   V\        P                  ,          pV
'       d   V\        P                  ,          pV'       d   V\        P                  ,          pV^ 8X  d   \        P
                  pV\        P                  8X  dN   V P                  P                  R4       V P                  P                  R4       V\        P
                  ,          pVP                  4       V n        VP                  V P                  4      V n        \!        WP                  V P                  4      p\"        P$                  R/pVP'                  \        P(                  ^ WVRVVRRVR7      w  pp\+        V P                  V4       R# )*z-use "@" to dump entire domain, looking up %s
z>Specify either --authority or --root along with --additional.
zAssuming --authority.
Record or zone does not exist.Nr#  )r   findr  r   r   DNS_RPC_VIEW_AUTHORITY_DATADNS_RPC_VIEW_CACHE_DATADNS_RPC_VIEW_GLUE_DATADNS_RPC_VIEW_ROOT_HINT_DATADNS_RPC_VIEW_ADDITIONAL_DATADNS_RPC_VIEW_NO_CHILDRENDNS_RPC_VIEW_ONLY_CHILDRENr~  r   r  r    r'   r   rK   r=   r   rg  )r*   r   r6  r@   rtyper;  r  r<  r=  r>  r?  r@  rn  rp  ro  ri  select_flagsr"   r0   buflenr  s   &&&&&&&&&&&&&&&      r$   r  cmd_query.run#  s    $E*99S>RIIOOL ! " IAAALI===LI<<<LIAAALIBBBLI>>>LI@@@L1$@@L9AAAIIOO]^IIOO56IAAAL((*--dgg6
!&''4::> 550
 11111fD+|T4 2 
 	C(r-   r  )r   r6  r@   rM  )
FFFFFFFNNNr  rO   s   @r$   r:  r:    s     EH 5J 	W))w--G.. 	}#K"	6y6"	2x3"	1x1"	1~$="	7%;"	8 ';"	:M"/) /)r-   r:  c                      a  ] tR tRt o RtRtRR.tR]P                  R]P                  R]P                  /tRR
 ltRtV tR	# )cmd_roothintsiU  zQuery root hints.z!%prog <server> [<name>] [options]r   zname?rn  ro  rp  Nc                   \         P                  p\        P                  \        P                  ,          pVP                  4       V n        VP                  V P                  4      V n        \        WP                  V P                  4      pVP                  \        P                  ^ VRVRWgRR4
      w  r\        V P                  V
4       R# )r   z..RootHintsN)r   rF  r   rI  rJ  r~  r   r  r    r'   r=   r   rg  r  )r*   r   r@   rn  rp  ro  ri  rN  r"   rO  r  s   &&&&&&     r$   r  cmd_roothints.runb  s    &&!==!>>? ((*--dgg6
!&''4::>11111fm$4? 	C(r-   r  )r  NNNr8  rO   s   @r$   rR  rR  U  sL     2HG$J 	W))w--G..) )r-   rR  c                      a  ] tR tRt o RtRt. ROtR]P                  R]P                  R]P                  /t]! RRR	R
7      .tRR ltRtV tR# )cmd_add_recordir  a(  Add a DNS record

For each type data contents are as follows:
  A      ipv4_address_string
  AAAA   ipv6_address_string
  PTR    fqdn_string
  CNAME  fqdn_string
  NS     fqdn_string
  MX     "fqdn_string preference"
  SRV    "fqdn_string port priority weight"
  TXT    "'string1' 'string2' ..."
D%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SRV|TXT> <data>rn  ro  rp  z--allow-existingz!no error if record already existsr  rw  r  Nc
                   VP                  4       R
9  d   \        RV,          4      h\        V4      p
\        W4      pVP	                  4       V n        VP                  V P
                  4      V n        \        WP
                  V P                  4      p\        P                  ! 4       pWn        \        P                  RV RV 2\        P                  RV RV R2/p VP                  \        P                   ^ WW=RVR7       T P&                  P)                  R	4       R#   \         d`   pTP"                  P$                  ^ ,          \        P                  8X  d*   T'       d"   T P&                  P)                  R4        Rp?R# h Rp?ii ; i)Az)Adding record of type %s is not supportedz5Zone does not exist; record could not be added. zone[] name[z7Record already exists; record could not be added. zone[r3   Nr#  z"Record already exists, not adding
zRecord added successfully
rZ  AAAAPTRCNAMENSMXSRVTXT)r   r   r   rj  r~  r   r  r    r'   r   DNS_RPC_RECORD_BUFr]  r   rK   $WERR_DNS_ERROR_RECORD_ALREADY_EXISTSr>   r   inner_exceptionr4   r  r   )r*   r   r6  r@   rM  rB  allow_existingrn  rp  ro  ri  r]  r"   add_rec_bufr0   r#   s   &&&&&&&&&&      r$   r  cmd_add_record.run  sV    ;;= WWJURSS#E* 3((*--dgg6
!&''4::>224 55vWTF,77vWTF!-
		(()N)N)*F$T2: ) < 			56  	  %%a(F,W,WW!IIOO$IJ	s$   %D   F
+7F#FFF
r  r   r6  r@   rM  rB  )FNNNr  rO   s   @r$   rV  rV  r  sf      VH<J 	W))w--G.. 	!(K"	$M
#7 #7r-   rV  c                      a  ] tR tRt o RtRt. R
OtR]P                  R]P                  R]P                  /tRR ltR	tV tR# )cmd_update_recordi  aq  Update a DNS record

For each type data contents are as follows:
  A      ipv4_address_string
  AAAA   ipv6_address_string
  PTR    fqdn_string
  CNAME  fqdn_string
  NS     fqdn_string
  MX     "fqdn_string preference"
  SOA    "fqdn_dns fqdn_email serial refresh retry expire minimumttl"
  SRV    "fqdn_string port priority weight"
  TXT    "'string1' 'string2' ..."
zU%prog <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SOA|SRV|TXT> <olddata> <newdata>rn  ro  rp  Nc
                $   VP                  4       pVR9  d   \        RV,          4      h VR 8X  d   \        \        V4       MVR8X  d   \        \        V4       \        V4      p\        W4      pVP                  4       V n	        VP                  V P                  4      V n        \        WP                  V P                  4      p \        VP                  WW;V4      pT'       g   \        R4      hTP"                  Tn        TP$                  Tn        TP&                  Tn        TP(                  Tn        \*        P,                  ! 4       pYn        \*        P,                  ! 4       pTTn        \0        P2                  RT R2/pTP5                  \*        P6                  ^ TTTTTTR	7       T P8                  P;                  R
4       R#   \
         d   p
\        RT RT
: 24      hRp
?
ii ; i  \         d   p
\        T
P                   !  RhRp
?
ii ; i)rZ  r]  z+Updating record of type %s is not supportedzbad data for z: NrC  r3  z- does not exist; record could not be updated.r#  zRecord updated successfully
)	rZ  r]  r^  r_  r`  ra  SOArb  rc  )r   r   r   r   r	   OSErrorr   rj  r~  r   r  r    r'   r   r"   r   r4   rZ  r[  r\  r  r   rd  r]  r   rK   r>   r   r  r   )r*   r   r6  r@   rM  olddatanewdatarn  rp  ro  r#   ri  r]  r"   	rec_matchrh  del_rec_bufr0   s   &&&&&&&&&&        r$   r  cmd_update_record.run  s    VVLuTUU	?|'7+&(G, $E* 6((*--dgg6
!&''4::>	2():):F)-GEI
 ?@@  '' ))$11#//224224# 55vJK

 	$$Y%J%J%&%+%)%)%0%0.6 	% 	8 			78[  	?ugRu=>>	?  	2'T1	2s5   G G G+ G(G##G(+H6H

Hr  )r   r6  r@   rM  rp  rq  r  r8  rO   s   @r$   rl  rl    sL      gHJJ 	W))w--G..99 99r-   rl  c                      a  ] tR tRt o RtRt. R
OtR]P                  R]P                  R]P                  /tRR ltR	tV tR# )cmd_delete_recordi
  a+  Delete a DNS record

For each type data contents are as follows:
  A      ipv4_address_string
  AAAA   ipv6_address_string
  PTR    fqdn_string
  CNAME  fqdn_string
  NS     fqdn_string
  MX     "fqdn_string preference"
  SRV    "fqdn_string port priority weight"
  TXT    "'string1' 'string2' ..."
rW  rn  ro  rp  Nc	                B   VP                  4       R	9  d   \        RV,          4      h\        V4      p	\        W4      p
VP	                  4       V n        VP                  V P
                  4      V n        \        WP
                  V P                  4      p\        P                  ! 4       pWn        \        P                  RV RV 2\        P                  RV RV R2/pVP                  \        P                   ^ VVVRVVR7       V P"                  P%                  R4       R# )
rZ  z+Deleting record of type %s is not supportedz7Zone does not exist; record could not be deleted. zone[r[  z9Record already exists; record could not be deleted. zone[r3   Nr#  zRecord deleted successfully
r\  )r   r   r   rj  r~  r   r  r    r'   r   rd  r]  r   rK   re  r>   r   r  r   )r*   r   r6  r@   rM  rB  rn  rp  ro  ri  r]  r"   rs  r0   s   &&&&&&&&&     r$   r  cmd_delete_record.run"  s   ;;= WWLuTUU#E* 3((*--dgg6
!&''4::>224 55vWTF,77vWTF!-
 	$$Y%J%J%&%+%)%)%)%0.6 	% 	8 			78r-   r  rj  r  r8  rO   s   @r$   rv  rv  
  sL      VH<J 	W))w--G.. 9  9r-   rv  c                      a  ] tR tRt o RtRtRR.tR]P                  R]P                  R]P                  /t]! R	R
RRR7      ]! RRRRR7      .tRR ltRtV tR# )cmd_cleanup_recordiE  aD  Cleanup DNS records for a DNS host.

example:

    samba-tool dns cleanup dc1 dc1.samdom.test.site -U USER%PASSWORD

NOTE: This command in many cases will only mark the `dNSTombstoned` attr
as `TRUE` on the DNS records. Querying will no longer return results but
there may still be some placeholder entries in the database.
z%prog <server> <dnshostname>r   dnshostnamern  ro  rp  z-vz	--verbosez
Be verboser  rX  z-qz--quietzBe quietNc                    VP                  4       pVP                  V4      p	V P                  WgR 7      p
\        RV,          \	        4       WR7      p\
        P                  ! WVRR7       R# ))verbosequietr  r  T)ignore_no_nameN)r~  r  
get_loggerr   r   r   remove_dns_references)r*   r   r{  rn  rp  ro  r}  r~  r   r    loggerr  s   &&&&&&&&    r$   r  cmd_cleanup_record.run`  sa    ##%((,>+.#1#3"'0 	''{7;	=r-   rU   )NNNFFr  rO   s   @r$   rz  rz  E  su     	 .HM*J 	W))w--G.. 	t[|LItYZEM
= =r-   rz  c                      ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   ]	! 4       ]R&   ]
! 4       ]R&   ]! 4       ]R&   ]! 4       ]R	&   ]! 4       ]R
&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   RtR# )cmd_dnsio  z%Domain Name Service (DNS) management.r  zoneoptionsr/  zonelist
zonecreate
zonedeletequery	roothintsaddupdatedeletecleanuprU   N)rC   rD   rE   rF   rG   subcommandsrl  r  r  r  r  r1  r:  rR  rV  rl  rv  rz  rM   rU   r-   r$   r  r  o  s    /K . 0K!0!2K*nK
*nK
 . 0K . 0K$;K,K')K-/K-/K/1K	r-   r  )Lsamba.getoptgetoptr  sambar   r   r   r   socketr   r   r   r	   r  r  	samba.ndrr
   r   r  r   r   samba.samdbr   
samba.authr   samba.netcmdr   r   r   r   samba.dcerpcr   r   samba.dnsserverr   r   r   r   r%   r'   rX   r^   rd   rl   rs   r}   r   r   r   r   r   r   r   r   r   r  r0  r7  r=  r`  rg  rj  rl  r  r  r  r  r  r1  r:  rR  rV  rl  rv  rz  r  rU   r-   r$   <module>r     s  $     '     
 * 	 %  %  ) O O ,	H HV:9357;;8"$
EaP>VBL'DD01W 1@	6M:g M:`/7 /@L07 L0^[AW [A|AW ADN) N)b)G ):@7W @7FR9 R9j89 89v'= '=T2l 2r-   