summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_sudo.h
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2016-05-26 11:37:30 +0200
committerJakub Hrozek <jhrozek@redhat.com>2016-07-07 10:30:26 +0200
commit61913b8f0d1ba54d82640500d7486fac5f72b030 (patch)
tree21ed1952b88d463468d690a22f40328e4bbf4d7c /src/db/sysdb_sudo.h
parent552390afcc81af96ca201fa6c25ddefbbecbeb4e (diff)
downloadsssd-61913b8f0d1ba54d82640500d7486fac5f72b030.tar.gz
sssd-61913b8f0d1ba54d82640500d7486fac5f72b030.tar.xz
sssd-61913b8f0d1ba54d82640500d7486fac5f72b030.zip
sudo: solve problems with fully qualified names
sudo expects the same name in sudo rule as login name. Therefore if fully qualified name is used or even enforced by setting use_fully_qualified_names to true or by forcing default domain with default_domain_suffix sssd is able to correctly return the rules but sudo can't match the user with contect of sudoUser attribute since it is not qualified. This patch changes the rules on the fly to avoid using names at all. We do this in two steps: 1. We fetch all rules that match current user name, id or groups and replace sudoUser attribute with sudoUser: #uid. 2. We fetch complementry rules that contain netgroups since it is expected we don't have infromation about existing netgroups in cache, sudo still needs to evaluate it for us if needed. This patch also remove test for sysdb_get_sudo_filter since it wasn't sufficient anyway and I did not rewrite it since I don't thing it is a good thing to have filter tests that depends on exact filter order. Resolves: https://fedorahosted.org/sssd/ticket/2919 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Diffstat (limited to 'src/db/sysdb_sudo.h')
-rw-r--r--src/db/sysdb_sudo.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/db/sysdb_sudo.h b/src/db/sysdb_sudo.h
index c9dadb799..9c2456cf8 100644
--- a/src/db/sysdb_sudo.h
+++ b/src/db/sysdb_sudo.h
@@ -96,6 +96,27 @@ errno_t sysdb_sudo_filter_rules_by_time(TALLOC_CTX *mem_ctx,
uint32_t *_num_rules,
struct sysdb_attrs ***_rules);
+char *
+sysdb_sudo_filter_expired(TALLOC_CTX *mem_ctx,
+ const char *username,
+ char **groupnames,
+ uid_t uid);
+
+char *
+sysdb_sudo_filter_defaults(TALLOC_CTX *mem_ctx);
+
+char *
+sysdb_sudo_filter_user(TALLOC_CTX *mem_ctx,
+ const char *username,
+ char **groupnames,
+ uid_t uid);
+
+char *
+sysdb_sudo_filter_netgroups(TALLOC_CTX *mem_ctx,
+ const char *username,
+ char **groupnames,
+ uid_t uid);
+
errno_t
sysdb_get_sudo_filter(TALLOC_CTX *mem_ctx, const char *username,
uid_t uid, char **groupnames, unsigned int flags,