summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-12-10 14:33:13 +1100
committerAndrew Tridgell <tridge@samba.org>2009-12-10 17:51:29 +1100
commit261ba40e77192d0354d332a9a72eb94f327cb4e6 (patch)
treea942939d786efd821263da8bccae0befbf5a4a6e /source4/dsdb
parent215cc5a9edfbe9b50440266fba72e8f91c64066b (diff)
downloadsamba-261ba40e77192d0354d332a9a72eb94f327cb4e6.tar.gz
samba-261ba40e77192d0354d332a9a72eb94f327cb4e6.tar.bz2
samba-261ba40e77192d0354d332a9a72eb94f327cb4e6.zip
s4-dsdb: use GUID_to_ndr_blob()
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/common/util.c10
-rw-r--r--source4/dsdb/repl/replicated_objects.c9
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn_out.c14
-rw-r--r--source4/dsdb/samdb/ldb_modules/simple_ldap_map.c16
4 files changed, 15 insertions, 34 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 470406ea55..bfb2f0caa5 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -2289,16 +2289,12 @@ int dsdb_msg_add_guid(struct ldb_message *msg,
const char *attr_name)
{
int ret;
- enum ndr_err_code ndr_err;
struct ldb_val v;
-
+ NTSTATUS status;
TALLOC_CTX *tmp_ctx = talloc_init("dsdb_msg_add_guid");
- ndr_err = ndr_push_struct_blob(&v, tmp_ctx, NULL,
- guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
-
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = GUID_to_ndr_blob(guid, tmp_ctx, &v);
+ if (!NT_STATUS_IS_OK(status)) {
ret = LDB_ERR_OPERATIONS_ERROR;
goto done;
}
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index a8a93e413a..1efbd29d93 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -39,7 +39,6 @@ static WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
struct dsdb_extended_replicated_object *out)
{
NTSTATUS nt_status;
- enum ndr_err_code ndr_err;
WERROR status;
uint32_t i;
struct ldb_message *msg;
@@ -202,12 +201,8 @@ static WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
whenChanged_s = ldb_timestring(msg, whenChanged_t);
W_ERROR_HAVE_NO_MEMORY(whenChanged_s);
- ndr_err = ndr_push_struct_blob(&guid_value, msg,
- lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")),
- &in->object.identifier->guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- nt_status = ndr_map_error2ntstatus(ndr_err);
+ nt_status = GUID_to_ndr_blob(&in->object.identifier->guid, msg, &guid_value);
+ if (!NT_STATUS_IS_OK(nt_status)) {
return ntstatus_to_werror(nt_status);
}
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
index 1463e192e9..55dd6939e3 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn_out.c
@@ -202,8 +202,6 @@ static int handle_dereference_openldap(struct ldb_dn *dn,
entryUUIDblob = ldb_msg_find_ldb_val(&fake_msg, "entryUUID");
if (entryUUIDblob) {
NTSTATUS status;
- enum ndr_err_code ndr_err;
-
struct ldb_val guid_blob;
struct GUID guid;
@@ -212,9 +210,8 @@ static int handle_dereference_openldap(struct ldb_dn *dn,
if (!NT_STATUS_IS_OK(status)) {
return LDB_ERR_INVALID_DN_SYNTAX;
}
- ndr_err = ndr_push_struct_blob(&guid_blob, NULL, NULL, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = GUID_to_ndr_blob(&guid, dn, &guid_blob);
+ if (!NT_STATUS_IS_OK(status)) {
return LDB_ERR_INVALID_DN_SYNTAX;
}
@@ -259,8 +256,6 @@ static int handle_dereference_fds(struct ldb_dn *dn,
nsUniqueIdBlob = ldb_msg_find_ldb_val(&fake_msg, "nsUniqueId");
if (nsUniqueIdBlob) {
NTSTATUS status;
- enum ndr_err_code ndr_err;
-
struct ldb_val guid_blob;
struct GUID guid;
@@ -269,9 +264,8 @@ static int handle_dereference_fds(struct ldb_dn *dn,
if (!NT_STATUS_IS_OK(status)) {
return LDB_ERR_INVALID_DN_SYNTAX;
}
- ndr_err = ndr_push_struct_blob(&guid_blob, NULL, NULL, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ status = GUID_to_ndr_blob(&guid, dn, &guid_blob);
+ if (!NT_STATUS_IS_OK(status)) {
return LDB_ERR_INVALID_DN_SYNTAX;
}
diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
index 8d3c78d37f..43402248c0 100644
--- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
+++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
@@ -44,16 +44,14 @@ static struct ldb_val encode_guid(struct ldb_module *module, TALLOC_CTX *ctx, co
{
struct GUID guid;
NTSTATUS status = GUID_from_data_blob(val, &guid);
- enum ndr_err_code ndr_err;
struct ldb_val out = data_blob(NULL, 0);
if (!NT_STATUS_IS_OK(status)) {
return out;
}
- ndr_err = ndr_push_struct_blob(&out, ctx, NULL, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return out;
+ status = GUID_to_ndr_blob(&guid, ctx, &out);
+ if (!NT_STATUS_IS_OK(status)) {
+ return data_blob(NULL, 0);
}
return out;
@@ -74,16 +72,14 @@ static struct ldb_val encode_ns_guid(struct ldb_module *module, TALLOC_CTX *ctx,
{
struct GUID guid;
NTSTATUS status = NS_GUID_from_string((char *)val->data, &guid);
- enum ndr_err_code ndr_err;
struct ldb_val out = data_blob(NULL, 0);
if (!NT_STATUS_IS_OK(status)) {
return out;
}
- ndr_err = ndr_push_struct_blob(&out, ctx, NULL, &guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return out;
+ status = GUID_to_ndr_blob(&guid, ctx, &out);
+ if (!NT_STATUS_IS_OK(status)) {
+ return data_blob(NULL, 0);
}
return out;