mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
schema: Remove unnecessary schema reload code
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
769230a49a
commit
657e31450c
@ -496,20 +496,13 @@ static int schema_load_del_transaction(struct ldb_module *module)
|
||||
|
||||
static int schema_load_extended(struct ldb_module *module, struct ldb_request *req)
|
||||
{
|
||||
time_t *lastts;
|
||||
struct ldb_context *ldb = ldb_module_get_ctx(module);
|
||||
|
||||
if (strcmp(req->op.extended.oid, DSDB_EXTENDED_SCHEMA_UPDATE_NOW_OID) != 0) {
|
||||
return ldb_next_request(module, req);
|
||||
}
|
||||
lastts = (time_t *)ldb_get_opaque(ldb, DSDB_OPAQUE_LAST_SCHEMA_UPDATE_MSG_OPAQUE_NAME);
|
||||
if (!lastts) {
|
||||
lastts = talloc(ldb, time_t);
|
||||
}
|
||||
/* Force a refresh */
|
||||
dsdb_get_schema(ldb, NULL);
|
||||
*lastts = 0;
|
||||
ldb_set_opaque(ldb, DSDB_OPAQUE_LAST_SCHEMA_UPDATE_MSG_OPAQUE_NAME, lastts);
|
||||
|
||||
/* Pass to next module, the partition one should finish the chain */
|
||||
return ldb_next_request(module, req);
|
||||
|
@ -269,7 +269,6 @@ struct dsdb_extended_dn_store_format {
|
||||
bool store_extended_dn_in_ldb;
|
||||
};
|
||||
|
||||
#define DSDB_OPAQUE_LAST_SCHEMA_UPDATE_MSG_OPAQUE_NAME "DSDB_OPAQUE_LAST_SCHEMA_UPDATE"
|
||||
#define DSDB_OPAQUE_PARTITION_MODULE_MSG_OPAQUE_NAME "DSDB_OPAQUE_PARTITION_MODULE_MSG"
|
||||
|
||||
/* this takes a struct dsdb_fsmo_extended_op */
|
||||
|
@ -1226,10 +1226,7 @@ NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
|
||||
{
|
||||
unsigned int i;
|
||||
struct ldap_message *msg = call->request;
|
||||
struct ldb_context *samdb = call->conn->ldb;
|
||||
NTSTATUS status;
|
||||
time_t *lastts;
|
||||
bool recheck_schema = false;
|
||||
|
||||
/* Check for undecoded critical extensions */
|
||||
for (i=0; msg->controls && msg->controls[i]; i++) {
|
||||
@ -1249,11 +1246,9 @@ NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
|
||||
case LDAP_TAG_SearchRequest:
|
||||
return ldapsrv_SearchRequest(call);
|
||||
case LDAP_TAG_ModifyRequest:
|
||||
recheck_schema = true;
|
||||
status = ldapsrv_ModifyRequest(call);
|
||||
break;
|
||||
case LDAP_TAG_AddRequest:
|
||||
recheck_schema = true;
|
||||
status = ldapsrv_AddRequest(call);
|
||||
break;
|
||||
case LDAP_TAG_DelRequest:
|
||||
@ -1273,23 +1268,6 @@ NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
|
||||
return ldapsrv_unwilling(call, LDAP_PROTOCOL_ERROR);
|
||||
}
|
||||
|
||||
if (NT_STATUS_IS_OK(status) && recheck_schema) {
|
||||
lastts = (time_t *)ldb_get_opaque(samdb, DSDB_OPAQUE_LAST_SCHEMA_UPDATE_MSG_OPAQUE_NAME);
|
||||
if (lastts && !*lastts) {
|
||||
DEBUG(10, ("Schema update now was requested, "
|
||||
"fullfilling the request ts = %d\n",
|
||||
(int)*lastts));
|
||||
/*
|
||||
* Just requesting the schema will do the trick
|
||||
* as the delay for reload is experied, we will have a reload
|
||||
* from the schema as expected as we are not yet in a transaction!
|
||||
*/
|
||||
dsdb_get_schema(samdb, NULL);
|
||||
*lastts = time(NULL);
|
||||
ldb_set_opaque(samdb, DSDB_OPAQUE_LAST_SCHEMA_UPDATE_MSG_OPAQUE_NAME, lastts);
|
||||
}
|
||||
}
|
||||
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
ldapsrv_notification_retry_setup(call->conn->service, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user