Changeset 253 for test


Ignore:
Timestamp:
06/12/11 22:27:42 (14 years ago)
Author:
tim
Message:

added preliminary interface to security descriptors in pyregfi
misc bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/pyregfi-smoketest.py

    r252 r253  
    222222    for t in threads:
    223223        t.join()
     224
     225
     226def loopSecurity(hive, fh):
     227    start = hive.root.fetch_security()
     228    print(start.descriptor.group)
     229    cur = start.next_security()
     230
     231    while cur != start:
     232        print(start.descriptor.group)
     233        cur = cur.next_security()
     234
    224235   
     236def iterSecurity(hive, fh):
     237    stat = 0
     238    for k in hive:
     239        security = k.fetch_security()
     240        stat += security.ref_count
     241        stat += len(security.descriptor.owner)
     242        stat += len(security.descriptor.group)
     243        if security.descriptor.sacl:
     244            for ace in security.descriptor.sacl:
     245                stat += ace.flags
     246                if ace.object:
     247                    stat += ace.object.int
     248                if ace.inherited_object:
     249                    stat += ace.inherited_object.int
     250
     251        if security.descriptor.dacl:
     252            for ace in security.descriptor.dacl:
     253                stat += ace.flags
     254                if ace.object:
     255                    stat += ace.object.int
     256                if ace.inherited_object:
     257                    stat += ace.inherited_object.int
     258    print("  Security stat: %d" % stat)
    225259
    226260tests = {
     
    233267    "iterCallbackIO":iterCallbackIO,
    234268    "iterMultithread":iterMultithread,
     269    "loopSecurity":loopSecurity,
     270    "iterSecurity":iterSecurity,
    235271    }
    236272
Note: See TracChangeset for help on using the changeset viewer.