Example #1
0
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d: %s" % d)

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in list(ucache.keys()):
                print("u key: %s" % key)

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in list(gcache.keys()):
                print("g key: %s" % key)

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in list(ducache.keys()):
                print("du key: %s" % key)

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in list(dgcache.keys()):
                print("dg key: %s" % key)
Example #2
0
def _cache_rawdump_NT4(**kwargs):
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d 

        print "w: %s" % workgroup 

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in ucache.keys():
                print "u: %s=%s" % (key, ucache[key])

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g: %s=%s" % (key, gcache[key])

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du: %s=%s" % (key, ducache[key])

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg: %s=%s" % (key, dgcache[key])
Example #3
0
def _cache_keys_NT4(**kwargs):
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d

        print("w: %s" % workgroup)

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in list(ucache.keys()):
                print("u key: %s" % key)

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in list(gcache.keys()):
                print("g key: %s" % key)

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in list(ducache.keys()):
                print("du key: %s" % key)

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in list(dgcache.keys()):
                print("dg key: %s" % key)
Example #4
0
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print "d: %s" % d

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
Example #5
0
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print "d: %s" % d

        ucache = FreeNAS_UserCache(dir=d)
        if ucache: 
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
Example #6
0
def _cache_check_default(**kwargs):
    if not kwargs.has_key('args') and kwargs['args']:
        return

    ucache = FreeNAS_UserCache()
    gcache = FreeNAS_GroupCache()
    ducache = FreeNAS_Directory_UserCache()
    dgcache = FreeNAS_Directory_GroupCache()

    for arg in kwargs['args']:
        key = val = None
        try:
            parts = arg.split('=')
            key = parts[0]
            val = join(parts[1:], '=')

        except:
            continue

        if key == 'u':
            if ucache and ucache.has_key(val) and ucache[val]:
                print "%s: %s" % (val, ucache[val])

        elif key == 'g':
            if gcache and gcache.has_key(val) and gcache[val]:
                print "%s: %s" % (val, gcache[val])

        elif key == 'du':
            if ducache and ducache.has_key(val) and ducache[val]:
                print "%s: %s" % (val, ducache[val])

        elif key == 'dg':
            if dgcache and dgcache.has_key(val) and dgcache[val]:
                print "%s: %s" % (val, dgcache[val])
Example #7
0
def _cache_rawdump_NT4(**kwargs):
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d

        print "w: %s" % workgroup

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in ucache.keys():
                print "u: %s=%s" % (key, ucache[key])

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g: %s=%s" % (key, gcache[key])

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du: %s=%s" % (key, ducache[key])

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg: %s=%s" % (key, dgcache[key])
Example #8
0
def _cache_rawdump_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d: %s" % d)

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in list(ucache.keys()):
                print("u: %s=%s" % (key, ucache[key]))

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in list(gcache.keys()):
                print("g: %s=%s" % (key, gcache[key]))

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in list(ducache.keys()):
                print("du: %s=%s" % (key, ducache[key]))

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in list(dgcache.keys()):
                print("dg: %s=%s" % (key, dgcache[key]))
Example #9
0
def _cache_keys_ActiveDirectory(**kwargs):
    ad = FreeNAS_ActiveDirectory(flags=FLAGS_DBINIT)
    domains = ad.get_domains()
    for d in domains:
        workgroup = d['nETBIOSName']

        print "w: %s" % workgroup 

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache: 
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
Example #10
0
def _cache_keys_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d: %s" % d)

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in list(ucache.keys()):
                print("u key: %s" % key)

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in list(gcache.keys()):
                print("g key: %s" % key)

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in list(ducache.keys()):
                print("du key: %s" % key)

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in list(dgcache.keys()):
                print("dg key: %s" % key)
Example #11
0
def _cache_keys_NT4(**kwargs):
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d

        print "w: %s" % workgroup 

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
Example #12
0
def _cache_rawdump_ActiveDirectory(**kwargs):
    ad = FreeNAS_ActiveDirectory(flags=FLAGS_DBINIT)
    domains = ad.get_domains()
    for d in domains:
        workgroup = d['nETBIOSName']

        print "w: %s" % workgroup

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in ucache.keys():
                print "u: %s=%s" % (key, ucache[key])

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g: %s=%s" % (key, gcache[key])

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du: %s=%s" % (key, ducache[key])

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg: %s=%s" % (key, dgcache[key])
Example #13
0
def _cache_rawdump_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print "d: %s" % d

        ucache = FreeNAS_UserCache(dir=d)
        if ucache:
            for key in ucache.keys():
                print "u: %s=%s" % (key, ucache[key])

        gcache = FreeNAS_GroupCache(dir=d)
        if gcache:
            for key in gcache.keys():
                print "g: %s=%s" % (key, gcache[key])

        ducache = FreeNAS_Directory_UserCache(dir=d)
        if ducache:
            for key in ducache.keys():
                print "du: %s=%s" % (key, ducache[key])

        dgcache = FreeNAS_Directory_GroupCache(dir=d)
        if dgcache:
            for key in dgcache.keys():
                print "dg: %s=%s" % (key, dgcache[key])
Example #14
0
def _cache_keys_NT4(**kwargs):
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d

        print "w: %s" % workgroup

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
Example #15
0
def _cache_keys_ActiveDirectory(**kwargs):
    ad = FreeNAS_ActiveDirectory(flags=FLAGS_DBINIT)
    domains = ad.get_domains()
    for d in domains:
        workgroup = d['nETBIOSName']

        print "w: %s" % workgroup

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in ucache.keys():
                print "u key: %s" % key

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g key: %s" % key

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du key: %s" % key

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg key: %s" % key
Example #16
0
def _cache_rawdump_ActiveDirectory(**kwargs):
    ad = FreeNAS_ActiveDirectory(flags=FLAGS_DBINIT)
    domains = ad.get_domains()
    for d in domains:
        workgroup = d['nETBIOSName']

        print "w: %s" % workgroup 

        ucache = FreeNAS_UserCache(dir=workgroup)
        if ucache:
            for key in ucache.keys():
                print "u: %s=%s" % (key, ucache[key])

        gcache = FreeNAS_GroupCache(dir=workgroup)
        if gcache:
            for key in gcache.keys():
                print "g: %s=%s" % (key, gcache[key])

        ducache = FreeNAS_Directory_UserCache(dir=workgroup)
        if ducache:
            for key in ducache.keys():
                print "du: %s=%s" % (key, ducache[key])

        dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)
        if dgcache:
            for key in dgcache.keys():
                print "dg: %s=%s" % (key, dgcache[key])
Example #17
0
def _cache_check_default(**kwargs):
    if not kwargs.has_key('args') and kwargs['args']:
        return

    ucache = FreeNAS_UserCache()
    gcache = FreeNAS_GroupCache()
    ducache = FreeNAS_Directory_UserCache()
    dgcache = FreeNAS_Directory_GroupCache()

    for arg in kwargs['args']:
        key = val = None
        try:
            parts = arg.split('=')
            key = parts[0]
            val = join(parts[1:], '=')

        except:
            continue

        if key == 'u':
            if ucache and ucache.has_key(val) and ucache[val]:
                print "%s: %s" % (val, ucache[val])

        elif key == 'g':
            if gcache and gcache.has_key(val) and gcache[val]:
                print "%s: %s" % (val, gcache[val])

        elif key == 'du':
            if ducache and ducache.has_key(val) and ducache[val]:
                print "%s: %s" % (val, ducache[val])

        elif key == 'dg':
            if dgcache and dgcache.has_key(val) and dgcache[val]:
                print "%s: %s" % (val, dgcache[val])
Example #18
0
    def __init__(self, **kwargs):
        log.debug("FreeNAS_DomainController_Users.__init__: enter")

        super(FreeNAS_DomainController_Users, self).__init__(**kwargs)

        self.__users = {}
        self.__ucache = {}
        self.__ducache = {}

        if 'domain' in kwargs and kwargs['domain']:
            self.__domains = self.get_domains(domain=kwargs['domain'])
        else:
            self.__domains = [self.get_domain()]

        if (
            (self.flags & FLAGS_CACHE_READ_USER) or
            (self.flags & FLAGS_CACHE_WRITE_USER)
        ):
            for d in self.__domains:
                self.__ucache[d] = FreeNAS_UserCache(dir=d)
                self.__ducache[d] = FreeNAS_DomainController_UserCache(dir=d)

        self.__get_users()

        log.debug("FreeNAS_DomainController_Users.__init__: leave")
Example #19
0
def _cache_rawdump_default(**kwargs):
    ucache = FreeNAS_UserCache()
    for key in list(ucache.keys()):
        print("u: %s=%s" % (key, ucache[key]))

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in list(gcache.keys()):
            print("g: %s=%s" % (key, gcache[key]))

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in list(ducache.keys()):
            print("du: %s=%s" % (key, ducache[key]))

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in list(dgcache.keys()):
            print("dg: %s=%s" % (key, dgcache[key]))
Example #20
0
def _cache_count_NIS(**kwargs):
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        print("d:  %s" % d)
        print("u:  %ld" % _cachelen(FreeNAS_UserCache(dir=d)))
        print("g:  %ld" % _cachelen(FreeNAS_GroupCache(dir=d)))
        print("du: %ld" % _cachelen(FreeNAS_Directory_UserCache(dir=d)))
        print("dg: %ld" % _cachelen(FreeNAS_Directory_GroupCache(dir=d)))
        print("\n")
Example #21
0
def _cache_rawdump_default(**kwargs):
    ucache = FreeNAS_UserCache()
    for key in list(ucache.keys()):
        print("u: %s=%s" % (key, ucache[key]))

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in list(gcache.keys()):
            print("g: %s=%s" % (key, gcache[key]))

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in list(ducache.keys()):
            print("du: %s=%s" % (key, ducache[key]))

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in list(dgcache.keys()):
            print("dg: %s=%s" % (key, dgcache[key]))
Example #22
0
def _cache_rawdump_default(**kwargs):
    ucache = FreeNAS_UserCache()
    for key in ucache.keys():
        print "u: %s=%s" % (key, ucache[key])

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in gcache.keys():
            print "g: %s=%s" % (key, gcache[key])

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in ducache.keys():
            print "du: %s=%s" % (key, ducache[key])

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in dgcache.keys():
            print "dg: %s=%s" % (key, dgcache[key])
Example #23
0
def _cache_rawdump_default(**kwargs):
    ucache = FreeNAS_UserCache()
    for key in ucache.keys():
        print "u: %s=%s" % (key, ucache[key])

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in gcache.keys():
            print "g: %s=%s" % (key, gcache[key])

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in ducache.keys():
            print "du: %s=%s" % (key, ducache[key])

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in dgcache.keys():
            print "dg: %s=%s" % (key, dgcache[key])
Example #24
0
def _cache_keys_default(**kwargs):
    ucache = FreeNAS_UserCache()
    if ucache:
        for key in list(ucache.keys()):
            print("u key: %s" % key)

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in list(gcache.keys()):
            print("g key: %s" % key)

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in list(ducache.keys()):
            print("du key: %s" % key)

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in list(dgcache.keys()):
            print("dg key: %s" % key)
Example #25
0
def _cache_keys_default(**kwargs):
    ucache = FreeNAS_UserCache()
    if ucache:
        for key in list(ucache.keys()):
            print("u key: %s" % key)

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in list(gcache.keys()):
            print("g key: %s" % key)

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in list(ducache.keys()):
            print("du key: %s" % key)

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in list(dgcache.keys()):
            print("dg key: %s" % key)
Example #26
0
def _cache_keys_default(**kwargs):
    ucache = FreeNAS_UserCache()
    if ucache:
        for key in ucache.keys():
            print "u key: %s" % key

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in gcache.keys():
            print "g key: %s" % key

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in ducache.keys():
            print "du key: %s" % key

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in dgcache.keys():
            print "dg key: %s" % key
Example #27
0
def _cache_keys_default(**kwargs):
    ucache = FreeNAS_UserCache()
    if ucache:
        for key in ucache.keys():
            print "u key: %s" % key

    gcache = FreeNAS_GroupCache()
    if gcache:
        for key in gcache.keys():
            print "g key: %s" % key

    ducache = FreeNAS_Directory_UserCache()
    if ducache:
        for key in ducache.keys():
            print "du key: %s" % key

    dgcache = FreeNAS_Directory_GroupCache()
    if dgcache:
        for key in dgcache.keys():
            print "dg key: %s" % key
Example #28
0
    def __init__(self, **kwargs):
        super(FreeNAS_LDAP_Users, self).__init__(**kwargs)

        if ((self.flags & FLAGS_CACHE_READ_USER)
                or (self.flags & FLAGS_CACHE_WRITE_USER)):
            self.__ucache = FreeNAS_UserCache()
            self.__ducache = FreeNAS_Directory_UserCache()

        self.__users = []
        self.__usernames = []
        self.__get_users()
Example #29
0
def _cache_count_NT4(**kwargs):
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d

        print "w:  %s" % workgroup
        print "u:  %ld" % _cachelen(FreeNAS_UserCache(dir=workgroup))
        print "g:  %ld" % _cachelen(FreeNAS_GroupCache(dir=workgroup))
        print "du: %ld" % _cachelen(FreeNAS_NT4_UserCache(dir=workgroup))
        print "dg: %ld" % _cachelen(FreeNAS_NT4_GroupCache(dir=workgroup))
        print "\n"
Example #30
0
def _cache_count_ActiveDirectory(**kwargs):
    ad = FreeNAS_ActiveDirectory(flags=FLAGS_DBINIT)
    domains = ad.get_domains()
    for d in domains:
        workgroup = d['nETBIOSName']

        print "w:  %s" % workgroup
        print "u:  %ld" % _cachelen(FreeNAS_UserCache(dir=workgroup))
        print "g:  %ld" % _cachelen(FreeNAS_GroupCache(dir=workgroup))
        print "du: %ld" % _cachelen(FreeNAS_Directory_UserCache(dir=workgroup))
        print "dg: %ld" % _cachelen(
            FreeNAS_Directory_GroupCache(dir=workgroup))
        print "\n"
Example #31
0
    def __init__(self, user, **kwargs):
        log.debug("FreeNAS_LDAP_User.__init__: user = %s", user)

        super(FreeNAS_LDAP_User, self).__init__(**kwargs)

        if ((self.flags & FLAGS_CACHE_READ_USER)
                or (self.flags & FLAGS_CACHE_WRITE_USER)):
            self.__ucache = FreeNAS_UserCache()
            self.__ducache = FreeNAS_Directory_UserCache()
            if self.usersuffix and self.basedn:
                self.__key = str("uid=%s,%s,%s" %
                                 (user, self.usersuffix, self.basedn))
            elif self.basedn:
                self.__key = str("uid=%s,%s" % (user, self.basedn))

        self._pw = None
        if user:
            self.__get_user(user)
Example #32
0
    def __init__(self, user, **kwargs):
        log.debug("FreeNAS_DomainController_User.__init__: enter")
        log.debug("FreeNAS_DomainController_User.__init__: user = %s", user)

        parts = user.split(FREENAS_DOMAINCONTROLLER_SEPARATOR)
        domain = parts[0]

        self._pw = None

        kwargs['domain'] = domain
        super(FreeNAS_DomainController_User, self).__init__(**kwargs)

        if (
            (self.flags & FLAGS_CACHE_READ_USER) or
            (self.flags & FLAGS_CACHE_WRITE_USER)
        ):
            self.__ucache = FreeNAS_UserCache()
            self.__ducache = FreeNAS_DomainController_UserCache(dir=domain)
            self.__key = user

        self.__get_user(user, domain)

        log.debug("FreeNAS_DomainController_User.__init__: leave")
Example #33
0
def _cache_count_default(**kwargs):
    print("u:  %ld" % _cachelen(FreeNAS_UserCache()))
    print("g:  %ld" % _cachelen(FreeNAS_GroupCache()))
    print("du: %ld" % _cachelen(FreeNAS_Directory_UserCache()))
    print("dg: %ld" % _cachelen(FreeNAS_Directory_GroupCache()))
    print("\n")
Example #34
0
def _cache_check_ActiveDirectory(**kwargs):
    if not kwargs.has_key('args') and kwargs['args']:
        return

    valid = {}
    ad = FreeNAS_ActiveDirectory(flags=FLAGS_DBINIT)
    domains = ad.get_domains()
    for d in domains:
        workgroup = d['nETBIOSName']
        valid[workgroup] = True

    for arg in kwargs['args']:
        key = val = None

        if arg.startswith("u="):
            key = "u"
            val = arg.partition("u=")[2]

        elif arg.startswith("g="):
            key = "g"
            val = arg.partition("g=")[2]

        elif arg.startswith("du="):
            key = "du"
            val = arg.partition("du=")[2]

        elif arg.startswith("dg="):
            key = "dg"
            val = arg.partition("dg=")[2]

        else:
            continue

        if key in ('u', 'g'):
            parts = val.split('\\')
            if len(parts) < 2:
                continue

            workgroup = parts[0]
            if not valid.has_key(workgroup):
                continue

            ucache = FreeNAS_UserCache(dir=workgroup)
            gcache = FreeNAS_GroupCache(dir=workgroup)
            ducache = FreeNAS_Directory_UserCache(dir=workgroup)
            dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)

            if key == 'u':
                if ucache and ucache.has_key(val) and ucache[val]:
                    print "%s: %s" % (val, ucache[val])

            elif key == 'g':
                if gcache and gcache.has_key(val) and gcache[val]:
                    print "%s: %s" % (val, gcache[val])

        elif key in ('du', 'dg'):
            for workgroup in valid.keys():
                ucache = FreeNAS_UserCache(dir=workgroup)
                gcache = FreeNAS_GroupCache(dir=workgroup)
                ducache = FreeNAS_Directory_UserCache(dir=workgroup)
                dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)

                if key == 'du':
                    if ducache and ducache.has_key(val) and ducache[val]:
                        print "%s: %s" % (val, ducache[val])

                elif key == 'dg':
                    if dgcache and dgache.has_key(val) and dgcache[val]:
                        print "%s: %s" % (val, dgcache[val])
Example #35
0
def _cache_check_NIS(**kwargs):
    if 'args' not in kwargs and kwargs['args']:
        return

    valid = {}
    nis = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        valid[d] = True

    for arg in kwargs['args']:
        key = val = None

        if arg.startswith("u="):
            key = "u"
            val = arg.partition("u=")[2]

        elif arg.startswith("g="):
            key = "g"
            val = arg.partition("g=")[2]

        elif arg.startswith("du="):
            key = "du"
            val = arg.partition("du=")[2]

        elif arg.startswith("dg="):
            key = "dg"
            val = arg.partition("dg=")[2]

        else:
            continue

        if key in ('u', 'g'):
            parts = val.split('\\')
            if len(parts) < 2:
                continue

            d = parts[0]
            if d not in valid:
                continue

            ucache = FreeNAS_UserCache(dir=d)
            gcache = FreeNAS_GroupCache(dir=d)
            ducache = FreeNAS_Directory_UserCache(dir=d)
            dgcache = FreeNAS_Directory_GroupCache(dir=d)

            if key == 'u':
                if ucache and val in ucache and ucache[val]:
                    print("%s: %s" % (val, ucache[val]))

            elif key == 'g':
                if gcache and val in gcache and gcache[val]:
                    print("%s: %s" % (val, gcache[val]))

        elif key in ('du', 'dg'):
            for d in list(valid.keys()):
                ucache = FreeNAS_UserCache(dir=d)
                gcache = FreeNAS_GroupCache(dir=d)
                ducache = FreeNAS_Directory_UserCache(dir=d)
                dgcache = FreeNAS_Directory_GroupCache(dir=d)

                if key == 'du':
                    if ducache and val in ducache and ducache[val]:
                        print("%s: %s" % (val, ducache[val]))

                elif key == 'dg':
                    if dgcache and val in dgcache and dgcache[val]:
                        print("%s: %s" % (val, dgcache[val]))
Example #36
0
def _cache_check_NT4(**kwargs):
    if not ('args' in kwargs and kwargs['args']):
        return

    valid = {}
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d
        valid[workgroup] = True

    for arg in kwargs['args']:
        key = val = None

        if arg.startswith("u="):
            key = "u"
            val = arg.partition("u=")[2]

        elif arg.startswith("g="):
            key = "g"
            val = arg.partition("g=")[2]

        elif arg.startswith("du="):
            key = "du"
            val = arg.partition("du=")[2]

        elif arg.startswith("dg="):
            key = "dg"
            val = arg.partition("dg=")[2]

        else:
            continue

        if key in ('u', 'g'):
            parts = val.split('\\')
            if len(parts) < 2:
                continue

            workgroup = parts[0]
            if workgroup not in valid:
                continue

            ucache = FreeNAS_UserCache(dir=workgroup)
            gcache = FreeNAS_GroupCache(dir=workgroup)
            ducache = FreeNAS_Directory_UserCache(dir=workgroup)
            dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)

            if key == 'u':
                if ucache and val in ucache and ucache[val]:
                    print "%s: %s" % (val, ucache[val])

            elif key == 'g':
                if gcache and val in gcache and gcache[val]:
                    print "%s: %s" % (val, gcache[val])

        elif key in ('du', 'dg'):
            for workgroup in valid.keys():
                ucache = FreeNAS_UserCache(dir=workgroup)
                gcache = FreeNAS_GroupCache(dir=workgroup)
                ducache = FreeNAS_Directory_UserCache(dir=workgroup)
                dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)

                if key == 'du':
                    if ducache and val in ducache and ducache[val]:
                        print "%s: %s" % (val, ducache[val])

                elif key == 'dg':
                    if dgcache and val in dgcache and dgcache[val]:
                        print "%s: %s" % (val, dgcache[val])
Example #37
0
def _cache_check_NIS(**kwargs):
    if not kwargs.has_key('args') and kwargs['args']:
        return

    valid = {}
    ad = FreeNAS_NIS(flags=FLAGS_DBINIT)
    domains = nis.get_domains()
    for d in domains:
        valid[d] = True

    for arg in kwargs['args']:
        key = val = None

        if arg.startswith("u="): 
            key = "u"
            val = arg.partition("u=")[2]

        elif arg.startswith("g="): 
            key = "g"
            val = arg.partition("g=")[2]

        elif arg.startswith("du="): 
            key = "du"
            val = arg.partition("du=")[2]

        elif arg.startswith("dg="): 
            key = "dg"
            val = arg.partition("dg=")[2]

        else:
            continue


        if key in ('u', 'g'):
            parts = val.split('\\')
            if len(parts) < 2:
                continue

            d = parts[0]
            if not valid.has_key(d):
                continue

            ucache = FreeNAS_UserCache(dir=d)
            gcache = FreeNAS_GroupCache(dir=d)
            ducache = FreeNAS_Directory_UserCache(dir=d)
            dgcache = FreeNAS_Directory_GroupCache(dir=d)

            if key == 'u':
                if ucache and ucache.has_key(val) and ucache[val]:
                    print "%s: %s" % (val, ucache[val])

            elif key == 'g':
                if gcache and gcache.has_key(val) and gcache[val]:
                    print "%s: %s" % (val, gcache[val])


        elif key in ('du', 'dg'):
            for d in valid.keys():
                ucache = FreeNAS_UserCache(dir=d)
                gcache = FreeNAS_GroupCache(dir=d)
                ducache = FreeNAS_Directory_UserCache(dir=d)
                dgcache = FreeNAS_Directory_GroupCache(dir=d)

                if key == 'du':
                    if ducache and ducache.has_key(val) and ducache[val]:
                        print "%s: %s" % (val, ducache[val])

                elif key == 'dg':
                    if dgcache and dgache.has_key(val) and dgcache[val]:
                        print "%s: %s" % (val, dgcache[val])
Example #38
0
def _cache_check_NT4(**kwargs):
    if not kwargs.has_key('args') and kwargs['args']:
        return

    valid = {}
    nt4 = FreeNAS_NT4()
    domains = nt4.get_domains()
    for d in domains:
        workgroup = d
        valid[workgroup] = True

    for arg in kwargs['args']:
        key = val = None

        if arg.startswith("u="): 
            key = "u"
            val = arg.partition("u=")[2]

        elif arg.startswith("g="): 
            key = "g"
            val = arg.partition("g=")[2]

        elif arg.startswith("du="): 
            key = "du"
            val = arg.partition("du=")[2]

        elif arg.startswith("dg="): 
            key = "dg"
            val = arg.partition("dg=")[2]

        else:
            continue


        if key in ('u', 'g'):
            parts = val.split('\\')
            if len(parts) < 2:
                continue

            workgroup = parts[0]
            if not valid.has_key(workgroup):
                continue

            ucache = FreeNAS_UserCache(dir=workgroup)
            gcache = FreeNAS_GroupCache(dir=workgroup)
            ducache = FreeNAS_Directory_UserCache(dir=workgroup)
            dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)

            if key == 'u':
                if ucache and ucache.has_key(val) and ucache[val]:
                    print "%s: %s" % (val, ucache[val])

            elif key == 'g':
                if gcache and gcache.has_key(val) and gcache[val]:
                    print "%s: %s" % (val, gcache[val])


        elif key in ('du', 'dg'):
            for workgroup in valid.keys():
                ucache = FreeNAS_UserCache(dir=workgroup)
                gcache = FreeNAS_GroupCache(dir=workgroup)
                ducache = FreeNAS_Directory_UserCache(dir=workgroup)
                dgcache = FreeNAS_Directory_GroupCache(dir=workgroup)

                if key == 'du':
                    if ducache and ducache.has_key(val) and ducache[val]:
                        print "%s: %s" % (val, ducache[val])

                elif key == 'dg':
                    if dgcache and dgcache.has_key(val) and dgcache[val]:
                        print "%s: %s" % (val, dgcache[val])