1.2.9. pylibc
¶
This module provides a wrapped interface for Linux’s libc. Most of this
functionality is duplicated in Python’s own grp
and pwd
modules. This implementation however, using ctypes
to directly
interface with libc is necessary to avoid dead-lock issues when authenticating
non-local users such as would be found in an environment using an LDAP server.
1.2.9.1. Functions¶
-
getgrnam
(name, encoding='utf-8')[source]¶ Get the structure containing the fields from the specified entry in the group database. See getgrnam(3) for more information.
Parameters: Returns: The entry from the group database or
None
if it was not found.Return type:
-
getgrouplist
(user, group=AUTOMATIC, encoding='utf-8')[source]¶ Get the groups that the specified user belongs to. If group is not specified, it will be looked up from the password record for user. See getgrouplist(3) for more information.
Parameters: Returns: The group IDs that user belongs to.
Return type:
-
getpwnam
(name, encoding='utf-8')[source]¶ Get the structure containing the fields from the specified entry in the password database. See getpwnam(3) for more information.
Parameters: Returns: The entry from the user database or
None
if it was not found.Return type:
-
getpwuid
(uid)[source]¶ Get the structure containing the fields from the specified entry in the password database. See getpwuid(3) for more information.
Parameters: uid (int) – The user id to look up. Returns: The entry from the user database or None
if it was not found.Return type: tuple