"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "utils/shells.py" between
nss-pam-ldapd-0.9.11.tar.gz and nss-pam-ldapd-0.9.12.tar.gz

About: nss-pam-ldapd is a Name Service Switch (NSS) module and Pluggable Authentication Module (PAM) that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS. It also allows you to do authentication to an LDAP server.

shells.py  (nss-pam-ldapd-0.9.11):shells.py  (nss-pam-ldapd-0.9.12)
skipping to change at line 37 skipping to change at line 37
def list_shells(): def list_shells():
"""List the shells from /etc/shells.""" """List the shells from /etc/shells."""
libc = ctypes.CDLL(ctypes.util.find_library("c")) libc = ctypes.CDLL(ctypes.util.find_library("c"))
getusershell = libc.getusershell getusershell = libc.getusershell
getusershell.restype = ctypes.c_char_p getusershell.restype = ctypes.c_char_p
libc.setusershell() libc.setusershell()
while True: while True:
shell = getusershell() shell = getusershell()
if not shell: if not shell:
break break
yield shell yield shell.decode('utf-8')
libc.endusershell() libc.endusershell()
def shellexists(shell): def shellexists(shell):
"""Check if the provided shell exists and is executable.""" """Check if the provided shell exists and is executable."""
return os.path.isfile(shell) and os.access(shell, os.X_OK) return os.path.isfile(shell) and os.access(shell, os.X_OK)
def check(shell, asroot=False): def check(shell, asroot=False):
"""Check if the specified shell is valid and exit if it isn't.""" """Check if the specified shell is valid and exit if it isn't."""
# if the shell is listed in /etc/shells, everything should be OK # if the shell is listed in /etc/shells, everything should be OK
if shell in list_shells(): if shell in list_shells():
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)