/*
- * Copyright (c) 2004 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2001, 2003 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
* SUCH DAMAGE.
*/
-#include "gssapi_locl.h"
-
-RCSID("$Id: ccache_name.c,v 1.2 2005/06/16 20:38:49 lha Exp $");
-
-char *last_out_name;
+#include "mech_locl.h"
+RCSID("$Id: gss_add_oid_set_member.c,v 1.3 2006/10/22 09:36:13 lha Exp $");
OM_uint32
-gss_krb5_ccache_name(OM_uint32 *minor_status,
- const char *name,
- const char **out_name)
+gss_add_oid_set_member (OM_uint32 * minor_status,
+ const gss_OID member_oid,
+ gss_OID_set * oid_set)
{
- krb5_error_code kret;
-
- *minor_status = 0;
+ gss_OID tmp;
+ size_t n;
+ OM_uint32 res;
+ int present;
- GSSAPI_KRB5_INIT();
+ res = gss_test_oid_set_member(minor_status, member_oid, *oid_set, &present);
+ if (res != GSS_S_COMPLETE)
+ return res;
- if (out_name) {
- const char *n;
-
- if (last_out_name) {
- free(last_out_name);
- last_out_name = NULL;
- }
-
- n = krb5_cc_default_name(gssapi_krb5_context);
- if (n == NULL) {
- *minor_status = ENOMEM;
- gssapi_krb5_set_error_string ();
- return GSS_S_FAILURE;
- }
- last_out_name = strdup(n);
- if (last_out_name == NULL) {
- *minor_status = ENOMEM;
- return GSS_S_FAILURE;
- }
- *out_name = last_out_name;
+ if (present) {
+ *minor_status = 0;
+ return GSS_S_COMPLETE;
}
- kret = krb5_cc_set_default_name(gssapi_krb5_context, name);
- if (kret) {
- *minor_status = kret;
- gssapi_krb5_set_error_string ();
+ n = (*oid_set)->count + 1;
+ tmp = realloc ((*oid_set)->elements, n * sizeof(gss_OID_desc));
+ if (tmp == NULL) {
+ *minor_status = ENOMEM;
return GSS_S_FAILURE;
}
+ (*oid_set)->elements = tmp;
+ (*oid_set)->count = n;
+ (*oid_set)->elements[n-1] = *member_oid;
+ *minor_status = 0;
return GSS_S_COMPLETE;
}