diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/objectguid.c | 13 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 12 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/samldb.c | 26 |
3 files changed, 5 insertions, 46 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c index 12dd402617..bfbf2b4511 100644 --- a/source4/dsdb/samdb/ldb_modules/objectguid.c +++ b/source4/dsdb/samdb/ldb_modules/objectguid.c @@ -31,6 +31,7 @@ #include "includes.h" #include "ldb_module.h" +#include "dsdb/samdb/samdb.h" #include "librpc/gen_ndr/ndr_misc.h" #include "param/param.h" @@ -136,10 +137,8 @@ static int objectguid_add(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; uint64_t seq_num; - enum ndr_err_code ndr_err; int ret; time_t t = time(NULL); struct og_context *ac; @@ -174,15 +173,7 @@ 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, - lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), - &guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - return LDB_ERR_OPERATIONS_ERROR; - } - - ret = ldb_msg_add_value(msg, "objectGUID", &v, NULL); + ret = dsdb_msg_add_guid(msg, &guid, "objectGUID"); if (ret) { return ret; } diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 37aa399ef1..bfde2df1d1 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -411,7 +411,6 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) struct ldb_message *msg; const DATA_BLOB *guid_blob; struct GUID guid; - struct ldb_val guid_value; struct replPropertyMetaDataBlob nmd; struct ldb_val nmd_value; const struct GUID *our_invocation_id; @@ -580,15 +579,6 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) } /* generated NDR encoded values */ - ndr_err = ndr_push_struct_blob(&guid_value, msg, - NULL, - &guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - ldb_oom(ldb); - talloc_free(ac); - return LDB_ERR_OPERATIONS_ERROR; - } ndr_err = ndr_push_struct_blob(&nmd_value, msg, lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")), &nmd, @@ -602,7 +592,7 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req) /* * add the autogenerated values */ - ret = ldb_msg_add_value(msg, "objectGUID", &guid_value, NULL); + ret = dsdb_msg_add_guid(msg, &guid, "objectGUID"); if (ret != LDB_SUCCESS) { ldb_oom(ldb); talloc_free(ac); diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index c5161dbe41..e49b493a98 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -1161,21 +1161,10 @@ static int samldb_fill_object(struct samldb_ctx *ac, const char *type) } if (!ldb_msg_find_element(ac->msg, "schemaIDGUID")) { - enum ndr_err_code ndr_err; - struct ldb_val guid_value; struct GUID guid; /* a new GUID */ guid = GUID_random(); - /* generated NDR encoded values */ - ndr_err = ndr_push_struct_blob(&guid_value, ac->msg, - NULL, - &guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - ldb_oom(ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - ret = ldb_msg_add_value(ac->msg, "schemaIDGUID", &guid_value, NULL); + ret = dsdb_msg_add_guid(ac->msg, &guid, "schemaIDGUID"); if (ret != LDB_SUCCESS) { ldb_oom(ldb); return ret; @@ -1211,21 +1200,10 @@ static int samldb_fill_object(struct samldb_ctx *ac, const char *type) if (ret != LDB_SUCCESS) return ret; if (!ldb_msg_find_element(ac->msg, "schemaIDGUID")) { - enum ndr_err_code ndr_err; - struct ldb_val guid_value; struct GUID guid; /* a new GUID */ guid = GUID_random(); - /* generated NDR encoded values */ - ndr_err = ndr_push_struct_blob(&guid_value, ac->msg, - NULL, - &guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - ldb_oom(ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - ret = ldb_msg_add_value(ac->msg, "schemaIDGUID", &guid_value, NULL); + ret = dsdb_msg_add_guid(ac->msg, &guid, "schemaIDGUID"); if (ret != LDB_SUCCESS) { ldb_oom(ldb); return ret; |