From 4396d0d1482d4033a469f7a3e3835a6f3b145046 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 21 Jul 2005 08:32:07 +0000 Subject: r8669: The objectguid module belongs in Samba's ldb module collection, not in ldb, as it can't build without the NDR and GUID code. Also make it properly use the NDR encoding for the GUID (I forgot last time, and used a string), as well as set the dependencies on the module correctly. Andrew Bartlett (This used to be commit 8054abc76e5e3588cebc7fc01062a1223b7f140b) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 224 ++++++++++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 source4/dsdb/samdb/ldb_modules/objectguid.c (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c new file mode 100644 index 0000000000..45f1a10730 --- /dev/null +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -0,0 +1,224 @@ +/* + ldb database library + + Copyright (C) Simo Sorce 2004 + + ** NOTE! The following LGPL license applies to the ldb + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* + * Name: ldb + * + * Component: ldb objectguid module + * + * Description: add a unique objectGUID onto every new record + * + * Author: Simo Sorce + */ + +#include "includes.h" +#include "ldb/include/ldb.h" +#include "ldb/include/ldb_private.h" +#include + +struct private_data { + const char *error_string; +}; + +static int objectguid_search(struct ldb_module *module, const char *base, + enum ldb_scope scope, const char *expression, + const char * const *attrs, struct ldb_message ***res) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_search\n"); + return ldb_next_search(module, base, scope, expression, attrs, res); +} + +static int objectguid_search_bytree(struct ldb_module *module, const char *base, + enum ldb_scope scope, struct ldb_parse_tree *tree, + const char * const *attrs, struct ldb_message ***res) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_search\n"); + return ldb_next_search_bytree(module, base, scope, tree, attrs, res); +} + +static struct ldb_message_element *objectguid_find_attribute(const struct ldb_message *msg, const char *name) +{ + int i; + + for (i = 0; i < msg->num_elements; i++) { + if (ldb_attr_cmp(name, msg->elements[i].name) == 0) { + return &msg->elements[i]; + } + } + + return NULL; +} + +/* add_record: add crateTimestamp/modifyTimestamp attributes */ +static int objectguid_add_record(struct ldb_module *module, const struct ldb_message *msg) +{ + struct ldb_val v; + struct ldb_message *msg2; + struct ldb_message_element *attribute; + struct GUID guid; + NTSTATUS nt_status; + int ret, i; + + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); + + if (msg->dn[0] == '@') { /* do not manipulate our control entries */ + return ldb_next_add_record(module, msg); + } + + if ((attribute = objectguid_find_attribute(msg, "objectGUID")) != NULL ) { + return ldb_next_add_record(module, msg); + } + + msg2 = talloc(module, struct ldb_message); + if (!msg2) { + return -1; + } + + msg2->dn = msg->dn; + msg2->num_elements = msg->num_elements; + msg2->private_data = msg->private_data; + msg2->elements = talloc_array(msg2, struct ldb_message_element, msg2->num_elements); + for (i = 0; i < msg2->num_elements; i++) { + msg2->elements[i] = msg->elements[i]; + } + + /* a new GUID */ + guid = GUID_random(); + + nt_status = ndr_push_struct_blob(&v, msg2, &guid, + (ndr_push_flags_fn_t)ndr_push_GUID); + if (!NT_STATUS_IS_OK(nt_status)) { + return -1; + } + + ret = ldb_msg_add_value(module->ldb, msg2, "objectGUID", &v); + if (ret) { + return ret; + } + + ret = ldb_next_add_record(module, msg2); + talloc_free(msg2); + + return ret; +} + +/* modify_record: change modifyTimestamp as well */ +static int objectguid_modify_record(struct ldb_module *module, const struct ldb_message *msg) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_modify_record\n"); + return ldb_next_modify_record(module, msg); +} + +static int objectguid_delete_record(struct ldb_module *module, const char *dn) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_delete_record\n"); + return ldb_next_delete_record(module, dn); +} + +static int objectguid_rename_record(struct ldb_module *module, const char *olddn, const char *newdn) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_rename_record\n"); + return ldb_next_rename_record(module, olddn, newdn); +} + +static int objectguid_lock(struct ldb_module *module, const char *lockname) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_lock\n"); + return ldb_next_named_lock(module, lockname); +} + +static int objectguid_unlock(struct ldb_module *module, const char *lockname) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_unlock\n"); + return ldb_next_named_unlock(module, lockname); +} + +/* return extended error information */ +static const char *objectguid_errstring(struct ldb_module *module) +{ + struct private_data *data = (struct private_data *)module->private_data; + + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_errstring\n"); + if (data->error_string) { + const char *error; + + error = data->error_string; + data->error_string = NULL; + return error; + } + + return ldb_next_errstring(module); +} + +static int objectguid_destructor(void *module_ctx) +{ + /* struct ldb_module *ctx = module_ctx; */ + /* put your clean-up functions here */ + return 0; +} + +static const struct ldb_module_ops objectguid_ops = { + .name = "objectguid", + .search = objectguid_search, + .search_bytree = objectguid_search_bytree, + .add_record = objectguid_add_record, + .modify_record = objectguid_modify_record, + .delete_record = objectguid_delete_record, + .rename_record = objectguid_rename_record, + .named_lock = objectguid_lock, + .named_unlock = objectguid_unlock, + .errstring = objectguid_errstring +}; + + +/* the init function */ +#ifdef HAVE_DLOPEN_DISABLED + struct ldb_module *init_module(struct ldb_context *ldb, const char *options[]) +#else +struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *options[]) +#endif +{ + struct ldb_module *ctx; + struct private_data *data; + + ctx = talloc(ldb, struct ldb_module); + if (!ctx) + return NULL; + + data = talloc(ctx, struct private_data); + if (!data) { + talloc_free(ctx); + return NULL; + } + + data->error_string = NULL; + ctx->private_data = data; + ctx->ldb = ldb; + ctx->prev = ctx->next = NULL; + ctx->ops = &objectguid_ops; + + talloc_set_destructor (ctx, objectguid_destructor); + + return ctx; +} -- cgit From 6553dd0c60e922f42de347a02c8f792f087c393c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 28 Jul 2005 00:27:28 +0000 Subject: r8811: Fix the build.. (This used to be commit fac77f5fa267da57a55e88cad8993897e80741a0) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 45f1a10730..873c89cf28 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -35,6 +35,7 @@ #include "includes.h" #include "ldb/include/ldb.h" #include "ldb/include/ldb_private.h" +#include "librpc/gen_ndr/ndr_misc.h" #include struct private_data { -- cgit From 3e4c4cff2177af33efdb15f03a1bbcb639505cee Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 18 Aug 2005 15:02:01 +0000 Subject: r9391: Convert all the code to use struct ldb_dn to ohandle ldap like distinguished names Provide more functions to handle DNs in this form (This used to be commit 692e35b7797e39533dd2a1c4b63d9da30f1eb5ba) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 873c89cf28..dc4576a8f9 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -42,7 +42,7 @@ struct private_data { const char *error_string; }; -static int objectguid_search(struct ldb_module *module, const char *base, +static int objectguid_search(struct ldb_module *module, const struct ldb_dn *base, enum ldb_scope scope, const char *expression, const char * const *attrs, struct ldb_message ***res) { @@ -50,7 +50,7 @@ static int objectguid_search(struct ldb_module *module, const char *base, return ldb_next_search(module, base, scope, expression, attrs, res); } -static int objectguid_search_bytree(struct ldb_module *module, const char *base, +static int objectguid_search_bytree(struct ldb_module *module, const struct ldb_dn *base, enum ldb_scope scope, struct ldb_parse_tree *tree, const char * const *attrs, struct ldb_message ***res) { @@ -83,7 +83,7 @@ static int objectguid_add_record(struct ldb_module *module, const struct ldb_mes ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); - if (msg->dn[0] == '@') { /* do not manipulate our control entries */ + if (ldb_dn_is_special(msg->dn)) { /* do not manipulate our control entries */ return ldb_next_add_record(module, msg); } @@ -131,13 +131,13 @@ static int objectguid_modify_record(struct ldb_module *module, const struct ldb_ return ldb_next_modify_record(module, msg); } -static int objectguid_delete_record(struct ldb_module *module, const char *dn) +static int objectguid_delete_record(struct ldb_module *module, const struct ldb_dn *dn) { ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_delete_record\n"); return ldb_next_delete_record(module, dn); } -static int objectguid_rename_record(struct ldb_module *module, const char *olddn, const char *newdn) +static int objectguid_rename_record(struct ldb_module *module, const struct ldb_dn *olddn, const struct ldb_dn *newdn) { ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_rename_record\n"); return ldb_next_rename_record(module, olddn, newdn); -- cgit From 4f85004da5ea5809321ba4a3bc23631bef61bea7 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 17 Sep 2005 19:29:45 +0000 Subject: r10300: forgot to change the dsdb modules function names (This used to be commit e9018e3d9f69528acc0c440929fdb8d95413fa0d) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index dc4576a8f9..c2569d18ca 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -143,16 +143,16 @@ static int objectguid_rename_record(struct ldb_module *module, const struct ldb_ return ldb_next_rename_record(module, olddn, newdn); } -static int objectguid_lock(struct ldb_module *module, const char *lockname) +static int objectguid_start_trans(struct ldb_module *module) { - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_lock\n"); - return ldb_next_named_lock(module, lockname); + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_start_trans\n"); + return ldb_next_start_trans(module); } -static int objectguid_unlock(struct ldb_module *module, const char *lockname) +static int objectguid_end_trans(struct ldb_module *module, int status) { - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_unlock\n"); - return ldb_next_named_unlock(module, lockname); + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_end_trans\n"); + return ldb_next_end_trans(module, status); } /* return extended error information */ @@ -187,8 +187,8 @@ static const struct ldb_module_ops objectguid_ops = { .modify_record = objectguid_modify_record, .delete_record = objectguid_delete_record, .rename_record = objectguid_rename_record, - .named_lock = objectguid_lock, - .named_unlock = objectguid_unlock, + .start_transaction = objectguid_start_trans, + .end_transaction = objectguid_end_trans, .errstring = objectguid_errstring }; -- cgit From 3d7935e656fe682e1d0545eaaa72428b78a65635 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 18 Sep 2005 18:50:02 +0000 Subject: r10306: change these modules to use new error API (This used to be commit e86c9b4a7f399a3152a2703c76406e9d69ec1225) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 34 ++--------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index c2569d18ca..2a27398fbc 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -38,10 +38,6 @@ #include "librpc/gen_ndr/ndr_misc.h" #include -struct private_data { - const char *error_string; -}; - static int objectguid_search(struct ldb_module *module, const struct ldb_dn *base, enum ldb_scope scope, const char *expression, const char * const *attrs, struct ldb_message ***res) @@ -155,23 +151,6 @@ static int objectguid_end_trans(struct ldb_module *module, int status) return ldb_next_end_trans(module, status); } -/* return extended error information */ -static const char *objectguid_errstring(struct ldb_module *module) -{ - struct private_data *data = (struct private_data *)module->private_data; - - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_errstring\n"); - if (data->error_string) { - const char *error; - - error = data->error_string; - data->error_string = NULL; - return error; - } - - return ldb_next_errstring(module); -} - static int objectguid_destructor(void *module_ctx) { /* struct ldb_module *ctx = module_ctx; */ @@ -188,8 +167,7 @@ static const struct ldb_module_ops objectguid_ops = { .delete_record = objectguid_delete_record, .rename_record = objectguid_rename_record, .start_transaction = objectguid_start_trans, - .end_transaction = objectguid_end_trans, - .errstring = objectguid_errstring + .end_transaction = objectguid_end_trans }; @@ -201,20 +179,12 @@ struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *o #endif { struct ldb_module *ctx; - struct private_data *data; ctx = talloc(ldb, struct ldb_module); if (!ctx) return NULL; - data = talloc(ctx, struct private_data); - if (!data) { - talloc_free(ctx); - return NULL; - } - - data->error_string = NULL; - ctx->private_data = data; + ctx->private_data = NULL; ctx->ldb = ldb; ctx->prev = ctx->next = NULL; ctx->ops = &objectguid_ops; -- cgit From 63b43dd12fb579aaaccedd07aaa630cb1cd7aa88 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 24 Sep 2005 15:42:15 +0000 Subject: r10477: expose transactions outside ldb and change the API once more do not autostart transactions on ldb operations if a transaction is already in place test transactions on winsdb all my tests passes so far tridge please confirm this is ok for you (This used to be commit c2bb2a36bdbe0ec7519697a9a9ba7526a0defac2) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 2a27398fbc..bdef4d5147 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -145,10 +145,16 @@ static int objectguid_start_trans(struct ldb_module *module) return ldb_next_start_trans(module); } -static int objectguid_end_trans(struct ldb_module *module, int status) +static int objectguid_end_trans(struct ldb_module *module) { ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_end_trans\n"); - return ldb_next_end_trans(module, status); + return ldb_next_end_trans(module); +} + +static int objectguid_del_trans(struct ldb_module *module) +{ + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_del_trans\n"); + return ldb_next_del_trans(module); } static int objectguid_destructor(void *module_ctx) @@ -167,7 +173,8 @@ static const struct ldb_module_ops objectguid_ops = { .delete_record = objectguid_delete_record, .rename_record = objectguid_rename_record, .start_transaction = objectguid_start_trans, - .end_transaction = objectguid_end_trans + .end_transaction = objectguid_end_trans, + .del_transaction = objectguid_del_trans }; -- cgit From 5fd031c97daaa1bf09a7ad80550753acd434075f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Oct 2005 05:24:46 +0000 Subject: r10753: don't require every ldb module to implement both a search_bytree() and a search() function, instead each module now only implements the bytree method, and the expression based search is handled generically by the modules code. This makes for more consistency and less code duplication. fixed the tdb backend to handle BASE searches much more efficiently. They now always only lookup one record, regardless of the search expression (This used to be commit 7e44f9153c5578624e2fca04cdc0a00af0fd9eb4) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index bdef4d5147..9e0946b17c 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -38,14 +38,6 @@ #include "librpc/gen_ndr/ndr_misc.h" #include -static int objectguid_search(struct ldb_module *module, const struct ldb_dn *base, - enum ldb_scope scope, const char *expression, - const char * const *attrs, struct ldb_message ***res) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_search\n"); - return ldb_next_search(module, base, scope, expression, attrs, res); -} - static int objectguid_search_bytree(struct ldb_module *module, const struct ldb_dn *base, enum ldb_scope scope, struct ldb_parse_tree *tree, const char * const *attrs, struct ldb_message ***res) @@ -166,7 +158,6 @@ static int objectguid_destructor(void *module_ctx) static const struct ldb_module_ops objectguid_ops = { .name = "objectguid", - .search = objectguid_search, .search_bytree = objectguid_search_bytree, .add_record = objectguid_add_record, .modify_record = objectguid_modify_record, -- cgit From 78d0e79c9f9263e7f3798aa2e174a347ea1a3df1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Oct 2005 06:57:09 +0000 Subject: r10759: make modules easier to write by allowing modules to only implement the functions they care about, instead of all functions. This also makes it more likely that future changes to ldb will not break existing modules (This used to be commit 45f0c967b58e7c1b2e900a4d74cfde2a2c527dfa) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 53 +---------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 9e0946b17c..0a7fe3a42b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -112,60 +112,11 @@ static int objectguid_add_record(struct ldb_module *module, const struct ldb_mes return ret; } -/* modify_record: change modifyTimestamp as well */ -static int objectguid_modify_record(struct ldb_module *module, const struct ldb_message *msg) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_modify_record\n"); - return ldb_next_modify_record(module, msg); -} - -static int objectguid_delete_record(struct ldb_module *module, const struct ldb_dn *dn) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_delete_record\n"); - return ldb_next_delete_record(module, dn); -} - -static int objectguid_rename_record(struct ldb_module *module, const struct ldb_dn *olddn, const struct ldb_dn *newdn) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_rename_record\n"); - return ldb_next_rename_record(module, olddn, newdn); -} - -static int objectguid_start_trans(struct ldb_module *module) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_start_trans\n"); - return ldb_next_start_trans(module); -} - -static int objectguid_end_trans(struct ldb_module *module) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_end_trans\n"); - return ldb_next_end_trans(module); -} - -static int objectguid_del_trans(struct ldb_module *module) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_del_trans\n"); - return ldb_next_del_trans(module); -} - -static int objectguid_destructor(void *module_ctx) -{ - /* struct ldb_module *ctx = module_ctx; */ - /* put your clean-up functions here */ - return 0; -} static const struct ldb_module_ops objectguid_ops = { .name = "objectguid", .search_bytree = objectguid_search_bytree, - .add_record = objectguid_add_record, - .modify_record = objectguid_modify_record, - .delete_record = objectguid_delete_record, - .rename_record = objectguid_rename_record, - .start_transaction = objectguid_start_trans, - .end_transaction = objectguid_end_trans, - .del_transaction = objectguid_del_trans + .add_record = objectguid_add_record }; @@ -187,7 +138,5 @@ struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *o ctx->prev = ctx->next = NULL; ctx->ops = &objectguid_ops; - talloc_set_destructor (ctx, objectguid_destructor); - return ctx; } -- cgit From 5e0fd505abd1926558e59ae77bcfd03cd0beecfa Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 7 Oct 2005 01:01:44 +0000 Subject: r10791: Add copyright, fix comments (this isn't the timestamps module any more) Andrew Bartlett (This used to be commit efdc6d834aecbf978f538365c72149fa7afe0828) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 0a7fe3a42b..7dc6a433c0 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -2,6 +2,7 @@ ldb database library Copyright (C) Simo Sorce 2004 + Copyright (C) Andrew Bartlett 2005 ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released @@ -36,7 +37,6 @@ #include "ldb/include/ldb.h" #include "ldb/include/ldb_private.h" #include "librpc/gen_ndr/ndr_misc.h" -#include static int objectguid_search_bytree(struct ldb_module *module, const struct ldb_dn *base, enum ldb_scope scope, struct ldb_parse_tree *tree, @@ -59,7 +59,7 @@ static struct ldb_message_element *objectguid_find_attribute(const struct ldb_me return NULL; } -/* add_record: add crateTimestamp/modifyTimestamp attributes */ +/* add_record: add objectGUID attribute */ static int objectguid_add_record(struct ldb_module *module, const struct ldb_message *msg) { struct ldb_val v; @@ -112,7 +112,6 @@ static int objectguid_add_record(struct ldb_module *module, const struct ldb_mes return ret; } - static const struct ldb_module_ops objectguid_ops = { .name = "objectguid", .search_bytree = objectguid_search_bytree, -- cgit From a599edf04cbdeef9014923ba0d3713b8ff84f266 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 12 Oct 2005 06:10:23 +0000 Subject: r10913: This patch isn't as big as it looks ... most of the changes are fixes to make all the ldb code compile without warnings on gcc4. Unfortunately That required a lot of casts :-( I have also added the start of an 'operational' module, which will replace the timestamp module, plus add support for some other operational attributes In ldb_msg_*() I added some new utility functions to make the operational module sane, and remove the 'ldb' argument from the ldb_msg_add_*() functions. That argument was only needed back in the early days of ldb when we didn't use the hierarchical talloc and thus needed a place to get the allocation function from. Now its just a pain to pass around everywhere. Also added a ldb_debug_set() function that calls ldb_debug() plus sets the result using ldb_set_errstring(). That saves on some awkward coding in a few places. (This used to be commit f6818daecca95760c12f79fd307770cbe3346f57) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 7dc6a433c0..70bbaf179c 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -101,7 +101,7 @@ static int objectguid_add_record(struct ldb_module *module, const struct ldb_mes return -1; } - ret = ldb_msg_add_value(module->ldb, msg2, "objectGUID", &v); + ret = ldb_msg_add_value(msg2, "objectGUID", &v); if (ret) { return ret; } -- cgit From 5c9590587197dcb95007fdc54318187d5716c7c6 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 8 Nov 2005 00:11:45 +0000 Subject: r11567: Ldb API change patch. This patch changes the way lsb_search is called and the meaning of the returned integer. The last argument of ldb_search is changed from struct ldb_message to struct ldb_result which contains a pointer to a struct ldb_message list and a count of the number of messages. The return is not the count of messages anymore but instead it is an ldb error value. I tryed to keep the patch as tiny as possible bu as you can guess I had to change a good amount of places. I also tried to double check all my changes being sure that the calling functions would still behave as before. But this patch is big enough that I fear some bug may have been introduced anyway even if it passes the test suite. So if you are currently working on any file being touched please give it a deep look and blame me for any error. Simo. (This used to be commit 22c8c97e6fb466b41859e090e959d7f1134be780) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 36 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 70bbaf179c..0d5ae69219 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -38,14 +38,6 @@ #include "ldb/include/ldb_private.h" #include "librpc/gen_ndr/ndr_misc.h" -static int objectguid_search_bytree(struct ldb_module *module, const struct ldb_dn *base, - enum ldb_scope scope, struct ldb_parse_tree *tree, - const char * const *attrs, struct ldb_message ***res) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_search\n"); - return ldb_next_search_bytree(module, base, scope, tree, attrs, res); -} - static struct ldb_message_element *objectguid_find_attribute(const struct ldb_message *msg, const char *name) { int i; @@ -60,8 +52,9 @@ static struct ldb_message_element *objectguid_find_attribute(const struct ldb_me } /* add_record: add objectGUID attribute */ -static int objectguid_add_record(struct ldb_module *module, const struct ldb_message *msg) +static int objectguid_add(struct ldb_module *module, struct ldb_request *req) { + const struct ldb_message *msg = req->op.add.message; struct ldb_val v; struct ldb_message *msg2; struct ldb_message_element *attribute; @@ -72,11 +65,11 @@ static int objectguid_add_record(struct ldb_module *module, const struct ldb_mes ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); if (ldb_dn_is_special(msg->dn)) { /* do not manipulate our control entries */ - return ldb_next_add_record(module, msg); + return ldb_next_request(module, req); } if ((attribute = objectguid_find_attribute(msg, "objectGUID")) != NULL ) { - return ldb_next_add_record(module, msg); + return ldb_next_request(module, req); } msg2 = talloc(module, struct ldb_message); @@ -106,16 +99,31 @@ static int objectguid_add_record(struct ldb_module *module, const struct ldb_mes return ret; } - ret = ldb_next_add_record(module, msg2); + req->op.add.message = msg2; + ret = ldb_next_request(module, req); + req->op.add.message = msg; + talloc_free(msg2); return ret; } +static int objectguid_request(struct ldb_module *module, struct ldb_request *req) +{ + switch (req->operation) { + + case LDB_REQ_ADD: + return objectguid_add(module, req); + + default: + return ldb_next_request(module, req); + + } +} + static const struct ldb_module_ops objectguid_ops = { .name = "objectguid", - .search_bytree = objectguid_search_bytree, - .add_record = objectguid_add_record + .request = objectguid_request }; -- cgit From 3b99d9c5bd563203adc4b017d6e6599dd84b8d57 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 1 Jan 2006 17:32:10 +0000 Subject: r12658: Couple of fixes related to shared module builds. (This used to be commit c297c93faf3b748de68679f5a4be50845ebe25fe) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 0d5ae69219..c9063af6ef 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -128,11 +128,7 @@ static const struct ldb_module_ops objectguid_ops = { /* the init function */ -#ifdef HAVE_DLOPEN_DISABLED - struct ldb_module *init_module(struct ldb_context *ldb, const char *options[]) -#else struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *options[]) -#endif { struct ldb_module *ctx; -- cgit From c908d0b2aa111659e57a73efb8c33c413965c846 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 6 Jan 2006 04:01:23 +0000 Subject: r12733: Merge ldap/ldb controls into main tree There's still lot of work to do but the patch is stable enough to be pushed into the main samba4 tree. Simo. (This used to be commit 77125feaff252cab44d26593093a9c211c846ce8) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index c9063af6ef..935f92c55b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -128,10 +128,12 @@ static const struct ldb_module_ops objectguid_ops = { /* the init function */ -struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *options[]) +struct ldb_module *objectguid_module_init(struct ldb_context *ldb, int stage, const char *options[]) { struct ldb_module *ctx; + if (stage != LDB_MODULES_INIT_STAGE_1) return NULL; + ctx = talloc(ldb, struct ldb_module); if (!ctx) return NULL; -- cgit From dbef4d76de92c3388f4e1819a76d6febf90be290 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 6 Jan 2006 16:12:45 +0000 Subject: r12743: Remove the ugly way we had to make a second stage init and introduce a second_stage_init private function for modules that need a second stage init. Simo. (This used to be commit 5e8b365fa2d93801a5de1d9ea76ce9d5546bd248) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 935f92c55b..c9063af6ef 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -128,12 +128,10 @@ static const struct ldb_module_ops objectguid_ops = { /* the init function */ -struct ldb_module *objectguid_module_init(struct ldb_context *ldb, int stage, const char *options[]) +struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *options[]) { struct ldb_module *ctx; - if (stage != LDB_MODULES_INIT_STAGE_1) return NULL; - ctx = talloc(ldb, struct ldb_module); if (!ctx) return NULL; -- cgit From 26af14c39b88b0e7eb53657b89be65d865804688 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 2 Mar 2006 16:32:53 +0000 Subject: r13786: [merge] Add registration functions for LDB modules Applications that use LDB modules will now have to run ldb_global_init() before they can use LDB. The next step will be adding support for loading LDB modules from .so files. This will also allow us to use one LDB without difference between the standalone and the Samba-specific build (This used to be commit 52a235650514039bf8ffee99a784bbc1b6ae6b92) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index c9063af6ef..7169aa6842 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -127,19 +127,7 @@ static const struct ldb_module_ops objectguid_ops = { }; -/* the init function */ -struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *options[]) +int objectguid_module_init(void) { - struct ldb_module *ctx; - - ctx = talloc(ldb, struct ldb_module); - if (!ctx) - return NULL; - - ctx->private_data = NULL; - ctx->ldb = ldb; - ctx->prev = ctx->next = NULL; - ctx->ops = &objectguid_ops; - - return ctx; + return ldb_register_module(&objectguid_ops); } -- cgit From aa7a02d45fefad3640f273b1d3bfe535a1e6b88c Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 13 May 2006 21:08:37 +0000 Subject: r15582: Commit some forgotten stuff that have been setting on my private tree fro long (This used to be commit 7c050b541e98cd442a0c9ed0ddadb3e573cd1304) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 75 +++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 7169aa6842..699f04775c 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -1,7 +1,7 @@ /* ldb database library - Copyright (C) Simo Sorce 2004 + Copyright (C) Simo Sorce 2004-2006 Copyright (C) Andrew Bartlett 2005 ** NOTE! The following LGPL license applies to the ldb @@ -34,8 +34,7 @@ */ #include "includes.h" -#include "ldb/include/ldb.h" -#include "ldb/include/ldb_private.h" +#include "ldb/include/includes.h" #include "librpc/gen_ndr/ndr_misc.h" static struct ldb_message_element *objectguid_find_attribute(const struct ldb_message *msg, const char *name) @@ -108,6 +107,73 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) return ret; } +static int objectguid_add_async(struct ldb_module *module, struct ldb_request *req) +{ + struct ldb_request *down_req; + struct ldb_message_element *attribute; + struct ldb_message *msg; + struct ldb_val v; + struct GUID guid; + NTSTATUS nt_status; + int ret; + + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); + + /* do not manipulate our control entries */ + if (ldb_dn_is_special(req->op.add.message->dn)) { + return ldb_next_request(module, req); + } + + if ((attribute = objectguid_find_attribute(req->op.add.message, "objectGUID")) != NULL ) { + return ldb_next_request(module, req); + } + + down_req = talloc(req, struct ldb_request); + if (down_req == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + + /* we have to copy the message as the caller might have it as a const */ + msg = ldb_msg_copy_shallow(down_req, req->op.add.message); + if (msg == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + + /* a new GUID */ + guid = GUID_random(); + + nt_status = ndr_push_struct_blob(&v, msg, &guid, + (ndr_push_flags_fn_t)ndr_push_GUID); + if (!NT_STATUS_IS_OK(nt_status)) { + return -1; + } + + ret = ldb_msg_add_value(msg, "objectGUID", &v); + if (ret) { + return ret; + } + + down_req->op.add.message = msg; + + down_req->controls = req->controls; + down_req->creds = req->creds; + + down_req->async.context = req->async.context; + down_req->async.callback = req->async.callback; + down_req->async.timeout = req->async.timeout; + + /* go on with the call chain */ + ret = ldb_next_request(module, down_req); + + /* do not free down_req as the call results may be linked to it, + * it will be freed when the upper level request get freed */ + if (ret == LDB_SUCCESS) { + req->async.handle = down_req->async.handle; + } + + return ret; +} + static int objectguid_request(struct ldb_module *module, struct ldb_request *req) { switch (req->operation) { @@ -115,6 +181,9 @@ static int objectguid_request(struct ldb_module *module, struct ldb_request *req case LDB_REQ_ADD: return objectguid_add(module, req); + case LDB_ASYNC_ADD: + return objectguid_add_async(module, req); + default: return ldb_next_request(module, req); -- cgit From 12f377c638d118da58f2f2802baf28961a631f0f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 16 May 2006 16:43:34 +0000 Subject: r15639: fix warnings metze (This used to be commit 73ca71b42b20c9cc0acba8caecc24b07624c4abc) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 699f04775c..71591f187f 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -53,7 +53,7 @@ static struct ldb_message_element *objectguid_find_attribute(const struct ldb_me /* add_record: add objectGUID attribute */ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) { - const struct ldb_message *msg = req->op.add.message; + struct ldb_message *msg = req->op.add.message; struct ldb_val v; struct ldb_message *msg2; struct ldb_message_element *attribute; -- cgit From e2112ba3b7d491f6b6d9957b57a36a78efed18a9 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 21 May 2006 20:06:01 +0000 Subject: r15782: More fixes for async cases (This used to be commit 3c9434e264710a1fa29adedbe571d5324ecae906) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 71591f187f..96457447fb 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -133,8 +133,10 @@ static int objectguid_add_async(struct ldb_module *module, struct ldb_request *r return LDB_ERR_OPERATIONS_ERROR; } + *down_req = *req; + /* we have to copy the message as the caller might have it as a const */ - msg = ldb_msg_copy_shallow(down_req, req->op.add.message); + down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message); if (msg == NULL) { return LDB_ERR_OPERATIONS_ERROR; } @@ -152,16 +154,7 @@ static int objectguid_add_async(struct ldb_module *module, struct ldb_request *r if (ret) { return ret; } - - down_req->op.add.message = msg; - down_req->controls = req->controls; - down_req->creds = req->creds; - - down_req->async.context = req->async.context; - down_req->async.callback = req->async.callback; - down_req->async.timeout = req->async.timeout; - /* go on with the call chain */ ret = ldb_next_request(module, down_req); -- cgit From 3a4d7eb2c08a06fac89c34d132f1c32751ce7ad5 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 29 May 2006 01:30:02 +0000 Subject: r15927: Optimize ldb module traverse while keeping the API intact. I was sick of jumping inot each module for each request, even the ones not handle by that module. (This used to be commit 7d65105e885a28584e8555453b90232c43a92bf7) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 96457447fb..5ac3260339 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -174,9 +174,6 @@ static int objectguid_request(struct ldb_module *module, struct ldb_request *req case LDB_REQ_ADD: return objectguid_add(module, req); - case LDB_ASYNC_ADD: - return objectguid_add_async(module, req); - default: return ldb_next_request(module, req); @@ -185,6 +182,7 @@ static int objectguid_request(struct ldb_module *module, struct ldb_request *req static const struct ldb_module_ops objectguid_ops = { .name = "objectguid", + .add = objectguid_add_async, .request = objectguid_request }; -- cgit From 0c7b82e5f6063de4114de21cf854ac67346e31f6 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 29 May 2006 23:46:43 +0000 Subject: r15942: Remove the sync internal ldb calls altogether. This means that some modules have been disabled as well as they have not been ported to the async interface One of them is the ugly objectclass module. I hope that the change in samldb module will make the MMC happy without the need of this crappy module, we need proper handling in a decent schema module. proxy and ldb_map have also been disabled ldb_sqlite3 need to be ported as well (currenlty just broken). (This used to be commit 51083de795bdcbf649de926e86969adc20239b6d) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 72 +---------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 5ac3260339..643f8c17fd 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -52,62 +52,6 @@ static struct ldb_message_element *objectguid_find_attribute(const struct ldb_me /* add_record: add objectGUID attribute */ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) -{ - struct ldb_message *msg = req->op.add.message; - struct ldb_val v; - struct ldb_message *msg2; - struct ldb_message_element *attribute; - struct GUID guid; - NTSTATUS nt_status; - int ret, i; - - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); - - if (ldb_dn_is_special(msg->dn)) { /* do not manipulate our control entries */ - return ldb_next_request(module, req); - } - - if ((attribute = objectguid_find_attribute(msg, "objectGUID")) != NULL ) { - return ldb_next_request(module, req); - } - - msg2 = talloc(module, struct ldb_message); - if (!msg2) { - return -1; - } - - msg2->dn = msg->dn; - msg2->num_elements = msg->num_elements; - msg2->private_data = msg->private_data; - msg2->elements = talloc_array(msg2, struct ldb_message_element, msg2->num_elements); - for (i = 0; i < msg2->num_elements; i++) { - msg2->elements[i] = msg->elements[i]; - } - - /* a new GUID */ - guid = GUID_random(); - - nt_status = ndr_push_struct_blob(&v, msg2, &guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NT_STATUS_IS_OK(nt_status)) { - return -1; - } - - ret = ldb_msg_add_value(msg2, "objectGUID", &v); - if (ret) { - return ret; - } - - req->op.add.message = msg2; - ret = ldb_next_request(module, req); - req->op.add.message = msg; - - talloc_free(msg2); - - return ret; -} - -static int objectguid_add_async(struct ldb_module *module, struct ldb_request *req) { struct ldb_request *down_req; struct ldb_message_element *attribute; @@ -167,23 +111,9 @@ static int objectguid_add_async(struct ldb_module *module, struct ldb_request *r return ret; } -static int objectguid_request(struct ldb_module *module, struct ldb_request *req) -{ - switch (req->operation) { - - case LDB_REQ_ADD: - return objectguid_add(module, req); - - default: - return ldb_next_request(module, req); - - } -} - static const struct ldb_module_ops objectguid_ops = { .name = "objectguid", - .add = objectguid_add_async, - .request = objectguid_request + .add = objectguid_add, }; -- cgit From ca5accf224dc3ef998235603797b519866b57b1c Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 4 Jun 2006 05:28:13 +0000 Subject: r16036: Add a couple of new functions to corretly deal with timeouts. Check timeouts are correctly verified. Some minor fixed and removal of unused code. (This used to be commit b52e5d6a0cb1a32e62759eaa49ce3e4cc804cc92) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 643f8c17fd..3f6a951997 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -99,6 +99,8 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) return ret; } + ldb_set_timeout_from_prev_req(module->ldb, req, down_req); + /* go on with the call chain */ ret = ldb_next_request(module, down_req); -- cgit From 49f68caed20d2a7d1850e493005bdf85929d6365 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 22 Jul 2006 17:21:59 +0000 Subject: r17186: "async" word abuse clean-up part 2 (This used to be commit c6aa60c7e69abf1f83efc150b1c3ed02751c45fc) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 3f6a951997..1f18f0e603 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -107,7 +107,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { - req->async.handle = down_req->async.handle; + req->handle = down_req->handle; } return ret; -- cgit From 8f42f1292c2f1f1002b8446dc8b5351eb633d5ce Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Aug 2006 00:59:57 +0000 Subject: r17526: Move timestamp generation into the objectGUID module. It probably needs to be renamed (operation_add?). This allows me to match the behaviour and substitute with the entryUUID module for remote LDAP connections. Andrew Bartlett (This used to be commit af02b4d7c631bb15bf5a5f73f9fdc23075d50f60) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 89 ++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 1f18f0e603..ca27f17d71 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -50,6 +50,35 @@ static struct ldb_message_element *objectguid_find_attribute(const struct ldb_me return NULL; } +/* + add a time element to a record +*/ +static int add_time_element(struct ldb_message *msg, const char *attr, time_t t) +{ + struct ldb_message_element *el; + char *s; + + if (ldb_msg_find_element(msg, attr) != NULL) { + return 0; + } + + s = ldb_timestring(msg, t); + if (s == NULL) { + return -1; + } + + if (ldb_msg_add_string(msg, attr, s) != 0) { + return -1; + } + + el = ldb_msg_find_element(msg, attr); + /* always set as replace. This works because on add ops, the flag + is ignored */ + el->flags = LDB_FLAG_MOD_REPLACE; + + return 0; +} + /* add_record: add objectGUID attribute */ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) { @@ -60,6 +89,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) struct GUID guid; NTSTATUS nt_status; int ret; + time_t t = time(NULL); ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); @@ -82,6 +112,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) /* we have to copy the message as the caller might have it as a const */ down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message); if (msg == NULL) { + talloc_free(down_req); return LDB_ERR_OPERATIONS_ERROR; } @@ -91,14 +122,70 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) nt_status = ndr_push_struct_blob(&v, msg, &guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NT_STATUS_IS_OK(nt_status)) { - return -1; + talloc_free(down_req); + return LDB_ERR_OPERATIONS_ERROR; } ret = ldb_msg_add_value(msg, "objectGUID", &v); if (ret) { + talloc_free(down_req); return ret; } + if (add_time_element(msg, "whenCreated", t) != 0 || + add_time_element(msg, "whenChanged", t) != 0) { + talloc_free(down_req); + return LDB_ERR_OPERATIONS_ERROR; + } + + ldb_set_timeout_from_prev_req(module->ldb, req, down_req); + + /* go on with the call chain */ + ret = ldb_next_request(module, down_req); + + /* do not free down_req as the call results may be linked to it, + * it will be freed when the upper level request get freed */ + if (ret == LDB_SUCCESS) { + req->handle = down_req->handle; + } + + return ret; +} + +/* modify_record: update timestamps */ +static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) +{ + struct ldb_request *down_req; + struct ldb_message *msg; + int ret; + time_t t = time(NULL); + + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); + + /* do not manipulate our control entries */ + if (ldb_dn_is_special(req->op.add.message->dn)) { + return ldb_next_request(module, req); + } + + down_req = talloc(req, struct ldb_request); + if (down_req == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + + *down_req = *req; + + /* we have to copy the message as the caller might have it as a const */ + down_req->op.mod.message = msg = ldb_msg_copy_shallow(down_req, req->op.mod.message); + if (msg == NULL) { + talloc_free(down_req); + return LDB_ERR_OPERATIONS_ERROR; + } + + if (add_time_element(msg, "whenChanged", t) != 0) { + talloc_free(down_req); + return LDB_ERR_OPERATIONS_ERROR; + } + ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* go on with the call chain */ -- cgit From 69ecd9538fac24e20c7500096a479a7c8ff260ba Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 28 Aug 2006 03:26:17 +0000 Subject: r17870: This module (for the moment) handles the modifyTimestamp generation. For that, it needs to hook into the modify operation. Andrew Bartlett (This used to be commit d22117a53bafa4bb72c854353620099b5a6f81d8) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index ca27f17d71..7e475d1ef4 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -203,6 +203,7 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) static const struct ldb_module_ops objectguid_ops = { .name = "objectguid", .add = objectguid_add, + .modify = objectguid_modify, }; -- cgit From 77db3973c417cc934485dbd6bf1a8a1c84c1b30b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 21 Sep 2006 06:44:12 +0000 Subject: r18781: Move the usnCreated and usnChanged handling around again. This moves these attributes from objectguid into an optional backend (objectguid), used by ltdb. For OpenLDAP, the entryUUID module converts entryCSN into usnChanged. This also changes the sequence number API, and uses 'time based' sequence numbers, when an LDAP or similar backend is detected. To assist this, we also store the last modified time in the TDB, whenever we change a value. Andrew Bartlett (This used to be commit 72858f859483c0c532dddb2c146d6bd7b9be5072) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 7e475d1ef4..0c4a493adb 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -3,6 +3,7 @@ Copyright (C) Simo Sorce 2004-2006 Copyright (C) Andrew Bartlett 2005 + Copyright (C) Andrew Tridgell 2005 ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released @@ -79,6 +80,29 @@ static int add_time_element(struct ldb_message *msg, const char *attr, time_t t) return 0; } +/* + add a uint64_t element to a record +*/ +static int add_uint64_element(struct ldb_message *msg, const char *attr, uint64_t v) +{ + struct ldb_message_element *el; + + if (ldb_msg_find_element(msg, attr) != NULL) { + return 0; + } + + if (ldb_msg_add_fmt(msg, attr, "%llu", (unsigned long long)v) != 0) { + return -1; + } + + el = ldb_msg_find_element(msg, attr); + /* always set as replace. This works because on add ops, the flag + is ignored */ + el->flags = LDB_FLAG_MOD_REPLACE; + + return 0; +} + /* add_record: add objectGUID attribute */ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) { @@ -87,6 +111,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) struct ldb_message *msg; struct ldb_val v; struct GUID guid; + uint64_t seq_num; NTSTATUS nt_status; int ret; time_t t = time(NULL); @@ -138,6 +163,16 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } + /* Get a sequence number from the backend */ + ret = ldb_sequence_number(module->ldb, LDB_SEQ_NEXT, &seq_num); + if (ret == LDB_SUCCESS) { + if (add_uint64_element(msg, "uSNCreated", seq_num) != 0 || + add_uint64_element(msg, "uSNChanged", seq_num) != 0) { + talloc_free(down_req); + return LDB_ERR_OPERATIONS_ERROR; + } + } + ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* go on with the call chain */ @@ -159,6 +194,7 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) struct ldb_message *msg; int ret; time_t t = time(NULL); + uint64_t seq_num; ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n"); @@ -186,6 +222,15 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } + /* Get a sequence number from the backend */ + ret = ldb_sequence_number(module->ldb, LDB_SEQ_NEXT, &seq_num); + if (ret == LDB_SUCCESS) { + if (add_uint64_element(msg, "uSNChanged", seq_num) != 0) { + talloc_free(down_req); + return LDB_ERR_OPERATIONS_ERROR; + } + } + ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* go on with the call chain */ -- cgit From 7f833458ca0083654e34cbfde1c6c6510cab1826 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 25 Oct 2006 01:42:59 +0000 Subject: r19489: Change ldb_msg_add_value and ldb_msg_add_empty to take a foruth argument. This is a pointer to an element pointer. If it is not null it will be filled with the pointer of the manipulated element. Will avoid double searches on the elements list in some cases. (This used to be commit 0fa5d4bc225b83e9f63ac6d75bffc4c08eb6b620) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 0c4a493adb..76413ca56b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -151,7 +151,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } - ret = ldb_msg_add_value(msg, "objectGUID", &v); + ret = ldb_msg_add_value(msg, "objectGUID", &v, NULL); if (ret) { talloc_free(down_req); return ret; -- cgit From 52fb06edc25e8538c413df1aaabba18c859a00cf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 5 May 2007 18:50:56 +0000 Subject: r22681: Fix standalone ldb build when parent directory name != ldb. (This used to be commit 1093875d59f1ea9b8bd82277d4f9d8366e584952) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 76413ca56b..457440804b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -35,7 +35,7 @@ */ #include "includes.h" -#include "ldb/include/includes.h" +#include "ldb/include/ldb_includes.h" #include "librpc/gen_ndr/ndr_misc.h" static struct ldb_message_element *objectguid_find_attribute(const struct ldb_message *msg, const char *name) -- cgit From b8d69a7ea2505b706ff7c74d7c97bc89d82dfa07 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:46:15 +0000 Subject: r23795: more v2->v3 conversion (This used to be commit 84b468b2f8f2dffda89593f816e8bc6a8b6d42ac) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 457440804b..25a01c2c1b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -12,7 +12,7 @@ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. + version 3 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -- cgit From 6c973f4e8ccbcb6c9275f8a54e26abb19df7e15a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 03:42:26 +0000 Subject: r23798: updated old Temple Place FSF addresses to new URL (This used to be commit 40c0919aaa9c1b14bbaebb95ecce53eb0380fdbb) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 25a01c2c1b..d7e74cf38d 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -20,8 +20,7 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + License along with this library; if not, see . */ /* -- cgit From 529763a9aa192a6785ba878aceeb1683c2510913 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Nov 2007 19:24:51 +0100 Subject: r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers) lib/messaging/ lib/registry/ lib/ldb-samba/ librpc/rpc/ auth/auth_winbind.c auth/gensec/ auth/kerberos/ dsdb/repl/ dsdb/samdb/ dsdb/schema/ torture/ cluster/ctdb/ kdc/ ntvfs/ipc/ torture/rap/ ntvfs/ utils/getntacl.c ntptr/ smb_server/ libcli/wrepl/ wrepl_server/ libcli/cldap/ libcli/dgram/ libcli/ldap/ libcli/raw/ libcli/nbt/ libnet/ winbind/ rpc_server/ metze (This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index d7e74cf38d..e9d699d59c 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -111,7 +111,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) struct ldb_val v; struct GUID guid; uint64_t seq_num; - NTSTATUS nt_status; + enum ndr_err_code ndr_err; int ret; time_t t = time(NULL); @@ -143,9 +143,9 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) /* a new GUID */ guid = GUID_random(); - nt_status = ndr_push_struct_blob(&v, msg, &guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NT_STATUS_IS_OK(nt_status)) { + ndr_err = ndr_push_struct_blob(&v, msg, &guid, + (ndr_push_flags_fn_t)ndr_push_GUID); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(down_req); return LDB_ERR_OPERATIONS_ERROR; } -- cgit From 86dc05e99f124db47f2743d1fc23117a7f5145ab Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 1 Jan 2008 22:05:05 -0600 Subject: r26638: libndr: Require explicitly specifying iconv_convenience for ndr_struct_push_blob(). (This used to be commit 61ad78ac98937ef7a9aa32075a91a1c95b7606b3) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index e9d699d59c..bf57f5c21b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -36,6 +36,7 @@ #include "includes.h" #include "ldb/include/ldb_includes.h" #include "librpc/gen_ndr/ndr_misc.h" +#include "param/param.h" static struct ldb_message_element *objectguid_find_attribute(const struct ldb_message *msg, const char *name) { @@ -143,7 +144,9 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req) /* a new GUID */ guid = GUID_random(); - ndr_err = ndr_push_struct_blob(&v, msg, &guid, + ndr_err = ndr_push_struct_blob(&v, msg, + lp_iconv_convenience(ldb_get_opaque(module->ldb, "loadparm")), + &guid, (ndr_push_flags_fn_t)ndr_push_GUID); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(down_req); -- cgit From 16109a40c0abd8c30a5eb9bf9ef692bfae9dfc7d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 01:54:32 +0100 Subject: Use struct-based rather than function-based initialization for ldb modules everywhere. (This used to be commit 85c96a325867f7bcdb412ebc53f8a47dbf7cd89b) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index bf57f5c21b..99dc46bc1f 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -247,14 +247,8 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) return ret; } -static const struct ldb_module_ops objectguid_ops = { +const struct ldb_module_ops ldb_objectguid_module_ops = { .name = "objectguid", .add = objectguid_add, .modify = objectguid_modify, }; - - -int objectguid_module_init(void) -{ - return ldb_register_module(&objectguid_ops); -} -- cgit From 39a817d310964f8e9a63cfb096b3ad24fa03bd5e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 04:33:43 +0100 Subject: Fix use of some modules (needed _PUBLIC_). (This used to be commit ce332130ea77159832da23bab760fa26921719e2) --- source4/dsdb/samdb/ldb_modules/objectguid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules/objectguid.c') diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 99dc46bc1f..f62839389d 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -247,7 +247,7 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req) return ret; } -const struct ldb_module_ops ldb_objectguid_module_ops = { +_PUBLIC_ const struct ldb_module_ops ldb_objectguid_module_ops = { .name = "objectguid", .add = objectguid_add, .modify = objectguid_modify, -- cgit