From 2af963792566797ac9edcfb528198b82a2518a18 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 28 Aug 2007 12:40:01 +0000 Subject: r24733: Add support for storing DATA_BLOBs in gencache.tdb (including torturetest). Mimir, please have a look. DATA_BLOBs will now just show up as "DATA_BLOB" values with "net cache list". Guenther (This used to be commit b8ad546d041a2a8cc85c7db8eba4d2d3b97df1a8) --- source3/torture/torture.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'source3/torture/torture.c') diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 4b6d98aea8..6d0fc546ab 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -4820,6 +4820,7 @@ static BOOL run_local_gencache(int dummy) { char *val; time_t tm; + DATA_BLOB blob; if (!gencache_init()) { d_printf("%s: gencache_init() failed\n", __location__); @@ -4861,6 +4862,46 @@ static BOOL run_local_gencache(int dummy) return False; } + blob = data_blob_string_const("bar"); + tm = time(NULL); + + if (!gencache_set_data_blob("foo", &blob, tm)) { + d_printf("%s: gencache_set_data_blob() failed\n", __location__); + return False; + } + + data_blob_free(&blob); + + if (!gencache_get_data_blob("foo", &blob, NULL)) { + d_printf("%s: gencache_get_data_blob() failed\n", __location__); + return False; + } + + if (strcmp((const char *)blob.data, "bar") != 0) { + d_printf("%s: gencache_get_data_blob() returned %s, expected %s\n", + __location__, (const char *)blob.data, "bar"); + data_blob_free(&blob); + return False; + } + + data_blob_free(&blob); + + if (!gencache_del("foo")) { + d_printf("%s: gencache_del() failed\n", __location__); + return False; + } + if (gencache_del("foo")) { + d_printf("%s: second gencache_del() succeeded\n", + __location__); + return False; + } + + if (gencache_get_data_blob("foo", &blob, NULL)) { + d_printf("%s: gencache_get_data_blob() on deleted entry " + "succeeded\n", __location__); + return False; + } + if (!gencache_shutdown()) { d_printf("%s: gencache_shutdown() failed\n", __location__); return False; -- cgit