diff options
Diffstat (limited to 'src/lib/Server/Hostbase/nisauth.py')
-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') |