From ffac0ffa658f7c54429512d77ed57e7b71634893 Mon Sep 17 00:00:00 2001 From: Ken Raffenetti Date: Fri, 3 Nov 2006 16:41:49 +0000 Subject: 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 --- src/lib/Server/Hostbase/nisauth.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/lib') 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') -- cgit v1.2.3-1-g7c22