{
struct dcerpc_binding *binding;
NTSTATUS status;
-
+ char *s;
+ char *our_name;
+
+ /* we avoid connecting to ourselves over ncacn_np, as that has
+ quite a high overhead with s3fs */
+ our_name = talloc_asprintf(state, "%s.%s",
+ lpcfg_netbios_name(state->service->task->lp_ctx),
+ lpcfg_realm(state->service->task->lp_ctx));
/* Make a binding string */
- {
- char *s = talloc_asprintf(state, "ncacn_np:%s", state->domain->dc_name);
- if (s == NULL) return NULL;
- status = dcerpc_parse_binding(state, s, &binding);
- talloc_free(s);
- if (!NT_STATUS_IS_OK(status)) {
- return NULL;
- }
+ if (strcasecmp(lpcfg_netbios_name(state->service->task->lp_ctx),
+ state->domain->dc_name) == 0 ||
+ strcasecmp(our_name, state->domain->dc_name) == 0) {
+ s = talloc_asprintf(state, "ncalrpc:%s", state->domain->dc_name);
+ } else {
+ s = talloc_asprintf(state, "ncacn_np:%s", state->domain->dc_name);
+ }
+ talloc_free(our_name);
+ if (s == NULL) return NULL;
+ status = dcerpc_parse_binding(state, s, &binding);
+ talloc_free(s);
+ if (!NT_STATUS_IS_OK(status)) {
+ return NULL;
}
/* Alter binding to contain hostname, but also address (so we don't look it up twice) */