mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
strdup from libc is not available on windows
This commit is contained in:
parent
f2dd79f9c4
commit
55845f4846
1 changed files with 13 additions and 8 deletions
|
@ -48,15 +48,20 @@ from salt.ext.six.moves import range # pylint: disable=import-error,redefined-b
|
|||
# Import 3rd-party libs
|
||||
import salt.ext.six as six
|
||||
|
||||
LIBC = CDLL(find_library('c'))
|
||||
try:
|
||||
LIBC = CDLL(find_library('c'))
|
||||
|
||||
CALLOC = LIBC.calloc
|
||||
CALLOC.restype = c_void_p
|
||||
CALLOC.argtypes = [c_uint, c_uint]
|
||||
CALLOC = LIBC.calloc
|
||||
CALLOC.restype = c_void_p
|
||||
CALLOC.argtypes = [c_uint, c_uint]
|
||||
|
||||
STRDUP = LIBC.strdup
|
||||
STRDUP.argstypes = [c_char_p]
|
||||
STRDUP.restype = POINTER(c_char) # NOT c_char_p !!!!
|
||||
STRDUP = LIBC.strdup
|
||||
STRDUP.argstypes = [c_char_p]
|
||||
STRDUP.restype = POINTER(c_char) # NOT c_char_p !!!!
|
||||
except AttributeError:
|
||||
HAS_LIBC = False
|
||||
else:
|
||||
HAS_LIBC = True
|
||||
|
||||
# Various constants
|
||||
PAM_PROMPT_ECHO_OFF = 1
|
||||
|
@ -147,7 +152,7 @@ def __virtual__():
|
|||
'''
|
||||
Only load on Linux systems
|
||||
'''
|
||||
return HAS_PAM
|
||||
return HAS_LIBC and HAS_PAM
|
||||
|
||||
|
||||
def authenticate(username, password):
|
||||
|
|
Loading…
Add table
Reference in a new issue