ó
    cÛ–i÷d  ã                   óº  • S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	  S SK
JrJrJr  S SKJrJr  S SKJrJrJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJrJr  SSK J!r!  S SKJ"r"J#r#J$r$J%r%J&r&  S SK'J(r(J)r)J*r*J+r+  S!S jr,S r-S r.S r/ " S S\(5      r0 " S S\(5      r1 " S S\(5      r2 " S S\(5      r3 " S S\(5      r4 " S S\(5      r5 " S S \*5      r6g)"é    N)Úsd_utils)Ú	dnsserverÚdnspÚsecurity)ÚARecordÚ
AAAARecord)Ú
ndr_unpackÚndr_packÚ	ndr_print)Úremove_dns_references)Úsystem_session)ÚSamDB)Ú	get_bytes)Ú
check_callÚCalledProcessErroré   )Úcommon)ÚcredentialsÚdsdbÚLdbÚwerrorÚWERRORError)ÚCommandÚCommandErrorÚSuperCommandÚOptionc                 óÈ   • U(       d   [         R                  [         R                  /nU H  n [         R                  " X 5          g   g! [         R                   a     M6  f = f)z Check ip string is valid addressTF)ÚsocketÚAF_INETÚAF_INET6Ú	inet_ptonÚerror)Ú	ip_stringÚaddress_familiesÚaddress_familys      Ú7/usr/lib/python3/dist-packages/samba/netcmd/computer.pyÚ_is_valid_ipr'   8   sW   € ö Ü"ŸN™N¬F¯O©OÐ<Ðã*ˆð	Ü×Ò˜^Ô7Ùñ +ð øô �|‰|ó 	Úð	ús   ®A	Á	A!Á A!c                 ó4   • [        U [        R                  /S9$ )z%Check ip string is valid ipv4 address©r$   )r'   r   r   ©r#   s    r&   Ú_is_valid_ipv4r+   G   s   € ä˜	´V·^±^Ð4DÑEÐEó    c                 ó4   • [        U [        R                  /S9$ )z%Check ip string is valid ipv6 addressr)   )r'   r   r    r*   s    r&   Ú_is_valid_ipv6r.   L   s   € ä˜	´V·_±_Ð4EÑFÐFr,   c                 óô  • UR                  S5      n[        R                  n[        R                  [        R                  -  nU R                  5       n	Sn
[        R                  " U 5      n UR                  USUU	US[        R                  USS5
      u  pÍU
(       a˜  WR                   Hˆ  nUR                    Hu  nUR"                  [        R$                  :X  d   UR"                  [        R&                  :X  d  MA  [        R(                  " 5       nUUl         UR+                  USUU	USU5        Mw     MŠ     U HÂ  n[-        U5      (       a)  UR/                  SU< SU	< SU< 35        [1        U5      nOS[3        U5      (       a)  UR/                  S	U< SU	< S
U< 35        [5        U5      nO[7        SR9                  U5      5      e[        R(                  " 5       nUUl        UR+                  USUU	UUS5        MÄ     [;        U5      S:”  aw  [<        R>                  " U SU RA                  5       -  5      nU RC                  U< SU	< 3US9u  nnURE                  UUS[F        RH                  [F        RJ                  -  -  /S9  gg! [         a.  nUR                  S   [        R                  :X  a  Sn
 SnAGN!SnAff = f! [         a.  nUR                  S   [        R                  :w  a  e  SnAGM:  SnAff = f)z3Add DNS A or AAAA records while creating computer. Ú$Tr   NFzAdding DNS AAAA record Ú.z for IPv6 IP: zAdding DNS A record z for IPv4 IP: zInvalid IP: {}zDC=DomainDnsZones,%s)Údns_partitionzsd_flags:1:%d)Úcontrols)&Úrstripr   ÚDNS_CLIENT_VERSION_LONGHORNÚDNS_RPC_VIEW_AUTHORITY_DATAÚDNS_RPC_VIEW_NO_CHILDRENÚdomain_dns_namer   ÚSDUtilsÚDnssrvEnumRecords2r   ÚDNS_TYPE_ALLr   Úargsr   Ú"WERR_DNS_ERROR_NAME_DOES_NOT_EXISTÚrecÚrecordsÚwTypeÚ
DNS_TYPE_AÚDNS_TYPE_AAAAÚDNS_RPC_RECORD_BUFÚDnssrvUpdateRecord2r.   Úinfor   r+   r   Ú
ValueErrorÚformatÚlenÚldbÚDnÚget_default_basednÚ
dns_lookupÚmodify_sd_on_dnr   ÚSECINFO_OWNERÚSECINFO_GROUP)ÚsamdbÚnameÚdns_connÚchange_owner_sdÚserverÚip_address_listÚloggerÚclient_versionÚselect_flagsÚzoneÚ
name_foundÚ	sd_helperÚbuflenÚresÚer>   ÚrecordÚdel_rec_bufÚ
ip_addressÚadd_rec_bufÚdomaindns_zone_dnÚdns_a_dnÚldap_records                          r&   Úadd_dns_recordsrf   Q   s»  € ð �;‰;�sÓ€DÜ×:Ñ:€NÜ×8Ñ8¼9×;]Ñ;]Ñ]€LØ× Ñ Ó"€DØ€JÜ× Ò  Ó'€IðØ×1Ñ1ØØØØØØÜ×ÑØØØó
‰ˆö  Ø—7”7ˆCØŸ+œ+�Ø—<‘<¤4§?¡?Ó2°f·l±lÄd×FXÑFXÕ6Xä"+×">Ò">Ó"@�KØ&,�K”Oð"Ø ×4Ñ4Ø*ØØ"Ø Ø Ø Ø'öó &ñ ó( &ˆ
Ü˜*×%Ñ%Ø�KŠKÛ“dšJð(ô )ä˜ZÓ(‰CÜ˜J×'Ñ'Ø�KŠKÛ“dšJð(ô )ä˜*Ó%‰CäÐ-×4Ñ4°ZÓ@ÓAÐAô  ×2Ò2Ó4ˆØˆŒà×$Ñ$ØØØØØØØö	
ñ! &ô4 	ˆOÓ˜qÓ ÜŸFšFØØ" U×%=Ñ%=Ó%?Ñ?ó
Ðð
 !&× 0Ñ 0ÛšTÐ"Ø+ð !1ð !
Ñˆ�+ð 	×!Ñ!ØØØ%¬×)?Ñ)?Ä(×BXÑBXÑ)XÑYÐZð 	"ò 	
ð 	!øôg ó Ø�6‰6�!‰9œ×AÑAÓAØˆJÿùðûô* 'ó "ØŸ6™6 !™9¬×(QÑ(QÓQØ!ö Rûð"ús0   Á,*J ÄJ?Ê
J<Ê#J7Ê7J<Ê?
K7Ë	"K2Ë2K7c                   óÜ   • \ rS rSrSrSr\" SSS\SSS	9\" S
S\S9\" SS\S9\" SSSS9\" SSSSS9\" SSSSS9/rS/r	\
R                  \
R                  \
R                  S.r   S S jrSrg)!Úcmd_computer_addé¯   a+  Add a new computer.

This command adds a new computer account to the Active Directory domain.
The computername specified on the command is the sAMaccountName without the
trailing $ (dollar sign).

Computer accounts may represent physical entities, such as workstations. Computer
accounts are also referred to as security principals and are assigned a
security identifier (SID).

Example1:
samba-tool computer add Computer1 -H ldap://samba.samdom.example.com \
    -Uadministrator%passw1rd

Example1 shows how to add a new computer to the domain against a remote LDAP
server. The -H parameter is used to specify the remote target server. The -U
option is used to pass the userid and password authorized to issue the command
remotely.

Example2:
sudo samba-tool computer add Computer2

Example2 shows how to add a new computer to the domain against the local
server. sudo is used so a user may run the command as root.

Example3:
samba-tool computer add Computer3 --computerou='OU=OrgUnit'

Example3 shows how to add a new computer in the OrgUnit organizational unit.

ú%prog <computername> [options]ú-Hú--URLú%LDB URL for database or target serverÚURLÚH©ÚhelpÚtypeÚmetavarÚdestz--computerouz›DN of alternative location (with or without domainDN counterpart) to default CN=Computers in which new computer object will be created. E.g. 'OU=<OU name>'©rq   rr   z--descriptionzComputer's descriptionz--prepare-oldjoinz5Prepare enabled machine account for oldjoin mechanismÚ
store_true)rq   Úactionz--ip-addressrU   ziIPv4 address for the computer's A record, or IPv6 address for AAAA record, can be provided multiple timesÚappend)rt   rq   rw   z--service-principal-nameÚservice_principal_name_listzAComputer's Service Principal Name, can be provided multiple timesÚcomputername©Ú	sambaoptsÚcredoptsÚversionoptsNc           
      ó‚  • U	c  / n	U
c  / n
U	 H-  n[        U5      (       a  M  [        SR                  U5      5      e   UR                  5       nUR	                  U5      n [        U[        5       XÜS9nUR                  XUUU	U
S9  U	(       Gas  [        R                  " SSU5      nUR                  S5      (       a  [        SU-  5      eSR                  [        R                  " U5      5      nUR                  UR                  5       [        R                  US	S
/S9nUS   S	   S   n[!        ["        R$                  US   S
   S   5      n[&        R&                  " SR                  UR)                  5       5      XÍ5      n["        R*                  " 5       nUUl        ["        R$                  " SR                  UR/                  5       U5      5      Ul        [3        XïUUUR)                  5       X�R5                  5       5        U R8                  R;                  SU-  5        g ! [6         a  n[        SU-  U5      eS nAff = f)NzInvalid IP address {}©ÚurlÚsession_infor   Úlp)Ú
computerouÚdescriptionÚprepare_oldjoinrU   ry   z\$$Ú r0   zIllegal computername "%s"z-(&(sAMAccountName={}$)(objectclass=computer))ÚprimaryGroupIDÚ	objectSid©ÚbaseÚscopeÚ
expressionÚattrsr   zncacn_ip_tcp:{}[sign]z{}-{}zFailed to add computer '%s': z!Computer '%s' added successfully
)r'   r   rG   Úget_loadparmÚget_credentialsr   r   ÚnewcomputerÚreÚsubÚcountrI   Úbinary_encodeÚsearchÚ	domain_dnÚSCOPE_SUBTREEr	   r   Údom_sidr   Úhost_dns_nameÚ
descriptorÚ	owner_sidÚget_domain_sidÚ	group_sidrf   Ú
get_loggerÚ	ExceptionÚoutfÚwrite)Úselfrz   r}   r|   r~   ro   r„   r…   r†   rU   ry   ra   rƒ   ÚcredsrP   ÚhostnameÚfiltersÚrecsÚgroupÚownerrR   rS   r^   s                          r&   ÚrunÚcmd_computer_add.runò   s;  € ð Ñ"Ø ˆOà&Ñ.Ø*,Ð'ó *ˆJÜ 
×+Ó+Ü"Ð#:×#AÑ#AÀ*Ó#MÓNÐNñ *ð ×#Ñ#Ó%ˆØ×(Ñ(¨Ó,ˆð.	0Ü˜a¬nÓ.>Ø&+ñ4ˆEà×Ñ˜lØ*5Ø.=Ø.=Ø:Uð	 ñ  ÷ ô Ÿ6š6 &¨"¨lÓ;�Ø—>‘> #×&Ñ&Ü&Ð'BÀ\Ñ'QÓRÐRàI×PÑPÜ×%Ò% hÓ/ó1�ð —|‘|ØŸ™Ó*Ü×+Ñ+Ø&Ø+¨[Ð9ð	 $ð ;�ð ˜Q™Ð 0Ñ1°!Ñ4�Ü"¤8×#3Ñ#3°T¸!±W¸[Ñ5IÈ!Ñ5LÓM�ä$×.Ò.Ø+×2Ñ2°5×3FÑ3FÓ3HÓIØó�ô #+×"5Ò"5Ó"7�Ø,1�Ô)Ü,4×,<Ò,<Ø—N‘N 5×#7Ñ#7Ó#9¸5ÓAó-�Ô)ô  Ø XØ# U×%8Ñ%8Ó%:Ø#§_¡_Ó%6ô8ð 	�	‰	�‰Ð<¸|ÑKÕLøô	 ó 	0ÜÐ>Ø+ñ ,Ø-.ó0ð 0ûð	0ús   Á F!H  È 
H>È*H9È9H>© )	NNNNNNFNN©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úsynopsisr   ÚstrÚtakes_optionsÚ
takes_argsÚoptionsÚSambaOptionsÚCredentialsOptionsÚVersionOptionsÚtakes_optiongroupsrª   Ú__static_attributes__r¬   r,   r&   rh   rh   ¯   sÖ   † ñð> 0€Hñ 	ˆt�WÐ#JØ ¨Sñ	2áˆ~ðLð ñ		ñ
 	ˆÐ%=ÀCÑHÙÐ"ØKØ"ñ	$ñ 	ˆ~Ø%ðð ñ	 ñ 	Ð)Ø1ð&àñ		 ð%€Mð2 !Ð!€Jð ×)Ñ)Ø×.Ñ.Ø×-Ñ-ñÐð LPØGLØ>B÷BMr,   rh   c            	       ó�   • \ rS rSrSrSr\" SSS\SSS	9/rS
/r	\
R                  \
R                  \
R                  S.r  SS jrSrg)Úcmd_computer_deletei7  af  Delete a computer.

This command deletes a computer account from the Active Directory domain. The
computername specified on the command is the sAMAccountName without the
trailing $ (dollar sign).

Once the account is deleted, all permissions and memberships associated with
that account are deleted. If a new computer account is added with the same name
as a previously deleted account name, the new computer does not have the
previous permissions. The new account computer will be assigned a new security
identifier (SID) and permissions and memberships will have to be added.

The command may be run from the root userid or another authorized
userid. The -H or --URL= option can be used to execute the command against
a remote server.

Example1:
samba-tool computer delete Computer1 -H ldap://samba.samdom.example.com \
    -Uadministrator%passw1rd

Example1 shows how to delete a computer in the domain against a remote LDAP
server. The -H parameter is used to specify the remote target server. The
--computername= and --password= options are used to pass the computername and
password of a computer that exists on the remote server and is authorized to
issue the command on that server.

Example2:
sudo samba-tool computer delete Computer2

Example2 shows how to delete a computer in the domain against the local server.
sudo is used so a computer may run the command as root.

rj   rk   rl   rm   rn   ro   rp   rz   r{   Nc                 óJ  • UR                  5       nUR                  USS9n[        U[        5       XvS9nUn	UR	                  S5      (       d  SU-  n	S[
        R                  " U	5      [        R                  4-  n
 UR                  UR                  5       [
        R                  U
SS/S	9nUS
   R                  n[        US
   S   S
   5      nSUS
   ;   a  [        US
   S   S
   5      nOS n U[        R"                  -  nU(       d  [!        SU-  5      e UR%                  U5        U(       a  ['        X€R)                  5       USS9  U R,                  R/                  SU-  5        g ! [         a    [!        SU-  5      ef = f! [*         a  n[!        SU	-  U5      eS nAff = f)NT©Úfallback_machiner€   r0   ú%s$ú)(&(sAMAccountName=%s)(sAMAccountType=%u))ÚuserAccountControlÚdNSHostNamerŠ   r   úUnable to find computer "%s"zNFailed to remove computer "%s": Computer is not a workstation - removal denied)Úignore_no_namezFailed to remove computer "%s"zDeleted computer %s
)r�   r�   r   r   ÚendswithrI   r•   r   ÚATYPE_WORKSTATION_TRUSTr–   r—   r˜   ÚdnÚintr´   Ú
IndexErrorr   ÚUF_WORKSTATION_TRUST_ACCOUNTÚdeleter   rŸ   r    r¡   r¢   )r£   rz   r}   r|   r~   ro   rƒ   r¤   rP   ÚsamaccountnameÚfilterr]   Úcomputer_dnÚcomputer_acÚcomputer_dns_host_nameÚcomputer_is_workstationr^   s                    r&   rª   Úcmd_computer_delete.rung  sÒ  € à×#Ñ#Ó%ˆØ×(Ñ(¨¸dÐ(ÐCˆä˜!¬.Ó*:Ø"'ñ0ˆð &ˆØ×$Ñ$ S×)Ñ)Ø" \Ñ1ˆNà=Ü×$Ò$ ^Ó4Ü×/Ñ/ð1ñ1ˆð	NØ—,‘, E§O¡OÓ$5Ü%(×%6Ñ%6Ø*0Ø&:¸MÐ%Jð ð LˆCð ˜a™&Ÿ)™)ˆKÜ˜c !™fÐ%9Ñ:¸1Ñ=Ó>ˆKØ  A¡Ó&Ü),¨S°©V°MÑ-BÀ1Ñ-EÓ)FÑ&à)-Ñ&ð
 œ$×;Ñ;Ñ;ð 	 æ&Üð  Pà!-ñ .ó /ð /ð	2Ø�L‰L˜Ô%Þ%Ü%ØŸ?™?Ó,Ð.DØ#'ò)ð 	�	‰	�‰Ð/°,Ñ>Õ?øô% ó 	NÜÐ=ÀÑLÓMÐMð	Nûô ó 	2ÜÐ?Ø-ñ .Ø/0ó2ð 2ûð	2ús+   Á;A0E( Ã,E( Ä1F Å(FÆ
F"ÆFÆF"r¬   ©NNNNr­   r¬   r,   r&   r¾   r¾   7  si   † ñ ðB 0€Hñ 	ˆt�WÐ#JØ ¨Sñ	2ð€Mð
 !Ð!€Jà×)Ñ)Ø×.Ñ.Ø×-Ñ-ñÐð :>Ø $÷,@r,   r¾   c            	       óž   • \ rS rSrSrSr\" SSS\SSS	9\" S
S\S9/rS/r	\
R                  \
R                  \
R                  S.r  SS jrSrg)Úcmd_computer_editi–  a  Modify Computer AD object.

This command will allow editing of a computer account in the Active
Directory domain. You will then be able to add or change attributes and
their values.

The computername specified on the command is the sAMaccountName with or
without the trailing $ (dollar sign).

The command may be run from the root userid or another authorized userid.

The -H or --URL= option can be used to execute the command against a remote
server.

Example1:
samba-tool computer edit Computer1 -H ldap://samba.samdom.example.com \
    -U administrator --password=passw1rd

Example1 shows how to edit a computers attributes in the domain against a
remote LDAP server.

The -H parameter is used to specify the remote target server.

Example2:
samba-tool computer edit Computer2

Example2 shows how to edit a computers attributes in the domain against a
local LDAP server.

Example3:
samba-tool computer edit Computer3 --editor=nano

Example3 shows how to edit a computers attributes in the domain against a
local LDAP server using the 'nano' editor.
rj   rk   rl   rm   rn   ro   rp   z--editorzQEditor to use instead of the system default, or 'vi' if no system default is set.ru   rz   r{   Nc                 ót  • UR                  5       nUR                  USS9n[        U[        5       X‡S9n	Un
UR	                  S5      (       d  SU-  n
S[
        R                  [        R                  " U
5      4-  nU	R                  5       n U	R                  UU[        R                  S9nUS   R                  n[        U5      S
:w  a  [        SU[        U5      4-  5      eUS   n[         R"                  " XŸ5      nUc$  [$        R&                  R)                  S5      nUc  Sn[*        R,                  " SS9 nUR/                  [1        U5      5        UR3                  5          [5        UUR6                  /5        [;        UR6                  5       nUR=                  5       nS S S 5        S S S 5        U	R?                  W5      n[A        U5      S
   nU	RC                  UU5      n[        U5      S:X  a  U RD                  R/                  S5        g  U	RG                  U5        U RD                  R/                  SU-  5        g ! [         a    [        S	U-  5      ef = f! [8         a  n[9        SU5      eS nAff = f! , (       d  f       NÝ= f! , (       d  f       Næ= f! [H         a  n[        SU-  U5      eS nAff = f)NTrÀ   r€   r0   rÂ   ú)(&(sAMAccountType=%d)(sAMAccountName=%s))©r‹   r�   rŒ   r   rÆ   r   z'Invalid number of results: for "%s": %dÚEDITORÚviz.tmp)ÚsuffixzERROR: zNothing to do
z Failed to modify computer '%s': z$Modified computer '%s' successfully
)%r�   r�   r   r   rÈ   r   rÉ   rI   r•   r—   r–   r˜   rÊ   rÌ   r   rH   r   Úget_ldif_for_editorÚosÚenvironÚgetÚtempfileÚNamedTemporaryFiler¢   r   Úflushr   rQ   r   ÚopenÚreadÚ
parse_ldifÚnextÚmsg_diffr¡   Úmodifyr    )r£   rz   r}   r|   r~   ro   Úeditorrƒ   r¤   rP   rÏ   rÐ   Údomaindnr]   rÑ   ÚmsgÚresult_ldifÚt_filer^   Úedited_fileÚedited_messageÚmsgs_editedÚ
msg_editedÚres_msg_diffs                           r&   rª   Úcmd_computer_edit.runÊ  s‘  € à×#Ñ#Ó%ˆØ×(Ñ(¨¸dÐ(ÐCˆÜ˜!¬.Ó*:Ø"'ñ0ˆð &ˆØ×$Ñ$ S×)Ñ)Ø" \Ñ1ˆNà=Ü×/Ñ/Ü×$Ò$ ^Ó4ð6ñ6ˆð —?‘?Ó$ˆð	PØ—,‘, HØ*0Ü%(×%6Ñ%6ð ð 8ˆCð ˜a™&Ÿ)™)ˆKô ˆs‹8�q‹=ÜÐHØ!-´°C³Ð9ñ :ó ;ð ;ð �!‰fˆÜ×0Ò0°Ó<ˆà‰>Ü—Z‘Z—^‘^ HÓ-ˆFØ‰~Ø�ä×(Ò(°Ò7¸6Ø�L‰Lœ ;Ó/Ô0Ø�L‰LŒNð7Ü˜F F§K¡KÐ0Ô1ô �f—k‘kÔ" kØ!,×!1Ñ!1Ó!3�÷ #÷ 8ð ×&Ñ& ~Ó6ˆÜ˜+Ó& qÑ)ˆ
à—~‘~ c¨:Ó6ˆÜˆ|Ó Ó!Ø�I‰I�O‰OÐ-Ô.Øð	0Ø�L‰L˜Ô&ð
 	�	‰	�‰Ð?À,ÑNÕOøôO ó 	PÜÐ=ÀÑNÓOÐOð	Pûô( &ó 7Ü(¨°AÓ6Ð6ûð7úç"Õ"ú÷ 8Õ7ûô( ó 	0ÜÐAØ+ñ ,Ø-.ó0ð 0ûð	0úsl   Â.H= Ä7+JÅ#IÅ:JÆI7Æ JÈJ È=IÉ
I4É#I/É/I4É4JÉ7
J	ÊJÊ
JÊ
J7Ê#J2Ê2J7r¬   ©NNNNNr­   r¬   r,   r&   rØ   rØ   –  s~   † ñ"ðF 0€Hñ 	ˆt�WÐ#JØ ¨Sñ	2áˆzð !7Ø=@ñ	Bð€Mð !Ð!€Jà×)Ñ)Ø×.Ñ.Ø×-Ñ-ñÐð LPØ÷=Pr,   rØ   c            
       ó´   • \ rS rSrSrSr\" SSS\SSS	9\" S
SS\S9\" SSSSSS9/r\	R                  \	R                  \	R                  S.r      SS jrSrg)Úcmd_computer_listi	  zList all computers.z%prog [options]rk   rl   rm   rn   ro   rp   z-bz	--base-dnzSpecify base DN to useru   z	--full-dnÚfull_dnFrv   z)Display DN instead of the sAMAccountName.)rt   Údefaultrw   rq   r{   Nc           	      ó  • UR                  5       nUR                  USS9n[        U[        5       X‡S9n	S[        R
                  -  n
U	R                  5       nU(       a  U	R                  U5      nU	R                  U[        R                  U
S/S9n[        U5      S:X  a  g U He  nU(       a/  U R                  R                  SUR                  S	5      -  5        M9  U R                  R                  SUR                  SSS
9-  5        Mg     g )NTrÀ   r€   z(sAMAccountType=%u)rÏ   )rŒ   r�   rŽ   r   z%s
rÊ   )Úidx)r�   r�   r   r   r   rÉ   r—   Únormalize_dn_in_domainr–   rI   r˜   rH   r¡   r¢   râ   )r£   r|   r}   r~   ro   Úbase_dnrú   rƒ   r¤   rP   rÐ   Ú	search_dnr]   rî   s                 r&   rª   Úcmd_computer_list.run   só   € ð ×#Ñ#Ó%ˆØ×(Ñ(¨¸dÐ(ÐCˆä˜!¬.Ó*:Ø"'ñ0ˆð '¬$×*FÑ*FÑGˆà—O‘OÓ%ˆ	ÞØ×4Ñ4°WÓ=ˆIà�l‰l˜9Ü!$×!2Ñ!2Ø&,Ø"2Ð!3ð ð 5ˆô �‹H˜‹MØãˆCÞØ—	‘	—‘ ¨¯©°«Ñ 6Ô7Ùà�I‰I�O‰O˜F S§W¡WÐ-=À1 WÐ%EÑEÖFò r,   r¬   )NNNNNF)r®   r¯   r°   r±   r²   r³   r   r´   rµ   r·   r¸   r¹   rº   r»   rª   r¼   r¬   r,   r&   rù   rù   	  s’   † Ùà €Hñ 	ˆt�WÐ#JØ ¨Sñ	2áˆt�[Ø,Øñ	ñ 	ˆ{ ØØ"Ø?ñ	Að
€Mð ×)Ñ)Ø×.Ñ.Ø×-Ñ-ñÐð ØØØØØ÷Gr,   rù   c            	       ó    • \ rS rSrSrSr\" SSS\SSS	9\" S
S\SS9/rS/r	\
R                  \
R                  \
R                  S.r  SS jrSrg)Úcmd_computer_showiB  a›  Display a computer AD object.

This command displays a computer account and it's attributes in the Active
Directory domain.
The computername specified on the command is the sAMAccountName.

The command may be run from the root userid or another authorized
userid.

The -H or --URL= option can be used to execute the command against a remote
server.

Example1:
samba-tool computer show Computer1 -H ldap://samba.samdom.example.com \
    -U administrator

Example1 shows how display a computers attributes in the domain against a
remote LDAP server.

The -H parameter is used to specify the remote target server.

Example2:
samba-tool computer show Computer2

Example2 shows how to display a computers attributes in the domain against a
local LDAP server.

Example3:
samba-tool computer show Computer2 --attributes=objectSid,operatingSystem

Example3 shows how to display a computers objectSid and operatingSystem
attribute.
rj   rk   rl   rm   rn   ro   rp   z--attributesz:Comma separated list of attributes, which will be printed.Úcomputer_attrs)rq   rr   rt   rz   r{   Nc                 óV  • UR                  5       nUR                  USS9n[        U[        5       X‡S9n	S n
U(       a  UR	                  S5      n
UnUR                  S5      (       d  SU-  nS[        R                  [        R                  " U5      4-  nU	R                  5       n U	R                  XÜ[        R                  U
S9nUS	   R                  nU H5  n[         R"                  " U	U5      nU R$                  R'                  U5        M7     g ! [         a    [        S
U-  5      ef = f)NTrÀ   r€   Ú,r0   rÂ   rÚ   )r‹   r�   rŒ   rŽ   r   rÆ   )r�   r�   r   r   ÚsplitrÈ   r   rÉ   rI   r•   r—   r–   r˜   rÊ   rÌ   r   r   rß   r¡   r¢   )r£   rz   r}   r|   r~   ro   r  rƒ   r¤   rP   rŽ   rÏ   rÐ   rí   r]   rÑ   rî   Úcomputer_ldifs                     r&   rª   Úcmd_computer_show.runv  s3  € ð ×#Ñ#Ó%ˆØ×(Ñ(¨¸dÐ(ÐCˆÜ˜!¬.Ó*:Ø"'ñ0ˆð ˆÞØ"×(Ñ(¨Ó-ˆEà%ˆØ×$Ñ$ S×)Ñ)Ø" \Ñ1ˆNà=Ü×/Ñ/Ü×$Ò$ ^Ó4ð6ñ6ˆð —?‘?Ó$ˆð	/Ø—,‘, HÜ%(×%6Ñ%6¸eð ð EˆCà˜a™&Ÿ)™)ˆKó
 ˆCÜ"×6Ò6°u¸cÓBˆMØ�I‰I�O‰O˜MÖ*ò øô	 ó 	/ÜÐ=Ø-ñ .ó /ð /ð	/ús   Â%.D ÄD(r¬   r÷   r­   r¬   r,   r&   r  r  B  s   † ñ ðB 0€Hñ 	ˆt�WÐ#JØ ¨Sñ	2áˆ~ð.àÐ.ñ	0ð€Mð !Ð!€Jà×)Ñ)Ø×.Ñ.Ø×-Ñ-ñÐð LPØ#'÷ +r,   r  c            	       ó’   • \ rS rSrSrSr\" SSS\SSS	9/rS
S/r	\
R                  \
R                  \
R                  S.r  SS jrSrg)Úcmd_computer_movei™  z4Move a computer to an organizational unit/container.z*%prog <computername> <new_ou_dn> [options]rk   rl   rm   rn   ro   rp   rz   Ú	new_ou_dnr{   Nc                 óš  • UR                  5       nUR                  USS9n[        U[        5       X‡S9n	[        R
                  " X™R                  5       5      n
UnUR                  S5      (       d  SU-  nS[        R                  " U5      [        R                  4-  n U	R                  U
U[        R                  S9nUS   R                  n[        R
                  " X’5      nUR!                  U
5      (       d  UR#                  U
5        [        R
                  " U	[%        U5      5      nUR'                  [)        U5      S
-
  5        UR#                  U5         U	R+                  UU5        U R.                  R1                  SU< SU< S35        g ! [         a    [        S	U-  5      ef = f! [,         a  n[        SU-  U5      eS nAff = f)NTrÀ   r€   r0   rÂ   rÃ   rÛ   r   rÆ   r   zFailed to move computer "%s"zMoved computer "z" to "z"
)r�   r�   r   r   rI   rJ   r—   rÈ   r•   r   rÉ   r–   r˜   rÊ   rÌ   r   Úis_child_ofÚadd_baser´   Úremove_base_componentsrH   Úrenamer    r¡   r¢   )r£   rz   r  r}   r|   r~   ro   rƒ   r¤   rP   r—   rÏ   rÐ   r]   rÑ   Úfull_new_ou_dnÚnew_computer_dnr^   s                     r&   rª   Úcmd_computer_move.runª  s®  € à×#Ñ#Ó%ˆØ×(Ñ(¨¸dÐ(ÐCˆÜ˜!¬.Ó*:Ø"'ñ0ˆä—F’F˜5§/¡/Ó"3Ó4ˆ	à%ˆØ×$Ñ$ S×)Ñ)Ø" \Ñ1ˆNà=Ü×$Ò$ ^Ó4Ü×/Ñ/ð1ñ1ˆð	PØ—,‘, IØ*0Ü%(×%6Ñ%6ð ð 8ˆCð ˜a™&Ÿ)™)ˆKô Ÿš Ó1ˆØ×)Ñ)¨)×4Ñ4Ø×#Ñ# IÔ.ÜŸ&š& ¬¨KÓ(8Ó9ˆØ×.Ñ.¬s°;Ó/?ÀÑ/BÔCØ× Ñ  Ô0ð	QØ�L‰L˜ oÔ6ð 	�	‰	�ŠÛ%£yð2õ 	3øô ó 	PÜÐ=ÀÑNÓOÐOð	Pûô ó 	QÜÐ=ÀÑLÈaÓPÐPûð	Qús$   Â.F ÅF, ÆF)Æ,
G
Æ6GÇG
r¬   rÖ   r­   r¬   r,   r&   r  r  ™  sg   † Ù>à;€Hñ 	ˆt�WÐ#JØ ¨Sñ	2ð€Mð
 ! +Ð.€Jà×)Ñ)Ø×.Ñ.Ø×-Ñ-ñÐð EIØ $÷"3r,   r  c                   ó¨   • \ rS rSrSr0 r\" 5       \S'   \" 5       \S'   \" 5       \S'   \" 5       \S'   \	" 5       \S'   \
" 5       \S'   \" 5       \S	'   S
rg)Úcmd_computeriÏ  zComputer management.ÚaddÚcreaterÎ   ÚeditÚlistÚshowÚmover¬   N)r®   r¯   r°   r±   r²   Úsubcommandsrh   r¾   rØ   rù   r  r  r¼   r¬   r,   r&   r  r  Ï  se   † Ùà€KÙ)Ó+€K�ÑÙ,Ó.€K�ÑÙ/Ó1€K�ÑÙ+Ó-€K�ÑÙ+Ó-€K�ÑÙ+Ó-€K�ÑÙ+Ó-€K�Ôr,   r  )N)7Úsamba.getoptÚgetoptr·   rI   r   Úsambar’   rà   rã   r   Úsamba.dcerpcr   r   r   Úsamba.dnsserverr   r   Ú	samba.ndrr	   r
   r   Úsamba.remove_dcr   Ú
samba.authr   Úsamba.samdbr   Úsamba.commonr   Ú
subprocessr   r   r‡   r   r   r   r   r   r   Úsamba.netcmdr   r   r   r   r'   r+   r.   rf   rh   r¾   rØ   rù   r  r  r  r¬   r,   r&   Ú<module>r*     sÖ   ðõ. Û 
Û Û Û 	Û 	Û Ý ß 2Ñ 2ß /ß 5Ñ 5Ý 1Ý %Ý Ý "ß 5Ý ÷õ ÷ó ôòFò
Gò
[
ô|EM�wô EMôP\@˜'ô \@ô~qP˜ô qPôf6G˜ô 6GôrT+˜ô T+ôn33˜ô 33ôl
.�<õ 
.r,   