summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-05-03 12:34:29 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2016-06-10 18:15:27 +0200
commit8c829226ce0cf98c35ffce39a66f9645cff65767 (patch)
tree0ffea4cb021a4f956be96ba9d282ff9e5c64f758
parent6dcbfe52d5e64205c0d922f3e89add066b42c496 (diff)
downloadsssd-8c829226ce0cf98c35ffce39a66f9645cff65767.tar.gz
sssd-8c829226ce0cf98c35ffce39a66f9645cff65767.tar.xz
sssd-8c829226ce0cf98c35ffce39a66f9645cff65767.zip
STAP: Add helper functions to for human-readable account request representation
The caller of the systemtap script would be able to see what kind of account request sssd received with a string representation, not just the cryptic hexadecimal number. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
-rw-r--r--Makefile.am4
-rw-r--r--src/providers/data_provider_req.h2
-rw-r--r--src/systemtap/sssd_functions.stp66
3 files changed, 72 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 3a2bb44f3..9adbfd4c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1085,6 +1085,10 @@ SYSTEMTAP_PROBES = \
systemtap_tap_DATA = $(builddir)/src/systemtap/sssd.stp
+dist_systemtap_tap_DATA = \
+ $(builddir)/src/systemtap/sssd_functions.stp \
+ $(NULL)
+
stap_generated_probes.h: $(srcdir)/src/systemtap/sssd_probes.d
$(AM_V_GEN)$(DTRACE) -C -h -s $< -o $@
diff --git a/src/providers/data_provider_req.h b/src/providers/data_provider_req.h
index 338f8192f..a2889cda5 100644
--- a/src/providers/data_provider_req.h
+++ b/src/providers/data_provider_req.h
@@ -24,6 +24,8 @@
#include <dbus/dbus.h>
+/* When changing these constants, also please change sssd_functions.stp
+ */
#define BE_REQ_USER 0x0001
#define BE_REQ_GROUP 0x0002
#define BE_REQ_INITGROUPS 0x0003
diff --git a/src/systemtap/sssd_functions.stp b/src/systemtap/sssd_functions.stp
new file mode 100644
index 000000000..bad194ead
--- /dev/null
+++ b/src/systemtap/sssd_functions.stp
@@ -0,0 +1,66 @@
+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
+}