d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson// constants
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephensonglobal TARGET_ID=0, TARGET_AUTH=1, TARGET_ACCESS=2, TARGET_CHPASS=3,
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson TARGET_SUDO=4, TARGET_AUTOFS=5, TARGET_SELINUX=6, TARGET_HOSTID=7,
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson TARGET_SUBDOMAINS=8, TARGET_SENTINEL=9
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephensonglobal METHOD_CHECK_ONLINE=0, METHOD_ACCOUNT_HANDLER=1, METHOD_AUTH_HANDLER=2,
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson METHOD_ACCESS_HANDLER=3, METHOD_SELINUX_HANDLER=4, METHOD_SUDO_HANDLER=5,
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson METHOD_AUTOFS_HANDLER=6, METHOD_HOSTID_HANDLER=7, METHOD_DOMAINS_HANDLER=8,
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson METHOD_SENTINEL=9
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozekfunction acct_req_desc(entry_type)
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek{
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek if (entry_type == 0x0001) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "user"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0002) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "group"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0003) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "initgroups"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0004) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "netgroups"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0005) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "services"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0006) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "sudo_full"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0007) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "sudo_rules"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek # See src/providers/data_provider_req.h, no 0x0008 there..
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0009) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "autofs"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0010) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "host"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0011) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "by_secid"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0012) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "user_and_group"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0013) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "by_uuid"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (entry_type == 0x0014) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = "by_cert"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = sprintf("%X", entry_type)
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek }
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek return str_entry_type
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek}
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozekfunction sssd_acct_req_probestr(fc_name, entry_type, filter_type,
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek filter_value, extra_value)
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek{
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_entry_type = acct_req_desc(entry_type)
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek # Maybe we could use guru mode here and include the constants
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek # directly..
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek if (filter_type == 1) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = "name"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (filter_type == 2) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = "idnum"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (filter_type == 3) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = "enum"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (filter_type == 4) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = "secid"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (filter_type == 5) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = "uuid"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (filter_type == 6) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = "cert"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else if (filter_type == 7) {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = "wildcard"
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek } else {
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek str_filter_type = sprintf("%d", filter_type)
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek }
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek probestr = sprintf("%s(entry_type=%s, filter_type=%s, filter_value=%s, extra_value=%s)",
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek fc_name, str_entry_type, str_filter_type,
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek filter_value, extra_value)
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek return probestr
8c829226ce0cf98c35ffce39a66f9645cff65767Jakub Hrozek}
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephensonfunction dp_target_str(target)
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson{
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson if (target == TARGET_ID) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "ID"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_AUTH) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "AUTH"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_ACCESS) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "ACCESS"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_CHPASS) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "CHPASS"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_SUDO) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "SUDO"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_AUTOFS) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "AUTOFS"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_SELINUX) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "SELINUX"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_HOSTID) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "HOSTID"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_SUBDOMAINS) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "SUBDOMAINS"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (target == TARGET_SENTINEL) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "TARGET_SENTINEL"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_target = "UNKNOWN"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson }
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson return str_target
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson}
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephensonfunction dp_method_str(method)
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson{
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson if (method == METHOD_CHECK_ONLINE) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Check Online"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_ACCOUNT_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Account Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_AUTH_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Auth Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_ACCESS_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Access Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_SELINUX_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "SELinux Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_SUDO_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Sudo Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_AUTOFS_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Autofs Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_HOSTID_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "HostID Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_DOMAINS_HANDLER) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Domains Handler"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else if (method == METHOD_SENTINEL) {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "Method Sentinel"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson } else {
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson str_method = "UNKNOWN"
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson }
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson return str_method
d46d59e78600aa72176df7217c94743b7e71881aJustin Stephenson}