s4:dsdb - always fail if a search filter could not be parsed
[mdw/samba.git] / source4 / libcli / ldap / ldap_ildap.c
index 10fe8e491658705d0653269849304c05d269f84f..8b6f8e8ddd41bfb7000b06417228f6399355b805 100644 (file)
@@ -119,8 +119,12 @@ _PUBLIC_ NTSTATUS ildap_search(struct ldap_connection *conn, const char *basedn,
                      struct ldb_control ***control_res,
                      struct ldap_message ***results)
 {
-       struct ldb_parse_tree *tree = ldb_parse_tree(conn, expression);
        NTSTATUS status;
+       struct ldb_parse_tree *tree = ldb_parse_tree(conn, expression);
+
+       if (tree == NULL) {
+               return NT_STATUS_INVALID_PARAMETER;
+       }
        status = ildap_search_bytree(conn, basedn, scope, tree, attrs,
                                     attributesonly, control_req,
                                     control_res, results);