summaryrefslogtreecommitdiff
path: root/source3/passdb/secrets.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-12-12 14:52:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:25 -0500
commit4225f9a4bd5eece4d57820bbabb7b882610aa7cc (patch)
treee9dc08eba6d786b9ca17d784244cea7f3829d832 /source3/passdb/secrets.c
parent18f9156d96cba17adc199d0e8c4cf1d6c9ae1960 (diff)
downloadsamba-4225f9a4bd5eece4d57820bbabb7b882610aa7cc.tar.gz
samba-4225f9a4bd5eece4d57820bbabb7b882610aa7cc.tar.bz2
samba-4225f9a4bd5eece4d57820bbabb7b882610aa7cc.zip
r20116: Start merging in the work done to create the new idmap subsystem.
Simo. (This used to be commit 50cd8bffeeed2cac755f75fc3d76fe41c451976b)
Diffstat (limited to 'source3/passdb/secrets.c')
-rw-r--r--source3/passdb/secrets.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index a1be400c46..d169ffa329 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -1252,3 +1252,45 @@ BOOL secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
return True;
}
+
+BOOL secrets_store_generic(const char *owner, const char *key, const char *secret)
+{
+ char *tdbkey = NULL;
+ BOOL ret;
+
+ if (asprintf(&tdbkey, "SECRETS/GENERIC/%s/%s", owner, key) < 0) {
+ DEBUG(0, ("asprintf failed!\n"));
+ return False;
+ }
+
+ ret = secrets_store(tdbkey, secret, strlen(secret)+1);
+
+ SAFE_FREE(tdbkey);
+ return ret;
+}
+
+/*******************************************************************
+ Find the ldap password.
+******************************************************************/
+
+char *secrets_fetch_generic(const char *owner, const char *key)
+{
+ char *secret = NULL;
+ char *tdbkey = NULL;
+
+ if (( ! owner) || ( ! key)) {
+ DEBUG(1, ("Invalid Paramters"));
+ return NULL;
+ }
+
+ if (asprintf(&tdbkey, "SECRETS/GENERIC/%s/%s", owner, key) < 0) {
+ DEBUG(0, ("Out of memory!\n"));
+ return NULL;
+ }
+
+ secret = (char *)secrets_fetch(tdbkey, NULL);
+ SAFE_FREE(tdbkey);
+
+ return secret;
+}
+