Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/gp_creds.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,24 @@ uint32_t gp_add_krb5_creds(uint32_t *min,
}
} else { /* impersonation */
switch (acquire_type) {
case ACQ_NORMAL:
ret_maj = gss_acquire_cred_from(&ret_min, GSS_C_NO_NAME,
case ACQ_NORMAL: {
struct gp_service *svc = gpcall->service;
gss_name_t host_principal = GSS_C_NO_NAME;

if (svc->krb5.principal) {
/* configuration dictates to use a specific name */
gss_buffer_desc const_buf;
const_buf.value = svc->krb5.principal;
const_buf.length = strlen(svc->krb5.principal) + 1;

ret_maj = gss_import_name(&ret_min, &const_buf,
discard_const(GSS_KRB5_NT_PRINCIPAL_NAME),
&host_principal);
if (ret_maj) {
goto done;
}
}
ret_maj = gss_acquire_cred_from(&ret_min, host_principal,
GSS_C_INDEFINITE,
&desired_mechs, GSS_C_BOTH,
&cred_store, &impersonator_cred,
Expand Down Expand Up @@ -714,6 +730,7 @@ uint32_t gp_add_krb5_creds(uint32_t *min,

input_cred = impersonator_cred;
break;
}
case ACQ_IMPNAME:
input_cred = in_cred;
break;
Expand Down