summaryrefslogtreecommitdiff
path: root/source4/passdb/secrets.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-26 16:57:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:58 -0500
commit49839f356f493d0de1b719c8c3bfdee4713c0728 (patch)
tree62055f766b1dea0f06a623e8454d22994dd500f2 /source4/passdb/secrets.c
parentf801ad359290c51d3216c755fb2a8344babb484f (diff)
downloadsamba-49839f356f493d0de1b719c8c3bfdee4713c0728.tar.gz
samba-49839f356f493d0de1b719c8c3bfdee4713c0728.tar.bz2
samba-49839f356f493d0de1b719c8c3bfdee4713c0728.zip
r10513: Reduce some use of pstring. The main reason some parts of the code still
use pstring is next_token() now. (This used to be commit a5b88bcd420eb7ae42283293541519e142be36e3)
Diffstat (limited to 'source4/passdb/secrets.c')
-rw-r--r--source4/passdb/secrets.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source4/passdb/secrets.c b/source4/passdb/secrets.c
index 13f82f61fd..9ebc836acf 100644
--- a/source4/passdb/secrets.c
+++ b/source4/passdb/secrets.c
@@ -26,7 +26,6 @@
#include "lib/tdb/include/tdbutil.h"
#include "secrets.h"
#include "system/filesys.h"
-#include "pstring.h"
#include "db_wrap.h"
#include "lib/ldb/include/ldb.h"
@@ -57,21 +56,22 @@ void secrets_shutdown(void)
/* open up the secrets database */
BOOL secrets_init(void)
{
- pstring fname;
+ char *fname;
uint8_t dummy;
if (tdb)
return True;
- pstrcpy(fname, lp_private_dir());
- pstrcat(fname,"/secrets.tdb");
+ asprintf(&fname, "%s/secrets.tdb", lp_private_dir());
tdb = tdb_wrap_open(talloc_autofree_context(), fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if (!tdb) {
DEBUG(0,("Failed to open %s\n", fname));
+ SAFE_FREE(fname);
return False;
}
+ SAFE_FREE(fname);
/**
* Set a reseed function for the crypto random generator
@@ -96,7 +96,7 @@ static void *secrets_fetch(const char *key, size_t *size)
secrets_init();
if (!tdb)
return NULL;
- kbuf.dptr = strdup(key);
+ kbuf.dptr = (uint8_t *)strdup(key);
kbuf.dsize = strlen(key);
dbuf = tdb_fetch(tdb->tdb, kbuf);
if (size)