diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-12-08 08:22:07 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-12-08 05:26:05 +0100 |
commit | 1b016f58cee801d12b452a89a4d4ba959da61b93 (patch) | |
tree | c160abe0e8113f2a26704c0ddd36bb6bc192d21b | |
parent | 9013f93df147de8c5f3c8bf821765053c29abbe8 (diff) | |
download | samba-1b016f58cee801d12b452a89a4d4ba959da61b93.tar.gz samba-1b016f58cee801d12b452a89a4d4ba959da61b93.tar.bz2 samba-1b016f58cee801d12b452a89a4d4ba959da61b93.zip |
s4-ldb: ensure ldb_register_samba_handlers() is not done twice
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/lib/ldb-samba/ldif_handlers.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index 5581cb1931..3fbb3fb512 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -1374,9 +1374,13 @@ const struct ldb_schema_syntax *ldb_samba_syntax_by_lDAPDisplayName(struct ldb_c int ldb_register_samba_handlers(struct ldb_context *ldb) { unsigned int i; + int ret; + + if (ldb_get_opaque(ldb, "SAMBA_HANDLERS_REGISTERED") != NULL) { + return LDB_SUCCESS; + } for (i=0; i < ARRAY_SIZE(samba_attributes); i++) { - int ret; const struct ldb_schema_syntax *s = NULL; s = ldb_samba_syntax_by_name(ldb, samba_attributes[i].syntax); @@ -1396,7 +1400,6 @@ int ldb_register_samba_handlers(struct ldb_context *ldb) } for (i=0; i < ARRAY_SIZE(samba_dn_syntax); i++) { - int ret; ret = ldb_dn_extended_add_syntax(ldb, LDB_ATTR_FLAG_FIXED, &samba_dn_syntax[i]); if (ret != LDB_SUCCESS) { return ret; @@ -1404,5 +1407,10 @@ int ldb_register_samba_handlers(struct ldb_context *ldb) } + ret = ldb_set_opaque(ldb, "SAMBA_HANDLERS_REGISTERED", (void*)1); + if (ret != LDB_SUCCESS) { + return ret; + } + return LDB_SUCCESS; } |