1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s4-rpc: added target_principal binding handle option

this allows you to specify a target SPN for a connection

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andrew Tridgell 2010-10-01 19:05:30 -07:00
parent ee15dc9692
commit 9bae4cd3d9
7 changed files with 18 additions and 6 deletions

View File

@ -247,7 +247,7 @@ _PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struc
char *p;
int i, j, comma_count;
b = talloc(mem_ctx, struct dcerpc_binding);
b = talloc_zero(mem_ctx, struct dcerpc_binding);
if (!b) {
return NT_STATUS_NO_MEMORY;
}
@ -651,7 +651,7 @@ _PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
NTSTATUS status;
struct dcerpc_binding *binding;
binding = talloc(mem_ctx, struct dcerpc_binding);
binding = talloc_zero(mem_ctx, struct dcerpc_binding);
NT_STATUS_HAVE_NO_MEMORY(binding);
ZERO_STRUCT(binding->object);

View File

@ -96,7 +96,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
return NT_STATUS_NO_MEMORY;
}
drsuapi_binding = talloc(tmp_ctx, struct dcerpc_binding);
drsuapi_binding = talloc_zero(tmp_ctx, struct dcerpc_binding);
if (!drsuapi_binding) {
r->out.error_string = NULL;
talloc_free(tmp_ctx);

View File

@ -772,7 +772,7 @@ static void continue_epm_map_binding_send(struct composite_context *c)
s = talloc_get_type(c->private_data, struct rpc_connect_dci_state);
/* prepare to get endpoint mapping for the requested interface */
s->final_binding = talloc(s, struct dcerpc_binding);
s->final_binding = talloc_zero(s, struct dcerpc_binding);
if (composite_nomem(s->final_binding, c)) return;
*s->final_binding = *s->lsa_pipe->binding;

View File

@ -517,7 +517,7 @@ _PUBLIC_ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent
{
struct dcerpc_pipe *p;
p = talloc(mem_ctx, struct dcerpc_pipe);
p = talloc_zero(mem_ctx, struct dcerpc_pipe);
if (!p) {
return NULL;
}

View File

@ -190,6 +190,7 @@ struct dcerpc_binding {
struct ndr_syntax_id object;
const char *host;
const char *target_hostname;
const char *target_principal;
const char *endpoint;
const char **options;
const char *localaddress;

View File

@ -292,6 +292,17 @@ struct composite_context *dcerpc_bind_auth_send(TALLOC_CTX *mem_ctx,
}
}
if (p->binding && p->binding->target_principal) {
c->status = gensec_set_target_principal(sec->generic_state,
p->binding->target_principal);
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(1, ("Failed to set GENSEC target principal to %s: %s\n",
p->binding->target_principal, nt_errstr(c->status)));
composite_error(c, c->status);
return c;
}
}
c->status = gensec_start_mech_by_authtype(sec->generic_state,
auth_type, auth_level);
if (!NT_STATUS_IS_OK(c->status)) {

View File

@ -268,7 +268,7 @@ struct composite_context *dcerpc_schannel_key_send(TALLOC_CTX *mem_ctx,
}
/* allocate binding structure */
s->binding = talloc(c, struct dcerpc_binding);
s->binding = talloc_zero(c, struct dcerpc_binding);
if (composite_nomem(s->binding, c)) return c;
*s->binding = *s->pipe->binding;