File: //usr/lib/python3/dist-packages/certbot/compat/__pycache__/filesystem.cpython-39.pyc
a
�`�u � @ s� d Z ddlmZ ddlZddlZddlZddlZddlmZ z<ddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlZW n ey� dZY n0 dZG dd� d�Ze� Zd d
� Zdd� Zd
d� ZdBdd�Zdd� Zdd� Zdd� ZdCdd�ZdDdd�ZdEdd�Zdd� Zd d!� Zd"d#� Z d$d%� Z!d&d'� Z"d(d)� Z#d*d+� Z$d,d-� Z%d.d/� Z&d0d1� Z'dFd2d3�Z(d4d5� Z)d6d7� Z*d8d9� Z+d:d;� Z,d<d=� Z-d>d?� Z.d@dA� Z/dS )Gz;Compat module to handle files security on Windows and Linux� )�absolute_importN)�ListTFc @ s e Zd ZdZdd� ZdS )�
_WindowsUmaskz+Store the current umask to apply on Windowsc C s
d| _ d S )N� )�mask)�self� r �;/usr/lib/python3/dist-packages/certbot/compat/filesystem.py�__init__ s z_WindowsUmask.__init__N)�__name__�
__module__�__qualname__�__doc__r
r r r r r s r c C s t rt�| |� n
t| |� dS )a[
Apply a POSIX mode on given file_path:
- for Linux, the POSIX mode will be directly applied using chmod,
- for Windows, the POSIX mode will be translated into a Windows DACL that make sense for
Certbot context, and applied to the file using kernel calls.
The definition of the Windows DACL that correspond to a POSIX mode, in the context of Certbot,
is explained at https://github.com/certbot/certbot/issues/6356 and is implemented by the
method `_generate_windows_flags()`.
:param str file_path: Path of the file
:param int mode: POSIX mode to apply
N)�
POSIX_MODE�os�chmod�_apply_win_mode�� file_path�moder r r r '