summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/responder/common/negcache.c29
-rw-r--r--src/responder/common/negcache.h2
2 files changed, 31 insertions, 0 deletions
diff --git a/src/responder/common/negcache.c b/src/responder/common/negcache.c
index 2e1c0af2..76934637 100644
--- a/src/responder/common/negcache.c
+++ b/src/responder/common/negcache.c
@@ -33,6 +33,7 @@
#define NC_SERVICE_PREFIX NC_ENTRY_PREFIX"SERVICE"
#define NC_UID_PREFIX NC_ENTRY_PREFIX"UID"
#define NC_GID_PREFIX NC_ENTRY_PREFIX"GID"
+#define NC_SID_PREFIX NC_ENTRY_PREFIX"SID"
struct sss_nc_ctx {
struct tdb_context *tdb;
@@ -401,6 +402,20 @@ int sss_ncache_check_gid(struct sss_nc_ctx *ctx, int ttl, gid_t gid)
return ret;
}
+int sss_ncache_check_sid(struct sss_nc_ctx *ctx, int ttl, const char *sid)
+{
+ char *str;
+ int ret;
+
+ str = talloc_asprintf(ctx, "%s/%s", NC_SID_PREFIX, sid);
+ if (!str) return ENOMEM;
+
+ ret = sss_ncache_check_str(ctx, str, ttl);
+
+ talloc_free(str);
+ return ret;
+}
+
static int sss_ncache_set_user_int(struct sss_nc_ctx *ctx, bool permanent,
const char *domain, const char *name)
{
@@ -518,6 +533,20 @@ int sss_ncache_set_gid(struct sss_nc_ctx *ctx, bool permanent, gid_t gid)
return ret;
}
+int sss_ncache_set_sid(struct sss_nc_ctx *ctx, bool permanent, const char *sid)
+{
+ char *str;
+ int ret;
+
+ str = talloc_asprintf(ctx, "%s/%s", NC_SID_PREFIX, sid);
+ if (!str) return ENOMEM;
+
+ ret = sss_ncache_set_str(ctx, str, permanent);
+
+ talloc_free(str);
+ return ret;
+}
+
static int delete_permanent(struct tdb_context *tdb,
TDB_DATA key, TDB_DATA data, void *state)
{
diff --git a/src/responder/common/negcache.h b/src/responder/common/negcache.h
index b2e6a7a9..0b7e00b0 100644
--- a/src/responder/common/negcache.h
+++ b/src/responder/common/negcache.h
@@ -36,6 +36,7 @@ int sss_ncache_check_netgr(struct sss_nc_ctx *ctx, int ttl,
const char *domain, const char *name);
int sss_ncache_check_uid(struct sss_nc_ctx *ctx, int ttl, uid_t uid);
int sss_ncache_check_gid(struct sss_nc_ctx *ctx, int ttl, gid_t gid);
+int sss_ncache_check_sid(struct sss_nc_ctx *ctx, int ttl, const char *sid);
int sss_ncache_check_service(struct sss_nc_ctx *ctx, int ttl,
struct sss_domain_info *dom,
@@ -58,6 +59,7 @@ int sss_ncache_set_netgr(struct sss_nc_ctx *ctx, bool permanent,
struct sss_domain_info *dom, const char *name);
int sss_ncache_set_uid(struct sss_nc_ctx *ctx, bool permanent, uid_t uid);
int sss_ncache_set_gid(struct sss_nc_ctx *ctx, bool permanent, gid_t gid);
+int sss_ncache_set_sid(struct sss_nc_ctx *ctx, bool permanent, const char *sid);
int sss_ncache_set_service_name(struct sss_nc_ctx *ctx, bool permanent,
struct sss_domain_info *dom,
const char *name, const char *proto);