Makefile.in: Add canon_name.c, duplicate_name.c, export_name.c to the
authorTheodore Tso <tytso@mit.edu>
Fri, 28 Mar 1997 04:46:19 +0000 (04:46 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 28 Mar 1997 04:46:19 +0000 (04:46 +0000)
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

src/lib/gssapi/krb5/ChangeLog
src/lib/gssapi/krb5/Makefile.in
src/lib/gssapi/krb5/canon_name.c [new file with mode: 0644]
src/lib/gssapi/krb5/duplicate_name.c [new file with mode: 0644]
src/lib/gssapi/krb5/export_name.c [new file with mode: 0644]
src/lib/gssapi/krb5/gssapiP_krb5.h

index 8bc5e8baf3af76cd808adc33db249243da371e32..1834e6a362998fde15c45b37c3b08e3bb8d6cacd 100644 (file)
@@ -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
index bfcdfbedbad13c38e500faf019d61e0b59312957..b938989e5d357b9e8825c4d2c0bf598cefc440f4 100644 (file)
@@ -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 (file)
index 0000000..f057d2b
--- /dev/null
@@ -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 (file)
index 0000000..176d603
--- /dev/null
@@ -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 (file)
index 0000000..ea6d893
--- /dev/null
@@ -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);
+}
+
+
+
+
+
+
index d7b01e0210b7fe020fe7cc2bb0689ac770e0f258..85104721313a60e11dc585248747c64df32f9a6d 100644 (file)
@@ -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)))