[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Sun Jan 12 21:22:05 UTC 2020
The branch, master has been updated
via beb386b584b fuzz: add a fuzzer for parsing ldb controls
via 16ca385013a ldb controls: fix typo in bypassoperational message
via 1d35962128c fuzz_ldap_decode: do not print to stdout
via e1c6e7d18b4 decode_ndr_X_crash: always find pipe in honggfuzz file
from e61ddeef4cc vfs_ceph: drop support for pre-hammer libcephfs versions
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit beb386b584bdff25c714feb7f76d73b65ed072e7
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Jan 9 17:40:02 2020 +1300
fuzz: add a fuzzer for parsing ldb controls
We have had issues here in the past.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Sun Jan 12 21:21:30 UTC 2020 on sn-devel-184
commit 16ca385013ae588e8f2b696af03013980926cac1
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Jan 9 19:19:56 2020 +1300
ldb controls: fix typo in bypassoperational message
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit 1d35962128c93c48cd477601359182b63610ab69
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Thu Jan 9 17:01:22 2020 +1300
fuzz_ldap_decode: do not print to stdout
The fuzzer doesn't care and it slows things down
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
commit e1c6e7d18b446b55634bb4807c6d1a9e9346bd6c
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Fri Dec 13 12:08:47 2019 +1300
decode_ndr_X_crash: always find pipe in honggfuzz file
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/fuzzing/decode_ndr_X_crash | 2 +-
lib/fuzzing/fuzz_ldap_decode.c | 1 -
...z_ldb_parse_tree.c => fuzz_ldb_parse_control.c} | 49 ++++++++++------------
lib/fuzzing/wscript_build | 5 +++
lib/ldb/common/ldb_controls.c | 2 +-
5 files changed, 28 insertions(+), 31 deletions(-)
copy lib/fuzzing/{fuzz_ldb_parse_tree.c => fuzz_ldb_parse_control.c} (51%)
Changeset truncated at 500 lines:
diff --git a/lib/fuzzing/decode_ndr_X_crash b/lib/fuzzing/decode_ndr_X_crash
index 8ca5922449f..63c3cd747d7 100755
--- a/lib/fuzzing/decode_ndr_X_crash
+++ b/lib/fuzzing/decode_ndr_X_crash
@@ -115,7 +115,7 @@ def main():
for line in f:
m = re.match(r'^\s*fuzzTarget\s*:\s*bin/fuzz_ndr_(\w+)\s*$', line)
if m:
- pipe = m.group(1)
+ pipe = m.group(1).split('_TYPE_', 1)[0]
print_if_verbose(f"found pipe {pipe}")
m = re.match(r'^FUZZ_FNAME: (\S+)$', line)
if m:
diff --git a/lib/fuzzing/fuzz_ldap_decode.c b/lib/fuzzing/fuzz_ldap_decode.c
index 85e0e38983e..659169aca96 100644
--- a/lib/fuzzing/fuzz_ldap_decode.c
+++ b/lib/fuzzing/fuzz_ldap_decode.c
@@ -47,7 +47,6 @@ int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len)
}
status = ldap_decode(asn1, samba_ldap_control_handlers(), ldap_msg);
- printf("%s\n", nt_errstr(status));
out:
talloc_free(mem_ctx);
diff --git a/lib/fuzzing/fuzz_ldb_parse_tree.c b/lib/fuzzing/fuzz_ldb_parse_control.c
similarity index 51%
copy from lib/fuzzing/fuzz_ldb_parse_tree.c
copy to lib/fuzzing/fuzz_ldb_parse_control.c
index e22dd776110..bd3fda87fdb 100644
--- a/lib/fuzzing/fuzz_ldb_parse_tree.c
+++ b/lib/fuzzing/fuzz_ldb_parse_control.c
@@ -1,6 +1,6 @@
/*
- Fuzzing for ldb_parse_tree
- Copyright (C) Michael Hanselmann 2019
+ Fuzzing ldb_parse_control_from_string
+ Copyright (C) Catalyst IT 2020
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,39 +15,32 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "includes.h"
#include "fuzzing/fuzzing.h"
-#include "ldb.h"
-#include "ldb_module.h"
+#include "ldb_private.h"
-int LLVMFuzzerInitialize(int *argc, char ***argv)
-{
- return 0;
-}
-int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len)
-{
- TALLOC_CTX *mem_ctx = talloc_init(__FUNCTION__);
- struct ldb_parse_tree *tree;
- char *filter;
+#define MAX_LENGTH (2 * 1024 * 1024 - 1)
+char buf[MAX_LENGTH + 1] = {0};
- if (len < 1) {
- goto out;
+int LLVMFuzzerTestOneInput(uint8_t *input, size_t len)
+{
+ struct ldb_control *control = NULL;
+ struct ldb_context *ldb = ldb_init(NULL, NULL);
+ /*
+ * We copy the buffer in order to NUL-teminate, because running off
+ * the end of the string would be an uninteresting crash.
+ */
+ if (len > MAX_LENGTH) {
+ len = MAX_LENGTH;
}
+ memcpy(buf, input, len);
+ buf[len] = 0;
- filter = talloc_strndup(mem_ctx, (const char*)buf, len);
-
- if (filter == NULL) {
- goto out;
+ control = ldb_parse_control_from_string(ldb, ldb, buf);
+ if (control != NULL) {
+ ldb_control_to_string(ldb, control);
}
-
- tree = ldb_parse_tree(mem_ctx, filter);
-
- (void)ldb_filter_from_tree(mem_ctx, tree);
-
-out:
- talloc_free(mem_ctx);
-
+ TALLOC_FREE(ldb);
return 0;
}
diff --git a/lib/fuzzing/wscript_build b/lib/fuzzing/wscript_build
index 75c41ac83f4..4d41a959bff 100644
--- a/lib/fuzzing/wscript_build
+++ b/lib/fuzzing/wscript_build
@@ -42,6 +42,11 @@ bld.SAMBA_BINARY('fuzz_ldap_decode',
deps='fuzzing cli-ldap afl-fuzz-main',
fuzzer=True)
+bld.SAMBA_BINARY('fuzz_ldb_parse_control',
+ source='fuzz_ldb_parse_control.c',
+ deps='fuzzing ldb afl-fuzz-main',
+ fuzzer=True)
+
bld.SAMBA_BINARY('fuzz_ldb_parse_tree',
source='fuzz_ldb_parse_tree.c',
deps='fuzzing ldb afl-fuzz-main',
diff --git a/lib/ldb/common/ldb_controls.c b/lib/ldb/common/ldb_controls.c
index e0f0eb48f3a..8a727f74e6e 100644
--- a/lib/ldb/common/ldb_controls.c
+++ b/lib/ldb/common/ldb_controls.c
@@ -814,7 +814,7 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
ret = sscanf(p, "%d", &crit);
if ((ret != 1) || (crit < 0) || (crit > 1)) {
ldb_set_errstring(ldb,
- "invalid bypassopreational control syntax\n"
+ "invalid bypassoperational control syntax\n"
" syntax: crit(b)\n"
" note: b = boolean");
talloc_free(ctrl);
--
Samba Shared Repository
More information about the samba-cvs
mailing list