Mercurial > hg > rc1
view plugins/password/helpers/chpass-wrapper.py @ 35:05c4c32948af
.hgignore: add vendor tree
composer.json: new packages
plugins/thunderbird_labels/thunderbird_labels.php: change hook and RFC822 use wrt whitelisting to avoid deprecated stuff
index.php: commented debugging hooks
others: new releases of vendor packages?
author | Charlie Root |
---|---|
date | Thu, 30 Aug 2018 16:21:59 -0400 |
parents | 1e000243b222 |
children |
line wrap: on
line source
#!/usr/bin/env python import sys import pwd import subprocess BLACKLIST = ( # add blacklisted users here #'user1', ) try: username, password = sys.stdin.readline().split(':', 1) except ValueError, e: sys.exit('Malformed input') try: user = pwd.getpwnam(username) except KeyError, e: sys.exit('No such user: %s' % username) if user.pw_uid < 1000: sys.exit('Changing the password for user id < 1000 is forbidden') if username in BLACKLIST: sys.exit('Changing password for user %s is forbidden (user blacklisted)' % username) handle = subprocess.Popen('/usr/sbin/chpasswd', stdin = subprocess.PIPE) handle.communicate('%s:%s' % (username, password)) sys.exit(handle.returncode)