1
1

gssapi: Use GSSAPIClientIdentity to acquire creds

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Simo Sorce 2013-11-15 10:02:48 -05:00 коммит произвёл Andreas Schneider
родитель 47e53deebd
Коммит 440d2ec0ea

Просмотреть файл

@ -623,16 +623,32 @@ static int ssh_gssapi_match(ssh_session session, gss_OID_set *valid_oids)
{ {
OM_uint32 maj_stat, min_stat, lifetime; OM_uint32 maj_stat, min_stat, lifetime;
gss_OID_set actual_mechs; gss_OID_set actual_mechs;
gss_buffer_desc namebuf;
gss_name_t client_id = GSS_C_NO_NAME;
gss_OID oid; gss_OID oid;
unsigned int i; unsigned int i;
char *ptr; char *ptr;
int ret;
maj_stat = gss_acquire_cred(&min_stat, GSS_C_NO_NAME, GSS_C_INDEFINITE, if (session->opts.gss_client_identity != NULL) {
namebuf.value = (void *)session->opts.gss_client_identity;
namebuf.length = strlen(session->opts.gss_client_identity);
maj_stat = gss_import_name(&min_stat, &namebuf,
GSS_C_NT_USER_NAME, &client_id);
if (GSS_ERROR(maj_stat)) {
ret = SSH_ERROR;
goto end;
}
}
maj_stat = gss_acquire_cred(&min_stat, client_id, GSS_C_INDEFINITE,
GSS_C_NO_OID_SET, GSS_C_INITIATE, GSS_C_NO_OID_SET, GSS_C_INITIATE,
&session->gssapi->client_creds, &session->gssapi->client_creds,
&actual_mechs, NULL); &actual_mechs, NULL);
if (GSS_ERROR(maj_stat)) { if (GSS_ERROR(maj_stat)) {
return SSH_ERROR; ret = SSH_ERROR;
goto end;
} }
gss_create_empty_oid_set(&min_stat, valid_oids); gss_create_empty_oid_set(&min_stat, valid_oids);
@ -653,7 +669,11 @@ static int ssh_gssapi_match(ssh_session session, gss_OID_set *valid_oids)
} }
} }
return SSH_OK; ret = SSH_OK;
end:
gss_release_name(&min_stat, &client_id);
return ret;
} }
/** /**