summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_sudo.c
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2012-01-17 15:33:02 +0100
committerStephen Gallagher <sgallagh@redhat.com>2012-01-17 11:38:16 -0500
commit1a542b3698d8c42cf075b722f8838f106eb09fcc (patch)
tree62c399da0dc3ba08e2bf6194ff12de60004c429b /src/db/sysdb_sudo.c
parent6961025be43141b1d1ca4a6a046ce8f3ac94f508 (diff)
downloadsssd-1a542b3698d8c42cf075b722f8838f106eb09fcc.tar.gz
sssd-1a542b3698d8c42cf075b722f8838f106eb09fcc.tar.xz
sssd-1a542b3698d8c42cf075b722f8838f106eb09fcc.zip
SUDO Integration - functions for manipulating with 'refreshed' attribute
https://fedorahosted.org/sssd/ticket/1110
Diffstat (limited to 'src/db/sysdb_sudo.c')
-rw-r--r--src/db/sysdb_sudo.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/db/sysdb_sudo.c b/src/db/sysdb_sudo.c
index 784b642e8..f7e87ee48 100644
--- a/src/db/sysdb_sudo.c
+++ b/src/db/sysdb_sudo.c
@@ -21,6 +21,7 @@
#include <talloc.h>
#include "db/sysdb.h"
+#include "db/sysdb_private.h"
#include "db/sysdb_sudo.h"
#define NULL_CHECK(val, rval, label) do { \
@@ -324,3 +325,60 @@ done:
talloc_free(tmp_ctx);
return ret;
}
+
+errno_t sysdb_sudo_set_refreshed(struct sysdb_ctx *sysdb,
+ bool refreshed)
+{
+ errno_t ret;
+ struct ldb_dn *dn;
+ TALLOC_CTX *tmp_ctx;
+
+
+ tmp_ctx = talloc_new(NULL);
+ if (!tmp_ctx) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_CUSTOM_SUBTREE,
+ SUDORULE_SUBDIR, sysdb->domain->name);
+ if (!dn) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ ret = sysdb_set_bool(sysdb, dn, SUDORULE_SUBDIR,
+ SYSDB_SUDO_AT_REFRESHED, refreshed);
+
+done:
+ talloc_free(tmp_ctx);
+ return ret;
+}
+
+errno_t sysdb_sudo_get_refreshed(struct sysdb_ctx *sysdb,
+ bool *refreshed)
+{
+ errno_t ret;
+ struct ldb_dn *dn;
+ TALLOC_CTX *tmp_ctx;
+
+
+ tmp_ctx = talloc_new(NULL);
+ if (!tmp_ctx) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_TMPL_CUSTOM_SUBTREE,
+ SUDORULE_SUBDIR, sysdb->domain->name);
+ if (!dn) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ ret = sysdb_get_bool(sysdb, dn, SYSDB_SUDO_AT_REFRESHED, refreshed);
+
+done:
+ talloc_free(tmp_ctx);
+ return ret;
+}