42
42
db = common.db.DB()
43
43
list = db.get_users()
44
res = db.get_all('login', ['login', 'unixid'])
46
return (flds['login'], flds['unixid'])
47
uids = dict(map(repack,res))
44
51
except Exception, message:
45
52
print "Error: " + str(message)
48
55
list.sort(key=lambda user: user.login)
53
# Resolve the user's username into a UID
60
# Resolve the user's login into a UID
54
61
# Create the user if it does not exist
56
(_,_,uid,_,_,_,_) = pwd.getpwnam(username)
58
raise Exception("User %s does not have a Unix user account"
65
raise Exception("User %s does not have a unixid in the database"
60
67
# Remake the user's jail
61
common.makeuser.make_jail(username, uid)
68
common.makeuser.make_jail(login, uid)
62
69
except Exception, message:
63
70
print "Error: " + str(message)
66
print "Successfully recreated user %s's jail." % username
73
print "Successfully recreated user %s's jail." % login