summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/secrets.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 6be63e4f9d..c7ff2f80b0 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -84,13 +84,11 @@ BOOL secrets_init(void)
*/
void *secrets_fetch(const char *key, size_t *size)
{
- TDB_DATA kbuf, dbuf;
+ TDB_DATA dbuf;
secrets_init();
if (!tdb)
return NULL;
- kbuf.dptr = (char *)key;
- kbuf.dsize = strlen(key);
- dbuf = tdb_fetch(tdb, kbuf);
+ dbuf = tdb_fetch(tdb, string_tdb_data(key));
if (size)
*size = dbuf.dsize;
return dbuf.dptr;
@@ -100,15 +98,11 @@ void *secrets_fetch(const char *key, size_t *size)
*/
BOOL secrets_store(const char *key, const void *data, size_t size)
{
- TDB_DATA kbuf, dbuf;
secrets_init();
if (!tdb)
return False;
- kbuf.dptr = (char *)key;
- kbuf.dsize = strlen(key);
- dbuf.dptr = (char *)data;
- dbuf.dsize = size;
- return tdb_store(tdb, kbuf, dbuf, TDB_REPLACE) == 0;
+ return tdb_store(tdb, string_tdb_data(key), make_tdb_data(data, size),
+ TDB_REPLACE) == 0;
}
@@ -116,13 +110,10 @@ BOOL secrets_store(const char *key, const void *data, size_t size)
*/
BOOL secrets_delete(const char *key)
{
- TDB_DATA kbuf;
secrets_init();
if (!tdb)
return False;
- kbuf.dptr = (char *)key;
- kbuf.dsize = strlen(key);
- return tdb_delete(tdb, kbuf) == 0;
+ return tdb_delete(tdb, string_tdb_data(key)) == 0;
}
BOOL secrets_store_domain_sid(const char *domain, const DOM_SID *sid)