summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-01-11 17:46:11 +0100
committerGünther Deschner <gd@samba.org>2011-01-11 22:18:02 +0100
commit4f057230ca979021dfa0b279392ff820599e54a0 (patch)
tree21e854dad5445c778bfd8203271f811578736ad8
parent3bf51a9e2853d8ce4f8c573eda7fb1d2ede6f8cb (diff)
downloadsamba-4f057230ca979021dfa0b279392ff820599e54a0.tar.gz
samba-4f057230ca979021dfa0b279392ff820599e54a0.tar.bz2
samba-4f057230ca979021dfa0b279392ff820599e54a0.zip
s3-drsuapi: prefer dcerpc_drsuapi_X functions.
Guenther
-rw-r--r--source3/libnet/libnet_dssync.c20
-rw-r--r--source3/rpcclient/cmd_drsuapi.c31
2 files changed, 36 insertions, 15 deletions
diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c
index e9a788b869..e2391625d8 100644
--- a/source3/libnet/libnet_dssync.c
+++ b/source3/libnet/libnet_dssync.c
@@ -23,19 +23,23 @@
#include "includes.h"
#include "libnet/libnet_dssync.h"
#include "../libcli/drsuapi/drsuapi.h"
-#include "../librpc/gen_ndr/cli_drsuapi.h"
+#include "../librpc/gen_ndr/ndr_drsuapi_c.h"
/****************************************************************
****************************************************************/
static int libnet_dssync_free_context(struct dssync_context *ctx)
{
+ WERROR result;
+ struct dcerpc_binding_handle *b;
+
if (!ctx) {
return 0;
}
if (is_valid_policy_hnd(&ctx->bind_handle) && ctx->cli) {
- rpccli_drsuapi_DsUnbind(ctx->cli, ctx, &ctx->bind_handle, NULL);
+ b = ctx->cli->binding_handle;
+ dcerpc_drsuapi_DsUnbind(b, ctx, &ctx->bind_handle, &result);
}
return 0;
@@ -124,6 +128,7 @@ static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx,
struct GUID bind_guid;
struct drsuapi_DsBindInfoCtr bind_info;
struct drsuapi_DsBindInfo28 info28;
+ struct dcerpc_binding_handle *b = ctx->cli->binding_handle;
ZERO_STRUCT(info28);
@@ -164,7 +169,7 @@ static NTSTATUS libnet_dssync_bind(TALLOC_CTX *mem_ctx,
bind_info.length = 28;
bind_info.info.info28 = info28;
- status = rpccli_drsuapi_DsBind(ctx->cli, mem_ctx,
+ status = dcerpc_drsuapi_DsBind(b, mem_ctx,
&bind_guid,
&bind_info,
&ctx->bind_handle,
@@ -223,6 +228,7 @@ static NTSTATUS libnet_dssync_lookup_nc(TALLOC_CTX *mem_ctx,
uint32_t level_out;
struct drsuapi_DsNameString names[1];
union drsuapi_DsNameCtr ctr;
+ struct dcerpc_binding_handle *b = ctx->cli->binding_handle;
names[0].str = talloc_asprintf(mem_ctx, "%s\\", ctx->domain_name);
NT_STATUS_HAVE_NO_MEMORY(names[0].str);
@@ -235,7 +241,7 @@ static NTSTATUS libnet_dssync_lookup_nc(TALLOC_CTX *mem_ctx,
req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_UNKNOWN;
req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
- status = rpccli_drsuapi_DsCrackNames(ctx->cli, mem_ctx,
+ status = dcerpc_drsuapi_DsCrackNames(b, mem_ctx,
&ctx->bind_handle,
level,
&req,
@@ -429,6 +435,7 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
uint32_t out_level = 0;
int y;
bool last_query;
+ struct dcerpc_binding_handle *b = ctx->cli->binding_handle;
if (!ctx->single_object_replication) {
new_utdv = TALLOC_ZERO_P(mem_ctx, struct replUpToDateVectorBlob);
@@ -452,7 +459,7 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
(long long)req->req5.highwatermark.highest_usn));
}
- status = rpccli_drsuapi_DsGetNCChanges(ctx->cli, mem_ctx,
+ status = dcerpc_drsuapi_DsGetNCChanges(b, mem_ctx,
&ctx->bind_handle,
level,
req,
@@ -468,6 +475,9 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
if (!W_ERROR_IS_OK(werr)) {
status = werror_to_ntstatus(werr);
+ ctx->error_message = talloc_asprintf(ctx,
+ "Failed to get NC Changes: %s",
+ get_friendly_werror_msg(werr));
goto out;
}
diff --git a/source3/rpcclient/cmd_drsuapi.c b/source3/rpcclient/cmd_drsuapi.c
index 4f3a16ca29..b7ea226a95 100644
--- a/source3/rpcclient/cmd_drsuapi.c
+++ b/source3/rpcclient/cmd_drsuapi.c
@@ -20,7 +20,7 @@
#include "includes.h"
#include "rpcclient.h"
-#include "../librpc/gen_ndr/cli_drsuapi.h"
+#include "../librpc/gen_ndr/ndr_drsuapi_c.h"
static WERROR cracknames(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
@@ -38,6 +38,7 @@ static WERROR cracknames(struct rpc_pipe_client *cli,
union drsuapi_DsNameRequest req;
uint32_t level_out;
struct drsuapi_DsNameString *names;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
names = TALLOC_ZERO_ARRAY(mem_ctx, struct drsuapi_DsNameString, argc);
W_ERROR_HAVE_NO_MEMORY(names);
@@ -54,7 +55,7 @@ static WERROR cracknames(struct rpc_pipe_client *cli,
req.req1.format_offered = format_offered;
req.req1.format_desired = format_desired;
- status = rpccli_drsuapi_DsCrackNames(cli, mem_ctx,
+ status = dcerpc_drsuapi_DsCrackNames(b, mem_ctx,
bind_handle,
level,
&req,
@@ -82,6 +83,7 @@ static WERROR cmd_drsuapi_cracknames(struct rpc_pipe_client *cli,
struct GUID bind_guid;
struct policy_handle bind_handle;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
union drsuapi_DsNameCtr ctr;
@@ -92,7 +94,7 @@ static WERROR cmd_drsuapi_cracknames(struct rpc_pipe_client *cli,
GUID_from_string(DRSUAPI_DS_BIND_GUID, &bind_guid);
- status = rpccli_drsuapi_DsBind(cli, mem_ctx,
+ status = dcerpc_drsuapi_DsBind(b, mem_ctx,
&bind_guid,
NULL,
&bind_handle,
@@ -102,6 +104,10 @@ static WERROR cmd_drsuapi_cracknames(struct rpc_pipe_client *cli,
return ntstatus_to_werror(status);
}
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
+
werr = cracknames(cli, mem_ctx,
&bind_handle,
DRSUAPI_DS_NAME_FORMAT_UNKNOWN,
@@ -125,7 +131,7 @@ static WERROR cmd_drsuapi_cracknames(struct rpc_pipe_client *cli,
out:
if (is_valid_policy_hnd(&bind_handle)) {
- rpccli_drsuapi_DsUnbind(cli, mem_ctx, &bind_handle, &werr);
+ dcerpc_drsuapi_DsUnbind(b, mem_ctx, &bind_handle, &werr);
}
return werr;
@@ -234,6 +240,7 @@ static WERROR cmd_drsuapi_getdcinfo(struct rpc_pipe_client *cli,
struct GUID bind_guid;
struct policy_handle bind_handle;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
const char *domain = NULL;
int32_t level = 1;
@@ -253,7 +260,7 @@ static WERROR cmd_drsuapi_getdcinfo(struct rpc_pipe_client *cli,
GUID_from_string(DRSUAPI_DS_BIND_GUID, &bind_guid);
- status = rpccli_drsuapi_DsBind(cli, mem_ctx,
+ status = dcerpc_drsuapi_DsBind(b, mem_ctx,
&bind_guid,
NULL,
&bind_handle,
@@ -263,10 +270,14 @@ static WERROR cmd_drsuapi_getdcinfo(struct rpc_pipe_client *cli,
return ntstatus_to_werror(status);
}
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
+
req.req1.domain_name = domain;
req.req1.level = level;
- status = rpccli_drsuapi_DsGetDomainControllerInfo(cli, mem_ctx,
+ status = dcerpc_drsuapi_DsGetDomainControllerInfo(b, mem_ctx,
&bind_handle,
1,
&req,
@@ -285,7 +296,7 @@ static WERROR cmd_drsuapi_getdcinfo(struct rpc_pipe_client *cli,
display_domain_controller_info(level_out, &ctr);
out:
if (is_valid_policy_hnd(&bind_handle)) {
- rpccli_drsuapi_DsUnbind(cli, mem_ctx, &bind_handle, &werr);
+ dcerpc_drsuapi_DsUnbind(b, mem_ctx, &bind_handle, &werr);
}
return werr;
@@ -299,6 +310,7 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
WERROR werr;
struct policy_handle bind_handle;
+ struct dcerpc_binding_handle *b = cli->binding_handle;
struct GUID bind_guid;
struct drsuapi_DsBindInfoCtr bind_info;
@@ -388,7 +400,7 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
bind_info.length = 28;
bind_info.info.info28 = info28;
- status = rpccli_drsuapi_DsBind(cli, mem_ctx,
+ status = dcerpc_drsuapi_DsBind(b, mem_ctx,
&bind_guid,
&bind_info,
&bind_handle,
@@ -475,7 +487,7 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
(long long)req.req8.highwatermark.highest_usn));
}
- status = rpccli_drsuapi_DsGetNCChanges(cli, mem_ctx,
+ status = dcerpc_drsuapi_DsGetNCChanges(b, mem_ctx,
&bind_handle,
level,
&req,
@@ -489,7 +501,6 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
}
if (!W_ERROR_IS_OK(werr)) {
- status = werror_to_ntstatus(werr);
goto out;
}