diff options
author | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-11-03 16:41:49 +0000 |
---|---|---|
committer | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-11-03 16:41:49 +0000 |
commit | ffac0ffa658f7c54429512d77ed57e7b71634893 (patch) | |
tree | 024460bd15b61df7b95cc92ed88e715d1d8eef31 | |
parent | 7c43d0ceef63d36716cbca679a493d275f48faec (diff) | |
download | bcfg2-ffac0ffa658f7c54429512d77ed57e7b71634893.tar.gz bcfg2-ffac0ffa658f7c54429512d77ed57e7b71634893.tar.bz2 bcfg2-ffac0ffa658f7c54429512d77ed57e7b71634893.zip |
fixed a few minor bugs in authentication
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2470 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | src/lib/Server/Hostbase/nisauth.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/Server/Hostbase/nisauth.py b/src/lib/Server/Hostbase/nisauth.py index 24673ec17..9c68c44eb 100644 --- a/src/lib/Server/Hostbase/nisauth.py +++ b/src/lib/Server/Hostbase/nisauth.py @@ -1,5 +1,6 @@ import os -import pwd, crypt, nis +import crypt, nis +from Hostbase.settings import AUTHORIZED_GROUP """Checks with NIS to see if the current user is in the support group""" @@ -27,17 +28,15 @@ class nisauth(object): def __init__(self,login,passwd=None): """get user profile from NIS""" try: - p = pwd.getpwnam(login) - print p + p = nis.match(login, 'passwd.byname').split(":") except: raise NISAUTHError('username') # check user password using crypt and 2 character salt from passwd file if p[1] == crypt.crypt(passwd, p[1][:2]): # check to see if user is in valid support groups # will have to include these groups in a settings file eventually - if not login in nis.match('support', 'group.byname').split(':')[-1].split(','): + if not login in nis.match(AUTHORIZED_GROUP, 'group.byname').split(':')[-1].split(','): raise NISAUTHError('group') self.uid = p[2] - print self.uid else: raise NISAUTHError('password') |