File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/auth/__pycache__/pam.cpython-310.pyc
o
�N�g� � @ s� d Z ddlZddlZddlZddlZddlZddlmZmZm Z m
Z
mZmZm
Z
mZmZmZmZmZ ddlmZ dZzddlZW n eyK dZY nw e�e�Zzeed��ZejZee_eege_ ej!Z"ege"_#e e�e"_W n e$y� ej%ddd � dZ&Y nw dZ&d
Z'dZ(dZ)d
Z*G dd� de
�Z+G dd� de
�Z,G dd� de
�Z-ee
e
e e e,��e e e-��e�Z.G dd� de
�Z/z:eed��Z0e0j1Z2e
e2_eee e/�e e+�ge2_ e0j3Z4e
e4_e+e
ge4_ e0j5Z6e
e6_e+e
ge6_ e0j7Z8e
e8_e+e
ge8_ W n e$�y
ej%ddd � dZ9Y nw dZ9dd� Z:d(dd�Z;dd� Z<dd � Z=d!d"� Z>ed#k�rGe;ej?d$ ej?d% ej?d& ej?d' ��r@e�@d� e�@d
� dS dS ))a`
Authenticate against PAM
Provides an authenticate function that will allow the caller to authenticate
a user against the Pluggable Authentication Modules (PAM) on the system.
Implemented using ctypes, so no compilation is necessary.
There is one extra configuration option for pam. The `pam_service` that is
authenticated against. This defaults to `login`
.. code-block:: yaml
auth.pam.service: login
.. note:: Solaris-like (SmartOS, OmniOS, ...) systems may need ``auth.pam.service`` set to ``other``.
.. note:: PAM authentication will not work for the ``root`` user.
The Python interface to PAM does not support authenticating as ``root``.
.. note:: This module executes itself in a subprocess in order to user the system python
and pam libraries. We do this to avoid openssl version conflicts when
running under a salt onedir build.
� N)�CDLL� CFUNCTYPE�POINTER� Structure�c_char�c_char_p�c_int�c_uint�c_void_p�cast�pointer�sizeof)�find_libraryTF�cz Failed to load libc using ctypes)�exc_info� � � � c @ s"