0 0 1
default
Jean-Francois Pieronne - 5 years ago 2014-10-20 18:27:21
jf.pieronne@laposte.net
Initial version of demo_read_sysuaf.py
1 file changed with 101 insertions and 0 deletions:
↑ Collapse Diff ↑
 
new file 100755
1
 
import struct
2
 
import vms.rms
3
 
import vms.fabdef
4
 
import vms.rmsdef
5
 

	
6
 
__version__ = '1.0'
7
 
__doc__ = 'get user informations from sysuaf'
8
 

	
9
 
class user:
10
 
    def __init__(self, username, uic_member, uic_group, sub_id, parent_id, 
11
 
                 account, owner, defdev, defdir, lgicmd, defcli, clitables,
12
 
                 pwd, pwd2, logfails, salt, encrypt, encrypt2, pwd_length,
13
 
                 expiration, pwd_lifetime, pwd_date, pwd2_date, lastlogin_i,
14
 
                 lastlogin_n, priv, def_priv, min_class, max_class, flags,
15
 
                 hourly_access, primedays, pri, quepri, maxjobs, maxacctjobs,
16
 
                 maxdetach, prccnt, biolm, diolm, tqcnt, astlm, enqlm, fillm,
17
 
                 shrfillm, wsquota, dfwscnt, wsextent, pgflquota, cputim,
18
 
                 bytlm, pbytlm, jtquota, proxy_lim, proxies, account_lim,
19
 
                 accounts, def_class):
20
 
        self.username = username
21
 
        self.uic_member = uic_member
22
 
        self.uic_group = uic_group
23
 
        self.sub_id = sub_id
24
 
        self.parent_id = parent_id
25
 
        self.account = account
26
 
        self.owner = owner
27
 
        self.defdev = defdev
28
 
        self.defdir = defdir
29
 
        self.lgicmd = lgicmd
30
 
        self.defcli = defcli
31
 
        self.clitables = clitables
32
 
        self.pwd = pwd
33
 
        self.pwd2 = pwd2
34
 
        self.logfails = logfails
35
 
        self.salt = salt
36
 
        self.encrypt = encrypt
37
 
        self.encrypt2 = encrypt2
38
 
        self.pwd_length = pwd_length
39
 
        self.expiration = expiration
40
 
        self.pwd_lifetime = pwd_lifetime
41
 
        # pre-expired pwd
42
 
        if pwd_date == 18446744073709551615L:
43
 
            self.pwd_date = None
44
 
        else:
45
 
            self.pwd_date = pwd_date
46
 
        # pre-expired pwd
47
 
        if pwd2_date == 18446744073709551615L:
48
 
            self.pwd2_date = None
49
 
        else:
50
 
            self.pwd2_date = pwd2_date
51
 
        self.lastlogin_i = lastlogin_i
52
 
        self.lastlogin_n = lastlogin_n
53
 
        self.priv = priv
54
 
        self.def_priv = def_priv
55
 
        self.min_class = min_class
56
 
        self.max_class = max_class
57
 
        self.flags = flags
58
 
        self.hourly_access = hourly_access        
59
 
        self.primedays = primedays
60
 
        self.pri = pri
61
 
        self.quepri = quepri
62
 
        self.maxjobs = maxjobs
63
 
        self.maxacctjobs = maxacctjobs
64
 
        self.maxdetach = maxdetach
65
 
        self.prccnt = prccnt
66
 
        self.biolm = biolm
67
 
        self.diolm = diolm
68
 
        self.tqcnt = tqcnt
69
 
        self.astlm = astlm
70
 
        self.enqlm = enqlm
71
 
        self.fillm = fillm
72
 
        self.shrfillm = shrfillm
73
 
        self.wsquota = wsquota
74
 
        self.dfwscnt = dfwscnt
75
 
        self.wsextent = wsextent
76
 
        self.pgflquota = pgflquota
77
 
        self.cputim = cputim
78
 
        self.bytlm = bytlm
79
 
        self.pbytlm = pbytlm
80
 
        self.jtquota = jtquota
81
 
        self.proxy_lim = proxy_lim
82
 
        self.proxies = proxies
83
 
        self.account_lim = account_lim
84
 
        self.accounts = accounts
85
 
        self.def_class = def_class
86
 

	
87
 
def all_users():
88
 
    acc = vms.fabdef.FAB_M_PUT + vms.fabdef.FAB_M_GET + vms.fabdef.FAB_M_DEL +\
89
 
          vms.fabdef.FAB_M_UPD
90
 
    shr = vms.fabdef.FAB_M_SHRPUT + vms.fabdef.FAB_M_SHRGET +\
91
 
          vms.fabdef.FAB_M_SHRDEL + vms.fabdef.FAB_M_SHRUPD
92
 
    f = vms.rms.file('sysuaf',fac=acc, shr=shr)
93
 
    res = {}
94
 
    format = "=4x32sHHIQ32s32p32p64p64p32p32pQQHHBBBB8xQQQQQQQ20s20sI30s12xBx"
95
 
    format += "BBHHHHHHHHHHHLLLLLLLLHHHH20s"
96
 
    for r in f:
97
 
        lst = struct.unpack(format, r[:600])
98
 
        usr = user(*lst)
99
 
        res[usr.username] = usr
100
 
    f.close()
101
 
    return res
0 comments (0 inline, 0 general)