s4:simple_ldap_map LDB module - enhance current partition control checks
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 5 Mar 2011 13:52:18 +0000 (14:52 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 10 Mar 2011 10:12:05 +0000 (11:12 +0100)
Don't stop the server if it hasn't been filled in correctly. An LDB
error should be enough.

Modified by request of tridge: errorcodes changed to ERR_PROTOCOL_ERROR

source4/dsdb/samdb/ldb_modules/simple_ldap_map.c

index 7412d29267d19c6523ac4bc7d0f53069f428d22e..9ed3b414d695c07cf965f0ce2913a0037b81265b 100644 (file)
@@ -848,13 +848,17 @@ static int entryuuid_sequence_number(struct ldb_module *module, struct ldb_reque
        partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
        if (!partition_ctrl) {
                ldb_debug_set(ldb, LDB_DEBUG_FATAL,
-                             "entryuuid_sequence_number: no current partition control found");
-               return LDB_ERR_CONSTRAINT_VIOLATION;
+                             "entryuuid_sequence_number: no current partition control found!");
+               return LDB_ERR_PROTOCOL_ERROR;
        }
 
        partition = talloc_get_type(partition_ctrl->data,
                                    struct dsdb_control_current_partition);
-       SMB_ASSERT(partition && partition->version == DSDB_CONTROL_CURRENT_PARTITION_VERSION);
+       if ((partition == NULL) || (partition->version != DSDB_CONTROL_CURRENT_PARTITION_VERSION)) {
+               ldb_debug_set(ldb, LDB_DEBUG_FATAL,
+                             "entryuuid_sequence_number: current partition control with wrong data!");
+               return LDB_ERR_PROTOCOL_ERROR;
+       }
 
        ret = ldb_build_search_req(&search_req, ldb, req,
                                   partition->dn, LDB_SCOPE_BASE,