[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Fri Sep 3 10:50:41 MDT 2010
The branch, master has been updated
via 31d3227 s4:lib/messaging: make irpc_request private and remove unused code
via dd71542 s4:libcli/composite: remove unused composite_continue_irpc()
via a9078aa s4:lib/messaging/tests: make use of irpc_binding_handle()
via a65d1eb s4:lib/messaging: use irpc_binding_handle() for python bindings
via 993d37b s4:wrepl_server: use irpc_binding_handle_by_name() in wreplsrv_scavenging_replica_active_records()
via f43ec0e s4:wrepl_server: use irpc_binding_handle_by_name() in r_do_release_demand()
via 2e07f82 s4:wrepl_server: use irpc_binding_handle_by_name() in r_do_challenge()
via 8202cf7 s4:auth_winbind: use irpc_binding_handle_by_name()
via 52d4a97 s4:libcli/wbclient: use irpc_binding_handle_by_name()
via 5c73c84 s4:rpc_server/netlogon: use irpc_binding_handle_by_name()
via e117177 s4:smbd/service_task: use irpc_binding_handle_by_name()
via ff0362f s4:dsdb/kcc: use irpc_binding_handle_by_name()
via 3c41505 s4:libcli/finddcs: use irpc_binding_handle_by_name()
via f2422a0 s4:rpc_server/common: use irpc_binding_handle_by_name() in dcesrv_irpc_forward_rpc_call()
via 611357a s4:lib/messaging: add irpc_binding_handle_by_name() helper function
via e26f0ab s4:lib/messaging: add irpc dcerpc_binding_handle backend
via 328c708 s4:lib/messaging: move messaging prototypes from irpc.h to messaging.h
via 8740cae s4:lib/messaging/tests: fix some compiler warnings
via 705f4c2 s4:auth_winbind: remove unused winbind_samba3 backend
via 0f35d51 s4:auth_winbind: fix segfault in winbind_check_password_wbclient()
via 5b0e0ac s4:auth_winbind: fix compiler warnings
via 14ffb7d nsswitch/libwbclient: LIBWBCLIENT depends on LIBWINBIND-CLIENT
from fdffa90 s4-drs: A quick fix for DRSUAPI_EXOP_FSMO_RID_ALLOC extended_op handling
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 31d3227074a63ab7f66f74eca019884bb2e236da
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 16:05:38 2010 +0200
s4:lib/messaging: make irpc_request private and remove unused code
metze
commit dd7154234c267254cea199638062c5be1cd8b253
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 15:59:44 2010 +0200
s4:libcli/composite: remove unused composite_continue_irpc()
metze
commit a9078aad3c970e325e71f72f9f2c09e7136082cd
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 15:42:56 2010 +0200
s4:lib/messaging/tests: make use of irpc_binding_handle()
metze
commit a65d1eb05ce2eb0369e7489205c57191cd09c989
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 15:21:16 2010 +0200
s4:lib/messaging: use irpc_binding_handle() for python bindings
metze
commit 993d37baf589da85f5285f4a0edc45da692cc192
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 13:18:14 2010 +0200
s4:wrepl_server: use irpc_binding_handle_by_name() in wreplsrv_scavenging_replica_active_records()
metze
commit f43ec0e7516a1039172ce3e7f26ad47eb0271310
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 13:05:32 2010 +0200
s4:wrepl_server: use irpc_binding_handle_by_name() in r_do_release_demand()
metze
commit 2e07f82f7cb905d5892d5dec7966ff17725bbc79
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 12:58:10 2010 +0200
s4:wrepl_server: use irpc_binding_handle_by_name() in r_do_challenge()
metze
commit 8202cf7966b8125ac175ceb8cef18037c9a8cc31
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 16:59:05 2010 +0200
s4:auth_winbind: use irpc_binding_handle_by_name()
metze
commit 52d4a97afc4b09f860e84f059c419d33bfec18ff
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 12:33:17 2010 +0200
s4:libcli/wbclient: use irpc_binding_handle_by_name()
metze
commit 5c73c84f291573e835e9286c8b3a0831bc3c7dad
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 12:09:36 2010 +0200
s4:rpc_server/netlogon: use irpc_binding_handle_by_name()
metze
commit e117177307fe42e0e6ef92ee66df1154ffe3b9ec
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 11:39:15 2010 +0200
s4:smbd/service_task: use irpc_binding_handle_by_name()
metze
commit ff0362fc3567ec2dab902c685f7715a6070a63e3
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 11:34:17 2010 +0200
s4:dsdb/kcc: use irpc_binding_handle_by_name()
metze
commit 3c4150522cc85fd5774ca3346ff11f9d481bca7a
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 11:13:01 2010 +0200
s4:libcli/finddcs: use irpc_binding_handle_by_name()
metze
commit f2422a0faab4443649633d6b378a4357eff194f2
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Aug 30 13:45:48 2010 +0200
s4:rpc_server/common: use irpc_binding_handle_by_name() in dcesrv_irpc_forward_rpc_call()
metze
commit 611357aee31ad58632a2b029a91d950a2cffb341
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Aug 30 13:44:41 2010 +0200
s4:lib/messaging: add irpc_binding_handle_by_name() helper function
metze
commit e26f0abe9183ac46fd8b749f7696f404414b780e
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Aug 30 13:44:01 2010 +0200
s4:lib/messaging: add irpc dcerpc_binding_handle backend
metze
commit 328c7084f2356dfad5c482fac4cd783b8027ab6b
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Aug 31 13:25:59 2010 +0200
s4:lib/messaging: move messaging prototypes from irpc.h to messaging.h
metze
commit 8740caece0a236d7db4c8efa757766532b06691b
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 15:42:28 2010 +0200
s4:lib/messaging/tests: fix some compiler warnings
metze
commit 705f4c205685b0a167402ff54e37abd75b92a72d
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 10:39:18 2010 +0200
s4:auth_winbind: remove unused winbind_samba3 backend
This uses the winbind protocol directly, which needs to be avoided!
metze
commit 0f35d51ab65b974d3362e0b6f7ebff7b41fb5835
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 16:15:27 2010 +0200
s4:auth_winbind: fix segfault in winbind_check_password_wbclient()
We should only look at err if WBC_ERR_AUTH_ERROR is returned.
metze
commit 5b0e0acc819dedba3ef631e66be6c632fdf23e77
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 10:57:01 2010 +0200
s4:auth_winbind: fix compiler warnings
metze
commit 14ffb7d699df450a4fc5fc362cec7f804cae922b
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Sep 3 13:27:01 2010 +0200
nsswitch/libwbclient: LIBWBCLIENT depends on LIBWINBIND-CLIENT
metze
-----------------------------------------------------------------------
Summary of changes:
nsswitch/libwbclient/wscript_build | 1 +
source4/auth/ntlm/auth_winbind.c | 156 ++--------
source4/auth/ntlm/wscript_build | 2 +-
source4/dsdb/kcc/kcc_periodic.c | 45 +++-
source4/dsdb/wscript_build | 2 +-
source4/lib/messaging/irpc.h | 73 +----
source4/lib/messaging/messaging.c | 447 +++++++++++++++++--------
source4/lib/messaging/messaging.h | 25 ++
source4/lib/messaging/pymessaging.c | 70 ++++-
source4/lib/messaging/tests/irpc.c | 75 +++--
source4/lib/messaging/wscript_build | 2 +-
source4/libcli/composite/composite.c | 11 -
source4/libcli/composite/composite.h | 5 -
source4/libcli/finddcs.c | 40 ++-
source4/libcli/wbclient/wbclient.c | 86 ++---
source4/libcli/wbclient/wbclient.h | 5 +-
source4/libcli/wbclient/wscript_build | 2 +-
source4/libcli/wscript_build | 2 +-
source4/librpc/wscript_build | 5 +
source4/rpc_server/common/forward.c | 41 ++-
source4/rpc_server/netlogon/dcerpc_netlogon.c | 17 +-
source4/rpc_server/wscript_build | 2 +-
source4/smbd/service_task.c | 11 +-
source4/smbd/wscript_build | 2 +-
source4/wrepl_server/wrepl_apply_records.c | 121 ++++----
source4/wrepl_server/wrepl_scavenging.c | 41 ++-
source4/wrepl_server/wscript_build | 2 +-
27 files changed, 715 insertions(+), 576 deletions(-)
Changeset truncated at 500 lines:
diff --git a/nsswitch/libwbclient/wscript_build b/nsswitch/libwbclient/wscript_build
index ee730e4..c6e48c5 100644
--- a/nsswitch/libwbclient/wscript_build
+++ b/nsswitch/libwbclient/wscript_build
@@ -2,6 +2,7 @@
bld.SAMBA_SUBSYSTEM('LIBWBCLIENT',
source='wbc_guid.c wbc_idmap.c wbclient.c wbc_pam.c wbc_pwd.c wbc_sid.c wbc_util.c',
+ deps='LIBWINBIND-CLIENT'
)
diff --git a/source4/auth/ntlm/auth_winbind.c b/source4/auth/ntlm/auth_winbind.c
index 51a1f4d..0dc52b9 100644
--- a/source4/auth/ntlm/auth_winbind.c
+++ b/source4/auth/ntlm/auth_winbind.c
@@ -25,43 +25,23 @@
#include "auth/auth.h"
#include "auth/ntlm/auth_proto.h"
#include "auth/auth_sam_reply.h"
-#include "nsswitch/winbind_client.h"
-#include "librpc/gen_ndr/ndr_netlogon.h"
-#include "librpc/gen_ndr/ndr_winbind.h"
+#include "librpc/gen_ndr/ndr_winbind_c.h"
#include "lib/messaging/irpc.h"
#include "param/param.h"
#include "nsswitch/libwbclient/wbclient.h"
#include "libcli/security/dom_sid.h"
-static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, struct netr_SamInfo3 *info3)
-{
- size_t len = response->length - sizeof(struct winbindd_response);
- if (len > 4) {
- enum ndr_err_code ndr_err;
- DATA_BLOB blob;
- blob.length = len - 4;
- blob.data = (uint8_t *)(((char *)response->extra_data.data) + 4);
-
- ndr_err = ndr_pull_struct_blob(&blob, mem_ctx,
- info3,
- (ndr_pull_flags_fn_t)ndr_pull_netr_SamInfo3);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- return NT_STATUS_OK;
- } else {
- DEBUG(2, ("get_info3_from_ndr: No info3 struct found!\n"));
- return NT_STATUS_UNSUCCESSFUL;
- }
-}
-
static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
struct wbcAuthUserInfo *info,
struct netr_SamInfo3 *info3)
{
int i, j;
struct samr_RidWithAttribute *rids = NULL;
+ struct dom_sid *user_sid;
+ struct dom_sid *group_sid;
+
+ user_sid = (struct dom_sid *)(void *)&info->sids[0].sid;
+ group_sid = (struct dom_sid *)(void *)&info->sids[1].sid;
info3->base.last_logon = info->logon_time;
info3->base.last_logoff = info->logoff_time;
@@ -101,10 +81,10 @@ static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
return NT_STATUS_INVALID_PARAMETER;
}
- dom_sid_split_rid(mem_ctx, (struct dom_sid2 *) &info->sids[0].sid,
+ dom_sid_split_rid(mem_ctx, user_sid,
&info3->base.domain_sid,
&info3->base.rid);
- dom_sid_split_rid(mem_ctx, (struct dom_sid2 *) &info->sids[1].sid, NULL,
+ dom_sid_split_rid(mem_ctx, group_sid, NULL,
&info3->base.primary_gid);
/* We already handled the first two, now take care of the rest */
@@ -115,9 +95,11 @@ static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(rids);
for (i = 2, j = 0; i < info->num_sids; ++i, ++j) {
+ struct dom_sid *tmp_sid;
+ tmp_sid = (struct dom_sid *)(void *)&info->sids[1].sid;
+
rids[j].attributes = info->sids[i].attributes;
- dom_sid_split_rid(mem_ctx,
- (struct dom_sid2 *) &info->sids[i].sid,
+ dom_sid_split_rid(mem_ctx, tmp_sid,
NULL, &rids[j].rid);
}
info3->base.groups.rids = rids;
@@ -138,89 +120,6 @@ static NTSTATUS winbind_want_check(struct auth_method_context *ctx,
return NT_STATUS_OK;
}
-/*
- Authenticate a user with a challenge/response
- using the samba3 winbind protocol
-*/
-static NTSTATUS winbind_check_password_samba3(struct auth_method_context *ctx,
- TALLOC_CTX *mem_ctx,
- const struct auth_usersupplied_info *user_info,
- struct auth_serversupplied_info **server_info)
-{
- struct winbindd_request request;
- struct winbindd_response response;
- NSS_STATUS result;
- NTSTATUS nt_status;
- struct netr_SamInfo3 info3;
-
- /* Send off request */
- const struct auth_usersupplied_info *user_info_temp;
- nt_status = encrypt_user_info(mem_ctx, ctx->auth_ctx,
- AUTH_PASSWORD_RESPONSE,
- user_info, &user_info_temp);
- if (!NT_STATUS_IS_OK(nt_status)) {
- return nt_status;
- }
- user_info = user_info_temp;
-
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
- request.flags = WBFLAG_PAM_INFO3_NDR;
-
- request.data.auth_crap.logon_parameters = user_info->logon_parameters;
-
- safe_strcpy(request.data.auth_crap.user,
- user_info->client.account_name, sizeof(fstring));
- safe_strcpy(request.data.auth_crap.domain,
- user_info->client.domain_name, sizeof(fstring));
- safe_strcpy(request.data.auth_crap.workstation,
- user_info->workstation_name, sizeof(fstring));
-
- memcpy(request.data.auth_crap.chal, ctx->auth_ctx->challenge.data.data, sizeof(request.data.auth_crap.chal));
-
- request.data.auth_crap.lm_resp_len = MIN(user_info->password.response.lanman.length,
- sizeof(request.data.auth_crap.lm_resp));
- request.data.auth_crap.nt_resp_len = MIN(user_info->password.response.nt.length,
- sizeof(request.data.auth_crap.nt_resp));
-
- memcpy(request.data.auth_crap.lm_resp, user_info->password.response.lanman.data,
- request.data.auth_crap.lm_resp_len);
- memcpy(request.data.auth_crap.nt_resp, user_info->password.response.nt.data,
- request.data.auth_crap.nt_resp_len);
-
- result = winbindd_request_response(WINBINDD_PAM_AUTH_CRAP, &request, &response);
-
- nt_status = NT_STATUS(response.data.auth.nt_status);
- NT_STATUS_NOT_OK_RETURN(nt_status);
-
- if (result == NSS_STATUS_SUCCESS && response.extra_data.data) {
- union netr_Validation validation;
-
- nt_status = get_info3_from_ndr(mem_ctx, &response, &info3);
- SAFE_FREE(response.extra_data.data);
- NT_STATUS_NOT_OK_RETURN(nt_status);
-
- validation.sam3 = &info3;
- nt_status = make_server_info_netlogon_validation(mem_ctx,
- user_info->client.account_name,
- 3, &validation,
- server_info);
- return nt_status;
- } else if (result == NSS_STATUS_SUCCESS && !response.extra_data.data) {
- DEBUG(0, ("Winbindd authenticated the user [%s]\\[%s], "
- "but did not include the required info3 reply!\n",
- user_info->client.domain_name, user_info->client.account_name));
- return NT_STATUS_INSUFFICIENT_LOGON_INFO;
- } else if (NT_STATUS_IS_OK(nt_status)) {
- DEBUG(1, ("Winbindd authentication for [%s]\\[%s] failed, "
- "but no error code is available!\n",
- user_info->client.domain_name, user_info->client.account_name));
- return NT_STATUS_NO_LOGON_SERVERS;
- }
-
- return nt_status;
-}
-
struct winbind_check_password_state {
struct winbind_SamLogon req;
};
@@ -235,7 +134,7 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx,
struct auth_serversupplied_info **server_info)
{
NTSTATUS status;
- struct server_id *winbind_servers;
+ struct dcerpc_binding_handle *irpc_handle;
struct winbind_check_password_state *s;
const struct auth_usersupplied_info *user_info_new;
struct netr_IdentityInfo *identity_info;
@@ -248,8 +147,10 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx,
s = talloc(mem_ctx, struct winbind_check_password_state);
NT_STATUS_HAVE_NO_MEMORY(s);
- winbind_servers = irpc_servers_byname(ctx->auth_ctx->msg_ctx, s, "winbind_server");
- if ((winbind_servers == NULL) || (winbind_servers[0].id == 0)) {
+ irpc_handle = irpc_binding_handle_by_name(s, ctx->auth_ctx->msg_ctx,
+ "winbind_server",
+ &ndr_table_winbind);
+ if (irpc_handle == NULL) {
DEBUG(0, ("Winbind authentication for [%s]\\[%s] failed, "
"no winbind_server running!\n",
user_info->client.domain_name, user_info->client.account_name));
@@ -310,9 +211,7 @@ static NTSTATUS winbind_check_password(struct auth_method_context *ctx,
s->req.in.validation_level = 3;
- status = IRPC_CALL(ctx->auth_ctx->msg_ctx, winbind_servers[0],
- winbind, WINBIND_SAMLOGON,
- &s->req, s);
+ status = dcerpc_winbind_SamLogon_r(irpc_handle, s, &s->req);
NT_STATUS_NOT_OK_RETURN(status);
status = make_server_info_netlogon_validation(mem_ctx,
@@ -385,13 +284,17 @@ static NTSTATUS winbind_check_password_wbclient(struct auth_method_context *ctx,
user_info->password.response.nt.data;
wbc_status = wbcAuthenticateUserEx(¶ms, &info, &err);
- if (!WBC_ERROR_IS_OK(wbc_status)) {
+ if (wbc_status == WBC_ERR_AUTH_ERROR) {
DEBUG(1, ("error was %s (0x%08x)\nerror message was '%s'\n",
err->nt_string, err->nt_status, err->display_string));
nt_status = NT_STATUS(err->nt_status);
wbcFreeMemory(err);
NT_STATUS_NOT_OK_RETURN(nt_status);
+ } else if (!WBC_ERROR_IS_OK(wbc_status)) {
+ DEBUG(1, ("wbcAuthenticateUserEx: failed with %u - %s\n",
+ wbc_status, wbcErrorString(wbc_status)));
+ return NT_STATUS_LOGON_FAILURE;
}
nt_status = get_info3_from_wbcAuthUserInfo(mem_ctx, info, &info3);
wbcFreeMemory(info);
@@ -405,13 +308,6 @@ static NTSTATUS winbind_check_password_wbclient(struct auth_method_context *ctx,
}
-static const struct auth_operations winbind_samba3_ops = {
- .name = "winbind_samba3",
- .get_challenge = auth_get_challenge_not_implemented,
- .want_check = winbind_want_check,
- .check_password = winbind_check_password_samba3
-};
-
static const struct auth_operations winbind_ops = {
.name = "winbind",
.get_challenge = auth_get_challenge_not_implemented,
@@ -430,12 +326,6 @@ _PUBLIC_ NTSTATUS auth_winbind_init(void)
{
NTSTATUS ret;
- ret = auth_register(&winbind_samba3_ops);
- if (!NT_STATUS_IS_OK(ret)) {
- DEBUG(0,("Failed to register 'winbind_samba3' auth backend!\n"));
- return ret;
- }
-
ret = auth_register(&winbind_ops);
if (!NT_STATUS_IS_OK(ret)) {
DEBUG(0,("Failed to register 'winbind' auth backend!\n"));
diff --git a/source4/auth/ntlm/wscript_build b/source4/auth/ntlm/wscript_build
index 673b5fc..c3ce364 100644
--- a/source4/auth/ntlm/wscript_build
+++ b/source4/auth/ntlm/wscript_build
@@ -27,7 +27,7 @@ bld.SAMBA_MODULE('auth_winbind',
source='auth_winbind.c',
subsystem='auth',
init_function='auth_winbind_init',
- deps='NDR_WINBIND MESSAGING LIBWINBIND-CLIENT LIBWBCLIENT'
+ deps='RPC_NDR_WINBIND MESSAGING LIBWBCLIENT'
)
diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c
index 0955c99..28ff404 100644
--- a/source4/dsdb/kcc/kcc_periodic.c
+++ b/source4/dsdb/kcc/kcc_periodic.c
@@ -33,7 +33,7 @@
#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_drsblobs.h"
-#include "librpc/gen_ndr/ndr_irpc.h"
+#include "librpc/gen_ndr/ndr_irpc_c.h"
#include "param/param.h"
/*
@@ -97,6 +97,11 @@ static bool check_MasterNC(struct kccsrv_partition *p, struct repsFromToBlob *r,
return false;
}
+struct kccsrv_notify_drepl_server_state {
+ struct dreplsrv_refresh r;
+};
+
+static void kccsrv_notify_drepl_server_done(struct tevent_req *subreq);
/**
* Force dreplsrv to update its state as topology is changed
@@ -104,16 +109,44 @@ static bool check_MasterNC(struct kccsrv_partition *p, struct repsFromToBlob *r,
static void kccsrv_notify_drepl_server(struct kccsrv_service *s,
TALLOC_CTX *mem_ctx)
{
- struct dreplsrv_refresh r;
- struct server_id *drepl_srv;
+ struct kccsrv_notify_drepl_server_state *state;
+ struct dcerpc_binding_handle *irpc_handle;
+ struct tevent_req *subreq;
- drepl_srv = irpc_servers_byname(s->task->msg_ctx, mem_ctx, "dreplsrv");
- if (!drepl_srv) {
+ state = talloc_zero(mem_ctx, struct kccsrv_notify_drepl_server_state);
+ if (state == NULL) {
+ return;
+ }
+
+ irpc_handle = irpc_binding_handle_by_name(state, s->task->msg_ctx,
+ "dreplsrv", &ndr_table_irpc);
+ if (irpc_handle == NULL) {
/* dreplsrv is not running yet */
+ TALLOC_FREE(state);
+ return;
+ }
+
+ subreq = dcerpc_dreplsrv_refresh_r_send(state, s->task->event_ctx,
+ irpc_handle, &state->r);
+ if (subreq == NULL) {
+ TALLOC_FREE(state);
return;
}
+ tevent_req_set_callback(subreq, kccsrv_notify_drepl_server_done, state);
+}
+
+static void kccsrv_notify_drepl_server_done(struct tevent_req *subreq)
+{
+ struct kccsrv_notify_drepl_server_state *state =
+ tevent_req_callback_data(subreq,
+ struct kccsrv_notify_drepl_server_state);
+ NTSTATUS status;
+
+ status = dcerpc_dreplsrv_refresh_r_recv(subreq, state);
+ TALLOC_FREE(subreq);
- IRPC_CALL(s->task->msg_ctx, drepl_srv[0], irpc, DREPLSRV_REFRESH, &r, mem_ctx);
+ /* we don't care about errors */
+ TALLOC_FREE(state);
}
/*
diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build
index 3b3dae9..d3961f5 100644
--- a/source4/dsdb/wscript_build
+++ b/source4/dsdb/wscript_build
@@ -38,7 +38,7 @@ bld.SAMBA_MODULE('KCC_SRV',
autoproto='kcc/kcc_service_proto.h',
subsystem='service',
init_function='server_service_kcc_init',
- deps='SAMDB process_model RPC_NDR_DRSUAPI'
+ deps='SAMDB process_model RPC_NDR_IRPC RPC_NDR_DRSUAPI'
)
diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h
index 6607eb4..4b49795 100644
--- a/source4/lib/messaging/irpc.h
+++ b/source4/lib/messaging/irpc.h
@@ -54,78 +54,25 @@ typedef NTSTATUS (*irpc_function_t)(struct irpc_message *, void *r);
NDR_ ## funcname, \
(irpc_function_t)function, private_data)
-/* make a irpc call */
-#define IRPC_CALL(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
- irpc_call(msg_ctx, server_id, &ndr_table_ ## pipename, NDR_ ## funcname, ptr, ctx)
-
-#define IRPC_CALL_SEND(msg_ctx, server_id, pipename, funcname, ptr, ctx) \
- irpc_call_send(msg_ctx, server_id, &ndr_table_ ## pipename, NDR_ ## funcname, ptr, ctx)
-
-
-/*
- a pending irpc call
-*/
-struct irpc_request {
- struct messaging_context *msg_ctx;
- const struct ndr_interface_table *table;
- int callnum;
- int callid;
- void *r;
- NTSTATUS status;
- bool done;
- bool reject_free;
- TALLOC_CTX *mem_ctx;
- struct {
- void (*fn)(struct irpc_request *);
- void *private_data;
- } async;
-};
-
-struct loadparm_context;
-
-typedef void (*msg_callback_t)(struct messaging_context *msg, void *private_data,
- uint32_t msg_type,
- struct server_id server_id, DATA_BLOB *data);
-
-NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server,
- uint32_t msg_type, const DATA_BLOB *data);
-NTSTATUS messaging_register(struct messaging_context *msg, void *private_data,
- uint32_t msg_type,
- msg_callback_t fn);
-NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private_data,
- msg_callback_t fn, uint32_t *msg_type);
-struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
- const char *dir,
- struct server_id server_id,
- struct tevent_context *ev);
-struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx,
- const char *dir,
- struct tevent_context *ev);
-NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server,
- uint32_t msg_type, void *ptr);
-void messaging_deregister(struct messaging_context *msg, uint32_t msg_type, void *private_data);
-
-
-
+struct ndr_interface_table;
NTSTATUS irpc_register(struct messaging_context *msg_ctx,
const struct ndr_interface_table *table,
int call, irpc_function_t fn, void *private_data);
-struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx,
- struct server_id server_id,
- const struct ndr_interface_table *table,
- int callnum, void *r, TALLOC_CTX *ctx);
-NTSTATUS irpc_call_recv(struct irpc_request *irpc);
-NTSTATUS irpc_call(struct messaging_context *msg_ctx,
- struct server_id server_id,
- const struct ndr_interface_table *table,
- int callnum, void *r, TALLOC_CTX *ctx);
+
+struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
+ struct server_id server_id,
+ const struct ndr_interface_table *table);
+struct dcerpc_binding_handle *irpc_binding_handle_by_name(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
+ const char *dest_task,
+ const struct ndr_interface_table *table);
NTSTATUS irpc_add_name(struct messaging_context *msg_ctx, const char *name);
struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, const char *name);
void irpc_remove_name(struct messaging_context *msg_ctx, const char *name);
NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status);
-struct server_id messaging_get_server_id(struct messaging_context *msg_ctx);
#endif
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 290210e..e50e50f 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -33,10 +33,23 @@
#include "../tdb/include/tdb.h"
#include "../lib/util/util_tdb.h"
#include "cluster/cluster.h"
+#include "../lib/util/tevent_ntstatus.h"
/* change the message version with any incompatible changes in the protocol */
#define MESSAGING_VERSION 1
+/*
+ a pending irpc call
+*/
+struct irpc_request {
+ struct messaging_context *msg_ctx;
+ int callid;
+ struct {
+ void (*handler)(struct irpc_request *irpc, struct irpc_message *m);
+ void *private_data;
+ } incoming;
+};
+
struct messaging_context {
struct server_id server_id;
struct socket_context *sock;
@@ -678,24 +691,11 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx,
static void irpc_handler_reply(struct messaging_context *msg_ctx, struct irpc_message *m)
{
struct irpc_request *irpc;
- enum ndr_err_code ndr_err;
irpc = (struct irpc_request *)idr_find(msg_ctx->idr, m->header.callid);
if (irpc == NULL) return;
- /* parse the reply data */
- ndr_err = irpc->table->calls[irpc->callnum].ndr_pull(m->ndr, NDR_OUT, irpc->r);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- irpc->status = m->header.status;
- talloc_steal(irpc->mem_ctx, m);
- } else {
- irpc->status = ndr_map_error2ntstatus(ndr_err);
--
Samba Shared Repository
More information about the samba-cvs
mailing list