Exemple #1
0
    def sync(self):
        found_names = []
        users = self.__search()
        for u in users:
            username = u[1]['sAMAccountName'][0]
            found_names.append(username)
            if not username in ajenti.config.tree.users:
                u = UserData()
                u.name = username
                ajenti.config.tree.users[username] = u

        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()
Exemple #2
0
    def sync(self):
        found_names = []
        users = self.__search()
        for u in users:
            username = u[1]['sAMAccountName'][0]
            found_names.append(username)
            if not username in ajenti.config.tree.users:
                u = UserData()
                u.name = username
                ajenti.config.tree.users[username] = u

        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()
Exemple #3
0
    def sync(self):
        found_names = []
        for l in open('/etc/shadow').read().splitlines():
            l = l.split(':')
            if len(l) >= 2:
                username, pwd = l[:2]
                if len(pwd) > 2:
                    found_names.append(username)
                    if not username in ajenti.config.tree.users:
                        u = UserData()
                        u.name = username
                        ajenti.config.tree.users[username] = u

        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()
Exemple #4
0
    def sync(self):
        found_names = []
        for l in subprocess.check_output(['passwd', '-Sa']).splitlines():
            l = l.split()
            if len(l) >= 2:
                username, state = l[:2]
                if state == 'P':
                    found_names.append(username)
                    if not username in ajenti.config.tree.users:
                        u = UserData()
                        u.name = username
                        ajenti.config.tree.users[username] = u

        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()
Exemple #5
0
    def sync(self):
        found_names = []
        for l in open('/etc/shadow').read().splitlines():
            l = l.split(':')
            if len(l) >= 2:
                username, pwd = l[:2]
                if len(pwd) > 2:
                    found_names.append(username)
                    if not username in ajenti.config.tree.users:
                        u = UserData()
                        u.name = username
                        ajenti.config.tree.users[username] = u

        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()
Exemple #6
0
    def sync(self):
        found_names = []
        for l in subprocess.check_output(['passwd', '-Sa']).splitlines():
            l = l.split()
            if len(l) >= 2:
                username, state = l[:2]
                if state == 'P':
                    found_names.append(username)
                    if not username in ajenti.config.tree.users:
                        u = UserData()
                        u.name = username
                        ajenti.config.tree.users[username] = u
        
        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()
Exemple #7
0
    def sync(self):
        found_names = []
        l = self.__get_ldap()
        users = l.search_s(
            self.classconfig['auth_dn'], ldap.SCOPE_SUBTREE,
            '(|(objectClass=user)(objectClass=simpleSecurityObject))', ['cn'])
        for u in users:
            username = u[1]['cn'][0]
            found_names.append(username)
            if not username in ajenti.config.tree.users:
                u = UserData()
                u.name = username
                ajenti.config.tree.users[username] = u

        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()
Exemple #8
0
    def sync(self):
        found_names = []
        l = self.__get_ldap()
        users = l.search_s(
            self.classconfig['auth_dn'], 
            ldap.SCOPE_SUBTREE, 
            '(|(objectClass=user)(objectClass=simpleSecurityObject))', 
            ['cn']
        ) 
        for u in users:
            username = u[1]['cn'][0]
            found_names.append(username)
            if not username in ajenti.config.tree.users:
                u = UserData()
                u.name = username
                ajenti.config.tree.users[username] = u
        
        for user in list(ajenti.config.tree.users.values()):
            if not user.name in found_names and user.name != 'root':
                ajenti.config.tree.users.pop(user.name)

        ajenti.config.save()