
    Id                     \    d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d Z	 G d de      Z
y)    N)
gp_pol_ext)NamedTemporaryFile)logc                 ^    t        | t        j                        xr t        |       t        k7  S )N)
isinstancenumbersNumbertypebool)xs    :/usr/lib/python3/dist-packages/samba/gp/gp_smb_conf_ext.py	is_numberr      s%    a( 7d?    c                   $    e Zd Zd Zd Zd Zd Zy)gp_smb_conf_extc                    d}|D ]  \  }}| j                   j                  |       |j                  d      }|5|j                         D ]M  \  }}| j	                  ||       | j                   j                  d|       | j                   j                          O  |D ]  }	|	j                  sd}
| j                   j                  |	j                         t        j                  j                  |	j                  |      }| j                  |      }|su|j                  D ]^  }|j                  j                  |
      s| j	                  |j                   |j"                         | j                   j                          `  y )NMACHINE/Registry.polsmb.conf Software\Policies\Samba\smb_conf)gp_dbset_guidgetitemsset_smb_confdeletecommitfile_sys_pathnameospathjoinparseentrieskeyname
startswith	valuenamedata)selfdeleted_gpo_listchanged_gpo_listpol_fileguidsettingssmb_confkeyvaluegposection_namer    pol_confes                 r   process_group_policyz$gp_smb_conf_ext.process_group_policy   sF   ). 	$ND(JJ%||J/H&nn. $
U!!#u-

!!*c2

!!#$	$ $ 	(C  D

##CHH-ww||C$5$5x@::d+!)) (A99//= %%akk166:JJ%%'	(	(r   c                    | j                   j                  |      }t        |      t        k(  r|j	                         }t        |      rt        |      rt        |      }n(t        |      rt        |      t        k(  rt        |      }t        |      t        k(  r|rdnd}| j                   j                  ||       t        dt        j                  j                  | j                   j                              5 }| j                   j                  d|j                         t        j                   | j                   j                        j"                  }t        j$                  |j                  |       t        j&                  |j                  | j                   j                         d d d        t)        j*                  d|t        |      i       t        |      rt        |      }n<t        |      t        k(  r|rdnd}n#t        |      t,        k(  rdj/                  |      }| j0                  j3                  t        |       ||       y # 1 sw Y   xY w)NyesnoF)r   dirzsmb.conf [global] was changed )lpr   r
   bytesdecoder   strr   setr   r   r    dirname
configfiledumpr   statst_modechmodrenamer   infolistr!   r   store)r(   	attributevalold_valfmodes         r   r   zgp_smb_conf_ext.set_smb_conf6   s   ''++i(9**,CS>i0c(Cs^W 5s)C9%DCIs#u$&GGOODGG4F4F$GI 	2LMGGLL'77477--.66DHHQVVT"IIaffdgg001	2 	0IC2JKW'lG']d"&eDG']d"hhw'G

TIw7	2 	2s   :B.IIc                      y)Nr    )r(   s    r   __str__zgp_smb_conf_ext.__str__T   s    r   c                 h   i }|j                   rd}d}t        j                  j                  |j                   |      }| j	                  |      }|s|S |j
                  D ]Q  }|j                  j                  |      sd|j                         vri |d<   |j                  |d   |j                  <   S |S )Nr   r   r   )r   r   r    r!   r"   r#   r$   r%   keysr'   r&   )r(   r1   outputr2   r+   r    r3   r4   s           r   rsopzgp_smb_conf_ext.rsopW   s    @L-H77<< 1 18<Dzz$'H%% 9yy++L9V[[]2)+F:&23&&z"1;;/9 r   N)__name__
__module____qualname__r5   r   rQ   rU   rP   r   r   r   r      s    (68<r   r   )r   rer   samba.gp.gpclassr   tempfiler   samba.gp.util.loggingr   r   r   rP   r   r   <module>r]      s)   "   ' ' %Lj Lr   