summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1997-03-28 04:46:19 +0000
committerTheodore Tso <tytso@mit.edu>1997-03-28 04:46:19 +0000
commitd33420d1df9d1d0146e3dbeb9658f12563e1e367 (patch)
tree7c60f7cfdeae4aa04c6ec79d572a764f26598ba6
parentcdef3b1c905cf089c64474953e5fcf3d886d0385 (diff)
downloadkrb5-d33420d1df9d1d0146e3dbeb9658f12563e1e367.tar.gz
krb5-d33420d1df9d1d0146e3dbeb9658f12563e1e367.tar.xz
krb5-d33420d1df9d1d0146e3dbeb9658f12563e1e367.zip
Makefile.in: Add canon_name.c, duplicate_name.c, export_name.c to the
GSSAPI library. gssapiP_krb5.h (KG_IMPLFLAGS): Add support for GSS_C_PROT_READY_FLAG and GSS_C_TRANS_FLAG canon_name.c (gss_canonicalize_name): New GSSAPI V2 function duplicate_name.c (gss_duplicate_name): New GSSAPI V2 function export_name.c (gss_export_name): New GSSAPI V2 function git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10031 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/lib/gssapi/krb5/ChangeLog14
-rw-r--r--src/lib/gssapi/krb5/Makefile.in9
-rw-r--r--src/lib/gssapi/krb5/canon_name.c43
-rw-r--r--src/lib/gssapi/krb5/duplicate_name.c67
-rw-r--r--src/lib/gssapi/krb5/export_name.c79
-rw-r--r--src/lib/gssapi/krb5/gssapiP_krb5.h1
6 files changed, 213 insertions, 0 deletions
diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog
index 8bc5e8baf..1834e6a36 100644
--- a/src/lib/gssapi/krb5/ChangeLog
+++ b/src/lib/gssapi/krb5/ChangeLog
@@ -1,3 +1,17 @@
+Thu Mar 27 15:52:04 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * Makefile.in: Add canon_name.c, duplicate_name.c, export_name.c
+ to the GSSAPI library.
+
+ * canon_name.c (gss_canonicalize_name): New GSSAPI V2 function
+
+ * duplicate_name.c (gss_duplicate_name): New GSSAPI V2 function
+
+ * export_name.c (gss_export_name): New GSSAPI V2 function
+
+ * gssapiP_krb5.h (KG_IMPLFLAGS): Add support for
+ GSS_C_PROT_STATE_READY and GSS_C_TRANS_FLAG
+
Tue Mar 25 01:00:55 1997 Theodore Y. Ts'o <tytso@mit.edu>
* init_sec_context.c (krb5_gss_init_sec_context): A zero-length
diff --git a/src/lib/gssapi/krb5/Makefile.in b/src/lib/gssapi/krb5/Makefile.in
index bfcdfbedb..b938989e5 100644
--- a/src/lib/gssapi/krb5/Makefile.in
+++ b/src/lib/gssapi/krb5/Makefile.in
@@ -16,11 +16,14 @@ gssapi_err_krb5.c: gssapi_err_krb5.et
SRCS = \
$(srcdir)/accept_sec_context.c \
$(srcdir)/acquire_cred.c \
+ $(srcdir)/canon_name.c \
$(srcdir)/compare_name.c \
$(srcdir)/context_time.c \
$(srcdir)/delete_sec_context.c \
$(srcdir)/disp_name.c \
$(srcdir)/disp_status.c \
+ $(srcdir)/duplicate_name.c \
+ $(srcdir)/export_name.c \
$(srcdir)/export_sec_context.c \
$(srcdir)/get_tkt_flags.c \
$(srcdir)/gssapi_krb5.c \
@@ -56,11 +59,14 @@ SRCS = \
OBJS = \
accept_sec_context.$(OBJEXT) \
acquire_cred.$(OBJEXT) \
+ canon_name.$(OBJECT) \
compare_name.$(OBJEXT) \
context_time.$(OBJEXT) \
delete_sec_context.$(OBJEXT) \
disp_name.$(OBJEXT) \
disp_status.$(OBJEXT) \
+ duplicate_name.$(OBJEXT) \
+ export_name.$(OBJEXT) \
export_sec_context.$(OBJEXT) \
get_tkt_flags.$(OBJEXT) \
gssapi_krb5.$(OBJEXT) \
@@ -96,11 +102,14 @@ OBJS = \
STLIBOBJS = \
accept_sec_context.o \
acquire_cred.o \
+ canon_name.o \
compare_name.o \
context_time.o \
delete_sec_context.o \
disp_name.o \
disp_status.o \
+ duplicate_name.o \
+ export_name.o \
export_sec_context.o \
get_tkt_flags.o \
gssapi_krb5.o \
diff --git a/src/lib/gssapi/krb5/canon_name.c b/src/lib/gssapi/krb5/canon_name.c
new file mode 100644
index 000000000..f057d2b05
--- /dev/null
+++ b/src/lib/gssapi/krb5/canon_name.c
@@ -0,0 +1,43 @@
+/*
+ * lib/gssapi/krb5/canon_name.c
+ *
+ * Copyright 1997 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ */
+
+#include "gssapiP_krb5.h"
+
+/* This is trivial since we're a single mechanism implementation */
+
+OM_uint32 gss_canonicalize_name(OM_uint32 *minor_status,
+ const gss_name_t input_name,
+ const gss_OID mech_type,
+ gss_name_t *output_name)
+{
+ if ((mech_type == GSS_C_NULL_OID) ||
+ !g_OID_equal(mech_type, gss_mech_krb5)) {
+ if (minor_status)
+ *minor_status = 0;
+ return(GSS_S_BAD_MECH);
+ }
+
+ return gss_duplicate_name(minor_status, input_name,
+ output_name);
+}
diff --git a/src/lib/gssapi/krb5/duplicate_name.c b/src/lib/gssapi/krb5/duplicate_name.c
new file mode 100644
index 000000000..176d6030d
--- /dev/null
+++ b/src/lib/gssapi/krb5/duplicate_name.c
@@ -0,0 +1,67 @@
+/*
+ * lib/gssapi/krb5/duplicate_name.c
+ *
+ * Copyright 1997 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ */
+
+#include "gssapiP_krb5.h"
+
+OM_uint32 gss_duplicate_name(OM_uint32 *minor_status,
+ const gss_name_t input_name,
+ gss_name_t *dest_name)
+{
+ krb5_context context;
+ krb5_error_code code;
+ krb5_principal princ, outprinc;
+ int length;
+ char *str, *cp;
+
+ if (GSS_ERROR(kg_get_context(minor_status, &context)))
+ return(GSS_S_FAILURE);
+
+ if (! kg_validate_name(input_name)) {
+ if (minor_status)
+ *minor_status = (OM_uint32) G_VALIDATE_FAILED;
+ return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME);
+ }
+
+ princ = input_name;
+ if (code = krb5_copy_principal(context, princ, &outprinc)) {
+ *minor_status = code;
+ return(GSS_S_FAILURE);
+ }
+
+ if (! kg_save_name((gss_name_t) outprinc)) {
+ krb5_free_principal(context, outprinc);
+ *minor_status = (OM_uint32) G_VALIDATE_FAILED;
+ return(GSS_S_FAILURE);
+ }
+
+ *dest_name = (gss_name_t) outprinc;
+ return(GSS_S_COMPLETE);
+
+}
+
+
+
+
+
+
diff --git a/src/lib/gssapi/krb5/export_name.c b/src/lib/gssapi/krb5/export_name.c
new file mode 100644
index 000000000..ea6d893f6
--- /dev/null
+++ b/src/lib/gssapi/krb5/export_name.c
@@ -0,0 +1,79 @@
+/*
+ * lib/gssapi/krb5/export_name.c
+ *
+ * Copyright 1997 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ */
+
+#include "gssapiP_krb5.h"
+
+OM_uint32 gss_export_name(OM_uint32 *minor_status,
+ const gss_name_t input_name,
+ gss_buffer_t exported_name)
+{
+ krb5_context context;
+ krb5_error_code code;
+ int length;
+ char *str, *cp;
+
+ if (GSS_ERROR(kg_get_context(minor_status, &context)))
+ return(GSS_S_FAILURE);
+
+ exported_name->length = 0;
+ exported_name->value = NULL;
+
+ if (! kg_validate_name(input_name)) {
+ if (minor_status)
+ *minor_status = (OM_uint32) G_VALIDATE_FAILED;
+ return(GSS_S_CALL_BAD_STRUCTURE|GSS_S_BAD_NAME);
+ }
+
+ if (code = krb5_unparse_name(context, (krb5_principal) input_name,
+ &str)) {
+ *minor_status = code;
+ return(GSS_S_FAILURE);
+ }
+
+ length = strlen(str);
+ exported_name->length = 8 + length + gss_mech_krb5->length;
+ exported_name->value = malloc(exported_name->length);
+ cp = exported_name->value;
+
+ *cp++ = 0x04; *cp++ = 0x01;
+ *cp++ = gss_mech_krb5->length >> 8;
+ *cp++ = gss_mech_krb5->length & 0xFF;
+ memcpy(cp, gss_mech_krb5->elements, gss_mech_krb5->length);
+ cp += gss_mech_krb5->length;
+ *cp++ = length >> 24;
+ *cp++ = length >> 16;
+ *cp++ = length >> 8;
+ *cp++ = length & 0xFF;
+ memcpy(cp, str, length);
+
+ free(str);
+
+ return(GSS_S_COMPLETE);
+}
+
+
+
+
+
+
diff --git a/src/lib/gssapi/krb5/gssapiP_krb5.h b/src/lib/gssapi/krb5/gssapiP_krb5.h
index d7b01e021..851047213 100644
--- a/src/lib/gssapi/krb5/gssapiP_krb5.h
+++ b/src/lib/gssapi/krb5/gssapiP_krb5.h
@@ -64,6 +64,7 @@
#define KG_TOK_DEL_CTX 0x0102
#define KG_IMPLFLAGS(x) (GSS_C_INTEG_FLAG | GSS_C_CONF_FLAG | \
+ GSS_C_TRANS_FLAG | GSS_C_PROT_READY_FLAG | \
((x) & (GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG | \
GSS_C_SEQUENCE_FLAG | GSS_C_DELEG_FLAG)))