8 # add blacklisted users here
13 username, password = sys.stdin.readline().split(':', 1)
15 sys.exit('Malformed input')
18 user = pwd.getpwnam(username)
20 sys.exit('No such user: %s' % username)
22 if user.pw_uid < 1000:
23 sys.exit('Changing the password for user id < 1000 is forbidden')
25 if username in BLACKLIST:
26 sys.exit('Changing password for user %s is forbidden (user blacklisted)' %
29 handle = subprocess.Popen('/usr/sbin/chpasswd', stdin = subprocess.PIPE)
30 handle.communicate('%s:%s' % (username, password))
32 sys.exit(handle.returncode)