summaryrefslogtreecommitdiff
path: root/usr/src/lib/libgss/g_acquire_cred.c
diff options
context:
space:
mode:
authorwyllys <none@none>2005-07-13 10:02:39 -0700
committerwyllys <none@none>2005-07-13 10:02:39 -0700
commit354d1447ce995f3923a8f53d41c49fd3e6543282 (patch)
treeb3380cb1588026a43df9055acffff2ed4428a11a /usr/src/lib/libgss/g_acquire_cred.c
parentf3f5a4dd0d8a3e3659add4eeca8b25772c3b35a2 (diff)
downloadillumos-gate-354d1447ce995f3923a8f53d41c49fd3e6543282.tar.gz
6259944 call gss_acquire_cred() with SPNEGO OID, it returns GSS_S_COMPLETE but did not return any credential
6260520 Call gss_context_time() with a handle of an un-established SPNEGO context, it will core dump. 6285582 gss_add_cred() is broken when input_cred_handle == GSS_C_NO_CREDENTIAL, assumes GSS_C_NO_NAME 6287358 SPNEGO init_sec_context fails when given 'actual_mechs' parameter 6290437 gss_accept_sec_context needs better handling of delegated credentials 6293338 call gss_create_empty_oid_set() with oid_set=NULL, it will seg fault.
Diffstat (limited to 'usr/src/lib/libgss/g_acquire_cred.c')
-rw-r--r--usr/src/lib/libgss/g_acquire_cred.c62
1 files changed, 40 insertions, 22 deletions
diff --git a/usr/src/lib/libgss/g_acquire_cred.c b/usr/src/lib/libgss/g_acquire_cred.c
index a6ecd5a533..9fffa3c63d 100644
--- a/usr/src/lib/libgss/g_acquire_cred.c
+++ b/usr/src/lib/libgss/g_acquire_cred.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -29,7 +29,6 @@
/*
* glue routine for gss_acquire_cred
*/
-
#include <mechglueP.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
@@ -274,33 +273,52 @@ gss_add_cred(minor_status, input_cred_handle,
return (GSS_S_FAILURE);
(void) memset(union_cred, 0, sizeof (gss_union_cred_desc));
-
- /* for default credentials we will use GSS_C_NO_NAME */
- internal_name = GSS_C_NO_NAME;
} else {
+ /* Input Cred is non-NULL */
union_cred = (gss_union_cred_t)input_cred_handle;
+
if (__gss_get_mechanism_cred(union_cred, desired_mech) !=
- GSS_C_NO_CREDENTIAL)
- return (GSS_S_DUPLICATE_ELEMENT);
+ GSS_C_NO_CREDENTIAL) {
+ status = GSS_S_DUPLICATE_ELEMENT;
+ goto errout;
+ }
- /* may need to create a mechanism specific name */
- if (desired_name) {
- union_name = (gss_union_name_t)desired_name;
- if (union_name->mech_type &&
- g_OID_equal(union_name->mech_type,
- &mech->mech_type))
- internal_name = union_name->mech_name;
- else {
- if (__gss_import_internal_name(minor_status,
- &mech->mech_type, union_name,
- &allocated_name) != GSS_S_COMPLETE)
- return (GSS_S_BAD_NAME);
+ /*
+ * If no name was given, determine the name from the
+ * existing credential.
+ */
+ if (desired_name == GSS_C_NO_NAME) {
+ if (gss_import_name(minor_status,
+ &union_cred->auxinfo.name,
+ union_cred->auxinfo.name_type,
+ &allocated_name) == GSS_S_COMPLETE &&
+ (gss_canonicalize_name(minor_status,
+ allocated_name,
+ &mech->mech_type,
+ NULL) == GSS_S_COMPLETE)) {
internal_name = allocated_name;
}
+ } /* else, get the name from the desired_name below */
+ }
+ if (desired_name != GSS_C_NO_NAME) {
+ /* may need to create a mechanism specific name */
+ union_name = (gss_union_name_t)desired_name;
+
+ if (union_name->mech_type &&
+ g_OID_equal(union_name->mech_type,
+ &mech->mech_type))
+ internal_name = union_name->mech_name;
+ else {
+ if (__gss_import_internal_name(minor_status,
+ &mech->mech_type, union_name,
+ &allocated_name) != GSS_S_COMPLETE) {
+ status = GSS_S_BAD_NAME;
+ goto errout;
+ }
+ internal_name = allocated_name;
}
}
-
if (cred_usage == GSS_C_ACCEPT)
time_req = acceptor_time_req;
else if (cred_usage == GSS_C_INITIATE)
@@ -317,7 +335,7 @@ gss_add_cred(minor_status, input_cred_handle,
if (status != GSS_S_COMPLETE)
goto errout;
- /* may need to set credential auxinfo strucutre */
+ /* may need to set credential auxinfo structure */
if (union_cred->auxinfo.creation_time == 0) {
union_cred->auxinfo.creation_time = time(NULL);
union_cred->auxinfo.time_rec = time_rec;
@@ -327,7 +345,7 @@ gss_add_cred(minor_status, input_cred_handle,
* we must set the name; if name is not supplied
* we must do inquire cred to get it
*/
- if (internal_name == NULL) {
+ if (internal_name == GSS_C_NO_NAME) {
if (mech->gss_inquire_cred == NULL ||
((status = mech->gss_inquire_cred(
mech->context,