summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-05-05 16:22:54 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2022-05-06 12:47:03 +0100
commit225c84f0f35d3aea1f0845eedde7632c371e1f99 (patch)
treed95b92363005cad3c61f1754be1c528d818cdb9e
parente73e1b8f9d4e962041a9e18fb23fc3c3838b055c (diff)
Fix dbmjz lookup. Bug 2884
Broken-by: 0cc804c877
-rw-r--r--src/src/lookups/dbmdb.c6
-rw-r--r--test/aux-fixed/2301.testsasldbbin0 -> 12288 bytes
-rw-r--r--test/confs/23014
-rw-r--r--test/scripts/2300-DBM/23015
-rw-r--r--test/stdout/23012
5 files changed, 15 insertions, 2 deletions
diff --git a/src/src/lookups/dbmdb.c b/src/src/lookups/dbmdb.c
index edc49e581..32514afcc 100644
--- a/src/src/lookups/dbmdb.c
+++ b/src/src/lookups/dbmdb.c
@@ -94,8 +94,10 @@ EXIM_DATUM key, data;
exim_datum_init(&key); /* Some DBM libraries require datums to */
exim_datum_init(&data); /* be cleared before use. */
-exim_datum_data_set(&key, string_copyn(keystring, length));
-exim_datum_size_set(&key, length + 1);
+length++;
+exim_datum_data_set(&key,
+ memcpy(store_get(length, keystring), keystring, length)); /* key can have embedded NUL */
+exim_datum_size_set(&key, length);
if (exim_dbget(d, &key, &data))
{
diff --git a/test/aux-fixed/2301.testsasldb b/test/aux-fixed/2301.testsasldb
new file mode 100644
index 000000000..50a05965d
--- /dev/null
+++ b/test/aux-fixed/2301.testsasldb
Binary files differ
diff --git a/test/confs/2301 b/test/confs/2301
new file mode 100644
index 000000000..3e88df718
--- /dev/null
+++ b/test/confs/2301
@@ -0,0 +1,4 @@
+# Exim test configuration 2301
+.include DIR/aux-var/std_conf_prefix
+primary_hostname = myhost.test.ex
+# End
diff --git a/test/scripts/2300-DBM/2301 b/test/scripts/2300-DBM/2301
new file mode 100644
index 000000000..9ba0c5079
--- /dev/null
+++ b/test/scripts/2300-DBM/2301
@@ -0,0 +1,5 @@
+# lookup dbmjz
+#
+exim -be
+${lookup{testid:test.example.invalid:userPassword}dbmjz{DIR/aux-fixed/TESTNUM.testsasldb}{$value}fail}
+****
diff --git a/test/stdout/2301 b/test/stdout/2301
new file mode 100644
index 000000000..ca59bf00b
--- /dev/null
+++ b/test/stdout/2301
@@ -0,0 +1,2 @@
+> testpw
+>