
    b                         d Z ddlmZmZmZ ddlmZmZmZ ddl	m
Z
 ddlmZ ddlZddlmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ dZdZ G d de
          Z G d de          Z G d de          ZdS )z*Tests for the Samba3 NT -> posix ACL layer    )setntaclgetntaclcheckset_backend)securitysmb_aclidmap)SmbdBaseTests)	provisionN)smbdpassdb)param)auth)SamDBsystem_session_unixz)S-1-5-21-2212615479-2695158682-2101375467zO:S-1-5-21-2212615479-2695158682-2101375467-512G:S-1-5-21-2212615479-2695158682-2101375467-513D:(A;OICI;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375467-512)c                        e Zd Z fdZ fdZefdZd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z xZS )PosixAclMappingTestsc                 P   t          t          |                                            t          j                    }|                    |                                 j                   |                    dt          j
                            | j        d                     || _        t          j
                            | j        d          | _        t          | j        d                              d           t#          | j        t%          j                              | _        d S )Nzxattr_tdb:file	xattr.tdbtestwempty)lpsession_info)superr   setUps3paramget_contextloadget_loadparm
configfilesetospathjointempdirr   tempfopenwriter   r   system_sessionsamdb)selfs3conf	__class__s     6/usr/lib/python3/dist-packages/samba/tests/posixacl.pyr   zPosixAclMappingTests.setUp&   s    "D))//111$&&D%%''2333

#RW\\$,%L%LMMMW\\$,77
TZ##G,,,dgD4G4I4IJJJ


    c                    t          j        | j        |                                            t	          j        t          j                            | j        d                     t          t          |           
                                 d S )Nr   )r   unlinkr'   get_session_infor#   r$   r%   r&   r   r   tearDown)r,   r.   s    r/   r4   zPosixAclMappingTests.tearDown0   sh    DJ 5 5 7 7888
	"',,t|[99:::"D))2244444r0   c                     t                      S )0
        Get session_info for setntacl.
        r   )r,   domsids     r/   r3   z%PosixAclMappingTests.get_session_info5   s     #$$$r0   c                     d}|j         D ]h}|d|j        z  d|j        z  z   z  }|j        t          j        k    r|d|j        j        z  z  }|j        t          j        k    r|d|j        j        z  z  }i|S )N za_type: %d
za_perm: %o
zuid: %d
zgid: %d
)	acla_typea_permr   SMB_ACL_USERinfouidSMB_ACL_GROUPgid)r,   	posix_aclaclstrentrys       r/   print_posix_aclz$PosixAclMappingTests.print_posix_acl;   s    ] 	7 	7Enu|3$u|34 4F|w333+
66|w444+
66r0   c                     t           }t          | j        | j        |t          |                                 d           d S NF	use_ntvfs)ACLr   r   r'   DOM_SIDr3   r,   r:   s     r/   test_setntaclz"PosixAclMappingTests.test_setntaclF   sE    $*c7&&((E	; 	; 	; 	; 	; 	;r0   c                 l   t           }t          | j        | j        |t          |                                 d           t          | j        | j        |                                 d          }t          j        t          j	                  }| 
                    |                    |          |           d S )NTrH   direct_db_accessrJ   r   r   r'   rK   r3   r   r   dom_sidSID_NT_SELFassertEqualas_sddlr,   r:   faclanysids       r/   test_setntacl_smbd_getntaclz0PosixAclMappingTests.test_setntacl_smbd_getntaclK   s    $*c7&&((D	: 	: 	: 	:T-B-B-D-DW[\\\!("677f--s33333r0   c                 \   t           }t          | j        | j        |t          |                                 d           t          j        | j        d|                                            |                     t          t          | j        | j        |                                 d           d S )NTrH     rO   )rJ   r   r   r'   rK   r3   r   set_simple_aclassertRaises	TypeErrorr   rL   s     r/   'test_setntacl_smbd_setposixacl_getntaclz<PosixAclMappingTests.test_setntacl_smbd_setposixacl_getntaclS   s    $*c7&&((D	: 	: 	: 	: 	DJt/D/D/F/FGGG 	x$*d6K6K6M6M`d 	 	f 	f 	f 	f 	fr0   c                    t           }t          | j        | j        |t          |                                 d           t          | j        d d           \  }}|                    || j        dd           t          | j        | j        |                                 d          }t          j
        t          j                  }|                     ||                    |                     d S )NTrH   system.fake_access_aclr0   rO   rJ   r   r   r'   rK   r3   r   wrap_setxattrr   r   rR   rS   rT   rU   r,   r:   backend_objdbnamerW   rX   s         r/   !test_setntacl_invalidate_getntaclz6PosixAclMappingTests.test_setntacl_invalidate_getntacl_   s    $*c7&&((D	: 	: 	: 	: !1$ E Ef!!&"&*.F	M 	M 	M T-B-B-D-DW[\\\!("677dll62233333r0   c                    t           }t          | j        | j        |t          |                                 d           t          | j        d d           \  }}|                    || j        dd           t          | j        | j        |                                           }t          j
        t          j                  }|                     ||                    |                     d S )NFrH   ra   r0   rb   rd   s         r/   &test_setntacl_invalidate_getntacl_smbdz;PosixAclMappingTests.test_setntacl_invalidate_getntacl_smbdn   s    $*c7&&((E	; 	; 	; 	; !1$ E Ef!!&"&*.F	M 	M 	M T-B-B-D-DEE!("677dll62233333r0   c                    t           }d}t          j        | j        d           t	          | j        | j        |t          |                                 d           t          | j        d d           \  }}|	                    || j        dd           t          | j        | j        |                                 d          }t          j        t          j                  }|                     ||                    |                     d S )NzO:S-1-5-21-2212615479-2695158682-2101375467-512G:S-1-5-21-2212615479-2695158682-2101375467-513D:(A;;0x001f01ff;;;S-1-5-21-2212615479-2695158682-2101375467-512)(A;;0x001200a9;;;S-1-5-21-2212615479-2695158682-2101375467-513)(A;;;;;WD)  FrH   ra   r0   rO   )rJ   r#   chmodr'   r   r   rK   r3   r   rc   r   r   rR   rS   rT   rU   )r,   r:   simple_acl_from_posixre   rf   rW   rX   s          r/   +test_setntacl_smbd_invalidate_getntacl_smbdz@PosixAclMappingTests.test_setntacl_smbd_invalidate_getntacl_smbd}   s     !K
U###$*c7&&((E	; 	; 	; 	; !1$ E Ef!!&"&*.F	M 	M 	M T-B-B-D-DW\]]]!("677.V0D0DEEEEEr0   c                 l   t           }t          | j        | j        |t          |                                 d           t          | j        | j        |                                 d          }t          j        t          j	                  }| 
                    |                    |          |           d S )NTrH   FrO   rQ   rV   s       r/   test_setntacl_getntacl_smbdz0PosixAclMappingTests.test_setntacl_getntacl_smbd   s    $*c7&&((D	: 	: 	: 	:T-B-B-D-DW\]]]!("677f--s33333r0   c                 l   t           }t          | j        | j        |t          |                                 d           t          | j        | j        |                                 d          }t          j        t          j	                  }| 
                    |                    |          |           d S )NFrH   rO   rQ   rV   s       r/    test_setntacl_smbd_getntacl_smbdz5PosixAclMappingTests.test_setntacl_smbd_getntacl_smbd   s    $*c7&&((E	; 	; 	; 	;T-B-B-D-DW\]]]!("677f--s33333r0   c                    t           }d}t          | j        | j        |t          |                                 d           t          j        | j        d|                                            t          | j        | j        |                                 d          }t          j
        t          j                  }|                     ||                    |                     d S )NzO:S-1-5-21-2212615479-2695158682-2101375467-512G:S-1-5-21-2212615479-2695158682-2101375467-513D:(A;;0x001f019f;;;S-1-5-21-2212615479-2695158682-2101375467-512)(A;;0x00120089;;;S-1-5-21-2212615479-2695158682-2101375467-513)(A;;;;;WD)FrH   r[   rO   )rJ   r   r   r'   rK   r3   r   r\   r   r   rR   rS   rT   rU   )r,   r:   rm   rW   rX   s        r/   ,test_setntacl_smbd_setposixacl_getntacl_smbdzAPosixAclMappingTests.test_setntacl_smbd_setposixacl_getntacl_smbd   s     !K$*c7&&((E	; 	; 	; 	; 	DJt/D/D/F/FGGGT-B-B-D-DW\]]]!("677.V0D0DEEEEEr0   c                    t           }t          j        t          j                  }d}t	          | j        | j        |t          |                                 d           t          j
        | j                            d                    }|                    |          \  }}t          j        | j        d|                                 |           t          | j        | j        |                                 d          }t          j        t          j                  }|                     ||                    |                     d S )NzO:S-1-5-21-2212615479-2695158682-2101375467-512G:S-1-5-21-2212615479-2695158682-2101375467-513D:(A;;0x001f019f;;;S-1-5-21-2212615479-2695158682-2101375467-512)(A;;0x00120089;;;BA)(A;;0x00120089;;;S-1-5-21-2212615479-2695158682-2101375467-513)(A;;;;;WD)FrH   passdb backendr[   rO   )rJ   r   rR   SID_BUILTIN_ADMINISTRATORSr   r   r'   rK   r3   r   PDBget	sid_to_idr   r\   r   rS   rT   rU   )	r,   r:   BA_sidrm   	s4_passdbBA_gidBA_typerW   rX   s	            r/   2test_setntacl_smbd_setposixacl_group_getntacl_smbdzGPosixAclMappingTests.test_setntacl_smbd_setposixacl_group_getntacl_smbd   s   !("EFF !_$*c7&&((E	; 	; 	; 	; Jtw{{+;<<==	%//77DJt/D/D/F/FOOO T-B-B-D-DW\]]]!("677.V0D0DEEEEEr0   c                 X   d}t          | j        | j        |t          |                                 d           t          | j        | j        |                                 d          }t          j        t                    }|                     |	                    |          |           d S )Nao  O:DAG:DUD:P(A;OICI;0x001f01ff;;;DA)(A;OICI;0x001f01ff;;;EA)(A;OICIIO;0x001f01ff;;;CO)(A;OICI;0x001f01ff;;;DA)(A;OICI;0x001f01ff;;;SY)(A;OICI;0x001200a9;;;AU)(A;OICI;0x001200a9;;;ED)S:AI(OU;CIIDSA;WP;f30e3bbe-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)(OU;CIIDSA;WP;f30e3bbf-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)FrH   rO   )
r   r   r'   rK   r3   r   r   rR   rT   rU   )r,   r:   rW   r7   s       r/   $test_setntacl_smbd_getntacl_smbd_gpoz9PosixAclMappingTests.test_setntacl_smbd_getntacl_smbd_gpo   s     @$*c7&&((E	; 	; 	; 	;T-B-B-D-DW\]]]!'**f--s33333r0   c                    t           }t          | j        | j        |t          |                                 d           t          | j        | j        |                                           }t          j        t          j	                  }| 
                    |                    |          |           t          j        | j        t          j        |                                           }d S rG   )rJ   r   r   r'   rK   r3   r   r   rR   rS   rT   rU   r   get_sys_aclr   SMB_ACL_TYPE_ACCESS)r,   r:   rW   rX   rB   s        r/   test_setntacl_getposixaclz.PosixAclMappingTests.test_setntacl_getposixacl   s    $*c7&&((E	; 	; 	; 	;T-B-B-D-DEE!("677f--s333$TZ1LdNcNcNeNeff			r0   c                     t          j        | j        d|                                            |                     t
          t          | j        | j        |                                            d S )Nrk   )r   r\   r'   r3   r]   r^   r   r   )r,   s    r/   test_setposixacl_getntaclz.PosixAclMappingTests.test_setposixacl_getntacl   sW    DJt/D/D/F/FGGG)Xtw
DDYDYD[D[\\\\\r0   c           	         t          j        | j                            d                    }|                    t          j        | j                  j                  }|	                    t          j        | j                  j
                  }t          j        | j        d|                                            t          | j        | j        |                                 d          }d|d|d|d|d		}t          j        t          j                  }|                     ||                    |                     d S )
Nrv   r[   FrO   O:G:D:(A;;0x001f019f;;;z)(A;;0x00120089;;;)(A;;;;;WD))r   rx   r   ry   
gid_to_sidr#   statr'   st_gid
uid_to_sidst_uidr   r\   r3   r   r   rR   rS   rT   rU   )r,   r|   	group_SIDuser_SIDrW   r:   rX   s          r/   test_setposixacl_getntacl_smbdz3PosixAclMappingTests.test_setposixacl_getntacl_smbd   s   Jtw{{+;<<==	(()<)<)CDD	''
(;(;(BCCDJt/D/D/F/FGGGT-B-B-D-DW\]]]PXPXPXZcZcZcemememoxoxoxy!("677dll62233333r0   c                    t          j        | j                            d                    }|                    t          j        | j                  j                  }t          j
        t          j                  }t          j        | j                            d                    }|                    |          \  }}|                     |t          j                   t          j
        t          j                  }|                    |          \  }}|                     |t          j                   t#          j        | j        |||                                            t#          j        | j        d|                                            t+          | j        | j        |                                 d          }	d}
t          j
        t          j                  }|                     |
|	                    |                     d S )Nrv   rk   FrO   zO:BAG:SOD:(A;;0x001f01ff;;;BA)(A;;0x001200a9;;;SO)(A;;;;;WD)(A;OICIIO;0x001f01ff;;;CO)(A;OICIIO;0x001200a9;;;CG)(A;OICIIO;0x001200a9;;;WD))r   rx   r   ry   r   r#   r   r&   r   r   rR   rw   rz   rT   r   ID_TYPE_BOTHSID_BUILTIN_SERVER_OPERATORSr   chownr3   r\   r   rS   rU   )r,   r|   r   r{   BA_idr~   SO_sidSO_idSO_typerW   r:   rX   s               r/   "test_setposixacl_dir_getntacl_smbdz7PosixAclMappingTests.test_setposixacl_dir_getntacl_smbd   s   Jtw{{+;<<==	''(=(=(DEE!("EFFJtw{{+;<<==	$..v66%"4555!("GHH$..v66%"4555
4<t/D/D/F/FGGGDL%1F1F1H1HIIIt/D/D/F/FY^___ [!("677dll62233333r0   c           	      Z   t          j        t           j                  }t          j        | j                            d                    }|                    |          \  }}|                    t          j
        | j                  j                  }|                    t          j
        | j                  j                  }|                     |t           j                   t%          j        | j        d|                                 |           t+          | j        | j        |                                 d          }t          j                    }d|d|d|d|d		}	t          j        t           j                  }
|                     |	|                    |
                     d S )
Nrv   r[   FrO   r   r   r   z&)(A;;0x00120089;;;BA)(A;;0x00120089;;;r   )r   rR   rw   r   rx   r   ry   rz   r   r#   r   r'   r   r   r   rT   r   r   r   r\   r3   r   get_global_sam_sidrS   rU   )r,   r{   r|   r}   r~   r   r   rW   r7   r:   rX   s              r/   $test_setposixacl_group_getntacl_smbdz9PosixAclMappingTests.test_setposixacl_group_getntacl_smbd   s   !("EFFJtw{{+;<<==	%//77(()<)<)CDD	''
(;(;(BCC%"4555DJt/D/D/F/FOOOT-B-B-D-DW\]]]*,,dldldlnwnwnw  zB  zB  zB  DM  DM  DM  N!("677dll62233333r0   c                    t          j        | j        d|                                            t          j        | j        t
          j        |                                           }|                     |j        d| 	                    |                     |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           d S )	Nr[      r                  )r   r\   r'   r3   r   r   r   rT   countrE   r:   r;   SMB_ACL_USER_OBJr<   SMB_ACL_GROUP_OBJSMB_ACL_OTHERSMB_ACL_MASKr,   rB   s     r/   test_setposixacl_getposixaclz1PosixAclMappingTests.test_setposixacl_getposixacl   s   DJt/D/D/F/FGGG$TZ1LdNcNcNeNeff	!T-A-A)-L-LMMMq)0'2JKKKq)0!444q)0'2KLLLq)0!444q)0'2GHHHq)0!444q)0'2FGGGq)0!44444r0   c                    t          j        | j        d|                                            t          j        | j        t
          j        |                                           }|                     |j        d| 	                    |                     |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           |                     |j
        d         j        t
          j                   |                     |j
        d         j        d           d S )	Nrk   r   r   r   r      r   r   )r   r\   r&   r3   r   r   r   rT   r   rE   r:   r;   r   r<   r   r   r   r   s     r/    test_setposixacl_dir_getposixaclz5PosixAclMappingTests.test_setposixacl_dir_getposixacl
  s   DL%1F1F1H1HIII$T\73NPTPePePgPghh	!T-A-A)-L-LMMMq)0'2JKKKq)0!444q)0'2KLLLq)0!444q)0'2GHHHq)0!444q)0'2FGGGq)0!44444r0   c                    t          j        t           j                  }t          j        | j                            d                    }|                    |          \  }}|                     |t          j
                   t          j        | j        d|                                 |           t          j        | j        t           j        |                                           }|                     |j        d|                     |                     |                     |j        d         j        t           j                   |                     |j        d         j        d           |                     |j        d         j        t           j                   |                     |j        d         j        d           |                     |j        d         j        t           j                   |                     |j        d         j        d           |                     |j        d	         j        t           j                   |                     |j        d	         j        d           |                     |j        d	         j        j        |           |                     |j        d
         j        t           j                   |                     |j        d
         j        d           d S )Nrv   i  r   r   r   r   r   r   r   r   )r   rR   rw   r   rx   r   ry   rz   rT   r   r   r   r\   r'   r3   r   r   r   r   rE   r:   r;   r   r<   r   r   r@   r>   rA   r   )r,   r{   r|   r}   r~   rB   s         r/   "test_setposixacl_group_getposixaclz7PosixAclMappingTests.test_setposixacl_group_getposixacl  sN   !("EFFJtw{{+;<<==	%//77%"4555DJt/D/D/F/FOOO$TZ1LdNcNcNeNeff	!T-A-A)-L-LMMMq)0'2JKKKq)0!444q)0'2KLLLq)0!444q)0'2GHHHq)0!444q)0'2GHHHq)0!444q).2F;;;q)0'2FGGGq)0!44444r0   c                    t           j        }t          j                    }|                     |          }t          | j        | j        |t          |          |d           t          | j        | j        |          }| 
                    |                    |          |           t          j        | j        t          j        |          }t!          j        d          }t!          j        d          }|dk    o|dk    }|j                                         }	t)          j        t          |          dz   t          t(          j                  z             }
t)          j        t(          j                  }t)          j        t(          j                  }t)          j        t(          j                  }t)          j        t(          j                  }t          j        | j                            d                    }|                    |
          \  }}| 
                    |t<          j                   |                    |          \  }}| 
                    |t<          j                    |                    |          \  }}| 
                    |t<          j                    |                    |          \  }}| 
                    |t<          j                    |                    |          \  }}| 
                    |t<          j                    | 
                    |j!        d	| "                    |                     | 
                    |j#        d
         j$        t          j%                   | 
                    |j#        d
         j&        d           | 
                    |j#        d
         j'        j(        |           | 
                    |j#        d         j$        t          j)                   |s|	r'| 
                    |j#        d         j&        d           n&| 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j*        |           | 
                    |j#        d         j$        t          j+                   | 
                    |j#        d         j&        d
           | 
                    |j#        d         j$        t          j,                   |s|	r'| 
                    |j#        d         j&        d           n&| 
                    |j#        d         j&        d           | 
                    |j#        d         j$        t          j)                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j*        |           | 
                    |j#        d         j$        t          j-                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j$        t          j)                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j*        |           | 
                    |j#        d         j$        t          j%                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j(        |           | 
                    |j#        d         j$        t          j)                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j*        |           | 
                    |j#        d         j$        t          j%                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j(        |           | 
                    |j#        d         j$        t          j)                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j*        |           | 
                    |j#        d         j$        t          j%                   | 
                    |j#        d         j&        d           | 
                    |j#        d         j'        j(        |           | 
                    |j#        d         j$        t          j.                   | 
                    |j#        d         j&        d           d S )NFrH   NSS_WRAPPER_MODULE_SO_PATHNSS_WRAPPER_MODULE_FN_PREFIXr9   winbind-rv      r   r   r   r   r   r   r   r      	   
         )/r
   
SYSVOL_ACLr   r   r3   r   r   r'   strr   rT   rU   r   r   r   r   r#   getenvsecurity_token	is_systemr   rR   DOMAIN_RID_ADMINISTRATORrw   r   SID_NT_SYSTEMSID_NT_AUTHENTICATED_USERSrx   ry   rz   r   ID_TYPE_UIDr   r   rE   r:   r;   r@   r<   r>   rA   r=   r?   r   r   r   r   )r,   r:   r7   r   rW   rB   nwrap_module_so_pathnwrap_module_fn_prefixnwrap_winbind_activeis_user_sessionLA_sidr{   r   SY_sidAU_sidr|   LA_uidLA_typer}   r~   SO_gidr   SY_gidSY_typeAU_gidAU_types                             r/   &test_setntacl_sysvol_check_getposixaclz;PosixAclMappingTests.test_setntacl_sysvol_check_getposixacl5  s   "*,,,,V44$*c3v;;	0 	0 	0 	0\::f--s333$TZ1Ll[[	!y)EFF!#+I!J!J 4 : !D 6) C 	*9CCEEE!#f++"3c(:[6\6\"\]]!("EFF!("GHH!("899!("EFFJtw{{+;<<==	
 &//77%"3444%//77%"4555%//77%"4555%//77%"4555%//77%"4555"d.B.B9.M.MNNNq)0'2GHHHq)0!444q).2F;;;q)0'2FGGG 	9? 	9Y]1-4a8888Y]1-4a888q).2F;;;q)0'2GHHHq)0!444q)0'2JKKK 	9? 	9Y]1-4a8888Y]1-4a888q)0'2FGGGq)0!444q).2F;;;q)0'2KLLLq)0!444q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;r*173GHHHr*11555r*/3V<<<r*173HIIIr*11555r*/3V<<<r*173GHHHr*1155555r0   c                    t           j        }t          j                    }|                     |          }t          | j        | j        |t          |          |d           t          | j        | j        |          }| 
                    |                    |          |           t          j        | j        t          j        |          }t!          j        t          |          dz   t          t           j                  z             }t!          j        t           j                  }t!          j        t           j                  }t!          j        t           j                  }	t!          j        t           j                  }
t          j        | j                            d                    }|                    |          \  }}| 
                    |t4          j                   |                    |          \  }}| 
                    |t4          j                   |                    |          \  }}| 
                    |t4          j                   |                    |	          \  }}| 
                    |t4          j                   |                    |
          \  }}| 
                    |t4          j                   | 
                    |j        d|                     |                     | 
                    |j        d         j         t          j!                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j$        |           | 
                    |j        d         j         t          j%                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j&        |           | 
                    |j        d	         j         t          j'                   | 
                    |j        d	         j"        d           | 
                    |j        d
         j         t          j(                   | 
                    |j        d
         j"        d           | 
                    |j        d         j         t          j%                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j&        |           | 
                    |j        d         j         t          j)                   | 
                    |j        d         j"        d           | 
                    |j        d         j         t          j%                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j&        |           | 
                    |j        d         j         t          j!                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j$        |           | 
                    |j        d         j         t          j%                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j&        |           | 
                    |j        d         j         t          j!                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j$        |           | 
                    |j        d         j         t          j%                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j&        |           | 
                    |j        d         j         t          j!                   | 
                    |j        d         j"        d           | 
                    |j        d         j#        j$        |           | 
                    |j        d         j         t          j*                   | 
                    |j        d         j"        d           d S )NFrH   r   rv   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )+r
   r   r   r   r3   r   r   r&   r   r   rT   rU   r   r   r   r   r   rR   r   rw   r   r   r   rx   ry   rz   r   r   r   r   rE   r:   r;   r@   r<   r>   rA   r=   r?   r   r   r   r   )r,   r:   r7   r   rW   rB   r   r{   r   r   r   r|   r   r   r}   r~   r   r   r   r   r   r   s                         r/   *test_setntacl_sysvol_dir_check_getposixaclz?PosixAclMappingTests.test_setntacl_sysvol_dir_check_getposixacl  s   "*,,,,V44$,S[[	0 	0 	0 	0|<<f--s333$T\73NP\]]	!#f++"3c(:[6\6\"\]]!("EFF!("GHH!("899!("EFFJtw{{+;<<==	
 &//77%"3444%//77%"4555%//77%"4555%//77%"4555%//77%"4555"d.B.B9.M.MNNNq)0'2GHHHq)0!444q).2F;;;q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q)0'2JKKKq)0!444q)0'2FGGGq)0!444q).2F;;;q)0'2KLLLq)0!444q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;r*173GHHHr*11555r*/3V<<<r*173HIIIr*11555r*/3V<<<r*173GHHHr*1155555r0   c                    t           j        }t          j                    }|                     |          }t          | j        | j        |t          |          |d           t          | j        | j        |          }| 
                    |                    |          |           t          j        | j        t          j        |          }t!          j        t          |          dz   t          t           j                  z             }t!          j        t           j                  }t!          j        t           j                  }t!          j        t           j                  }	t!          j        t           j                  }
t!          j        t          |          dz   t          t           j                  z             }t          j        | j                            d                    }|                    |          \  }}| 
                    |t6          j                   |                    |          \  }}| 
                    |t6          j                   |                    |          \  }}| 
                    |t6          j                   |                    |	          \  }}| 
                    |t6          j                   |                    |
          \  }}| 
                    |t6          j                   |                    |          \  }}| 
                    |t6          j                   | 
                    |j        d|                     |                     | 
                    |j         d         j!        t          j"                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j%        |           | 
                    |j         d         j!        t          j&                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j'        |           | 
                    |j         d	         j!        t          j(                   | 
                    |j         d	         j#        d           | 
                    |j         d
         j!        t          j)                   | 
                    |j         d
         j#        d           | 
                    |j         d         j!        t          j&                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j'        |           | 
                    |j         d         j!        t          j*                   | 
                    |j         d         j#        d           | 
                    |j         d         j!        t          j&                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j'        |           | 
                    |j         d         j!        t          j"                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j%        |           | 
                    |j         d         j!        t          j&                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j'        |           | 
                    |j         d         j!        t          j"                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j%        |           | 
                    |j         d         j!        t          j&                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j'        |           | 
                    |j         d         j!        t          j"                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j%        |           | 
                    |j         d         j!        t          j&                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j'        |           | 
                    |j         d         j!        t          j"                   | 
                    |j         d         j#        d           | 
                    |j         d         j$        j%        |           | 
                    |j         d         j!        t          j+                   | 
                    |j         d         j#        d           d S )NFrH   r   rv      r   r   r   r   r   r   r   r   r   r   r   r   r   r      ),r
   POLICIES_ACLr   r   r3   r   r   r&   r   r   rT   rU   r   r   r   r   r   rR   r   rw   r   r   r   DOMAIN_RID_POLICY_ADMINSrx   ry   rz   r   r   r   r   rE   r:   r;   r@   r<   r>   rA   r=   r?   r   r   r   r   )r,   r:   r7   r   rW   rB   r   r{   r   r   r   PA_sidr|   r   r   r}   r~   r   r   r   r   r   r   PA_gidPA_types                            r/   ,test_setntacl_policies_dir_check_getposixaclzAPosixAclMappingTests.test_setntacl_policies_dir_check_getposixacl"  s.   $*,,,,V44$,S[[	0 	0 	0 	0|<<f--s333$T\73NP\]]	!#f++"3c(:[6\6\"\]]!("EFF!("GHH!("899!("EFF!#f++"3c(:[6\6\"\]]Jtw{{+;<<==	
 &//77%"3444%//77%"4555%//77%"4555%//77%"4555%//77%"4555%//77%"4555"d.B.B9.M.MNNNq)0'2GHHHq)0!444q).2F;;;q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q)0'2JKKKq)0!444q)0'2FGGGq)0!444q).2F;;;q)0'2KLLLq)0!444q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;r*173GHHHr*11555r*/3V<<<r*173HIIIr*11555r*/3V<<<r*173GHHHr*11555r*/3V<<<r*173HIIIr*11555r*/3V<<<r*173GHHHr*1155555r0   c                    t           j        }t          j                    }|                     |          }t          | j        | j        |t          |          |d           t          | j        | j        |          }| 
                    |                    |          |           t          j        | j        t          j        |          }t!          j        d          }t!          j        d          }|dk    o|dk    }|j                                         }	t)          j        t          |          dz   t          t(          j                  z             }
t)          j        t(          j                  }t)          j        t(          j                  }t)          j        t(          j                  }t)          j        t(          j                  }t)          j        t          |          dz   t          t(          j                  z             }t          j        | j                            d                    }|                    |
          \  }}| 
                    |t>          j                    |                    |          \  }}| 
                    |t>          j!                   |                    |          \  }}| 
                    |t>          j!                   |                    |          \  }}| 
                    |t>          j!                   |                    |          \  }}| 
                    |t>          j!                   |                    |          \  }}| 
                    |t>          j!                   | 
                    |j"        d	| #                    |                     | 
                    |j$        d
         j%        t          j&                   | 
                    |j$        d
         j'        d           | 
                    |j$        d
         j(        j)        |           | 
                    |j$        d         j%        t          j*                   |s|	r'| 
                    |j$        d         j'        d           n&| 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j+        |           | 
                    |j$        d         j%        t          j,                   | 
                    |j$        d         j'        d
           | 
                    |j$        d         j%        t          j-                   |s|	r'| 
                    |j$        d         j'        d           n&| 
                    |j$        d         j'        d           | 
                    |j$        d         j%        t          j*                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j+        |           | 
                    |j$        d         j%        t          j.                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j%        t          j*                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j+        |           | 
                    |j$        d         j%        t          j&                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j)        |           | 
                    |j$        d         j%        t          j*                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j+        |           | 
                    |j$        d         j%        t          j&                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j)        |           | 
                    |j$        d         j%        t          j*                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j+        |           | 
                    |j$        d         j%        t          j&                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j)        |           | 
                    |j$        d         j%        t          j*                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j+        |           | 
                    |j$        d         j%        t          j&                   | 
                    |j$        d         j'        d           | 
                    |j$        d         j(        j)        |           | 
                    |j$        d         j%        t          j/                   | 
                    |j$        d         j'        d           d S )NFrH   r   r   r9   r   r   rv   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )0r
   r   r   r   r3   r   r   r'   r   r   rT   rU   r   r   r   r   r#   r   r   r   r   rR   r   rw   r   r   r   r   rx   ry   rz   r   r   r   r   rE   r:   r;   r@   r<   r>   rA   r=   r?   r   r   r   r   )r,   r:   r7   r   rW   rB   r   r   r   r   r   r{   r   r   r   r   r|   r   r   r}   r~   r   r   r   r   r   r   r   r   s                                r/   (test_setntacl_policies_check_getposixaclz=PosixAclMappingTests.test_setntacl_policies_check_getposixacl  s   $*,,,,V44$*c3v;;	0 	0 	0 	0\::f--s333$TZ1Ll[[	!y)EFF!#+I!J!J 4 : !D 6) C 	*9CCEEE!#f++"3c(:[6\6\"\]]!("EFF!("GHH!("899!("EFF!#f++"3c(:[6\6\"\]]Jtw{{+;<<==	
 &//77%"3444%//77%"4555%//77%"4555%//77%"4555%//77%"4555%//77%"4555"d.B.B9.M.MNNNq)0'2GHHHq)0!444q).2F;;;q)0'2FGGG 	9? 	9Y]1-4a8888Y]1-4a888q).2F;;;q)0'2GHHHq)0!444q)0'2JKKK 	9? 	9Y]1-4a8888Y]1-4a888q)0'2FGGGq)0!444q).2F;;;q)0'2KLLLq)0!444q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;q)0'2FGGGq)0!444q).2F;;;q)0'2GHHHq)0!444q).2F;;;r*173GHHHr*11555r*/3V<<<r*173HIIIr*11555r*/3V<<<r*173GHHHr*11555r*/3V<<<r*173HIIIr*11555r*/3V<<<r*173GHHHr*1155555r0   ) __name__
__module____qualname__r   r4   rK   r3   rE   rM   rY   r_   rg   ri   rn   rp   rr   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__)r.   s   @r/   r   r   $   s       K K K K K5 5 5 5 5
 '. % % % %	 	 	; ; ;
4 4 4
f 
f 
f4 4 44 4 4F F F"4 4 44 4 4	F 	F 	FF F F 4 4 4g g g] ] ]
4 4 44 4 4$4 4 45 5 5"5 5 5"5 5 54]6 ]6 ]6`P6 P6 P6z[6 [6 [6Ri6 i6 i6 i6 i6 i6 i6r0   r   c                       e Zd ZdZefdZdS )SessionedPosixAclMappingTests3
    Run same test suite with session enabled.
    c                    t          |          t          | j                                                  k    rEt          j        | j        t          |                    }t          j        || j        d           |S d                    |t          j	                  }t          j
        t          j        z  t          j        z  }t          j        | j        | j        ||          }t          j        || j        d           |S r6   Administrator)lp_ctx	user_namez<SID={0}-{1}>)r   dnsession_info_flagsr   r+   get_domain_sidr   admin_sessionr   session_info_fill_unixformatr   r    AUTH_SESSION_INFO_DEFAULT_GROUPSAUTH_SESSION_INFO_AUTHENTICATED#AUTH_SESSION_INFO_SIMPLE_PRIVILEGESuser_session)r,   r7   r   r   flagsr   s         r/   r3   z.SessionedPosixAclMappingTests.get_session_info2  s    v;;#dj7799:::: .twFDDM'/3w2AC C C C ! ##FH,MNN6569: (04,.<AC C C 	#L+/7.=	? 	? 	? 	? r0   Nr   r   r   __doc__rK   r3    r0   r/   r   r   -  s7          '.      r0   r   c                       e Zd ZdZefdZdS )!UnixSessionedPosixAclMappingTestsr   c                    t          |          t          | j                                                  k    rEt          j        | j        t          |                    }t          j        || j        d           |S d                    |t          j	                  }t          j
        t          j        z  t          j        z  }t          j        | j        | j        ||          }t          j        || j        d           |S r   r   )r,   r7   r   r   r   sessions         r/   r3   z2UnixSessionedPosixAclMappingTests.get_session_infoQ  s     v;;#dj7799:::: .twFDDM'/3w2AC C C C ! ##FH,MNN6569: #DJtw27<> > >#G+/7.=	? 	? 	? 	? r0   Nr   r   r0   r/   r   r   L  s7          '.      r0   r   )r   samba.ntaclsr   r   r   samba.dcerpcr   r   r   samba.tests.smbd_baser	   sambar
   r#   samba.samba3r   r   r   r   r   samba.samdbr   samba.auth_utilr   rK   rJ   r   r   r   r   r0   r/   <module>r
     sv  & 1 0 = = = = = = = = = = 1 1 1 1 1 1 1 1 1 1 / / / / / /       				 % % % % % % % % ) ) ) ) ) )             / / / / / /
5 lP6 P6 P6 P6 P6= P6 P6 P6R    $8   >    (<     r0   