summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-03-12 09:49:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:00 -0500
commit5ba3fb825bd9228f1471925bf80bc6e7ade94ee9 (patch)
treedad0552bcaf7ba4b2dbaa1582fb4136d2cfb3c6e /source3
parent08af1e6dccd479d4819dfdac28b8c3efc38d8174 (diff)
downloadsamba-5ba3fb825bd9228f1471925bf80bc6e7ade94ee9.tar.gz
samba-5ba3fb825bd9228f1471925bf80bc6e7ade94ee9.tar.bz2
samba-5ba3fb825bd9228f1471925bf80bc6e7ade94ee9.zip
r5767: Get rid of some compiler warnings
(This used to be commit 66471de977a56cbe58921f61da28cc7dcbc6e93e)
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/secrets.c19
-rw-r--r--source3/tdb/tdbutil.c7
2 files changed, 11 insertions, 15 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)
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c
index 45ebdae3af..682f8cc68e 100644
--- a/source3/tdb/tdbutil.c
+++ b/source3/tdb/tdbutil.c
@@ -40,7 +40,7 @@ static void gotalarm_sig(void)
Make a TDB_DATA and keep the const warning in one place
****************************************************************/
-static TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
+TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
{
TDB_DATA ret;
ret.dptr = dptr;
@@ -48,6 +48,11 @@ static TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
return ret;
}
+TDB_DATA string_tdb_data(const char *string)
+{
+ return make_tdb_data(string, strlen(string));
+}
+
/****************************************************************************
Lock a chain with timeout (in seconds).
****************************************************************************/