summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-30 20:46:31 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-30 20:52:10 +0200
commitb7270fbc9971b6e625c15a60e6717410aec2b77a (patch)
treea280e6edad76372f7df2c12b6f4a2a433225a36f
parentf927881028303eb955566c08a940cca18e50ce99 (diff)
downloadsamba-b7270fbc9971b6e625c15a60e6717410aec2b77a.tar.gz
samba-b7270fbc9971b6e625c15a60e6717410aec2b77a.tar.bz2
samba-b7270fbc9971b6e625c15a60e6717410aec2b77a.zip
s4:dsdb_module_search_dn - add code to handle NULL format string
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index c233df7216..37dc885a2d 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -113,12 +113,22 @@ int dsdb_module_search(struct ldb_module *module,
tmp_ctx = talloc_new(mem_ctx);
- va_start(ap, format);
- expression = talloc_vasprintf(tmp_ctx, format, ap);
- va_end(ap);
+ if (format) {
+ va_start(ap, format);
+ expression = talloc_vasprintf(tmp_ctx, format, ap);
+ va_end(ap);
+
+ if (!expression) {
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ } else {
+ expression = NULL;
+ }
res = talloc_zero(tmp_ctx, struct ldb_result);
if (!res) {
+ talloc_free(tmp_ctx);
return LDB_ERR_OPERATIONS_ERROR;
}