+
    cj                    	   ^ RI t ^ RIt^ RIHt ^ RIt^ RIt^ RIHu H	t
 ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHtHtHt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 t^ RIt^ R
IH!t!H"t"H#t# ^ RI$H%t% ^ RIH&t& ^ RI'H(t) ^ RIH*t* ^ RI+t+^ RI,H-t- ^ RIH.t. ^ RI/H0t0 ^ RI1H2t2H3t3H4t4 ^ RI5H6t6 ^ RI7H8t8H9t9H:t:H;t; ^ RI<H=t= ^ RI>H?t? ^ RI@HAtA ^ RIHBtB ^ RI$HCtC ^ RIDHEtEHFtF ^ RIGHHtH ^ RIIHJtJHKtK ^ RILHMtMHNtN ^ RIOtO^ RIPtP^ RIQHRtR ^ RISHTtTHUtUHVtVHWtWHXtX ^ R IYHZtZH[t[H\t\ ^ R!I]H^t^ ^ R"I_H`t` ^ R#IaHbtbHctcHdtd R$ teR% tfR& tgR' thRR( ltiRRR]P                  ]P                  ,          ]P                  ,          ]P                  ,          3R) ltnR* toR+ tpR, tq]P                  3R- ltsR. tt])P                  ])P                  ,          ])P                  ,          ])P                  ,          tyR/ tzRR0 lt{ ! R1 R2]4      t| ! R3 R4]|4      t} ! R5 R6]|4      t~ ! R7 R8]|4      t ! R9 R:]|4      t ! R; R<]|4      t ! R= R>]|4      t ! R? R@]|4      t ! RA RB]|4      t ! RC RD]|4      t ! RE RF]|4      t ! RG RH]|4      t ! RI RJ]|4      t ! RK RL]|4      t ! RM RN]|4      t ! RO RP]4      t ! RQ RR]|4      t ! RS RT]|4      t ! RU RV]4      t ! RW RX]|4      t ! RY RZ]4      t ! R[ R\]|4      t ! R] R^]4      t ! R_ R`]|4      t ! Ra Rb]4      t ! Rc Rd]4      t ! Re Rf]4      t ! Rg Rh]|4      t ! Ri Rj]4      t ! Rk Rl]4      t ! Rm Rn]|4      t ! Ro Rp]|4      t ! Rq Rr]4      t ! Rs Rt]4      t ! Ru Rv]|4      t ! Rw Rx]|4      t ! Ry Rz]4      t ! R{ R|]4      t ! R} R~]|4      t ! R R]4      t ! R R]4      t ! R R]|4      t ! R R]|4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]|4      t ! R R]4      t ! R R]4      t ! R R]|4      t ! R R]4      t ! R R]4      t ! R R]|4      t ! R R]|4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      tR# )    N)expat)system_session)CommandCommandErrorOptionSuperCommand)SamDB)dsdb)security)
ndr_unpackndr_pack)preg) AUTH_SESSION_INFO_DEFAULT_GROUPSAUTH_SESSION_INFO_AUTHENTICATED#AUTH_SESSION_INFO_SIMPLE_PRIVILEGES)netcmd_finddc)policy)libsmb_samba_internal)NTSTATUSError)dsacl2fsacl)nbt)Net)GPParserGPNoParserExceptionGPGeneralizeException)GPPolParser)GPIniParserGPTIniParserGPFDeploy1IniParserGPScriptsIniParser)GPAuditCsvParser)GptTmplInfParser)GPAasParser)param)attr_default)	get_bytes
get_string)ConfigParser)StringIOBytesIO)	calc_modestat_from_mode)str_regtype)NT_STATUS_OBJECT_NAME_INVALIDNT_STATUS_OBJECT_NAME_NOT_FOUNDNT_STATUS_OBJECT_PATH_NOT_FOUNDNT_STATUS_OBJECT_NAME_COLLISIONNT_STATUS_ACCESS_DENIED)create_directory_hiersmb_connection
get_gpo_dn)RegistryGroupPolicies)REG_MULTI_SZ)register_gp_extensionlist_gp_extensionsunregister_gp_extensionc                l    \         P                  ! V 4      pV'       g   RpV# RP                  V4      pV# )zreturn gpo flags stringNONE )r   get_gpo_flagsjoin)valueflagsrets   &  2/usr/lib/python3/dist-packages/samba/netcmd/gpo.pygpo_flags_stringrD   \   s5      'E J hhuoJ    c                l    \         P                  ! V 4      pV'       g   RpV# RP                  V4      pV# )zreturn gplink options stringr<   r=   )r   get_gplink_optionsr?   )r@   optionsrB   s   &  rC   gplink_options_stringrI   f   s6    ''.G J hhwJrE   c           
        . pV P                  4       R8X  d   V# V P                  R4      pV F  pV'       g   K  VP                  R4      p\        V4      ^8w  g   V^ ,          P                  R4      '       g   \	        RV,          4      hVP                  RV^ ,          R,          R\        V^,          4      /4       K  	  V# )	z.parse a gPLink into an array of dn and options ];z[LDAP://zBadly formed gPLink '%s'dn:   NNrH   )stripsplitlen
startswithRuntimeErrorappendint)gplinkrB   agds   &    rC   parse_gplinkr[   p   s    
C||~
SAGGCLq6Q;adooj999A=>>

D!A$r(Is1Q4y9:  JrE   c                6    RP                  R V  4       4      pV# )z4Encode an array of dn and options into gPLink stringrK   c              3   T   "   T F  pR VR,          VR,          3,          x  K   	  R# 5i)z[LDAP://%s;%d]rN   rH   N ).0rY   s   & rC   	<genexpr> encode_gplink.<locals>.<genexpr>   s&     Mf"agq|%<<<fs   &()r?   )gplistrB   s   & rC   encode_gplinkrc      s    
''MfM
MCJrE   c                ~    Vf   Vf    \        W4      pRV,           pV#   \         d   p\        RT4      hRp?ii ; i)zfIf URL is not specified, return URL for writable DC.
If dc is provided, use that to construct ldap URLNzCould not find a DC for domainldap://)r   	ExceptionrT   )lpcredsurldces   &&&& rC   dc_urlrl      sP     {:H"2- "nJ  H"#CQGGHs     <7<c                   V P                  4       pVP                  \        P                  ! V R4      4       TpRp\        P                  pVe   R\        P
                  ! V4      ,          pVe   R\        P
                  ! V4      ,          pVe   Tp\        P                  p V P                  WhV. R
ORV,          .R7      p	V	#   \         d!   p
Te   RT,          pMR	p\        Y4      hRp
?
ii ; i)z0Get GPO information using gpo, displayname or dnzCN=Policies,CN=Systemz"(objectClass=groupPolicyContainer)Nz.(&(objectClass=groupPolicyContainer)(name=%s))z5(&(objectClass=groupPolicyContainer)(displayname=%s))sd_flags:1:%d)basescope
expressionattrscontrolsz!Cannot get information for GPO %szCannot get information for GPOs)nTSecurityDescriptorversionNumberrA   namedisplayNamegPCFileSysPathgPCMachineExtensionNamesgPCUserExtensionNames)
get_default_basedn	add_childldbDnSCOPE_ONELEVELbinary_encode
SCOPE_BASEsearchrf   r   )samdbgpodisplaynamerN   sd_flagspolicies_dnbase_dnsearch_exprsearch_scopemsgrk   mesgs   &&&&&       rC   get_gpo_infor      s     **,K#&&(?@AG6K%%L
FIZIZ[^I__MPSPaPabmPnn	~~~$ll&1"; &5x%?$@  
B$ J  $?6<D4D4##$s   $C C0C++C0c                    RV,          p V P                  VR.R7      pV#   \         d   p\        RT,          T4      hRp?ii ; i)z lists dn of containers for a GPOz(&(objectClass=*)(gPLink=*%s*))gPLink)rq   rr   z'Could not find container(s) with GPO %sN)r   rf   r   )r   r   r   r   rk   s   &&   rC   get_gpo_containersr      sV     4c9KOllk(lD J  ODsJANNOs   ! A?Ac                    V P                  V\        P                  RR.R7      ^ ,          pRp\        \        Y4      4      pRT9   dl   \        \        TR,          ^ ,          4      4      pT FB  pTR,          P                  4       TP                  4       8X  g   K/  TP                  T4       Rp M	  M\	        R	4      hT'       g   \	        R
T,          4      h\        P                  ! 4       p	Yn        T'       d6   \        T4      p
\        P                  ! T
\        P                  R4      T	R&   M7\        P                  ! TR,          ^ ,          \        P                  R4      T	R&    T P!                  T	4       R#   \         d   p\	        RT,          T4      hRp?ii ; i  \         d   p\	        RT4      hRp?ii ; i)z!delete GPO link for the container(objectClass=*)r   ro   rp   rq   rr   Container '%s' does not existNFrN   Tz"No GPO(s) linked to this containerz%GPO '%s' not linked to this containerr0d0z!Error removing GPO from container)r   r}   r   rf   r   strr5   r[   lowerremoveMessagerN   rc   MessageElementFLAG_MOD_REPLACEFLAG_MOD_DELETEmodify)r   container_dnr   r   rk   foundgpo_dnrb   rY   m
gplink_strs   &&&        rC   del_gpo_linkr      s{   NllCNN&7"*  --.0 EE'(F3c#h-"234Aw}}&,,.0a 	  ?@@BSHIIAD"6*
$$Z1E1ExP$$$S]1%5s7J7JHU$CQ5  N:\I1MMN6  C>BBCs/   +E= *F# =F FF #F?.F::F?c                   . pV P                  R4      '       d   V R,          P                  R^4      pM0V P                  R4      '       d   V R,          P                  R^4      p\        V4      ^8w  d   \        RV ,          4      hV# )z;Parse UNC string into a hostname, a service, and a filepath\\:   NN\z///zInvalid UNC string: %s)rS   rQ   rR   
ValueError)unctmps   & rC   	parse_uncr      sn    
C
~~f"gmmD!$			"gmmC#
3x1}1C788JrE   c                 6   \         P                  ! R WR7      '       d   \        4       # \         P                  ! RWR7      '       d   \        4       # \         P                  ! RWR7      '       d   \	        4       # \         P                  ! RWR7      '       d   \        4       # \         P                  ! RWR7      '       d   \        4       # \         P                  ! RWR7      '       d   \        4       # \         P                  ! RWR7      '       d   \        4       # \         P                  ! RWR7      '       d   \        4       # \         P                  ! R	WR7      '       d   \        4       # \         P                  ! R
WR7      '       d   \        4       # \        4       # )zfdeploy1\.ini$)rA   zaudit\.csv$zGptTmpl\.inf$z	GPT\.INI$zscripts\.ini$zpsscripts\.ini$z	GPE\.INI$z.*\.ini$z.*\.pol$z.*\.aas$)rematchr   r!   r"   r   r    r   r   r   r#   )rv   rA   s   &&rC   find_parserr     s   	xx!455"$$	xx22!!	xx $44!!	xxd00~	xx $44!##	xx"D66!##	xxd00
 z	xxT//}	xxT//}	xxT//}:rE   c                    R p\         P                  P                  V4      '       g   \         P                  ! V4       V.pV.pV'       Edt   VP	                  4       pVP	                  4       pV P                  V\        R7      pVP                  R R7       V EF  p	VR,           V	R,          ,           p
\         P                  P                  WyR,          4      pV	R,          \        P                  ,          '       d;   VP                  V
4       VP                  V4       \         P                  ! V4       K  V P                  V
4      p\        W,           R4      ;_uu_ 4       pVP                  V4       RRR4       \        V	R,          4      pVP!                  V4       VP#                  VR	,           4       EK"  	  EK|  R#   + '       g   i     LU; i)
.SAMBABACKUPattribsc                     V R ,          # rv   r^   xs   &rC   <lambda>2backup_directory_remote_to_local.<locals>.<lambda>,      AfIrE   keyr   rv   attribwbN.xml)ospathisdirmkdirpoplist
attr_flagssortr?   libsmbFILE_ATTRIBUTE_DIRECTORYrU   loadfileopenwriter   parse	write_xml)conn	remotedirlocaldirSUFFIXr_dirsl_dirsr_dirl_dirdirlistrk   r_namel_namedatafparsers   &&&            rC    backup_directory_remote_to_localr   !  sF   F77==""
]F\F
&



))E:)6-.AT\AfI-FWW\\%63F{V<<<<f%f% }}V,&/400AGGDM 1 %QvY/T"  &1    10s   #GGc                 "   \         P                  P                  V4      '       g   \         P                  ! V4       V.pV.pV'       Ed1   VP	                  4       pVP	                  4       pV P                  V\        R 7      pVP                  R R7       V F  pVR,           VR,          ,           p	\         P                  P                  WhR,          4      p
VR,          \        P                  ,          '       d;   VP                  V	4       VP                  V
4       \         P                  ! V
4       K  V P                  V	4      p\        V
R4      ;_uu_ 4       pVP                  V4       RRR4       K  	  EK9  R#   + '       g   i     K  ; i)r   c                     V R ,          # r   r^   r   s   &rC   r   0copy_directory_remote_to_local.<locals>.<lambda>O  r   rE   r   r   rv   r   r   N)r   r   r   r   r   r   r   r   r?   r   r   rU   r   r   r   )r   r   r   r   r   r   r   r   rk   r   r   r   r   s   &&&          rC   copy_directory_remote_to_localr   E  s   77==""
[FZF
&



))E:)6-.AT\AfI-FWW\\%63F{V<<<<f%f% }}V,&$''1GGDM ('    (''s   E==Fc                 `   V P                  V4      '       g   V P                  V4       V.pV.pV'       Ed5   VP                  4       pVP                  4       p\        P                  ! V4      p	V	P                  4        V	 F  p
\        P                  P                  Wz4      pVR ,           V
,           p\        P                  P                  V4      '       d7   VP                  V4       VP                  V4        V P                  V4       K  V'       d    V P                  V4       K  \        VR4      ;_uu_ 4       pV P                  WP                  4       4       RRR4       K  	  EK=  R#   \         d    T'       g   h  EK  i ; i  \         d     Lni ; i  + '       g   i     EK-  ; i)r   rbN)chkpathr   r   r   listdirr   r   r?   r   rU   r   r   r   savefileread)r   r   r   ignore_existing_dirkeep_existing_filesr   r   r   r   r   rk   r   r   r   s   &&&&&         rC   copy_directory_local_to_remoter   ^  sI    <<	""

9ZF[F
&



**U#AWW\\%+FT\A%Fww}}V$$f%f%JJv&
 'f-  &$''1MM&&&(3 (')   % . / )  (''s6   :E.F
= F.FFF
FFF-c                   ,   a  ] tR tRt o R tR tRtV tR# )
GPOCommandi  c                   Vf4   \         P                  ! 4       p\        RV,          V P                  R7       \        P
                  P                  V4      '       g   \        RV,          4      h\        P
                  P                  VR4      p\        P
                  P                  V4      '       g   \        P                  ! V4       \        P
                  P                  W24      p\        P
                  P                  V4      '       d   \        RV,          4      h \        P                  ! V4       W3#   \        \        3 d   p\        RT4      hRp?ii ; i)a  Ensure that the temporary directory structure used in fetch,
backup, create, and restore is consistent.

If --tmpdir is used the named directory must be present, which may
contain a 'policy' subdirectory, but 'policy' must not itself have
a subdirectory with the gpo name. The policy and gpo directories
will be created.

If --tmpdir is not used, a temporary directory is securely created.
Nz5Using temporary directory %s (use --tmpdir to change))filez'Temporary directory '%s' does not existr   z8GPO directory '%s' already exists, refusing to overwritez%Error creating teporary GPO directory)tempfilemkdtempprintoutfr   r   r   r   r?   r   IOErrorOSError)selftmpdirr   r   gpodirrk   s   &&&   rC   construct_tmpdirGPOCommand.construct_tmpdir  s    >%%'FIFRyy" ww}}V$$H6QRR77<<1ww}}X&&HHXh,77==  JVSU U	KHHV ~ ! 	KFJJ	Ks   !D: :EEEc                     \        V P                  \        4       V P                  V P                  R7      V n        R#   \         d#   p\        RT P                  ,          T4      hRp?ii ; i)z$make a ldap connection to the serverri   session_infocredentialsrg   zLDAP connection to %s failed N)r	   ri   r   rh   rg   r   rf   r   )r   rk   s   & rC   samdb_connectGPOCommand.samdb_connect  sY    	N488,:,<+/::$''CDJ  	N>I1MM	Ns   :> A+	A&&A+)r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes____classdictcell____classdict__s   @rC   r   r     s     !FN NrE   r   c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tRR ltRtV tR# )cmd_listalli  zList all GPOs.%prog [options]	sambaoptsversionoptscredopts-H--URL%LDB URL for database or target serverURLHhelptypemetavardestNc                   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V P                  4        \        V P                  R4      pV EFG  pV P                  P                  RVR,          ^ ,          ,          4       V P                  P                  RVR,          ^ ,          ,          4       V P                  P                  RVR,          ^ ,          ,          4       V P                  P                  R	VP                  ,          4       V P                  P                  R
\        VRR4      ,          4       V P                  P                  R\        \        \        VR^ 4      4      4      ,          4       V P                  P                  R4       EKJ  	  R# )Tfallback_machineNGPO          : %s
rv   display name : %s
rw   path         : %s
rx   dn           : %s
version      : %s
ru   0flags        : %s
rA   
)get_loadparmrg   get_credentialsrh   rl   ri   r   r   r   r   r   rN   r%   rD   rV   )r   r  r  r  r  r   r   s   &&&&&  rC   runcmd_listall.run  sA   ((*--dgg-M
$''4::q14::t,AIIOO1AfIaL@AIIOO1Am4DQ4GGHIIOO1A6F4G4JJKIIOO1ADD89IIOO1LOUX4YYZIIOO14DSVWY`bcIdEe4ffgIIOOD! rE   rh   rg   ri   NNNNr  r  r  r  __doc__synopsisrH   SambaOptionsVersionOptionsCredentialsOptionstakes_optiongroupsr   r   takes_optionsr'  r  r  r  s   @rC   r  r    sb      H 	W))w--G.. 	tW#JQT3	(M
" "rE   r  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R7      .tRR ltRtV tR# )cmd_listi  zList GPOs for an account.z&%prog <username|machinename> [options]accountnamer  r  r  r  r  r  r  r  r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V P                  4         V P                  P                  R\        P                  ! V4      : R\        P                  ! V4      : R2R7      pV^ ,          P                  p T P                  P                  T\        P                  R.R7      ^ ,          pR	TR,          9   p\        \         ,          p	T P
                  e/   T P
                  P#                  R4      '       d   T	\$        ,          p	\&        P(                  P+                  T P                  T P                  TT	R7      p
T
P,                  p. pR p\        P.                  ! T P                  \1        T4      4      P3                  4       p T P                  P                  T\        P                  RR.R7      ^ ,          pRT9   Ed0   \5        \1        TR,          ^ ,          4      4      pT EF  pT'       g'   TR,          \6        P8                  ,          '       g   K2  TR,          \6        P:                  ,          '       d   KX   \<        P>                  \<        P@                  ,          \<        PB                  ,          pT P                  P                  TR,          \        P                  . R ORT,          .R7      pT^ ,          R,          ^ ,          p\E        \<        PF                  T4      p \&        P<                  PM                  TT\<        PN                  \<        PP                  ,          \<        PR                  ,          4       \W        \Y        T^ ,          R^ 4      4      pT'       d!   T\6        PZ                  ,          '       d   EK  T'       g!   T\6        P\                  ,          '       d   EK  TP_                  T^ ,          R,          ^ ,          T^ ,          R,          ^ ,          34       EK	  	  \W        \Y        TR^ 4      4      pT\6        P`                  ,          '       d   RpYP                  Pc                  4       8X  d   MTP3                  4       pEK  T'       d   R	pMRpT PH                  PK                  RT: RT: R24       T F5  pT PH                  PK                  RT^ ,          : RT^,          : R24       K7  	  R#   \         d    \        RT,          4      hi ; i  \         d    \        R
T,          4      hi ; i  \         d/    T PH                  PK                  RTR,          ,          4        EKZ  i ; i  \T         d2    T PH                  PK                  RTP                  ,          4        EK  i ; i)!Tr  z(&(|(samAccountName=z)(samAccountName=z$))(objectClass=User)))rq   zFailed to find account %sobjectClass)ro   rp   rr   computerz!Failed to find objectClass for %sNldap)lp_ctxrN   session_info_flagsr   	gPOptionsrH   rN   rv   rw   rA   rt   rn   )ro   rp   rr   rs   z8Failed to fetch gpo object with nTSecurityDescriptor %s
zFailed access check on %s
Fuserz	GPOs for r=   r$  z    )rv   rw   rA   rt   )2r%  rg   r&  rh   rl   ri   r   r   r   r}   r   rN   rf   r   r   r   r   rS   r   sambaauthuser_sessionsecurity_tokenr~   r   parentr[   r
   GPLINK_OPT_ENFORCEGPLINK_OPT_DISABLEr   SECINFO_OWNERSECINFO_GROUPSECINFO_DACLr   
descriptorr   r   access_checkSEC_STD_READ_CONTROLSEC_ADS_LISTSEC_ADS_READ_PROPrT   rV   r%   GPO_FLAG_MACHINE_DISABLEGPO_FLAG_USER_DISABLErU   GPO_BLOCK_INHERITANCEr{   )r   r5  r  r  r  r  r   user_dnis_computerr;  sessiontokengposinheritrN   glistrY   r   gmsgsecdesc_ndrsecdescrA   	gpoptionsmsg_strs   &&&&&&                  rC   r'  cmd_list.run  s   ((*--dgg-M
$''4::q1	J**##%(%6%6{%CSEVEVWbEc0e# fC!fiiG
	R**##}o#^_`aC$M(::K ?=> 88DHH$7$7$?$?"EE**))$**TWW=O * Q &&VVDJJG-446**##3>>(T_I`#abcdC3$SXq)9%:;A"AiL4;R;R,R,R |d&=&=== !$,$:$:$,$:$:%;$,$9$9%:  $zz00agS^^8P;JX;U:V  1  X '+1g.D&Ea&H",X-@-@+"N!33GU4<4Q4Q4<4I4I5J4<4N4N5OP  T!Wgq ABE"0M0M(M(M &ED4N4N,N,N KKa!7!:DGFOA<N OPI N Lk1=>I45555ZZ2244B GG		g{CDAIIOOQqTT1Q4489 g  	J:[HII	J  	RB[PQQ	RN % !		(c()$)0 1 ! ( !		(E(NO !s@   /A T A T? B)U AVT<?U 4VV7WWr)  r*  )r  r  r  r  r,  r-  
takes_argsrH   r.  r/  r0  r1  r   r   r2  r'  r  r  r  s   @rC   r4  r4    sh     #7HJW))w--G.. 	tW#JS	2M
a: a:rE   r4  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      .tRR ltRtV tR# )cmd_showiK  zShow information for a GPO.%prog <gpo> [options]r  r  r  r   r  r  r  r  Nc                
   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        V P                  4         \        V P                  V4      ^ ,          p TR,          ^ ,          p\        \        P                  T4      p	T	P!                  4       p
T P"                  P%                  RTR	,          ^ ,          ,          4       T P"                  P%                  R
TR,          ^ ,          ,          4       T P"                  P%                  RTR,          ^ ,          ,          4       RT9   d1   T P"                  P%                  RTR,          ^ ,          ,          4       RT9   d1   T P"                  P%                  RTR,          ^ ,          ,          4       T P"                  P%                  RTP&                  ,          4       T P"                  P%                  R\)        TRR4      ,          4       T P"                  P%                  R\+        \-        \)        TR^ 4      4      4      ,          4       T P"                  P%                  RT
,          4       \/        TRT P                  T P                  R7      pT P                  P1                  R4      pRP3                  TP5                  4       RTR.4      p. pR, EF8  p \        \6        P8                  TP;                  Y,          4      4      pTPH                   F  pTPJ                  R!8X  d   K  / pTPL                  TR"&   TPJ                  TR#&   TTR$&   \O        TPP                  4      TR%&   TPR                  TR&&   \Q        TR&,          4      \T        8X  dg   TPP                  \V        8X  d=   TR&,          PY                  R'4      pTP[                  R(4      P]                  R(4      TR&&   M\_        TR&,          4      TR&&   TPa                  T4       K  	  EK;  	  T P"                  P%                  R)4       \b        Pd                  ! YP"                  ^R*7       T P"                  P%                  R+4       R#   \         d    \        RT,          4      hi ; i  \         d    Rp
 ELi ; i  \<         d\   pTP>                  ^ ,          \@        \B        \D        39   d    Rp?EK  TP>                  ^ ,          \F        8X  d   \        R 4      hh Rp?ii ; i)-Tr  re      NNrj   GPO '%s' does not existrt   z<hidden>r  rv   r  rw   r  rx   ry   zMachine Exts : %s
rz   zUser Exts    : %s
r   r!  ru   r"  r#  rA   zACL          : %s
sysvolrg   rh   realmr   Policiesz%s\Registry.polN:The authenticated user does not have sufficient privilegesz
**delvals.keyname	valuenameclassr  r   z	utf-16-le zPolicies     :
)indentr$  )MACHINEUSER)3r%  rg   r&  rh   rS   ri   r   rl   r   r   r   rf   r   r   r   rH  as_sddlr   r   rN   r%   rD   rV   r4   getr?   r   r   r   r   r   argsr.   r/   r0   r2   entriesrm  rl  r-   r  r   bytesr7   decoderstriprQ   r   rU   jsondump)r   r   r  r  r  r  dc_hostnamer   rX  rY  secdesc_sddlr   ri  pol_filepolicy_defspolicy_classpol_datark   entrydefsr   s   &&&&&&               rC   r'  cmd_show.run\  s4   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH	@tzz3/2C	&45a8K !4!4kBG"??,L 			-FA>?		-M0B10EEF		-4D0Ea0HHI%,IIOO1C8R4STU4VVW"c)IIOO1C8O4PQR4SST		-67		-S/SV0WWX		-0@\RUW^`aEbAc0dde		-<= k&!%$(JJ0
 G$99ekkmZ 24 5/L%dii&*mmH4K&LN "))??l2"'--Y$)OO[! ,W*5::6V$zzVV%.zz\1#F|22;?'+{{6':'@'@'HV'+DL'9V""4(! * 0> 			*+		+yy3		C  	@83>??	@  	&%L	&: ! 66!9!>!@!@!B B 66!9 77& (H I Is<   ?S :S, 9/T S),S=<S= U&'U!9(U!!U&r)  r*  r  r  r  r  r,  r-  rH   r.  r/  r0  r1  r]  r   r   r2  r'  r  r  r  s   @rC   r_  r_  K  sc     %&H 	W))w--G.. J 	tALMR RrE   r_  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      ]! RR]R
7      ]! RRRR.RR7      ]! RRRR.RR7      ]! RRRRR7      .tRR ltRtV tR# )cmd_loadi  a  Load policies onto a GPO.

Reads json from standard input until EOF, unless a json formatted
file is provided via --content.

Example json_input:
[
    {
        "keyname": "Software\Policies\Mozilla\Firefox\Homepage",
        "valuename": "StartPage",
        "class": "USER",
        "type": "REG_SZ",
        "data": "homepage"
    },
    {
        "keyname": "Software\Policies\Mozilla\Firefox\Homepage",
        "valuename": "URL",
        "class": "USER",
        "type": "REG_SZ",
        "data": "google.com"
    },
    {
        "keyname": "Software\Microsoft\Internet Explorer\Toolbar",
        "valuename": "IEToolbar",
        "class": "USER",
        "type": "REG_BINARY",
        "data": [0]
    },
    {
        "keyname": "Software\Policies\Microsoft\InputPersonalization",
        "valuename": "RestrictImplicitTextCollection",
        "class": "USER",
        "type": "REG_DWORD",
        "data": 1
    }
]

Valid class attributes: MACHINE|USER|BOTH
Data arrays are interpreted as bytes.

The --machine-ext-name and --user-ext-name options are multi-value inputs
which respectively set the gPCMachineExtensionNames and gPCUserExtensionNames
ldap attributes on the GPO. These attributes must be set to the correct GUID
names for Windows Group Policy to work correctly. These GUIDs represent
the client side extensions to apply on the machine. Linux Group Policy does
not enforce this constraint.
{35378EAC-683F-11D2-A89A-00C04FBBCFA2} is provided by default, which
enables most Registry policies.
r`  r  r  r  r   r  r  ra  	--contentJSON file of policy inputs--machine-ext-namerU   machine_exts&{35378EAC-683F-11D2-A89A-00C04FBBCFA2}z;A machine extension name to add to gPCMachineExtensionNames)actionr  defaultr  --user-ext-name	user_extsz5A user extension name to add to gPCUserExtensionNamesz	--replace
store_trueFz8Replace the existing Group Policies, rather than mergingr  r  r  Nc
                   Vf   R.pVf   R.pVf4   \         P                  ! \        P                  P	                  4       4      p
Md\
        P                  P                  V4      '       d5   \        VR4      ;_uu_ 4       p\         P                  ! V4      p
R R R 4       M\        R4      hVP                  4       V n        VP                  V P                  RR7      V n        \        V P                  V P                  V4      V n        V P#                  4        \%        WP                  V P                  V P&                  V4      pV F  pVP)                  VR4       K  	  V F  pVP)                  VR4       K  	   V'       d   VP+                  X
4       R # VP-                  X
4       R #   + '       g   i     EL; i  \.         d.   pTP0                  ^ ,          \2        8X  d   \        R4      hh R p?ii ; i)	Nr  r   $The JSON content file does not existTr  ry   rz   rk  )rz  loadssysstdinr   r   r   existsr   loadr   r%  rg   r&  rh   rl   ri   r   r6   r   register_extension_name	replace_smerge_sr   ru  r2   )r   r   r  contentr  r  replacer  r  r  r  rregext_namerk   s   &&&&&&&&&&     rC   r'  cmd_load.run  s    DELABI?**SYY^^%56KWW^^G$$gt$$"iil %$ EFF((*--dgg-M
$''4::q1#C$**djj!L$H''2LM %!H''2IJ "
	k*K(% %$$&  	vvay33" $D E E 	s0   ?F(:F< F< F< (F9	<G4(G//G4r)  )NNNNFNNNr  r  s   @rC   r  r    s     0d 'H 	W))w--G.. J 	tAL{!=CH#.=>N	P 	 +=>H	J 	{<N	PM# #rE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      ]! 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_removei#  a  Remove policies from a GPO.

Reads json from standard input until EOF, unless a json formatted
file is provided via --content.

Example json_input:
[
    {
        "keyname": "Software\Policies\Mozilla\Firefox\Homepage",
        "valuename": "StartPage",
        "class": "USER",
    },
    {
        "keyname": "Software\Policies\Mozilla\Firefox\Homepage",
        "valuename": "URL",
        "class": "USER",
    },
    {
        "keyname": "Software\Microsoft\Internet Explorer\Toolbar",
        "valuename": "IEToolbar",
        "class": "USER"
    },
    {
        "keyname": "Software\Policies\Microsoft\InputPersonalization",
        "valuename": "RestrictImplicitTextCollection",
        "class": "USER"
    }
]

Valid class attributes: MACHINE|USER|BOTH
r`  r  r  r  r   r  r  ra  r  r  r  rU   r  z@A machine extension name to remove from gPCMachineExtensionNames)r  r  r  r  r  r  z:A user extension name to remove from gPCUserExtensionNamesNc	                   Vf   . pVf   . pVf4   \         P                  ! \        P                  P	                  4       4      p	Md\
        P                  P                  V4      '       d5   \        VR4      ;_uu_ 4       p
\         P                  ! V
4      p	R R R 4       M\        R4      hVP                  4       V n        VP                  V P                  RR7      V n        \        V P                  V P                  V4      V n        V P#                  4        \%        WP                  V P                  V P&                  V4      pV F  pVP)                  VR4       K  	  V F  pVP)                  VR4       K  	   VP+                  X	4       R #   + '       g   i     L; i  \,         d.   pTP.                  ^ ,          \0        8X  d   \        R4      hh R p?ii ; i)Nr   r  Tr  ry   rz   rk  )rz  r  r  r  r   r   r   r  r   r  r   r%  rg   r&  rh   rl   ri   r   r6   r   unregister_extension_nameremove_sr   ru  r2   )r   r   r  r  r  r  r  r  r  r  r  r  r  rk   s   &&&&&&&&&     rC   r'  cmd_remove.runY  sr   LI?**SYY^^%56KWW^^G$$gt$$"iil %$ EFF((*--dgg-M
$''4::q1#C$**djj!L$H))(4NO %!H))(4KL "	LL% %$   	vvay33" $D E E 	s$   =F8F F	G)(GGr)  NNNNNNNr  r  s   @rC   r  r  #  s     @ 'H 	W))w--G.. J 	tAL{!=CH#RnS	U 	 RkM	O	M rE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      .tRR ltRtV tR# )cmd_getlinkiz  zList GPO Links for a container.%prog <container_dn> [options]r  r  r  r   r  r  ra  Nc                R   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V P                  4         V P                  P                  V\        P                  RR.R7      ^ ,          pRT9   Ed9   TR,          '       Ed)   T P                  P                  RT,          4       \        \!        TR,          ^ ,          4      4      pT F  p\#        T P                  TR,          R7      pT P                  P                  R	T^ ,          R
,          ^ ,          ,          4       T P                  P                  RT^ ,          R,          ^ ,          ,          4       T P                  P                  R\%        TR,          4      ,          4       T P                  P                  R4       K  	  R# T P                  P                  RT,          4       R#   \         d    \        RT,          4      hi ; i)Tr  r   r   r   r   zGPO(s) linked to DN %s
rN   )rN   z    GPO     : %s
rv   z    Name    : %s
rw   z    Options : %s
rH   r$  zNo GPO(s) linked to DN=%s
N)r%  rg   r&  rh   rl   ri   r   r   r   r}   r   rf   r   r   r   r[   r   r   rI   )	r   r   r  r  r  r  r   rb   rY   s	   &&&&&&   rC   r'  cmd_getlink.run  s    ((*--dgg-M
$''4::q1	O**##S^^/@+3* $ 6679C s?s8}}IIOO6EF!#c(mA&6"78F"4::!D':		 4s1vf~a7H HI		 4s1vm7LQ7O OP		 47LQy\7Z Z[		%  IIOO9LHI  	O>MNN	Os   /5H H&r)  r*  r  r  s   @rC   r  r  z  sd     )/H 	W))w--G.. !!J 	tALMJ JrE   r  c            
          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
RR.t]! R	R
]R7      ]! RRRRRR7      ]! RRRRRR7      .tRR ltRtV tR# )cmd_setlinki  z(Add or update a GPO link to a container.$%prog <container_dn> <gpo> [options]r  r  r  r   r   r  r  ra  z	--disabledisabledFr  zDisable policyr  r  r  r  z	--enforceenforcedzEnforce policyNc	                T   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V P                  4        ^ p	V'       d   V	\        P                  ,          p	V'       d   V	\        P                  ,          p	 \        V P                  VR7      ^ ,           \        \        T P                  T4      4      p
 T P                  P!                  T\"        P$                  RR.R7      ^ ,          pRpRT9   d   \'        \        TR,          ^ ,          4      4      pR pRpT F5  pTR	,          P)                  4       T
P)                  4       8X  g   K/  YR
&   R p M	  T'       d   \        RT,          4      hTP+                  ^ R	T
R
T	/4       M. pTP-                  R	T
R
T	/4       \/        T4      p\"        P0                  ! 4       p\"        P2                  ! T P                  T4      Tn        T'       d+   \"        P6                  ! T\"        P8                  R4      TR&   M)\"        P6                  ! T\"        P:                  R4      TR&    T P                  P=                  T4       T P>                  PA                  R4       \C        4       PE                  YYgT4       R#   \         d    \        RT,          4      hi ; i  \         d    \        RT,          4      hi ; i  \         d   p\        RT4      hRp?ii ; i)Tr  r   rf  r   r   r   r   FrN   rH   z)GPO '%s' already linked to this container	new_valuezError adding GPO LinkNzAdded/Updated GPO link
)#r%  rg   r&  rh   rl   ri   r   r
   rD  rC  r   r   rf   r   r   r5   r   r}   r   r[   r   insertrU   rc   r   r~   rN   r   r   FLAG_MOD_ADDr   r   r   r  r'  )r   r   r   r  r  r  r  r  r  gplink_optionsr   r   existing_gplinkrb   r   rY   r   r   rk   s   &&&&&&&&&          rC   r'  cmd_setlink.run  s    ((*--dgg-M
$''4::q1d555Nd555N	@-a0 Z

C01	O**##S^^/@+3* $ 6679C  s?!#c(mA&6"78F"OET7==?flln4#1iL E	 
 "#NQT#TUUa$	>!JKFMM4NCD"6*
KKMvvdjj,/ //
C<P<PRZ[AkN //
C<L<LhWAkN	;JJa  			23,9L_  	@83>??	@  	O>MNN	OD  	;6::	;s0   /K	 -5K* 6L 	K'*LL'L""L'r)  )NFFNNNr  r  s   @rC   r  r    s     25H 	W))w--G.. !%(J 	tAL{U<$	&{U<$	&	MBM BMrE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
RR.t]! R	R
]R7      .tRR ltRtV tR# )cmd_dellinki  z!Delete GPO link from a container.r  r  r  r  	containerr   r  r  ra  Nc                :   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V P                  4         \        V P                  VR7      ^ ,           \        P                  ! T P                  T4      p\        T P                  Yr4       T P                  P                  R4       \!        4       P#                  YsYET4       R#   \         d    \        RT,          4      hi ; i)Tr  r  rf  zDeleted GPO link.
N)r%  rg   r&  rh   rl   ri   r   r   r   rf   r   r}   r~   r   r   r   r  r'  )r   r  r   r  r  r  r  r   s   &&&&&&& rC   r'  cmd_dellink.run  s     ((*--dgg-M
$''4::q1	@-a0 vvdjj)4TZZ3		-.,9L  	@83>??	@s   /C< <Dr)  r*  r  r  s   @rC   r  r    sf     +5H 	W))w--G.. u%J 	tALMM MrE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      .tRR ltRtV tR# )cmd_listcontainersi*  z%List all linked containers for a GPO.r`  r  r  r  r   r  r  ra  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V P                  4        \        V P                  V4      p\        V4      '       dW   V P                  P                  RV,          4       V F,  pV P                  P                  RVR,          ,          4       K.  	  R# V P                  P                  RV,          4       R# )Tr  zContainer(s) using GPO %s
z    DN: %s
rN   zNo Containers using GPO %s
N)r%  rg   r&  rh   rl   ri   r   r   r   rR   r   r   )r   r   r  r  r  r  r   r   s   &&&&&&  rC   r'  cmd_listcontainers.run;  s     ((*--dgg-M
$''4::q1 S1s88IIOO9C?@		4 89  IIOO:S@ArE   r)  r*  r  r  s   @rC   r  r  *  sc     /&H 	W))w--G.. J 	tALMB BrE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      .tRR ltRtV tR# )cmd_getinheritanceiN  z%Get inheritance flag for a container.r  r  r  r  r   r  r  ra  Nc                l   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V P                  4         V P                  P                  V\        P                  RR.R7      ^ ,          p^ pRT9   d   \        TR,          ^ ,          4      pT\        P                  8X  d   T P                   P#                  R4       R# T P                   P#                  R4       R#   \         d    \        RT,          4      hi ; i)	Tr  r   r<  r   r   z$Container has GPO_BLOCK_INHERITANCE
zContainer has GPO_INHERIT
N)r%  rg   r&  rh   rl   ri   r   r   r   r}   r   rf   r   rV   r
   rO  r   r   )r   r   r  r  r  r  r   inheritances   &&&&&&  rC   r'  cmd_getinheritance.run_  s    ((*--dgg-M
$''4::q1	O**##S^^/@+6- $ 99:<C #c+.q12K$444IIOOCDIIOO9:  	O>MNN	Os   /5D D3r)  r*  r  r  s   @rC   r  r  N  sb     //H 	W))w--G.. !!J 	tALM; ;rE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
RR.t]! R	R
]R7      .tRR ltRtV tR# )cmd_setinheritanceiz  z$Set inheritance flag on a container.z.%prog <container_dn> <block|inherit> [options]r  r  r  r   inherit_stater  r  ra  Nc                   VP                  4       R 8X  d   \        P                  pM8VP                  4       R8X  d   \        P                  pM\	        RV,          4      hVP                  4       V n        VP                  V P                  RR7      V n        \        V P                  V P                  V4      V n
        V P                  4         V P                  P                  V\        P                  RR.R7      ^ ,          p\        P"                  ! 4       p	\        P$                  ! T P                  T4      T	n        RT9   d4   \        P(                  ! \+        T4      \        P,                  R4      T	R	&   M2\        P(                  ! \+        T4      \        P.                  R4      T	R	&    T P                  P1                  T	4       R#   \          d    \	        RT,          4      hi ; i  \          d   p
\	        R
T,          T
4      hRp
?
ii ; i)blockrU  zUnknown inheritance state (%s)Tr  r   r<  r   r   r  z"Error setting inheritance state %sN)r   r
   rO  GPO_INHERITr   r%  rg   r&  rh   rl   ri   r   r   r   r}   r   rf   r   r~   rN   r   r   r   r  r   )r   r   r  r  r  r  r  r  r   r   rk   s   &&&&&&&    rC   r'  cmd_setinheritance.run  s     G+44K  "i/**K?-OPP((*--dgg-M
$''4::q1	O**##S^^/@+6- $ 99:<C KKMvvdjj,/# //K0@#BVBVXcdAkN //K0@#BRBRT_`AkN	XJJa   	O>MNN	O  	XCmSUVWW	Xs$   5G *G( G%(H3HHr)  r*  r  r  s   @rC   r  r  z  sf     .?H 	W))w--G.. !/2J 	tALM"X "XrE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      ]! RR]R
7      .tRR ltRtV tR# )	cmd_fetchi  zDownload a GPO.r`  r  r  r  r   r  r  ra  --tmpdir,Temporary directory for copying policy filesNc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        V P                  4         \        V P                  V4      ^ ,          p\        TR,          ^ ,          4      p	 \        T	4      w  rp\!        Y{T P                  T P                  R7      pT P#                  Y14      w  r> \%        YT4       T P&                  P)                  RT,          4       R
#   \         d    \        RT,          4      hi ; i  \         d    \        RT	,          4      hi ; i  \         d   p\        R	T4      hR
p?ii ; i)Tr  re   rc  re  rf  rx   Invalid GPO path (%s)rh  Error copying GPO from DCNGPO copied to %s
)r%  rg   r&  rh   rS   ri   r   rl   r   r   r   rf   r   r   r   r   r4   r   r   r   r   )r   r   r  r   r  r  r  r|  r   r   dom_nameservice	sharepathr   r   rk   s   &&&&&&&         rC   r'  cmd_fetch.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH	@tzz3/2C
 #&'*+	>-6s^*X	
 ktww$(JJ0 ..v;	?*4FC 			,v56-  	@83>??	@  	>6<==	>  	?:A>>	?s0   ?E* 6F :F, *FF),G7GGr)  NNNNNr  r  s   @rC   r  r    so     &H 	W))w--G.. J 	tALz NUXYM
&7 &7rE   r  c            
          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      ]! RR]R
7      ]! RRRRR7      ]! RRR]R7      .tRR lt]R 4       tRtV tR# )
cmd_backupi  zBackup a GPO.r`  r  r  r  r   r  r  ra  r  r  z--generalizez"Generalize XML entities to restoreFr  r  r  r  
--entitiesz4File to export defining XML entities for the restoreent_file)r  r  r  Nc	                    VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          p	W n        MG\        V P                  V P                  4      p	\        V P                  V P                  V	R7      V n        V P                  4         \        V P                  V4      ^ ,          p
\        T
R,          ^ ,          4      p \        T4      w  rp\!        YT P                  T P                  R7      pT P#                  Y14      w  pp \%        YT4       T P&                  P)                  RT,          4       T'       Ed   T P&                  P)                  R4       \*        P-                  T P&                  TT4      pTP/                  4        UUu. uF
  w  ppTT3NK  	  pppTP1                  4        RP3                  R T 4       4      pT'       dR   \5        TR4      ;_uu_ 4       pTP)                  T4       R
R
R
4       T P&                  P)                  RT,          4       M6T P&                  P)                  R4       T P&                  P)                  T4       R Fm  pTT
9   g   K  \5        \6        P8                  P3                  TTR,           4      R4      ;_uu_ 4       pTP)                  T
T,          ^ ,          4       R
R
R
4       Ko  	  R
#   \         d    \        RT,          4      hi ; i  \         d    \        RT,          4      hi ; i  \         d   p\        R	T4      hR
p?ii ; iu uppi   + '       g   i     ELF; i  + '       g   i     EK   ; i)Tr  re   rc  re  rf  rx   r  rh  r  Nr  z(
Attempting to generalize XML entities:
rK   c              3   V   "   T F  w  rR VP                  R4       RV R2x  K!  	  R# 5i)z	<!ENTITY z&;z "z">
N)rP   )r_   entvals   &  rC   r`   !cmd_backup.run.<locals>.<genexpr>2  s1      5+3xs 'syy&7r#dC+3s   ')wz$Entities successfully written to %s
z
Entities:
	.SAMBAEXTr   ry   rz   )r%  rg   r&  rh   rS   ri   r   rl   r   r   r   rf   r   r   r   r   r4   r   r   r   r   r  generalize_xml_entitiesitemsr   r?   r   r   r   )r   r   r  r   
generalizer  r  r  r  r|  r   r   r  r  r  r   r   rk   entitieskvent_listentsr   exts   &&&&&&&&&                rC   r'  cmd_backup.run  s    ((*--dgg-M
 i((B%KH'<KdggtzzkBDH	@tzz3/2C
 #&'*+	>-6s^*X	
 ktww$(JJ0 ..v;	?,TfE
 			,v56:IIOOHI!99$))V:@BH ,4>>+;<+;41aA+;H<MMO77 5+35 5D (C((AGGDM )		 G (!) * 		0		% ICcz"'',,vs[/@A4HHAGGCHQK( IH I[  	@83>??	@  	>6<==	>  	?:A>>	? = )(( IHHsN   ?L  6L! ;M M!M' M; L!L?MMM'M8	;Nc                    / p\         P                  P                  V4      '       g   \         P                  ! V4       V.pV.pV'       Ed   VP	                  4       pVP	                  4       p\         P
                  ! V4      pVP                  4        V EF  p	\         P                  P                  Wi4      p
\         P                  P                  Wy4      p\         P                  P                  V
4      '       db   VP                  V
4       VP                  V4       \         P                  P                  V4      '       g   \         P                  ! V4       K  K  V
P                  R 4      '       d   \         P                  P                  V
4      RR p\        V4      p \        V
R4      ;_uu_ 4       pVP                  4       pRRR4       \        P                   ! X4      pVP#                  VW4      pEKe  \         P                  P)                  W4      '       d   EK  \*        P,                  ! W4       EK  	  EK  V#   + '       g   i     L; i  \$         d    T P'                  RT,          4        EK  i ; i)r   Nr  z%SKIPPING: Generalizing failed for %s
)r   r   r  r   r   r   r   r?   r   rU   endswithbasenamer   r   r   ET
fromstringgeneralize_xmlr   r   samefileshutilcopy2)r   	sourcedir	targetdirr  r   r   r   r   r   rk   r   r   to_parser   ltempr   concrete_xmlfound_entitiess   &&&               rC   r  "cmd_backup.generalize_xml_entitiesD  s   ww~~i((HHYfJJLEJJLEjj'GLLNe/e/77==((MM&)MM&)77>>&11( 2 v.. $&77#3#3F#;CR#@!,X!6\!%fc!2!2e',zz| "3 ,.==+>L-3-B-B<QW-bN  "ww//??"LL8C F # "3!2
  5 \ JJ'ORZ'Z[[\s*   "I6I0III#I=<I=r)  )NNFNNNN)r  r  r  r  r,  r-  rH   r.  r/  r0  r1  r]  r   r   r2  r'  staticmethodr  r  r  r  s   @rC   r  r    s     &H 	W))w--G.. J 	tALz NUXY~$H\	3|"XS	*MA)F 1 1rE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      ]! RR]R
7      .tRR ltRtV tR# )
cmd_createiy  zCreate an empty GPO.z%prog <displayname> [options]r  r  r  r   r  r  ra  r  r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  R7      pV'       dt   VP                  R4      '       d]   VR,          pW n        \        P                  \        P                  ,          \        P                  ,          p	VP                  WR7      p
M\        P                  \        P                  ,          \        P                  ,          p	VP                  V P                  P                  R4      V	R7      p
V
P                  p\        V P                  V P                  VR7      V n        V P                  4        \!        V P"                  VR	7      pVP$                  ^ 8  d   \'        R
V,          4      h\)        \*        P,                  ! 4       4      pRVP/                  4       ,          pWn        V
P2                  pRV: RV: RV: 2pV P5                  W=4      w  V n        pVV n         \:        P<                  ! \:        P>                  PA                  VR4      4       \:        P<                  ! \:        P>                  PA                  VR4      4       Rp\C        \:        P>                  PA                  VR4      R4      ;_uu_ 4       pVPE                  V4       RRR4       \I        T4      w  pppTT n%        \M        TTT P                  T P                  R7      pTT n'        T P"                  PQ                  4         \S        T P"                  T4      p\T        PV                  ! 4       pTTn,        \T        PZ                  ! R\T        P\                  R4      TR&   T P"                  P_                  T4       \T        PV                  ! 4       p\T        P`                  ! T P"                  R\)        T4      ,          4      Tn,        \T        PZ                  ! R\T        P\                  R4      TR&   T P"                  P_                  T4       \T        PV                  ! 4       p\T        P`                  ! T P"                  R\)        T4      ,          4      Tn,        \T        PZ                  ! R\T        P\                  R4      TR&   T P"                  P_                  T4       \b        Pd                  \b        Pf                  ,          \b        Ph                  ,          p\!        T P"                  TTR7      ^ ,          pTR,          ^ ,          p\k        \b        Pl                  T4      Po                  4       p\b        Pp                  ! T P"                  Ps                  4       4      p\u        TTRR 7      p\w        TT4       \b        Pd                  \b        Pf                  ,          \b        Ph                  ,          \b        Px                  ,          pTP{                  TTT4       \}        TTT4       \T        PV                  ! 4       pTTn,        \T        PZ                  ! T\T        P~                  R!4      TR"&   \T        PZ                  ! T\T        P~                  R#4      TR$&   \T        PZ                  ! R%\T        P~                  R&4      TR'&   \T        PZ                  ! R(\T        P~                  R)4      TR*&   \T        PZ                  ! R%\T        P~                  R+4      TR,&   R-.p T P"                  P                  TT R.7       T P"                  P                  4        Tf!   \        P                  ! T P6                  4       T P                  PE                  R/T: R0T: R124       R#   + '       g   i     EL; i  \F         d   p\'        RT4      hRp?ii ; i  \F         d    T P"                  P                  4        h i ; i)2Tr  )rh   rg   re   rc  )addressrA   ri  )domainrA   re  )r   z%A GPO already existing with name '%s'{%s}r   z\sysvol\z
\Policies\MachineUserz[General]
Version=0
zGPT.INIr  NzError Creating GPO filesrh  groupPolicyContainerr7  a01
CN=User,%sr  CN=Machine,%s)r   r   rt   F)rs  rw   a02rx   a03r"  ru   a052gpcFunctionalityVersiona07rA   a04zpermissive_modify:0)rs   zGPO 'z' created as r$  )Fr%  rg   r&  rh   r   rS   ri   r   NBT_SERVER_LDAPNBT_SERVER_DSNBT_SERVER_WRITABLEfinddcrt  pdc_dns_namerl   r   r   r   countr   r   uuiduuid4uppergpo_name
dns_domainr   r   r   r   r   r   r?   r   r   rf   r   r  r4   r   transaction_startr5   r}   r   rN   r   r  addr~   r   rE  rF  rG  r   rH  rs  dom_sidget_domain_sidr   r3   SECINFO_PROTECTED_DACLset_aclr   r   r   transaction_committransaction_cancelr  rmtreer   )!r   r   r  r   r  r  r  netr|  rA   	cldap_retr   guidr   ri  unc_pathr   gpt_contentsr   rk   r  r  r  r   r   r   ds_sd_flags	ds_sd_ndrds_sd
domain_sidfs_sdsiors   s!   &&&&&&&                          rC   r'  cmd_create.run  s    ((*--dgg-M


tww/ i((B%KH((&&',,-E 

;
DI((&&',,-E 

$''++g*>e
LI#00KdggtzzkBDH4::;?99q=FTUU DJJL!tzz|#$$9>sK #33F@V	>HHRWW\\&)45HHRWW\\&&127Lbggll695s;;q% < *38)<&7I"k7tww$(JJ0 	

$$&;	,

C0FAAD))*@#BRBRTabAeHJJNN1 A66$**lS[&@AAD))+s7G7GWAeHJJNN1 A66$**oF&CDAD))+s7G7GWAeHJJNN1 $11#112#001K tzzs[I!LC23A6Ix22I>FFHE "))$***C*C*EFJz5AE "$	2 ))))*(() 223C LLE3/ +4CAAD))+s7K7K][AeH))(C4H4HJZ[AeH))#s/C/C_UAeH))#s/C/CE^_AeH))#s/C/CWMAeH-.HJJa(3
 JJ))+>MM$++&		k3GH_ <;; 	>91==	>F  	JJ))+	sD   -B^ 	^^ >O%^: ^	^ ^ ^7&^22^7:'_!)r   rh   r$  r   rg   r  r   ri   r  r  r  s   @rC   r	  r	  y  ss     .H 	W))w--G..  J 	tALz NUXYM
~I ~IrE   r	  c            
         a a ] tR tRt oRtRtR]P                  R]P                  R]P                  /t
RR.t]! R	R
]R7      ]! RR]R7      ]! RR]R7      ]! RRRRR7      .tRR lt]R 4       tRV 3R lltRtVtV ;t# )cmd_restorei  z!Restore a GPO to a new container.z/%prog <displayname> <backup location> [options]r  r  r  r   backupr  r  ra  r  r  r  z8File defining XML entities to insert into DOCTYPE headerz--restore-metadataz7Keep the old GPT.INI file and associated version numberFr  r  c           	        R p\         P                  P                  V4      '       g   \         P                  ! V4       V.pV.pV'       Ed(   VP	                  4       pVP	                  4       p\         P
                  ! V4      p	V	P                  4        V	 EF  p
\         P                  P                  Wz4      p\         P                  P                  W4      p\         P                  P                  V4      '       db   VP                  V4       VP                  V4       \         P                  P                  V4      '       g   \         P                  ! V4       K  K  VP                  R4      '       g   K  \         P                  P                  V4      RR p\        V4      p \        VR4      ;_uu_ 4       pVP                  4       pRpVP                  V4      '       dC   V\!        V4      R pVP#                  \$        P&                  ! VV,           V,           4      4       M,VP#                  \$        P&                  ! VV,           4      4       VP)                  VRR 4       RRR4       EK  	  EK0  R#   + '       g   i     EK  ; i  \*         di    TRR T,           p\,        P.                  ! TTRR 4       T P0                  P3                  RT,          4       T P0                  P3                  R4        EKh   ^ RIpTP7                  4        TRR T,           p\,        P.                  ! TTRR 4       T P0                  P3                  RT,          4       T P0                  P3                  R4        EK  ; i)	r   r   Nr  z&<?xml version="1.0" encoding="utf-8"?>zWARNING: No such parser for %s
z.WARNING: Falling back to simple copy-restore.
z%WARNING: Error during parsing for %s
r  )r   r   r  r   r   r   r   r?   r   rU   r  r  r   r   r   rS   rR   load_xmlr  r  write_binaryr   r  r  r   r   	traceback	print_exc)r   r   r  
dtd_headerr   r   r   r   r   r   rk   r   r   r  r   r  r   xml_headoriginal_filerA  s   &&&&                rC    restore_from_backup_to_local_dir,cmd_restore.restore_from_backup_to_local_dir!  s   ww~~i((HHYfJJLEJJLEjj'GLLNe/e/77==((MM&)MM&)77>>&11( 2 v.. $&77#3#3F#;CR#@!,X!6#_!%fc!2!2e',zz|+S#'??8#<#< ,0H+?D %+OOBMM(ZBWZ^B^4_$`$*OOBMM*tBS4T$U !' 3 3F3BK @! "3!2%  0 "3!2!2$  3 _,23BK&,@M"LLsD IIOO,NQY,YZ IIOO,]^^	_,%//1 -33BK&,@M"LLsD IIOO,TW],]^ IIOO,]^^s3   $J8B,I6$J6JJJA.M9=A8M9c                   V f   R#  \        V 4      ;_uu_ 4       pVP                  4       P                  4       pR R R 4       RX R2p\        P
                  ! 4       p TP                  TR,           R4       T#   + '       g   i     LG; i   \        RT  R24      h; i  \        P                   d   p\        RT 24      hR p?ii ; i)	NrK   zCould not open entities file: ''z<!DOCTYPE foobar [
z
]>
z<dummy/>TzfEntities file does not appear to conform to format
e.g. <!ENTITY entity "value">
Expat error message: )r   r   rP   r   r   ParserCreateParse
ExpatError)r  r   contentsrC  prk   s   &     rC   generate_dtd_headercmd_restore.generate_dtd_headere  s     	Nh1668>>+  
 ,H:V<
 	<GGJ+T2 !  	N!@
!LMM  	<  7 89c ; < <	<s?   B A9B B  9B		B 	B B C5CCc
                |  < \         P                  P                  V4      '       g   \        R V,          4      hV P	                  V4      p
\
        SV `  WWFWx4        Vf*   V P                  W@P                  4      w  V n	        pWn
        V P                  W P                  V
4       V	'       * p\        V P                  V P                  V P                  RVR7       \        V P                   V P                  4      pR	 F  p\         P                  P#                  W.R,           4      p\         P                  P                  V4      '       g   KP  \%        VR4      ;_uu_ 4       pVP'                  4       pRRR4       \(        P*                  ! 4       pVVn        \(        P.                  ! X\(        P0                  V4      VV&   V P                   P3                  V4       K  	  Vf#   \4        P6                  ! V P                  4       R# R#   + '       g   i     L; i  \8         d   p^ RIpTP=                  4        T P>                  PA                  \C        T4      R,           4       T P>                  PA                  R4       \E        4       pTP                  T P                  Y6Yx4       \        RT,          4      hRp?ii ; i)
z"Backup directory does not exist %sNT)r   r   r  r   r$  z%Failed to restore GPO -- deleting...
zFailed to restore: %sr  )#r   r   r  r   rO  superr'  r   r$  r   r   rF  r   r   r  r5   r   r?   r   r   r}   r   rN   r   r   r   r  r.  rf   rA  rB  r   r   r   cmd_del)r   r   r=  r  r   r  r  r  r  restore_metadatarC  r   keep_new_filesr   r  ext_filer   r   r   rk   rA  cmd	__class__s   &&&&&&&&&&            rC   r'  cmd_restore.run  s
    ww~~f%%CfLMM--h7
KFxM/	<~&*&;&;FMM&R#V$ 11&++2<> "21N +499dkk+/>>?C?MO
  

DMM:F M77<<k0AB77>>(++h-- vvx . A!AD //c6J6J035AcF JJ%%a( M ~dkk*  .-  		<!IIOOCFTM*IIOODE)CGGDMM1G6:;;		<s?   H  C'H H  H1BH HH J;#BJ66J;)r   r   )rK   r  )r  r  r  r  r,  r-  rH   r.  r/  r0  r1  r]  r   r   r2  rF  r  rO  r'  r  r  __classcell__)rX  r	  s   @@rC   r<  r<    s     +@H 	W))w--G..  *J 	tALz NUXY|"\cfg#*c\	3	MB_H  >9< 9<rE   r<  c                      a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
R.t]! RR	]R
7      .tRR ltRtV tR# )rS  i  zDelete a GPO.r`  r  r  r  r   r  r  ra  Nc           	     z   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        V P                  4         \        V P                  VR7      ^ ,          p\        VR,          ^ ,          4      p\        T4      w  rp\        YjT P                  T P                  R7      pT P                  P!                  4         \#        T P                  T4      p\%        T4      '       ds   T P&                  P)                  R	T,          4       T FJ  p\+        T P                  TR
,          T4       T P&                  P)                  RTR
,          ,          4       KL  	  \-        T P                  T4      pT P                  P/                  \0        P2                  ! T P                  R\        T4      ,          4      R.4       T P                  P/                  \0        P2                  ! T P                  R\        T4      ,          4      R.4       T P                  P/                  T4       TP5                  T4       T P                  P7                  4        T P&                  P)                  RT,          4       R#   \         d    \        RT,          4      hi ; i  \         d    T P                  P9                  4        h i ; i)Tr  re   rc  re  r  rx   rf  rh  zGPO %s is linked to containers
rN   z    Removed link from %s.
r  ztree_delete:1r  zGPO %s deleted.
N)r%  rg   r&  rh   rS   ri   r   rl   r   r   r   r   rf   r   r   r4   r&  r   rR   r   r   r   r5   deleter}   r~   deltreer,  r-  )r   r   r  r  r  r  r|  r   r2  r  r  r  r   r   r   s   &&&&&&         rC   r'  cmd_del.run  sa    ((*--dgg-M
 i((B%KH'<KdggtzzkBDH	@tzzs3A6C3/034H
 *38)<&Iktww$(JJ0 	

$$&	,$TZZ5C3xx		 BS HIA QtWc:IIOO$AAdG$KL 
  

C0FJJcffTZZF1KLN_`JJcffTZZ3v;1NORaQbcJJf% LL# JJ))+		+c12E  	@83>??	@8  	JJ))+	s   ?7K2 E3L 2L'L:r)  r*  r  r  s   @rC   rS  rS    sa     &H 	W))w--G.. J 	tALM63 63rE   rS  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tRR ltRtV tR# )cmd_aclchecki  z.Check all GPOs have matching LDAP and DS ACLs.r  r  r  r  r  r  r  r  r  r  Nc           	        VP                  4       V n        VP                  V P                  R R7      V n        \	        V P                  V P                  V4      V n        V'       d(   VP                  R4      '       d   VR,          pWn        MG\        V P                  V P                  4      p\	        V P                  V P                  VR7      V n        V P                  4        \        V P                  R4      pV EFg  p\        VR,          ^ ,          4      p \        V4      w  rp\        YZT P                  T P                  R7      pTP!                  T\"        P$                  \"        P&                  ,          \"        P(                  ,          \"        P*                  4      pR	T9  d   \        R
4      hTR	,          ^ ,          p\-        \"        P.                  T4      P1                  4       p\"        P2                  ! T P                  P5                  4       4      p\7        TT4      pTP1                  T4      T8w  g   EKD  \        RTP1                  T4      : RT: RT: 24      h	  R#   \         d    \        RT,          4      hi ; i)Tr  re   rc  re  Nrx   r  rh  rt   zKCould not read nTSecurityDescriptor. This requires an Administrator accountzInvalid GPO ACL z
 on path (z), should be )r%  rg   r&  rh   rl   ri   rS   r   r   r   r   r   r   r   r   r4   get_aclr   rE  rF  rG  SEC_FLAG_MAXIMUM_ALLOWEDr   rH  rs  r(  r)  r   )r   r  r  r  r  r|  r   r   r   r  r  r  r   r8  r5  r6  r7  expected_fs_sddls   &&&&&             rC   r'  cmd_aclcheck.run  s   ((*--dgg-M
$''4::q1 i((B%KH'<KdggtzzkBDH4::t,Aa()!,-CB1:3.I
 "+477(,

4D LLH,B,BXE[E[,[^f^s^s,su}  vW  vW  XE%Q." $L M M 01!4Ix22I>FFHE "))$***C*C*EFJ*5*=j)-=="V[VcVcdnVoqz  }M  $N  O  O5 
  B"#:S#@AABs   I**Jr)  r*  r+  r  s   @rC   ra  ra    sd     8 H 	W))w--G.. 	tW#JQT3	(M
-O -OrE   ra  c            
         a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      ]! RR]]P                  P                  ]P"                  ! 4       R4      R7      .tRR ltRtV tR# )cmd_admxloadiJ  z Loads samba admx files to sysvolr  r  r  r  r  r  r  r  r  r  z
--admx-dirz)Directory where admx templates are storedz
samba/admx)r  r  r  Nc           	     H   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pWn        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pRP                  V P                  P                  R4      P                  4       R	R
.4      p VP                  V4       \$        P&                  ! T4       F  w  rpT F  pT
P)                  TR4      p\$        P*                  P                  Y4      pRP                  Y.4      P)                  RR4      pRP                  TT.4      p \-        TT4       \/        TR4      ;_uu_ 4       p TP1                  TTP3                  4       4       RRR4       K  	  K  	  T P4                  P7                  R4       R#   \         dP   p	T	P                  ^ ,          \        8X  d   \!        R4      hT	P                  ^ ,          \"        8w  d   h  Rp	?	ELLRp	?	ii ; i  \         dP   p	T	P                  ^ ,          \        8X  d   \!        R4      hT	P                  ^ ,          \"        8w  d   h  Rp	?	ELRp	?	ii ; i  \         d3   p	T	P                  ^ ,          \        8X  d   \!        R4      h Rp	?	ELRp	?	ii ; i  + '       g   i     EK  ; i)Tr  re   rc  re  rg  rh  r   ri  rj  PolicyDefinitionsrk  NrK   r   r   a  Installing ADMX templates to the Central Store prevents Windows from displaying its own templates in the Group Policy Management Console. You will need to install these templates from https://www.microsoft.com/en-us/download/102157 to continue using Windows Administrative Templates.
)r%  rg   r&  rh   rS   ri   r   rl   r4   r?   rt  r   r   r   ru  r2   r   r1   r   walkr  r   r3   r   r   r   r   r   )r   r  r  r  r  admx_dirr|  r   smb_dirrk   dirnamedirsfilesfnamepath_in_admx	full_pathsub_dirsmb_pathr   s   &&&&&&             rC   r'  cmd_admxload.run\  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 ))TWW[[1779')<> ?	JJw %'GGH$5 G5&x<GGLL8	))W$;<DDS$O99gu%56)$8 )T**aQh9 +*  %6* 			 P 	Q9  	vvay33" $D E E== >		 % vvay$;;* ,L M M&EE F	 ) Q66!9(??". 0P #Q Q @Q +**sb   H &I2L	 KI/ AI**I/2K=AKKL'LL	LL	L!r)  r  )r  r  r  r  r,  r-  rH   r.  r/  r0  r1  r   r   r   r   r?   r$   data_dirr2  r'  r  r  r  s   @rC   rh  rh  J  s     * H 	W))w--G.. 	tW#JQTC	)|"M"'',,u~~/?"N	PM8Q 8QrE   rh  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      ]! RRRRR7      .t. ROtRR ltRtV tR# )cmd_add_sudoersi  a  Adds a Samba Sudoers Group Policy to the sysvol

This command adds a sudo rule to the sysvol for applying to winbind clients.

The command argument indicates the final field in the sudo rule.
The user argument indicates the user specified in the parentheses.
The users and groups arguments are comma separated lists, which are combined to
form the first field in the sudo rule.
The --passwd argument specifies whether the sudo entry will require a password
be specified. The default is False, meaning the NOPASSWD field will be
specified in the sudo entry.

Example:
samba-tool gpo manage sudoers add {31B2F340-016D-11D2-945F-00C04FB984F9} ALL ALL fakeu fakeg

The example command will generate the following sudoers entry:
fakeu,fakeg% ALL=(ALL) NOPASSWD: ALL
    z7%prog <gpo> <command> <user> <users> [groups] [options]r  r  r  r  r  r  r  r  r  z--passwdr  Fz;Specify to indicate that sudo entry must provide a passwordr  Nc                	   VP                  4       V n        V	P                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pWpn        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      pRP                  VR.4      p \        P                   ! \        P"                  ! VP%                  V4      4      4      pVP'                  4       P)                  R4      pVP)                  R4      p\        P6                  ! TR4      pT'       d   \        P6                  ! TR4       \        P6                  ! TR4      pTTn        \        P6                  ! TR4      pTTn        \        P6                  ! TR 4      pTP?                  R!4       F0  p\        P6                  ! TR"4      pTTn        RTP@                  R#&   K2  	  TeE   TP?                  4        F0  p \        P6                  ! TR"4      pT Tn        R$TP@                  R#&   K2  	  \C        4       p!TPE                  T!R%R R&7       T!PG                  ^ 4        \I        Y4       TPK                  TT!PM                  4       4       TPO                  R R'7       R#   \*         EdX   pTP,                  ^ ,          \.        \0        \2        39   Ed   \        P                   ! \        P4                  ! R4      4      p\        P6                  ! TP'                  4       R4      p\        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      p\        P6                  ! TR4      pRTn         Rp?ELTP,                  ^ ,          \:        8X  d   \=        R4      hh Rp?ii ; i  \*         d.   pTP,                  ^ ,          \:        8X  d   \=        R4      hh Rp?ii ; i)(Tr  re   rc  re  rg  rh  ri  r   rj  MACHINE\VGP\VTLA\SudoSudoersConfigurationmanifest.xmlpolicysettingr   	vgppolicyversion1rv   zSudo Policydescriptionz!Sudoers File Configuration Policy
apply_modemergeload_plugintruerk  Nsudoers_entrypasswordcommandr=  listelement,	principalr  groupUTF-8encodingxml_declarationmachine_changed)(r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  ElementTreer  r   getrootfindr   ru  r.   r/   r0   Element
SubElementtextr2   r   rQ   r   r*   r   seekr3   r   r   increment_gpt_ini)"r   r   r  r=  usersgroupspasswdr  r  r  r  r|  r   r  ri  vgp_dirvgp_xmlxml_datar~  r   rk   pvrv   r  r  r  r  command_elmuser_elmr  ur  rY   outs"   &&&&&&&&&&&                       rC   r'  cmd_add_sudoers.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J735 6 ))Wn56	~~bmmDMM'4J&KLH$,,.33ODM %%f-D4 dO<MM-4mmM9="==7mmM=AS!Ak;?IIN'-IV$ " \\^MM+{C	!"	+2	  ( $
 isWdC	!$0MM'388:.!!$!7c  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;)	 mmM=I#F ]]=,G
")
}}]F; mmD-@#)  55" $D E E /	d  	vvay33" $D E E		s8    A)M =R4 R1D$R,(R,,R14S,?(S''S,r)  )r   r  r=  r  zgroups?)NNNNNNr  r  r  r  r,  r-  rH   r.  r/  r0  r1  r   r   r2  r]  r'  r  r  r  s   @rC   ry  ry    s     & IH 	W))w--G.. 	tW#JQTC	)z,Q	SM @JU UrE   ry  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_sudoersi  zList Samba Sudoers Group Policy from the sysvol

This command lists sudo rules from the sysvol that will be applied to winbind clients.

Example:
samba-tool gpo manage sudoers list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
Eek   T
P-                  R4      pTP,                  ! R4      pTP/                  R4       EF1  pTP-                  R4      P0                  pTP-                  R4      P0                  pTP/                  R4      p. pT F#  pTP3                  TP/                  R4      4       K%  	  \5        T4      ^ 8  dX   RP                  T Uu. uF:  pTP6                  R,          R8X  d   TP0                  MRTP0                  ,          NK<  	  up4      pMRpTP-                  R4      RJ pT'       d   RMRpT: RT: RT: RT: 2pT P8                  P;                  RT,          4       EK4  	  RP                  TP                  4       R	TR .4      p \=        \>        P@                  TP                  T4      4      pR!pTPB                   Fv  p\E        TPF                  4      T8X  g   K  \I        TPJ                  4      PM                  4       '       g   KJ  T P8                  P;                  RTPJ                  ,          4       Kx  	  R#   \         d]   pTP                   ^ ,          \"        \$        \&        39   d	   Rp
 Rp?ELTP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; iu upi   \         d[   pTP                   ^ ,          \"        \$        \&        39   d    Rp?R# TP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)"Tr  re   rc  re  rg  rh  ri  r   rj  r{  z!SudoersConfiguration\manifest.xmlNrk  r~  r   r  r  r=  r  r  r  r  %s%%ALLr  
 NOPASSWD:rK    ALL=()r=   %s
MACHINE\Registry.pols1   Software\Policies\Samba\Unix Settings\Sudo Rights)'r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r  r  r   r   ru  r.   r/   r0   r2   r   r  findallr  extendrR   r   r   r   r   r   r   rv  r&   rl  r'   r   rP   )r   r   r  r  r  r  r|  r   ri  r  r  rk   r   r   r  r  r=  listelements
principalsr  r  uname
nopasswordnp_entryrN  r~  r  rl  s   &&&&&&                      rC   r'  cmd_list_sudoers.run*  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J : DF G	}}T]]7%;<H ]]?3F;;v&Do6**Y/44zz&)..$}}];
#/K%%k&9&9+&FG $0z?Q&HH6@&B6@ 120@F0Jaff#aff_'-6@&B CE "E"ZZ
3t;
+5<2*/xI		
+ 7" 99ekkmZ57 8
	!$))T]]8-DEH K%%E'72uzz*0022		 34 &a  
	vvay:<<> >  55" $D E E 
	.&B  	vvay:<<> > vvay33" $D E E	sC   %M< A O&
	)O+ <O#)O6(OO#+Q6'Q#(QQr)  r*  r  r  s   @rC   r  r    sq      'H 	W))w--G.. 	tW#JQTC	)M
 JK5 K5rE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tRR.tRR ltRtV tR# )cmd_remove_sudoersiw  a  Removes a Samba Sudoers Group Policy from the sysvol

This command removes a sudo rule from the sysvol from applying to winbind clients.

Example:
samba-tool gpo manage sudoers remove {31B2F340-016D-11D2-945F-00C04FB984F9} 'fakeu ALL=(ALL) NOPASSWD: ALL'
    %prog <gpo> <entry> [options]r  r  r  r  r  r  r  r  r  r   r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW0n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      p	V P                  P                  R4      p
RP                  V
P                  4       R	VR
R.4      pRP                  VR.4      p \        P                   ! \        P"                  ! VP%                  V4      4      4      pVP'                  4       P)                  R4      pVP)                  R4      pRP                  T
P                  4       R	TR.4      p \9        \:        P<                  TP%                  T4      4      p/ pT'       d   TP?                  R4      M.  EF  pTP)                  R4      P@                  pTP)                  R4      P@                  pTP?                  R4      p. pT F#  pTPC                  TP?                  R4      4       K%  	  \E        T4      ^ 8  dX   RP                  T Uu. uF:  pTPF                  R,          R8X  d   TP@                  MRTP@                  ,          NK<  	  up4      pMRpTP)                  R4      RJ pT'       d   RMRpT: RT: RT: R T: 2pTTT&   EK  	  TTPI                  4       9   d   TPK                  TT,          4       \M        4       pXPO                  TR!R R"7       TPQ                  ^ 4        \S        Y4       TPU                  TTPW                  4       4       T	PY                  R R#7       R# TT'       d'   TPZ                   Uu. uF  pTP\                  NK  	  upM. 9   dv   TPZ                   Uu. uF  pTP\                  T8w  g   K  TNK  	  pp\E        T4      Tn/        TTn-         TPU                  T\a        T4      4       T	PY                  R R#7       R# \7        R$T,          4      h  \*         d]   pTP,                  ^ ,          \.        \0        \2        39   d	   Rp Rp?ELTP,                  ^ ,          \4        8X  d   \7        R4      hh Rp?ii ; i  \*         d]   pTP,                  ^ ,          \.        \0        \2        39   d	   Rp Rp?EL2TP,                  ^ ,          \4        8X  d   \7        R4      hh Rp?ii ; iu upi   \*         d.   pTP,                  ^ ,          \4        8X  d   \7        R4      hh Rp?ii ; iu upi u upi   \*         d.   pTP,                  ^ ,          \4        8X  d   \7        R4      hh Rp?ii ; i)%Tr  re   rc  re  rg  rh  ri  r   rj  r{  r|  r}  r~  r   Nrk  r  r  r  r=  r  r  r  r  r  r  r  r  rK   r  r  r=   r  r  r  ,Cannot remove '%s' because it does not exist)1r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r2   r   r   r   r   r  r  r  rR   r   keysr   r*   r   r  r3   r   r   r  rv  r   num_entriesr   )r   r   r  r  r  r  r  r|  r   r  ri  r  r  r  r~  r   rk   r~  r  rv  r  r=  r  r  r  r  r  r  r  rN  r  s   &&&&&&&                        rC   r'  cmd_remove_sudoers.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J735 6 ))Wn56	~~bmmDMM'4J&KLH$,,.33ODM %%f-D 99ekkmZ57 8	!$))T]]8-DEH 26o.B>AffY',,G66&>&&D99]3LJ+!!+"5"5k"BC  ,:"2<">2<Q -.HHV,<,F!&&!&&#)2<"> ? 
+t3J'1|rH&+T8WEAGAJ ?" GLLN"KK')CNN3$NGHHQK%d4gsxxz2%%d%; X(8(89(81(892N"*"2"2F"2Qaffoqq"2GF#&w<H &Hh(:;%%d%; M$ % & &S  		vvay:<<> > 55" $D E E 		  		vvay:<<> >  55" $D E E 		(">& ! 66!9 77& (H I I	
 :F ! 66!9 77& (H I I	s    A)R$ -)T A U8
)=U= ?V8+V=V=#-W $T/)T(TTU5)U0(U00U5=V5(V00V5W:(W55W:r)  r*  r  r  s   @rC   r  r  w  st      /H 	W))w--G.. 	tW#JQTC	)M
 !Jh& h&rE   r  c                   Z    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   Rt	R# )cmd_sudoersi  z#Manage Sudoers Group Policy Objectsr'  r   r   r^   N)
r  r  r  r  r,  subcommandsry  r  r  r  r^   rE   rC   r  r    s1    -K(*K*,K.0KrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_set_securityi 	  a  Set Samba Security Group Policy to the sysvol

This command sets a security setting to the sysvol for applying to winbind
clients. Not providing a value will unset the policy.
These settings only apply to the ADDC.

Example:
samba-tool gpo manage security set {31B2F340-016D-11D2-945F-00C04FB984F9} MaxTicketAge 10

Possible policies:
MaxTicketAge            Maximum lifetime for user ticket
                        Defined in hours

MaxServiceAge           Maximum lifetime for service ticket
                        Defined in minutes

MaxRenewAge             Maximum lifetime for user ticket renewal
                        Defined in minutes

MinimumPasswordAge      Minimum password age
                        Defined in days

MaximumPasswordAge      Maximum password age
                        Defined in days

MinimumPasswordLength   Minimum password length
                        Defined in characters

PasswordComplexity      Password must meet complexity requirements
                        1 is Enabled, 0 is Disabled
    r`  r  r  r  r  r  r  r  r  r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW@n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      p	V P                  4        \        WP                  V P                  V P                  V4      p
V P                  P                  R4      pRP                  VP                  4       R	VR
.4      pRP                  VR.4      p \        RR7      p\         Vn        V	P%                  V4      p VP'                  \)        VP+                  4       4      4       RRRRRRRRRRRRRR/pTT,          pXP=                  T4      '       g   TP?                  T4       Te   TPA                  TY#4       MBTPC                  TT4       \E        TPG                  T4      4      ^ 8X  d   TPI                  T4       \)        4       pTPK                  T4        \M        Y4       T	PO                  T\Q        TPS                  4       4      4       T
PU                  R R7       R#   \,         d.    TP'                  \)        TP+                  R4      4      4        EL5i ; i  \.         d[   pTP0                  ^ ,          \2        8X  d   \5        R4      hTP0                  ^ ,          \6        \8        \:        39  d   h  Rp?ELRp?ii ; i  \.         d.   pTP0                  ^ ,          \2        8X  d   \5        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  z$MACHINE\Microsoft\Windows NT\SecEditzGptTmpl.infNinterpolationutf-16rk  MaxTicketAgeKerberos PolicyMaxServiceAgeMaxRenewAgeMinimumPasswordAgeSystem AccessMaximumPasswordAgeMinimumPasswordLengthPasswordComplexityr  )+r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r(   r   optionxformr   	read_filer)   rx  UnicodeDecodeErrorr   ru  r2   r   r.   r/   r0   has_sectionadd_sectionsetremove_optionrR   rH   remove_sectionr   r3   r   r&   getvaluer  )r   r   r   r@   r  r  r  r  r|  r   r  ri  inf_dirinf_fileinf_datarawrk   section_mapsectionr  s   &&&&&&&&            rC   r'  cmd_set_security.run0	  s	   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J57 899g}56	#$7H!$H --)CC""8CJJL#9: '):'*;%(9,,//, f%##G,,  )LL&0""7F38##G,-2''0js		!$0MM(Iclln$=>!!$!7G & C""8CJJx,@#ABC 	vvay33" $D E Evvay!>!@!@!B B B		D  	vvay33" $D E E 	sP   (K) (J. &AM .4K&"K) %K&&K) )M4AM		MN	(NN	r)  )r   r   value?r  r  r  s   @rC   r  r   	  sp     @ 'H 	W))w--G.. 	tW#JQTC	)M
 -JI IrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_securityi{	  a  List Samba Security Group Policy from the sysvol

This command lists security settings from the sysvol that will be applied to winbind clients.
These settings only apply to the ADDC.

Example:
samba-tool gpo manage security list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
.4      p	 \        RR7      p
\        V
n        VP                  V	4      p V
P!                  \#        VP%                  4       4      4       T
P7                  4        FI  pTR9  d   K  T
P9                  T4       F(  w  rT P:                  P=                  T: RT: R24       K*  	  KK  	  R#   \&         d-    T
P!                  \#        TP%                  R4      4      4        Li ; i  \(         d[   pTP*                  ^ ,          \,        \.        \0        39   d    Rp?R# TP*                  ^ ,          \2        8X  d   \5        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  z0MACHINE\Microsoft\Windows NT\SecEdit\GptTmpl.infNr  r  rk   = r$  )r  r  )r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r(   r   r  r   r  r)   rx  r  r   ru  r.   r/   r0   r2   r   sectionsr  r   r   )r   r   r  r  r  r  r|  r   ri  r  r  r  rk   r  r   r@   s   &&&&&&          rC   r'  cmd_list_security.run	  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$99ekkmZBD E	#$7H!$H --)CC""8CJJL#9:  ((*GBB&nnW5
		sE :; 6 + & C""8CJJx,@#ABC 	vvay:<<> > vvay33" $D E E	s<   (G: 9(G   4G74G: 6G77G: :I'I2(IIr)  r*  r  r  s   @rC   r  r  {	  so      'H 	W))w--G.. 	tW#JQTC	)M
 J+< +<rE   r  c                   F    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   RtR# )cmd_securityi	  z$Manage Security Group Policy Objectsr  r   r^   N)	r  r  r  r  r,  r  r  r  r  r^   rE   rC   r  r  	  s$    .K)+K+-KrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_smb_confi	  zList Samba smb.conf Group Policy from the sysvol

This command lists smb.conf settings from the sysvol that will be applied to winbind clients.

Example:
samba-tool gpo manage smb_conf list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
.4      p	 \        \        P                  VP                  V	4      4      p
Rp\.        P0                  ! 4       pT
P2                   F  p\5        TP6                  4      T8X  g   K  TP9                  TP:                  \=        TP>                  4      4       TP                  TP:                  4      pT P@                  PC                  TP:                  : RT: R24       K  	  R#   \          d[   pTP"                  ^ ,          \$        \&        \(        39   d    Rp?R# TP"                  ^ ,          \*        8X  d   \-        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  r  Nrk      Software\Policies\Samba\smb_confr  r$  )"r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r   r   r   r   r   ru  r.   r/   r0   r2   r   r$   LoadParmrv  r&   rl  r  rm  r   r   r   r   )r   r   r  r  r  r  r|  r   ri  r~  r  rk   rl  rg   r  r  s   &&&&&&          rC   r'  cmd_list_smb_conf.run	  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$99ekkmZ 79 :
	!$))T]]8-DEH 9^^%%E'72uEJJ8ffU__-		u DE	 &  	vvay:<<> > vvay33" $D E E	s   )G8 8I'I0(IIr)  r*  r  r  s   @rC   r  r  	  sq      'H 	W))w--G.. 	tW#JQTC	)M
 J'F 'FrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_set_smb_confi
  a%  Sets a Samba smb.conf Group Policy to the sysvol

This command sets an smb.conf setting to the sysvol for applying to winbind
clients. Not providing a value will unset the policy.

Example:
samba-tool gpo manage smb_conf set {31B2F340-016D-11D2-945F-00C04FB984F9} 'apply gpo policies' yes
    r  r  r  r  r  r  r  r  r  r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW@n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      p	V P                  4        \        WP                  V P                  V P                  V4      p
V P                  P                  R4      pRP                  VP                  4       R	VR
.4      pRP                  VR.4      p \        \         P"                  V	P%                  V4      4      pTf   Y.P4                   Uu. uF  qP6                  NK  	  up9  d   \3        RT,          4      hTP4                   Uu. uF  pTP6                  T8w  g   K  TNK  	  ppTTn        \9        T4      Tn        EM \=        T4      P                  4       R9   d   ^p^pMf\=        T4      P                  4       R9   d   ^p^ pMC\=        T4      P?                  4       '       d   ^p\A        \=        T4      4      pM^p\C        T4      p\         PD                  ! 4       pRTn#        \C        T4      Tn        TTn$        TTn%        \M        TP4                  4      pTPO                  T4       TTn        \9        T4      Tn         \Q        Y4       T	PS                  T\U        T4      4       T
PW                  R R7       R#   \&         dp   pTP(                  ^ ,          \*        \,        \.        39   d   \         P"                  ! 4       p Rp?ELTP(                  ^ ,          \0        8X  d   \3        R4      hh Rp?ii ; iu upi u upi   \&         d.   pTP(                  ^ ,          \0        8X  d   \3        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  rq  zRegistry.polrk  Nr  r  r  )yesr  r  )nofalser"  ),r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r   r   r   r   r   ru  r.   r/   r0   r2   r   rv  rm  rR   r  r'   	isnumericrV   r&   r  rl  r  r   r   rU   r3   r   r   r  )r   r   settingr@   r  r  r  r  r|  r   r  ri  pol_dirr~  r  rk   rv  etyper  s   &&&&&&&&           rC   r'  cmd_set_smb_conf.run!
  s\   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]JYGH99g~67	!$))T]]8-DEH =4D4DE4Dq{{4DEE" $029$: ; ;"*"2"2 +"2Q;;') q"2G +&H#&w<H % &&(,@@E"((*.BBE",,..*U+,&

A>AI#G,AKAFAF8++,GNN1&H#&w<H 	!$0MM(HX$67!!$!7[  		vvay:<<> >  99;55" $D E E 		 F+>  	vvay33" $D E E		sH   )M	 OO-O8O 	O<N>(N>>OP(PPr)  r   r  r  r  r  r  s   @rC   r  r  
  so      /H 	W))w--G.. 	tW#JQTC	)M
 .JM MrE   r  c                   F    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   RtR# )cmd_smb_confip
  z$Manage smb.conf Group Policy Objectsr   r  r^   N)	r  r  r  r  r,  r  r  r  r  r^   rE   rC   r  r  p
  s$    .K+-K)+KrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_symlinkiv
  zList VGP Symbolic Link Group Policy from the sysvol

This command lists symlink settings from the sysvol that will be applied to winbind clients.

Example:
samba-tool gpo manage symlink list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc                j   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
P-                  R4      pTP,                  ! R4      pTP/                  R4       F]  pTP-                  R4      pTP-                  R4      pT P0                  P3                  RTP4                  : RTP4                  : R24       K_  	  R#   \         d[   pTP                   ^ ,          \"        \$        \&        39   d    Rp?R# TP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  MACHINE\VGP\VTLA\UnixzSymlink\manifest.xmlNrk  r~  r   file_propertiessourcetargetzln -s r=   r$  r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r  r  r   r   ru  r.   r/   r0   r2   r   r  r  r   r   r  )r   r   r  r  r  r  r|  r   ri  r  r  rk   r   r   r  r  r  s   &&&&&&           rC   r'  cmd_list_symlink.run
  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J : 79 :
	}}T]]7%;<H /{{6"#||,=>O$))(3F$))(3FIIOOv{{FKKHI  ?  	vvay:<<> > vvay33" $D E E	s   %G H2'H-(H--H2r)  r*  r  r  s   @rC   r  r  v
  sq      'H 	W))w--G.. 	tW#JQTC	)M
 J'J 'JrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_add_symlinki
  zAdds a VGP Symbolic Link Group Policy to the sysvol

This command adds a symlink setting to the sysvol that will be applied to winbind clients.

Example:
samba-tool gpo manage symlink add {31B2F340-016D-11D2-945F-00C04FB984F9} /tmp/source /tmp/target
    '%prog <gpo> <source> <target> [options]r  r  r  r  r  r  r  r  r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW@n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      p	V P                  4        \        WP                  V P                  V P                  V4      p
V P                  P                  R4      pRP                  VP                  4       R	VR
.4      pRP                  VR.4      p \        P                   ! \        P"                  ! V	P%                  V4      4      4      pVP'                  4       P)                  R4      pVP(                  ! R4      p\        P6                  ! TR4      p\        P6                  ! TR4      pTTn        \        P6                  ! TR4      pTTn        \?        4       pTPA                  TRR R7       TPC                  ^ 4        \E        Y4       T	PG                  TTPI                  4       4       T
PK                  R R7       R#   \*         Ed   pTP,                  ^ ,          \.        \0        \2        39   d   \        P                   ! \        P4                  ! R4      4      p\        P6                  ! TP'                  4       R4      p\        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      p Rp?ELTP,                  ^ ,          \:        8X  d   \=        R4      hh Rp?ii ; i  \*         d.   pTP,                  ^ ,          \:        8X  d   \=        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  MACHINE\VGP\VTLA\Unix\Symlinkr}  r~  r   r  r  r  rv   zSymlink Policyr  zSpecifies symbolic link datark  Nr  r  r  r  r  r  )&r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r  r  r  r2   r   r*   r   r  r3   r   r   r  )r   r   r  r  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r~  r  rv   r  r  
source_elm
target_elmr  s   &&&&&&&&                  rC   r'  cmd_add_symlink.run
  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J@B C))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D, --.?@]]?H=
 
]]?H=
 
isWdC	!$0MM'388:.!!$!7C  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;,	 mmM=I#A }}]F;55" $D E E '	D  	vvay33" $D E E		s8   A*J =N4 N1C'N,(N,,N14O,?(O''O,r)  r   r  r  r*  r  r  s   @rC   r  r  
  so      9H 	W))w--G.. 	tW#JQTC	)M
 -JD DrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_remove_symlinki  a  Removes a VGP Symbolic Link Group Policy from the sysvol

This command removes a symlink setting from the sysvol from applying to winbind
clients.

Example:
samba-tool gpo manage symlink remove {31B2F340-016D-11D2-945F-00C04FB984F9} /tmp/source /tmp/target
    r  r  r  r  r  r  r  r  r  r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW@n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      p	V P                  4        \        WP                  V P                  V P                  V4      p
V P                  P                  R4      pRP                  VP                  4       R	VR
.4      pRP                  VR.4      p \        P                   ! \        P"                  ! V	P%                  V4      4      4      pVP'                  4       P)                  R4      pVP(                  ! R4      pTP9                  R4       F\  pTP)                  R4      pTP)                  R4      pTP:                  T8X  g   K8  TP:                  T8X  g   KK  TP=                  T4        M	  \5        RT,          T4      h\?        4       pTPA                  TRR R7       TPC                  ^ 4        \E        Y4       T	PG                  TTPI                  4       4       T
PK                  R R7       R#   \*         dh   pTP,                  ^ ,          \.        \0        \2        39   d   \5        RT,          T4      hTP,                  ^ ,          \6        8X  d   \5        R4      hh Rp?ii ; i  \*         d.   pTP,                  ^ ,          \6        8X  d   \5        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  r  r}  r~  r   z>Cannot remove link from '%s' to '%s' because it does not existrk  Nr  r  r  r  r  r  )&r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r   r2   r  r  r   r*   r   r  r3   r   r   r  )r   r   r  r  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r  r  r  r  s   &&&&&&&&              rC   r'  cmd_remove_symlink.run.  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J@B C))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D  $||,=>O(--h7J(--h7J&(Z__-FO,  ?   ;=C DEKM M isWdC	!$0MM'388:.!!$!7;  
	vvay:<<> > # $028$9:@B B55" $D E E 
	<  	vvay33" $D E E		s2   A*J< ==L1 <L.A"L))L.1M)<(M$$M)r)  r  r*  r  r  s   @rC   r  r    so      9H 	W))w--G.. 	tW#JQTC	)M
 -J@ @rE   r  c                   Z    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   Rt	R# )cmd_symlinkip  z#Manage symlink Group Policy Objectsr   r'  r   r^   N)
r  r  r  r  r,  r  r  r  r  r  r^   rE   rC   r  r  p  s1    -K*,K(*K.0KrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_filesiw  zList VGP Files Group Policy from the sysvol

This command lists files which will be copied from the sysvol and applied to winbind clients.

Example:
samba-tool gpo manage files list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc           
     $   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
P-                  R4      pTP,                  ! R4      pTP/                  R4       F  pTP-                  R4      P0                  pTP-                  R4      P0                  pTP-                  R4      P0                  pTP-                  R4      P0                  p\3        T4      p\5        T4      : RT: RT: RT: RT: 2	pT P6                  P9                  RT,          4       K  	  R#   \         d[   pTP                   ^ ,          \"        \$        \&        39   d    Rp?R# TP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  r  zFiles\manifest.xmlNrk  r~  r   r  r  r  r=  r  	z -> r  )r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r  r  r   r   ru  r.   r/   r0   r2   r   r  r  r  r+   r,   r   r   )r   r   r  r  r  r  r|  r   ri  r  r  rk   r   r   r  r  r  r=  r  moderN  s   &&&&&&               rC   r'  cmd_list_files.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J : 57 8
	}}T]]7%;<H /{{6"\\"34EZZ)..FZZ)..F::f%**DJJw',,EU#D#D)4HAIIOOFQJ' 5  	vvay:<<> > vvay33" $D E E	s   %H* *J5'J
"(J

Jr)  r*  r  r  s   @rC   r  r  w  so      'H 	W))w--G.. 	tW#JQTC	)M
 J,( ,(rE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_add_filesi  a  Add VGP Files Group Policy to the sysvol

This command adds files which will be copied from the sysvol and applied to winbind clients.

Example:
samba-tool gpo manage files add {31B2F340-016D-11D2-945F-00C04FB984F9} ./source.txt /usr/share/doc/target.txt root root 600
    z=%prog <gpo> <source> <target> <user> <group> <mode> [options]r  r  r  r  r  r  r  r  r  Nc                   VP                  4       V n        V	P                  V P                  R R7      V n        \        P
                  P                  V4      '       g   \        RV,          4      hV'       d(   VP                  R4      '       d   VR,          pWpn	        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n	        \        VRV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      pV P                  P!                  R4      pR	P#                  VP%                  4       R
VR.4      pR	P#                  VR.4      p \&        P(                  ! \&        P*                  ! VP-                  V4      4      4      pVP/                  4       P1                  R4      pVP0                  ! R4      p\&        P>                  ! TR4      p\&        P>                  ! TR4      p\        P
                  PE                  T4      Tn         \&        P>                  ! TR4      pTTn         \&        P>                  ! TR4      pTTn         \&        P>                  ! TR4      pTTn         R& F  w  pp\&        P>                  ! TR4      p T PG                  RT4       \I        T^4      ^T,          ,          '       d   \&        P>                  ! T R4       \I        T^4      ^T,          ,          '       d   \&        P>                  ! T R 4       \I        T^4      ^T,          ,          '       g   K  \&        P>                  ! T R!4       K  	  \K        4       p!TPM                  T!R"R R#7       T!PO                  ^ 4       \Q        TR$4      ;_uu_ 4       p"T"PS                  4       p#RRR4       R	P#                  T\        P
                  PE                  T4      .4      p$ \U        Y4       TPW                  TT!PS                  4       4       TPW                  T$X#4       TPY                  R R%7       R#   \2         Ed   pTP4                  ^ ,          \6        \8        \:        39   d   \&        P(                  ! \&        P<                  ! R4      4      p\&        P>                  ! TP/                  4       R4      p\&        P>                  ! TR4      pRTn         \&        P>                  ! TR4      pRTn         \&        P>                  ! TR4      pRTn         \&        P>                  ! TR4      p Rp?EL_TP4                  ^ ,          \B        8X  d   \        R4      hh Rp?ii ; i  + '       g   i     EL; i  \2         d.   pTP4                  ^ ,          \B        8X  d   \        R4      hh Rp?ii ; i)'Tr  zSource '%s' does not existre   rc  re  rg  rh  ri  r   rj  MACHINE\VGP\VTLA\Unix\Filesr}  r~  r   r  r  r  rv   Filesr  z+Represents file data to set/copy on clientsrk  Nr  r  r  r=  r  permissionsr  r   r   executer  r  r   r  ))r=     )r     )otherr   )-r%  rg   r&  rh   r   r   r  r   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r  r  r  r2   r  r  rV   r*   r   r  r   r   r3   r   r  )%r   r   r  r  r=  r  r  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r~  r  rv   r  r  r  r  r  	group_elmptypeshiftr%  r  r   source_datasysvol_sources%   &&&&&&&&&&&                          rC   r'  cmd_add_files.run  se   ((*--dgg-M
ww~~f%%;fDEE i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J>@ A))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D, --.?@]]?H=
''**62
]]?H=
 
==&9MM/7;		ELE5--GKOOFE*4|se|,,k624|se|,,k734|se|,,k95 F isWdC&$1&&(K  		7BGG,<,<V,D"EF		!$0MM'388:.MM-5!!$!7e  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;#	 mmM=I#P }}]F;55" $D E E '	V    	vvay33" $D E E		sE   A*Q& VAV# &V2C'V(VVV 	#W.(WWr)  )r   r  r  r=  r  r  r*  r  r  s   @rC   r!  r!    sq      OH 	W))w--G.. 	tW#JQTC	)M
 FJX XrE   r!  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tRR.tRR ltRtV tR# )cmd_remove_filesi/  a  Remove VGP Files Group Policy from the sysvol

This command removes files which would be copied from the sysvol and applied to winbind clients.

Example:
samba-tool gpo manage files remove {31B2F340-016D-11D2-945F-00C04FB984F9} /usr/share/doc/target.txt
    z%prog <gpo> <target> [options]r  r  r  r  r  r  r  r  r  r   r  Nc                
   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW0n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      p	V P                  P                  R4      p
RP                  V
P                  4       R	VR
.4      pRP                  VR.4      p \        P                   ! \        P"                  ! VP%                  V4      4      4      pVP'                  4       P)                  R4      pVP(                  ! R4      pTP9                  R4       Fw  pTP)                  R4      pTP)                  R4      pTP:                  T8X  g   K8  RP                  TTP:                  .4      pTP=                  T4       TP?                  T4        M	  \5        RT,          4      h\A        4       pTPC                  TRR R7       TPE                  ^ 4        \G        Y4       TPI                  TTPK                  4       4       T	PM                  R R7       R#   \*         dg   pTP,                  ^ ,          \.        \0        \2        39   d   \5        RT,          4      hTP,                  ^ ,          \6        8X  d   \5        R4      hh Rp?ii ; i  \*         d.   pTP,                  ^ ,          \6        8X  d   \5        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  r#  r}  r~  r   z1Cannot remove file '%s' because it does not existrk  Nr  r  r  r  r  r  )'r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r   r2   r  r  unlinkr   r*   r   r  r3   r   r   r  )r   r   r  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r  r  r  r  r  s   &&&&&&&               rC   r'  cmd_remove_files.runG  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J>@ A))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D  $||,=>O(--h7J(--h7J&(GZ__#=>F#O,  ?   ;=C D E E isWdC	!$0MM'388:.!!$!7?  
	vvay:<<> > # $028$9 : :55" $D E E 
	@  	vvay33" $D E E		s2   A*K =M
 M!A!MM
N(M==Nr)  r*  r  r  s   @rC   r1  r1  /  st      0H 	W))w--G.. 	tW#JQTC	)M
 "JB BrE   r1  c                   Z    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   Rt	R# )	cmd_filesi  z!Manage Files Group Policy Objectsr   r'  r   r^   N)
r  r  r  r  r,  r  r  r!  r1  r  r^   rE   rC   r6  r6    s0    +K(*K&K,.KrE   r6  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_opensshi  zList VGP OpenSSH Group Policy from the sysvol

This command lists openssh options from the sysvol that will be applied to winbind clients.

Example:
samba-tool gpo manage openssh list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc           	        VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
P-                  R4      pTP,                  ! R4      pTP-                  R4      pTP/                  R4       F  pTP-                  R4      P0                  '       d   K&  TP/                  R4       FX  pT P2                  P5                  TP-                  R4      P0                  : RTP-                  R4      P0                  : R24       KZ  	  K  	  R#   \         d[   pTP                   ^ ,          \"        \$        \&        39   d    Rp?R# TP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  zMACHINE\VGP\VTLA\SshCfgzSshD\manifest.xmlNrk  r~  r   
configfileconfigsectionsectionnamekeyvaluepairr   r=   r@   r$  r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r  r  r   r   ru  r.   r/   r0   r2   r   r  r  r  r   r   )r   r   r  r  r  r  r|  r   ri  r  r  rk   r   r   r:  r;  kvs   &&&&&&           rC   r'  cmd_list_openssh.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J < 46 7
	}}T]]7%;<H /{{6"YY|,
'//@M!!-0555#++N;		RWWU^-@-@-/WWW-=-B-B!D E < A  	vvay:<<> > vvay33" $D E E	s   %H I9'I4(I44I9r)  r*  r  r  s   @rC   r8  r8    sq      'H 	W))w--G.. 	tW#JQTC	)M
 J*E *ErE   r8  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_set_opensshi  a"  Sets a VGP OpenSSH Group Policy to the sysvol

This command sets an openssh setting to the sysvol for applying to winbind
clients. Not providing a value will unset the policy.

Example:
samba-tool gpo manage openssh set {31B2F340-016D-11D2-945F-00C04FB984F9} KerberosAuthentication Yes
    z'%prog <gpo> <setting> [value] [options]r  r  r  r  r  r  r  r  r  Nc                R   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW@n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      p	V P                  4        \        WP                  V P                  V P                  V4      p
V P                  P                  R4      pRP                  VP                  4       R	VR
.4      pRP                  VR.4      p \        P                   ! \        P"                  ! V	P%                  V4      4      4      pVP'                  4       P)                  R4      pVP(                  ! R4      pVP)                  R4      pTe   TP?                  R4       F  pTP)                  R4      P8                  '       d   K&  / pTP?                  R4       F  pTTTP)                  R4      &   K  	  TTPA                  4       9   d   TTT,          n        Ky  \        P6                  ! TR4      p\        P6                  ! TR4      pTTn        \        P6                  ! TR4      pTTn        K  	  MTP?                  R4       F  pTP)                  R4      P8                  '       d   K&  / pTP?                  R4       F!  pTTTP)                  R4      P8                  &   K#  	  TTPA                  4       9   d   TPC                  TT,          4       K  \=        RT,          4      h	  \E        4       pTPG                  TR R R!7       TPI                  ^ 4        \K        Y4       T	PM                  TTPO                  4       4       T
PQ                  R R"7       R#   \*         Ed   pTP,                  ^ ,          \.        \0        \2        39   Ed*   \        P                   ! \        P4                  ! R4      4      p\        P6                  ! TP'                  4       R4      p\        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      pRTn        \        P6                  ! TR4      p\        P6                  ! TR4      p\        P6                  ! TR4      p\        P6                  ! TR4        Rp?ELdTP,                  ^ ,          \:        8X  d   \=        R4      hh Rp?ii ; i  \*         d.   pTP,                  ^ ,          \:        8X  d   \=        R4      hh Rp?ii ; i)#Tr  re   rc  re  rg  rh  ri  r   rj  zMACHINE\VGP\VTLA\SshCfg\SshDr}  r~  r   r:  r  r  r  rv   zConfiguration Filer  z+Represents Unix configuration file settingsr  r  r;  r<  rk  Nr=  r   r@   r  r  r  r  ))r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r  r  r  r2   r   r  r  r   r*   r   r  r3   r   r   r  )r   r   r  r@   r  r  r  r  r|  r   r  ri  r  r  r  r   r   r:  rk   r~  r  rv   r  r  r;  settingsr?  r=  r   dvaluer  s   &&&&&&&&                       rC   r'  cmd_set_openssh.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J?A B))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D<0J6 !+!3!3O!D %%m4999'//?B/1HRWWU^, @hmmo--2HW%*#%==#OL--e<C&CH]]<AF"'FK "E ",!3!3O!D %%m4999'//?B46HRWWU^001 @hmmo-!(('):;& (35<(= > > "E isWdC	!$0MM'388:.!!$!7y  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;0	 mmM=I#P ]]=,G
")
}}]F;]]4>
 "j/ Jm];;55" $D E E 1	z  	vvay33" $D E E		s8   A;O! "=U. !U+-EU&>(U&&U+.V&9(V!!V&r)  r  r  r  r  s   @rC   rB  rB    so      9H 	W))w--G.. 	tW#JQTC	)M
 .J` `rE   rB  c                   F    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   RtR# )cmd_opensshiQ  z#Manage OpenSSH Group Policy Objectsr   r  r^   N)	r  r  r  r  r,  r  r8  rB  r  r^   rE   rC   rH  rH  Q  s$    -K*,K(*KrE   rH  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_startupiW  zList VGP Startup Script Group Policy from the sysvol

This command lists the startup script policies currently set on the sysvol.

Example:
samba-tool gpo manage scripts startup list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc           
        VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
P-                  R4      pTP,                  ! R4      pTP/                  R4       F  pTP-                  R4      pRP                  RTP                  4       R	TRRTP0                  .4      pTP-                  R4      pTP-                  R4      pTe   TP0                  pMRpTe   TP0                  pMRpT P2                  P5                  RT: RT: RT: R24       K  	  R#   \         d[   pTP                   ^ ,          \"        \$        \&        39   d    Rp?R# TP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  r  zScripts\Startup\manifest.xmlNrk  r~  r   r  scriptzMACHINE\VGP\VTLA\Unix\ScriptsStartup
parametersrun_asrootrK   z@reboot r=   r$  r>  )r   r   r  r  r  r  r|  r   ri  r  r  rk   r   r   r  rL  script_pathrN  rO  s   &&&&&&             rC   r'  cmd_list_startup.runo  s"   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J : @B C
	}}T]]7%;<H /{{6"<<6K %%h/F))T5;;=*c%H%.%= >K %)),7J %%h/F!%'__

IIOOFK2<> ? 7  	vvay:<<> > vvay33" $D E E	s   %H$ $J	/'J(JJ	r)  r*  r  r  s   @rC   rJ  rJ  W  so      'H 	W))w--G.. 	tW#JQTC	)M
 J4? 4?rE   rJ  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      ]! RRRRRR7      .t. ROtRR ltRtV tR# )cmd_add_startupi  zAdds VGP Startup Script Group Policy to the sysvol

This command adds a startup script policy to the sysvol.

Example:
samba-tool gpo manage scripts startup add {31B2F340-016D-11D2-945F-00C04FB984F9} test_script.sh '\-n \-p all'
    z.%prog <gpo> <script> [args] [run_as] [options]r  r  r  r  r  r  r  r  r  z
--run-oncerun_onceFr  z#Whether to run the script only oncer  Nc
                   VP                  4       V n        VP                  V P                  R R7      V n        \        P
                  P                  V4      '       g   \        RV,          4      hV'       d(   VP                  R4      '       d   VR,          p
W`n	        MG\        V P                  V P                  4      p
\        V P                  V P                  V
R7      V n	        \        V
RV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      pV P                  P!                  R4      pR	P#                  VP%                  4       R
VR.4      pR	P#                  VR.4      p \&        P(                  ! \&        P*                  ! VP-                  V4      4      4      pVP/                  4       P1                  R4      pVP0                  ! R4      p\E        TR4      ;_uu_ 4       pTPG                  4       pRRR4       \&        P>                  ! TR4      p\&        P>                  ! TR4      p\        P
                  PI                  T4      Tn         \&        P>                  ! TR4      p\J        PL                  ! X4      PO                  4       PQ                  4       Tn         TeM   \&        P>                  ! TR4      pTPS                  R4      PS                  R4      PU                  RR 4      Tn         Te   \&        P>                  ! TR!4      pTTn         T'       d   \&        P>                  ! TR"4       \W        4       pTPY                  TR#R R$7       TP[                  ^ 4       R	P#                  T\        P
                  PI                  T4      .4      p  \]        Y4       TP_                  TTPG                  4       4       TP_                  T T4       TPa                  R R%7       R#   \2         Ed   pTP4                  ^ ,          \6        \8        \:        39   d   \&        P(                  ! \&        P<                  ! R4      4      p\&        P>                  ! TP/                  4       R4      p\&        P>                  ! TR4      pRTn         \&        P>                  ! TR4      pRTn         \&        P>                  ! TR4      pRTn         \&        P>                  ! TR4      p Rp?ELTP4                  ^ ,          \B        8X  d   \        R4      hh Rp?ii ; i  + '       g   i     EL; i  \2         d.   pTP4                  ^ ,          \B        8X  d   \        R4      hh Rp?ii ; i)&Tr  zScript '%s' does not existre   rc  re  rg  rh  ri  r   rj  %MACHINE\VGP\VTLA\Unix\Scripts\Startupr}  r~  r   r  r  r  rv   zUnix Scriptsr  z6Represents Unix scripts to run on Group Policy clientsrk  Nr   r  rL  hashrN  "rI  z\--rO  rU  r  r  r  )1r%  rg   r&  rh   r   r   r  r   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r  r  r  r2   r   r   r  hashlibmd5	hexdigestr#  rP   r  r*   r   r  r3   r   r  )!r   r   rL  ru  rO  rU  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r~  r  rv   r  r   script_datar  
script_elmrX  rN  
run_as_elmr  sysvol_scripts!   &&&&&&&&&&                       rC   r'  cmd_add_startup.run  s&   ((*--dgg-M
ww~~f%%;fDEE i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]JIK L))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D. &$1&&(K  mmD-8]];9
''**62
}}[&1KK,668>>@	{LAJ"jjo33C8@@LJO{H=J$JOMM+z2isWdC		7BGG,<,<V,D"EF		!$0MM'388:.MM-5!!$!7]  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;*	 mmM=IL  }}]F;55" $D E E )	,  2  	vvay33" $D E E		sE   A*P T8>AU T5C'T0(T00T58U		V(U??Vr)  )r   rL  zargs?zrun_as?r  r  r  s   @rC   rT  rT    s      @H 	W))w--G.. 	tW#JQTC	)|*eL9	;M 7JT TrE   rT  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tRR.tRR ltRtV tR# )cmd_remove_startupi  zRemoves VGP Startup Script Group Policy from the sysvol

This command removes a startup script policy from the sysvol.

Example:
samba-tool gpo manage scripts startup remove {31B2F340-016D-11D2-945F-00C04FB984F9} test_script.sh
    z%prog <gpo> <script> [options]r  r  r  r  r  r  r  r  r  r   rL  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW0n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      p	V P                  P                  R4      p
RP                  V
P                  4       R	VR
.4      pRP                  VR.4      p \        P                   ! \        P"                  ! VP%                  V4      4      4      pVP'                  4       P)                  R4      pVP(                  ! R4      pTP9                  R4       Fe  pTP)                  R4      pTP:                  \<        P>                  PA                  TPC                  RR4      4      8X  g   KT  TPE                  T4        M	  \5        RT,          4      h\G        4       pTPI                  TRR R7       TPK                  ^ 4        \M        Y4       TPO                  TTPQ                  4       4       T	PS                  R R7       R#   \*         dg   pTP,                  ^ ,          \.        \0        \2        39   d   \5        RT,          4      hTP,                  ^ ,          \6        8X  d   \5        R4      hh Rp?ii ; i  \*         d.   pTP,                  ^ ,          \6        8X  d   \5        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  rW  r}  r~  r   z3Cannot remove script '%s' because it does not existrk  Nr  rL  r   r  r  r  )*r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r   r2   r  r  r   r   r  r  r   r*   r   r  r3   r   r   r  )r   r   rL  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r  r_  r  s   &&&&&&&             rC   r'  cmd_remove_startup.run-  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]JIK L))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D  <<6K$))(3J"''"2"26>>$3L"MMK(	 7   ,.4 5 6 6 isWdC	!$0MM'388:.!!$!77  
	vvay:<<> > # $028$9 : :55" $D E E 
	8  	vvay33" $D E E		s2   A*K =L8 L5A!L00L58M0(M++M0r)  r*  r  r  s   @rC   rd  rd    sr      0H 	W))w--G.. 	tW#JQTC	)M
 "J> >rE   rd  c                   Z    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   Rt	R# )cmd_startupim  z+Manage Startup Scripts Group Policy Objectsr   r'  r   r^   N)
r  r  r  r  r,  r  rJ  rT  rd  r  r^   rE   rC   rh  rh  m  s1    5K*,K(*K.0KrE   rh  c                   2    ] tR tRtRt/ t]! 4       ]R&   RtR# )cmd_scriptsit  z#Manage Scripts Group Policy Objectsstartupr^   N)r  r  r  r  r,  r  rh  r  r^   rE   rC   rj  rj  t  s    -K(]K	rE   rj  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_motdiy  zList VGP MOTD Group Policy from the sysvol

This command lists the Message of the Day from the sysvol that will be applied
to winbind clients.

Example:
samba-tool gpo manage motd list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
P-                  R4      pTP,                  ! R4      pTP-                  R4      pTe8   TP.                  e(   T P0                  P3                  TP.                  4       R# R# R#   \         d[   pTP                   ^ ,          \"        \$        \&        39   d    Rp?R# TP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  r  zMOTD\manifest.xmlNrk  r~  r   r  )r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r  r  r   r   ru  r.   r/   r0   r2   r   r  r  r   r   r   r   r  r  r  r  r|  r   ri  r  r  rk   r   r   r  s   &&&&&&         rC   r'  cmd_list_motd.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J : 46 7
	}}T]]7%;<H /{{6"yy yy$				* %   	vvay:<<> > vvay33" $D E E	s   %F' 'H2'H(HHr)  r*  r  r  s   @rC   rm  rm  y  so      'H 	W))w--G.. 	tW#JQTC	)M
 J'+ '+rE   rm  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tRR.tRR ltRtV tR# )cmd_set_motdi  a  Sets a VGP MOTD Group Policy to the sysvol

This command sets the Message of the Day to the sysvol for applying to winbind
clients. Not providing a value will unset the policy.

Example:
samba-tool gpo manage motd set {31B2F340-016D-11D2-945F-00C04FB984F9} "Message for today"
    %prog <gpo> [value] [options]r  r  r  r  r  r  r  r  r  r   r  Nc                h   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW0n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      p	V P                  P                  R4      p
RP                  V
P                  4       R	VR
.4      pRP                  VR.4      pVf&   VP                  V4       V	P!                  R R7       R#  \"        P$                  ! \"        P&                  ! VP)                  V4      4      4      pVP+                  4       P-                  R4      pVP-                  R4      pTP-                  R4      pTf   \"        P:                  ! TR4      pTTn        \C        4       pTPE                  TRR R7       TPG                  ^ 4        \I        Y4       TPK                  TTPM                  4       4       T	P!                  R R7       R#   \.         EdX   pTP0                  ^ ,          \2        \4        \6        39   Ed   \"        P$                  ! \"        P8                  ! R4      4      p\"        P:                  ! TP+                  4       R4      p\"        P:                  ! TR4      pRTn        \"        P:                  ! TR4      pRTn        \"        P:                  ! TR4      pRTn        \"        P:                  ! TR4      pRTn        \"        P:                  ! TR4      p\"        P:                  ! TR4      pRTn         Rp?ELTP0                  ^ ,          \>        8X  d   \A        R4      hh Rp?ii ; i  \.         d.   pTP0                  ^ ,          \>        8X  d   \A        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  zMACHINE\VGP\VTLA\Unix\MOTDr}  Nr  r~  r   r  r  r  rv   	Text Filer  Represents a Generic Text Filer  r  filenamemotdrk  r  r  r  )'r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r3  r  r  r  r  r   r  r  r   ru  r.   r/   r0   r  r  r  r2   r   r*   r   r  r3   r   r   )r   r   r@   r  r  r  r  r|  r   r  ri  r  r  r  r~  r   rk   r  rv   r  r  rw  r  r  s   &&&&&&&                 rC   r'  cmd_set_motd.run  sR   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J=? @))Wn56=KK !!$!7	~~bmmDMM'4J&KLH$,,.33ODM %%f-D4 yy <==v.D	isWdC	!$0MM'388:.!!$!7I  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;'	 mmM=I#C ]]=,G
"+
}}]F;==z: &55" $D E E /	J  	vvay33" $D E E		s8   A)J =O9 O6D$O1	(O11O69P1(P,,P1r)  r  r  r  s   @rC   rr  rr    st      /H 	W))w--G.. 	tW#JQTC	)M
 "JM MrE   rr  c                   F    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   RtR# )cmd_motdi#  z.Manage Message of the Day Group Policy Objectsr   r  r^   N)	r  r  r  r  r,  r  rm  rr  r  r^   rE   rC   r{  r{  #  s"    8K'/K%KrE   r{  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_issuei)  zList VGP Issue Group Policy from the sysvol

This command lists the Prelogin Message from the sysvol that will be applied
to winbind clients.

Example:
samba-tool gpo manage issue list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
P-                  R4      pTP,                  ! R4      pTP-                  R4      pT P.                  P1                  TP2                  4       R#   \         d[   pTP                   ^ ,          \"        \$        \&        39   d    Rp?R# TP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  r  zIssue\manifest.xmlNrk  r~  r   r  )r%  rg   r&  rh   rS   ri   r   rl   r4   rt  r?   r   r  r  r   r   ru  r.   r/   r0   r2   r   r  r   r   r  ro  s   &&&&&&         rC   r'  cmd_list_issue.runB  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J : 57 8
	}}T]]7%;<H /{{6"yy 				"  	vvay:<<> > vvay33" $D E E	s   %F G6'G1	(G11G6r)  r*  r  r  s   @rC   r}  r}  )  so      'H 	W))w--G.. 	tW#JQTC	)M
 J%# %#rE   r}  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tRR.tRR ltRtV tR# )cmd_set_issueii  a  Sets a VGP Issue Group Policy to the sysvol

This command sets the Prelogin Message to the sysvol for applying to winbind
clients. Not providing a value will unset the policy.

Example:
samba-tool gpo manage issue set {31B2F340-016D-11D2-945F-00C04FB984F9} "Welcome to Samba!"
    rs  r  r  r  r  r  r  r  r  r  r   r  Nc                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW0n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  4        \        WP                  V P                  V P                  V4      p	V P                  P                  R4      p
RP                  V
P                  4       R	VR
.4      pRP                  VR.4      pVf&   VP                  V4       V	P!                  R R7       R#  \"        P$                  ! VP'                  V4      4      p\"        P6                  ! XR4      pTTn        \A        4       pTPC                  TRR R7       TPE                  ^ 4        \G        Y4       TPI                  TTPK                  4       4       T	P!                  R R7       R#   \(         EdX   pTP*                  ^ ,          \,        \.        \0        39   Ed   \"        P2                  ! \"        P4                  ! R4      4      p\"        P6                  ! TP9                  4       R4      p\"        P6                  ! TR4      pRTn        \"        P6                  ! TR4      pRTn        \"        P6                  ! TR4      pRTn        \"        P6                  ! TR4      pRTn        \"        P6                  ! TR4      p\"        P6                  ! TR4      pRTn         Rp?ELTP*                  ^ ,          \<        8X  d   \?        R4      hh Rp?ii ; i  \(         d.   pTP*                  ^ ,          \<        8X  d   \?        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  zMACHINE\VGP\VTLA\Unix\Issuer}  Nr  r  r~  r  r  rv   ru  r  rv  r  r  r   rw  issuerk  r  r  r  )&r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r3  r  r  r  r   r   ru  r.   r/   r0   r  r  r  r  r  r2   r   r*   r   r  r3   r   r   )r   r   r@   r  r  r  r  r|  r   r  ri  r  r  r  rk   r~  r  rv   r  r  r   rw  r  r  s   &&&&&&&                 rC   r'  cmd_set_issue.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$))U[[]J>@ A))Wn56=KK !!$!7	}}T]]7%;<H4 }}T6*	isWdC	!$0MM'388:.!!$!7E  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;'	 mmM=I#C ]]=,G
"+
}}]F;==z: '55" $D E E /	F  	vvay33" $D E E		s7   %H: ;=N  :ND$N0(NN O+(OOr)  r  r  r  s   @rC   r  r  i  st      /H 	W))w--G.. 	tW#JQTC	)M
 "JI IrE   r  c                   F    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   RtR# )	cmd_issuei  z!Manage Issue Group Policy Objectsr   r  r^   N)	r  r  r  r  r,  r  r}  r  r  r^   rE   rC   r  r    s#    +K(*K&KrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .tR.tRR ltRtV tR# )cmd_list_accessi  zList VGP Host Access Group Policy from the sysvol

This command lists host access rules from the sysvol that will be applied to winbind clients.

Example:
samba-tool gpo manage access list {31B2F340-016D-11D2-945F-00C04FB984F9}
    r`  r  r  r  r  r  r  r  r  r  r   Nc                X   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          pW n        MG\        V P                  V P                  4      p\        V P                  V P                  VR7      V n        \        VRV P                  V P                  R7      pV P                  P                  R4      pRP                  VP                  4       R	VR
R.4      p	 \        P                  ! VP                  V	4      4      p
T
e   T
P-                  R4      pTP,                  ! R4      pTP/                  R4       Fn  pTP-                  R4      pTP-                  R4      pTP-                  R4      pT P0                  P3                  RTP4                  : RTP4                  : R24       Kp  	  RP                  TP                  4       R	TR
R.4      p	 \        P                  ! TP                  T	4      4      pTe   TP-                  R4      pTP,                  ! R4      pTP/                  R4       Fn  pTP-                  R4      pTP-                  R4      pTP-                  R4      pT P0                  P3                  RTP4                  : RTP4                  : R24       Kp  	  R# R#   \         d]   pTP                   ^ ,          \"        \$        \&        39   d	   Rp
 Rp?ELTP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i  \         d]   pTP                   ^ ,          \"        \$        \&        39   d	   Rp Rp?ELRTP                   ^ ,          \(        8X  d   \+        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r   rj  MACHINE\VGP\VTLA\VASz$HostAccessControl\Allow\manifest.xmlNrk  r~  r   r  adobjectrv   r  z+:z:ALL
z#HostAccessControl\Deny\manifest.xmlz-:r	  )r   r   r  r  r  r  r|  r   ri  r  allowrk   r   r   r  r  rv   r  denys   &&&&&&             rC   r'  cmd_list_access.run  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 G$))U[[]J6EG H	MM$--"89E ZZ0F;;v&D#||M:&++J7}}V,!x0		FKK KL	  ; ))U[[]J6DF G	==w!78D YY/F;;v&D#||M:&++J7}}V,!x0		FKK KL	  ; I  		vvay:<<> > 55" $D E E 		2  		vvay:<<> > 55" $D E E 		s<   %K %M L?#)L:(L::L?N))N$<(N$$N)r)  r*  r  r  s   @rC   r  r    ss      'H 	W))w--G.. 	tW#JQTC	)M
 JCM CMrE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_add_accessi0  aS  Adds a VGP Host Access Group Policy to the sysvol

This command adds a host access setting to the sysvol for applying to winbind
clients. Any time an allow entry is detected by the client, an implicit deny
ALL will be assumed.

Example:
samba-tool gpo manage access add {31B2F340-016D-11D2-945F-00C04FB984F9} allow goodguy example.com
    z0%prog <gpo> <allow/deny> <cn> <domain> [options]r  r  r  r  r  r  r  r  r  Nc	                V   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          p	WPn        MG\        V P                  V P                  4      p	\        V P                  V P                  V	R7      V n        \        V	RV P                  V P                  R7      p
V P                  4        \        WP                  V P                  V P                  V4      pV P                  P                  R4      pVR8X  d&   R	P                  VP                  4       R
VRR.4      pM>VR8X  d&   R	P                  VP                  4       R
VRR.4      pM\        RV,          4      hR	P                  VR.4      p \         P"                  ! \         P$                  ! V
P'                  V4      4      4      pVP)                  4       P+                  R4      pVP*                  ! R4      p\        T P                  T P                  TR7      p\?        T\A        4       T P                  T P                  R7      pTPC                  TPE                  4       \F        PH                  RT,          . R0OR"7      p\K        T4      ^ 8X  d   \        R#T,          4      h\M        T^ ,          R!,          R1,          4      pTR29  d   \        R%T,          4      h\         P8                  ! TR&4      p\         P8                  ! TR'4      pTPO                  4       Tn        \         P8                  ! TR(4      pTPQ                  4       : R	\M        T^ ,          R ,          R1,          4      : 2Tn        TR$8X  d   \         P8                  ! TR)4      pR*Tn        \         P8                  ! TR+4      p\         P8                  ! TR4      p\M        T^ ,          R ,          R1,          4      Tn        \         P8                  ! TR,4      p TT n        \         P8                  ! TR'4      pTTn        \S        4       p!TPU                  T!R-R R.7       T!PW                  ^ 4        \Y        Y4       T
P[                  TT!P]                  4       4       TP_                  R R/7       R#   \,         Ed9   pTP.                  ^ ,          \0        \2        \4        39   d   \         P"                  ! \         P6                  ! R4      4      p\         P8                  ! TP)                  4       R4      p\         P8                  ! TR4      pRTn        \         P8                  ! TR4      pRTn        \         P8                  ! TR4      pRTn        \         P8                  ! TR4      pRTn        \         P8                  ! TR4      p Rp?ELTP.                  ^ ,          \<        8X  d   \        R4      hh Rp?ii ; i  \,         d.   pTP.                  ^ ,          \<        8X  d   \        R4      hh Rp?ii ; i)3Tr  re   rc  re  rg  rh  ri  r  r   rj  r  HostAccessControl\Allowr  HostAccessControl\DenyBThe entry type must be either 'allow' or 'deny'. Unknown type '%s'r}  r~  r   r  r  r  rv   zHost Access Controlr  z0Represents host access control data (pam_access)r  r  rk  Nr   z(cn=%s)samaccountnamer7  r   z!Unable to find user or group "%s"r  z%s is not a user or groupr  r  r  	groupattrsamAccountNamer  r  r  r  r  )userPrincipalNamer  r7  )r=  r  )0r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r  r  r  r2   r	   r   r   	domain_dnr}   SCOPE_SUBTREErR   r'   r#  domain_netbios_namer*   r   r  r3   r   r   r  )"r   r   r  cnr  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r~  r  rv   r  r  ri   r   resobjectclassr  r  r  r  
domain_elmr  s"   &&&&&&&&&                         rC   r'  cmd_add_access.runJ  s   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$Gii
C!:!;!= >G f_ii
C!:!:!< =G   ;=B C D D))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D0 TWWdjjV4#N,<"&**: ll 1!$!2!2&/"n"1  2 s8q=BRGHH Q!6r!:;//:R?@@mmD-8k62 &&(
k73!&!:!:!<!+CF3C,DR,H!IK
'!dK8I-IN==j9}}Xv.s1v&67;<	]]8X6
 
h/ 
isWdC	!$0MM'388:.!!$!7  	vvay:<<> > >>"**[*AB "h.>.>.@.=!?]]=)<}}]F;1	 mmM=I#U ]]=,G
")
}}]F;55" $D E E +	@  	vvay33" $D E E		s8   &A*R) *=W0 )W-5DW( (W((W-0X(;(X##X(r)  )r   r  r  r  r*  r  r  s   @rC   r  r  0  sp      BH 	W))w--G.. 	tW#JQTC	)M
 2Jk krE   r  c            	          a  ] tR tRt o RtRtR]P                  R]P                  R]P                  /t
]! RRR	]R
RR7      .t. ROtRR ltRtV tR# )cmd_remove_accessi  a  Remove a VGP Host Access Group Policy from the sysvol

This command removes a host access setting from the sysvol for applying to
winbind clients.

Example:
samba-tool gpo manage access remove {31B2F340-016D-11D2-945F-00C04FB984F9} allow goodguy example.com
    z2%prog <gpo> <allow/deny> <name> <domain> [options]r  r  r  r  r  r  r  r  r  Nc	                   VP                  4       V n        VP                  V P                  R R7      V n        V'       d(   VP	                  R4      '       d   VR,          p	WPn        MG\        V P                  V P                  4      p	\        V P                  V P                  V	R7      V n        \        V	RV P                  V P                  R7      p
V P                  4        \        WP                  V P                  V P                  V4      pV P                  P                  R4      pVR8X  d&   R	P                  VP                  4       R
VRR.4      pM>VR8X  d&   R	P                  VP                  4       R
VRR.4      pM\        RV,          4      hR	P                  VR.4      p \         P"                  ! \         P$                  ! V
P'                  V4      4      4      pVP)                  4       P+                  R4      pVP*                  ! R4      pTP9                  R4       Fy  pTP+                  R4      pTP+                  R4      pTP+                  R4      pTf   K<  TP:                  T8X  g   KO  Tf   KU  TP:                  T8X  g   Kh  TP=                  T4        M	  \        RT,          4      h\?        4       pTPA                  TRR R7       TPC                  ^ 4        \E        Y4       T
PG                  TTPI                  4       4       TPK                  R R7       R#   \,         dg   pTP.                  ^ ,          \0        \2        \4        39   d   \        RT,          4      hTP.                  ^ ,          \6        8X  d   \        R4      hh Rp?ii ; i  \,         d.   pTP.                  ^ ,          \6        8X  d   \        R4      hh Rp?ii ; i)Tr  re   rc  re  rg  rh  ri  r  r   rj  r  r  r  r  r  r}  r~  r   z0Cannot remove %s entry because it does not existrk  Nr  r  rv   r  r  r  r  )&r%  rg   r&  rh   rS   ri   r   rl   r4   r   r6   r   rt  r?   r   r   r  r  r  r   r  r  r   ru  r.   r/   r0   r2   r  r  r   r*   r   r  r3   r   r   r  )r   r   r  rv   r  r  r  r  r  r|  r   r  ri  r  r  r  r   r   rk   r  r  name_elmr  r  s   &&&&&&&&&               rC   r'  cmd_remove_access.run  sE   ((*--dgg-M
 i((B%KH'<KdggtzzkBDH k&!%$(JJ0
 	#C$**djj!LG$Gii
C!:!;!= >G f_ii
C!:!:!< =G   ;=B C D D))Wn56	~~bmmDMM'4J&KLH%%',,_=F;;v&D  <<6K"''
3H}}V,H!x0J#(=%*//V*CK( 7   /16 7 8 8 isWdC	!$0MM'388:.!!$!7=  
	vvay:<<> > # $/16$7 8 855" $D E E 
	>  	vvay33" $D E E		s2   &A*L  =N N*A!NNO(OOr)  )r   r  rv   r  r*  r  r  s   @rC   r  r    sp      DH 	W))w--G.. 	tW#JQTC	)M
 4JJ JrE   r  c                      a  ] tR tRt o RtRtR]P                  R]P                  /t	]
! RRRR	R
7      ]
! RRRRR
7      .tRR.tRR ltRtV tR# )cmd_cse_registeri  a  Register a Client Side Extension (CSE) on the current host

This command takes a CSE filename as an argument, and registers it for
applying policy on the current host. This is not necessary for CSEs which
are distributed with the current version of Samba, but is useful for installing
experimental CSEs or custom built CSEs.
The <cse_file> argument MUST be a permanent location for the CSE. The register
command does not copy the file to some other directory. The samba-gpupdate
command will execute the CSE from the exact location specified from this
command.

Example:
samba-tool gpo cse register ./gp_chromium_ext.py gp_chromium_ext --machine
    z%%prog <cse_file> <cse_name> [options]r  r  z	--machineFr  z-Whether to register the CSE as Machine policy)r  r  r  z--userz*Whether to register the CSE as User policycse_filecse_nameNc           	     d   VP                  4       V n        VR 8X  d   VR 8X  d   \        R4      hR\        \        P
                  ! 4       4      ,          p\        P                  P                  V4      p\        WrVV P                  P                  W4R7      p	V	'       g   \        RV,          4      hR# )Fz+Either --machine or --user must be selectedr  )smb_confmachiner=  zFailed to register CSE "%s"N)r%  rg   r   r   r!  r"  r   r   realpathr8   r:  )
r   r  r  r  r=  r  r  ext_guidext_pathrB   s
   &&&&&&&   rC   r'  cmd_cse_register.run<  s    ((*eLMMC

--77##H-#H-1WW-?-?,3@ <xGHH rE   rg   )FFNN)r  r  r  r  r,  r-  rH   r.  r/  r1  r   r2  r]  r'  r  r  r  s   @rC   r  r    sv      7H 	W))w-- 	{E,C	Ex|@	BM j)JI IrE   r  c                   f   a  ] tR tRt o RtRtR]P                  R]P                  /t	R	R lt
RtV tR# )
cmd_cse_listiK  zList the registered Client Side Extensions (CSEs) on the current host

This command lists the currently registered CSEs on the host.

Example:
samba-tool gpo cse list
    r  r  r  Nc                P   VP                  4       V n        \        V P                  P                  4      pVP	                  4        F  w  rEV P
                  P                  R V,          4       V P
                  P                  RVR,          ,          4       V P
                  P                  RVR,          ,          4       V P
                  P                  R\        VR,          4      ,          4       V P
                  P                  R\        VR,          4      ,          4       K  	  R	# )
zUniqueGUID         : %s
zFileName           : %s
DllNamezProcessGroupPolicy : %s
ProcessGroupPolicyzMachinePolicy      : %s
MachinePolicyzUserPolicy         : %s


UserPolicyN)r%  rg   r9   r:  r  r   r   r   )r   r  r  csesr1  gp_exts   &&&   rC   r'  cmd_cse_list.run[  s    ((*!$''"4"45 JJLLDIIOO7$>?IIOO7&:KKLIIOO7/01 2IIOO7/01 2IIOO9|,-. / )rE   r  NN)r  r  r  r  r,  r-  rH   r.  r/  r1  r'  r  r  r  s   @rC   r  r  K  s;      !H 	W))w--
/ /rE   r  c                   l   a  ] tR tRt o RtRtR]P                  R]P                  /t	R.t
R
R ltR	tV tR# )cmd_cse_unregisterii  aq  Unregister a Client Side Extension (CSE) from the current host

This command takes a unique GUID as an argument (representing a registered
CSE), and unregisters it for applying policy on the current host. Use the
`samba-tool gpo cse list` command to determine the unique GUIDs of CSEs.

Example:
samba-tool gpo cse unregister {3F60F344-92BF-11ED-A1EB-0242AC120002}
    z%prog <guid> [options]r  r  r1  Nc                    VP                  4       V n        \        WP                  P                  4      pV'       g   \	        R V,          4      hR# )zFailed to unregister CSE "%s"N)r%  rg   r:   r:  r   )r   r1  r  r  rB   s   &&&& rC   r'  cmd_cse_unregister.run}  s?    ((*%dGG,>,>?>EFF rE   r  r  )r  r  r  r  r,  r-  rH   r.  r/  r1  r]  r'  r  r  r  s   @rC   r  r  i  sF      (H 	W))w--
 JG GrE   r  c                   Z    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   Rt	R# )cmd_csei  zManage Client Side Extensionsregisterr   
unregisterr^   N)
r  r  r  r  r,  r  r  r  r  r  r^   rE   rC   r  r    s0    'K.0K
&.K 2 4KrE   r  c                   Z    ] tR tRtRt/ t]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   Rt	R# )
cmd_accessi  z'Manage Host Access Group Policy Objectsr   r'  r   r^   N)
r  r  r  r  r,  r  r  r  r  r  r^   rE   rC   r  r    s1    1K)+K')K-/KrE   r  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&   RtR# )
cmd_managei  zManage Group Policy Objectssudoersr   r  symlinkrp  opensshscriptsrx  r  accessr^   N)r  r  r  r  r,  r  r  r  r  r  r6  rH  rj  r{  r  r  r  r^   rE   rC   r  r    s    %K(]K	*nK
*nK
(]K	$;K(]K	(]K	"*K$;K&LKrE   r  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&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   ]! 4       ]R&   RtR# )cmd_gpoi  z%Group Policy Object (GPO) management.listallr   showr  r   getlinksetlinkdellinklistcontainersgetinheritancesetinheritancefetchcreatedelaclcheckr=  restoreadmxloadmanagecser^   N)r  r  r  r  r,  r  r  r4  r_  r  r  r  r  r  r  r  r  r  r	  rS  ra  r  r<  rh  r  r  r  r^   rE   rC   r  r    s    /K(]K	"*K"*K"*K&LK(]K	(]K	(]K	$6$8K !$6$8K !$6$8K !$;K&LK K*nK
&LK(]K	*nK
&LK KrE   r  r  )FF)r   r  samba.getoptgetoptrH   r}   r   xml.etree.ElementTreeetreer  r  xml.parsersr   r  r   
samba.authr   samba.netcmdr   r   r   r   samba.samdbr	   r>  r
   samba.dcerpcr   	samba.ndrr   r   r   samba.securityr   r   r   samba.netcmd.commonr   r   samba.samba3r   r   r   r!  samba.ntaclsr   r   	samba.netr   samba.gp_parser   r   r   samba.gp_parse.gp_polr   samba.gp_parse.gp_inir   r   r   r    samba.gp_parse.gp_csvr!   samba.gp_parse.gp_infr"   samba.gp_parse.gp_aasr#   r$   r%   samba.commonr&   r'   configparserr(   ior)   r*   samba.gp.vgp_files_extr+   r,   r[  rz  samba.registryr-   samba.ntstatusr.   r/   r0   r1   r2   samba.netcmd.gpcommonr3   r4   r5   samba.policiesr6   samba.dcerpc.miscr7   samba.gp.gpclassr8   r9   r:   rD   rI   r[   rc   rl   rE  rF  rG  SECINFO_SACLr   r   r   r   
IGNORECASEr   r   FILE_ATTRIBUTE_SYSTEMr   FILE_ATTRIBUTE_ARCHIVEFILE_ATTRIBUTE_HIDDENr   r   r   r   r  r4  r_  r  r  r  r  r  r  r  r  r  r  r	  r<  rS  ra  rh  ry  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r!  r1  r6  r8  rB  rH  rJ  rT  rd  rh  rj  rm  rr  r{  r}  r  r  r  r  r  r  r  r  r  r  r  r  r^   rE   rC   <module>r     s  * 
 
  
 	 " "    %    ! *    } } -  8   $   O O -  3 2 -  , . %   <   &  
 1 * $ !dt#11#112#001 $001+\	#CL MM :2< )),,-**+ ))*
"2"4J+N +N\""* ""Jr:z r:jcz cLoz odT Tn,J* ,J^WM* WMt$M* $MN!B !BH); );X3X 3Xl87
 87vK K\PI PIfr<* r<jG3j G3T=O: =O~JQ7 JQXzj zxc5w c5J@& @&D1, 1yz yvD< D<L.< .?F ?FBfz fP,< ,?Jw ?JB\j \|Y Yv1, 1D(W D(LpJ pdZz Zx/ /BEw BEHyj yv+, +L?w L?\nj n`V Vp1, 1+, +
@+G @+Df: fP(| (>#W >#@bJ bH) )[Mg [MzEZ ENc
 cJ-Iw -I^/7 /<G G65l 50 0) )#l #rE   