mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
r19363: - don't need to store the baseinfo message after cache load
(This used to be commit 8c091bcdece5c17073838ad2367f3f4e22e97c31)
This commit is contained in:
parent
e36ea2e8eb
commit
1865044d5c
@ -320,6 +320,7 @@ int ltdb_cache_load(struct ldb_module *module)
|
|||||||
struct ldb_dn *baseinfo_dn = NULL;
|
struct ldb_dn *baseinfo_dn = NULL;
|
||||||
struct ldb_dn *indexlist_dn = NULL;
|
struct ldb_dn *indexlist_dn = NULL;
|
||||||
uint64_t seq;
|
uint64_t seq;
|
||||||
|
struct ldb_message *baseinfo;
|
||||||
|
|
||||||
if (ltdb->cache == NULL) {
|
if (ltdb->cache == NULL) {
|
||||||
ltdb->cache = talloc_zero(ltdb, struct ltdb_cache);
|
ltdb->cache = talloc_zero(ltdb, struct ltdb_cache);
|
||||||
@ -334,30 +335,29 @@ int ltdb_cache_load(struct ldb_module *module)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
talloc_free(ltdb->cache->baseinfo);
|
baseinfo = talloc(ltdb->cache, struct ldb_message);
|
||||||
ltdb->cache->baseinfo = talloc(ltdb->cache, struct ldb_message);
|
if (baseinfo == NULL) goto failed;
|
||||||
if (ltdb->cache->baseinfo == NULL) goto failed;
|
|
||||||
|
|
||||||
baseinfo_dn = ldb_dn_explode(module->ldb, LTDB_BASEINFO);
|
baseinfo_dn = ldb_dn_explode(module->ldb, LTDB_BASEINFO);
|
||||||
if (baseinfo_dn == NULL) goto failed;
|
if (baseinfo_dn == NULL) goto failed;
|
||||||
|
|
||||||
if (ltdb_search_dn1(module, baseinfo_dn, ltdb->cache->baseinfo) == -1) {
|
if (ltdb_search_dn1(module, baseinfo_dn, baseinfo) == -1) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* possibly initialise the baseinfo */
|
/* possibly initialise the baseinfo */
|
||||||
if (!ltdb->cache->baseinfo->dn) {
|
if (!baseinfo->dn) {
|
||||||
if (ltdb_baseinfo_init(module) != 0) {
|
if (ltdb_baseinfo_init(module) != 0) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
if (ltdb_search_dn1(module, baseinfo_dn, ltdb->cache->baseinfo) != 1) {
|
if (ltdb_search_dn1(module, baseinfo_dn, baseinfo) != 1) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the current internal sequence number is the same as the one
|
/* if the current internal sequence number is the same as the one
|
||||||
in the database then assume the rest of the cache is OK */
|
in the database then assume the rest of the cache is OK */
|
||||||
seq = ldb_msg_find_attr_as_uint64(ltdb->cache->baseinfo, LTDB_SEQUENCE_NUMBER, 0);
|
seq = ldb_msg_find_attr_as_uint64(baseinfo, LTDB_SEQUENCE_NUMBER, 0);
|
||||||
if (seq == ltdb->sequence_number) {
|
if (seq == ltdb->sequence_number) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -396,11 +396,13 @@ int ltdb_cache_load(struct ldb_module *module)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
talloc_free(baseinfo);
|
||||||
talloc_free(baseinfo_dn);
|
talloc_free(baseinfo_dn);
|
||||||
talloc_free(indexlist_dn);
|
talloc_free(indexlist_dn);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
talloc_free(baseinfo);
|
||||||
talloc_free(baseinfo_dn);
|
talloc_free(baseinfo_dn);
|
||||||
talloc_free(indexlist_dn);
|
talloc_free(indexlist_dn);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -22,7 +22,6 @@ struct ltdb_private {
|
|||||||
unsigned long long sequence_number;
|
unsigned long long sequence_number;
|
||||||
|
|
||||||
struct ltdb_cache {
|
struct ltdb_cache {
|
||||||
struct ldb_message *baseinfo;
|
|
||||||
struct ldb_message *indexlist;
|
struct ldb_message *indexlist;
|
||||||
struct ldb_message *attributes;
|
struct ldb_message *attributes;
|
||||||
struct ldb_message *subclasses;
|
struct ldb_message *subclasses;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user