mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fixed pylint issues
This commit is contained in:
parent
5ebf159554
commit
90f7829ad3
1 changed files with 10 additions and 5 deletions
|
@ -36,7 +36,7 @@ CALLOC.argtypes = [c_uint, c_uint]
|
|||
|
||||
STRDUP = LIBC.strdup
|
||||
STRDUP.argstypes = [c_char_p]
|
||||
STRDUP.restype = POINTER(c_char) # NOT c_char_p !!!!
|
||||
STRDUP.restype = POINTER(c_char) # NOT c_char_p !!!!
|
||||
|
||||
# Various constants
|
||||
PAM_PROMPT_ECHO_OFF = 1
|
||||
|
@ -44,6 +44,7 @@ PAM_PROMPT_ECHO_ON = 2
|
|||
PAM_ERROR_MSG = 3
|
||||
PAM_TEXT_INFO = 4
|
||||
|
||||
|
||||
class PamHandle(Structure):
|
||||
'''
|
||||
Wrapper class for pam_handle_t
|
||||
|
@ -56,6 +57,7 @@ class PamHandle(Structure):
|
|||
Structure.__init__(self)
|
||||
self.handle = 0
|
||||
|
||||
|
||||
class PamMessage(Structure):
|
||||
'''
|
||||
Wrapper class for pam_message structure
|
||||
|
@ -66,7 +68,8 @@ class PamMessage(Structure):
|
|||
]
|
||||
|
||||
def __repr__(self):
|
||||
return "<PamMessage %i '%s'>" % (self.msg_style, self.msg)
|
||||
return "<PamMessage {0:d} '{1}'>".format(self.msg_style, self.msg)
|
||||
|
||||
|
||||
class PamResponse(Structure):
|
||||
'''
|
||||
|
@ -78,12 +81,13 @@ class PamResponse(Structure):
|
|||
]
|
||||
|
||||
def __repr__(self):
|
||||
return "<PamResponse %i '%s'>" % (self.resp_retcode, self.resp)
|
||||
return "<PamResponse {0:d} '{1}'>".format(self.resp_retcode, self.resp)
|
||||
|
||||
CONV_FUNC = CFUNCTYPE(c_int,
|
||||
c_int, POINTER(POINTER(PamMessage)),
|
||||
POINTER(POINTER(PamResponse)), c_void_p)
|
||||
|
||||
|
||||
class PamConv(Structure):
|
||||
'''
|
||||
Wrapper class for pam_conv structure
|
||||
|
@ -110,7 +114,7 @@ try:
|
|||
PAM_SETCRED = LIBPAM.pam_setcred
|
||||
PAM_SETCRED.restype = c_int
|
||||
PAM_SETCRED.argtypes = [PamHandle, c_int]
|
||||
|
||||
|
||||
PAM_OPEN_SESSION = LIBPAM.pam_open_session
|
||||
PAM_OPEN_SESSION.restype = c_int
|
||||
PAM_OPEN_SESSION.argtypes = [PamHandle, c_int]
|
||||
|
@ -130,6 +134,7 @@ def __virtual__():
|
|||
'''
|
||||
return HAS_PAM
|
||||
|
||||
|
||||
def authenticate(username, password, service='login'):
|
||||
'''
|
||||
Returns True if the given username and password authenticate for the
|
||||
|
@ -172,7 +177,7 @@ def authenticate(username, password, service='login'):
|
|||
if retval != 0:
|
||||
PAM_END(handle, retval)
|
||||
return False
|
||||
|
||||
|
||||
retval = PAM_SETCRED(handle, 0)
|
||||
if retval != 0:
|
||||
PAM_END(handle, retval)
|
||||
|
|
Loading…
Add table
Reference in a new issue