diff options
Diffstat (limited to 'source3/winbindd/idmap_util.c')
-rw-r--r-- | source3/winbindd/idmap_util.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c index cbad91d151..a068298968 100644 --- a/source3/winbindd/idmap_util.c +++ b/source3/winbindd/idmap_util.c @@ -24,6 +24,7 @@ #include "idmap.h" #include "idmap_cache.h" #include "../libcli/security/security.h" +#include "secrets.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP @@ -213,3 +214,27 @@ struct id_map *idmap_find_map_by_sid(struct id_map **maps, struct dom_sid *sid) return NULL; } + +char *idmap_fetch_secret(const char *backend, const char *domain, + const char *identity) +{ + char *tmp, *ret; + int r; + + r = asprintf(&tmp, "IDMAP_%s_%s", backend, domain); + + if (r < 0) + return NULL; + + /* make sure the key is case insensitive */ + if (!strupper_m(tmp)) { + SAFE_FREE(tmp); + return NULL; + } + + ret = secrets_fetch_generic(tmp, identity); + + SAFE_FREE(tmp); + + return ret; +} |