summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-08-28 12:40:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:15 -0500
commit2af963792566797ac9edcfb528198b82a2518a18 (patch)
treef48f54a9a801a52d1cf3ddc614c1f6267bb53b75 /source3/torture
parent40102ad546c1bb3d9627df786d884fd0ca026ac2 (diff)
downloadsamba-2af963792566797ac9edcfb528198b82a2518a18.tar.gz
samba-2af963792566797ac9edcfb528198b82a2518a18.tar.bz2
samba-2af963792566797ac9edcfb528198b82a2518a18.zip
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)
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/torture.c41
1 files changed, 41 insertions, 0 deletions
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;