dsdb: Fix CID 1363810: Null pointer dereferences
authorVolker Lendecke <vl@samba.org>
Tue, 12 Jul 2016 16:28:23 +0000 (18:28 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 13 Jul 2016 04:34:33 +0000 (06:34 +0200)
The if-condition explicitly tests for new_schema==NULL, so this seems to be a
valid error case. The DEBUG statement would segfault in this case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul 13 06:34:33 CEST 2016 on sn-devel-144

source4/dsdb/repl/replicated_objects.c

index 88ba598ba6b1a4fcda7746fad35ffcdcebf905d9..6d39dba4833d1858f7b6b227512de20076a46678 100644 (file)
@@ -891,9 +891,12 @@ WERROR dsdb_replicated_objects_commit(struct ldb_context *ldb,
                 * unable to operate for other users from this
                 * point... */
                if (new_schema == NULL || new_schema == working_schema) {
-                       DEBUG(0,("Failed to re-load schema after commit of transaction (working: %p/%llu, new: %p/%llu)\n",
-                                new_schema, (unsigned long long)new_schema->metadata_usn,
-                                working_schema, (unsigned long long)working_schema->metadata_usn));
+                       DBG_ERR("Failed to re-load schema after commit of "
+                               "transaction (working: %p/%"PRIu64", new: "
+                               "%p/%"PRIu64")\n", new_schema,
+                               new_schema != NULL ?
+                               new_schema->metadata_usn : 0,
+                               working_schema, working_schema->metadata_usn);
                        dsdb_reference_schema(ldb, cur_schema, false);
                        if (used_global_schema) {
                                dsdb_set_global_schema(ldb);