summaryrefslogtreecommitdiffstats
path: root/src/systemtap/sssd_functions.stp
blob: e249aac986969e21b8c251e642324e85b74cf3c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// constants
global TARGET_ID=0, TARGET_AUTH=1, TARGET_ACCESS=2, TARGET_CHPASS=3,
       TARGET_SUDO=4, TARGET_AUTOFS=5, TARGET_SELINUX=6, TARGET_HOSTID=7,
       TARGET_SUBDOMAINS=8, TARGET_SENTINEL=9

global METHOD_CHECK_ONLINE=0, METHOD_ACCOUNT_HANDLER=1, METHOD_AUTH_HANDLER=2,
       METHOD_ACCESS_HANDLER=3, METHOD_SELINUX_HANDLER=4, METHOD_SUDO_HANDLER=5,
       METHOD_AUTOFS_HANDLER=6, METHOD_HOSTID_HANDLER=7, METHOD_DOMAINS_HANDLER=8,
       METHOD_SENTINEL=9

function acct_req_desc(entry_type)
{
    if (entry_type == 0x0001) {
        str_entry_type = "user"
    } else if (entry_type == 0x0002) {
        str_entry_type = "group"
    } else if (entry_type == 0x0003) {
        str_entry_type = "initgroups"
    } else if (entry_type == 0x0004) {
        str_entry_type = "netgroups"
    } else if (entry_type == 0x0005) {
        str_entry_type = "services"
    } else if (entry_type == 0x0006) {
        str_entry_type = "sudo_full"
    } else if (entry_type == 0x0007) {
        str_entry_type = "sudo_rules"
    # See src/providers/data_provider_req.h, no 0x0008 there..
    } else if (entry_type == 0x0009) {
        str_entry_type = "autofs"
    } else if (entry_type == 0x0010) {
        str_entry_type = "host"
    } else if (entry_type == 0x0011) {
        str_entry_type = "by_secid"
    } else if (entry_type == 0x0012) {
        str_entry_type = "user_and_group"
    } else if (entry_type == 0x0013) {
        str_entry_type = "by_uuid"
    } else if (entry_type == 0x0014) {
        str_entry_type = "by_cert"
    } else {
        str_entry_type = sprintf("%X", entry_type)
    }

    return str_entry_type
}

function sssd_acct_req_probestr(fc_name, entry_type, filter_type,
                                filter_value, extra_value)
{
    str_entry_type = acct_req_desc(entry_type)

    # Maybe we could use guru mode here and include the constants
    # directly..
    if (filter_type == 1) {
        str_filter_type = "name"
    } else if (filter_type == 2) {
        str_filter_type = "idnum"
    } else if (filter_type == 3) {
        str_filter_type = "enum"
    } else if (filter_type == 4) {
        str_filter_type = "secid"
    } else if (filter_type == 5) {
        str_filter_type = "uuid"
    } else if (filter_type == 6) {
        str_filter_type = "cert"
    } else if (filter_type == 7) {
        str_filter_type = "wildcard"
    } else {
        str_filter_type = sprintf("%d", filter_type)
    }

    probestr = sprintf("%s(entry_type=%s, filter_type=%s, filter_value=%s, extra_value=%s)",
                       fc_name, str_entry_type, str_filter_type,
                       filter_value, extra_value)
    return probestr
}

function dp_target_str(target)
{
    if (target == TARGET_ID) {
        str_target = "ID"
    } else if (target == TARGET_AUTH) {
        str_target = "AUTH"
    } else if (target == TARGET_ACCESS) {
        str_target = "ACCESS"
    } else if (target == TARGET_CHPASS) {
        str_target = "CHPASS"
    } else if (target == TARGET_SUDO) {
        str_target = "SUDO"
    } else if (target == TARGET_AUTOFS) {
        str_target = "AUTOFS"
    } else if (target == TARGET_SELINUX) {
        str_target = "SELINUX"
    } else if (target == TARGET_HOSTID) {
        str_target = "HOSTID"
    } else if (target == TARGET_SUBDOMAINS) {
        str_target = "SUBDOMAINS"
    } else if (target == TARGET_SENTINEL) {
        str_target = "TARGET_SENTINEL"
    } else {
        str_target = "UNKNOWN"
    }

    return str_target
}

function dp_method_str(method)
{
    if (method == METHOD_CHECK_ONLINE) {
        str_method = "Check Online"
    } else if (method == METHOD_ACCOUNT_HANDLER) {
        str_method = "Account Handler"
    } else if (method == METHOD_AUTH_HANDLER) {
        str_method = "Auth Handler"
    } else if (method == METHOD_ACCESS_HANDLER) {
        str_method = "Access Handler"
    } else if (method == METHOD_SELINUX_HANDLER) {
        str_method = "SELinux Handler"
    } else if (method == METHOD_SUDO_HANDLER) {
        str_method = "Sudo Handler"
    } else if (method == METHOD_AUTOFS_HANDLER) {
        str_method = "Autofs Handler"
    } else if (method == METHOD_HOSTID_HANDLER) {
        str_method = "HostID Handler"
    } else if (method == METHOD_DOMAINS_HANDLER) {
        str_method = "Domains Handler"
    } else if (method == METHOD_SENTINEL) {
        str_method = "Method Sentinel"
    } else {
        str_method = "UNKNOWN"
    }

    return str_method
}