diff options
author | Bjorn Sandell <biorn@cvs.openbsd.org> | 2006-04-14 08:24:43 +0000 |
---|---|---|
committer | Bjorn Sandell <biorn@cvs.openbsd.org> | 2006-04-14 08:24:43 +0000 |
commit | 5a4ee3110ee6b3ae8ef7cb0d2a7bbd09e7ca1206 (patch) | |
tree | 48423b2ed05d73bfe56936e3ce858d55f7b67781 /lib/libgssapi | |
parent | 1fb60d0b09104c2afb46f00e7fc0be99226b30ab (diff) |
fix for heimdal 0.7.2
Diffstat (limited to 'lib/libgssapi')
-rw-r--r-- | lib/libgssapi/Makefile | 46 | ||||
-rw-r--r-- | lib/libgssapi/generated/asn1_ContextFlags.c | 146 | ||||
-rw-r--r-- | lib/libgssapi/generated/asn1_MechType.c | 70 | ||||
-rw-r--r-- | lib/libgssapi/generated/asn1_MechTypeList.c | 115 | ||||
-rw-r--r-- | lib/libgssapi/generated/asn1_NegTokenInit.c | 297 | ||||
-rw-r--r-- | lib/libgssapi/generated/asn1_NegTokenTarg.c | 296 | ||||
-rw-r--r-- | lib/libgssapi/generated/asn1_NegotiationToken.c | 15 | ||||
-rw-r--r-- | lib/libgssapi/generated/asn1_files | 1 | ||||
-rw-r--r-- | lib/libgssapi/generated/spnego_asn1.h | 165 | ||||
-rw-r--r-- | lib/libgssapi/shlib_version | 2 |
10 files changed, 1146 insertions, 7 deletions
diff --git a/lib/libgssapi/Makefile b/lib/libgssapi/Makefile index 93e5b785caa..f92a6008421 100644 --- a/lib/libgssapi/Makefile +++ b/lib/libgssapi/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2005/11/24 20:49:18 deraadt Exp $ +# $OpenBSD: Makefile,v 1.9 2006/04/14 08:24:42 biorn Exp $ KRB5DIR = ${.CURDIR}/../../kerberosV .include <${.CURDIR}/../libkrb5/Makefile.common.inc> @@ -7,9 +7,23 @@ LIB= gssapi WANTLINT= DIR_GSSAPI= ${KRB5SRC}/lib/gssapi +GENDIR= ${.CURDIR}/generated HDR_GSSAPI= gssapi.h +HDR_GEN= ${GENDIR}/spnego_asn1.h + +.PATH: ${GENDIR} + +#${HDR_GEN}: ${DIR_GSSAPI}/spnego.asn1 +# asn1_compile $(DIR_GSSAPI)/spnego.asn1 spnego_asn1 + +includes: ${HDR_GEN} + for i in ${HDR_GEN}; do\ + echo -n " $$i"; \ + cmp -s $$i ${DESTDIR}/usr/include/kerberosV/spnego_asn1.h || \ + ${INSTALL} ${INSTALL_COPY} -m 444 \ + -o ${BINOWN} -g $(BINGRP) $$i \ + ${DESTDIR}/usr/include/kerberosV; done; \ -includes: @echo -n ${DIR_GSSAPI}:; \ cd ${DIR_GSSAPI}; for i in ${HDR_GSSAPI}; do \ echo -n " $$i"; \ @@ -24,8 +38,11 @@ SRCS= 8003.c \ acquire_cred.c \ add_cred.c \ add_oid_set_member.c \ + address_to_krb5addr.c \ arcfour.c \ canonicalize_name.c \ + ccache_name.c \ + cfx.c \ compare_name.c \ compat.c \ context_time.c \ @@ -37,8 +54,8 @@ SRCS= 8003.c \ display_status.c \ duplicate_name.c \ encapsulate.c \ - export_sec_context.c \ export_name.c \ + export_sec_context.c \ external.c \ get_mic.c \ gssapi.h \ @@ -53,17 +70,28 @@ SRCS= 8003.c \ inquire_cred_by_mech.c \ inquire_mechs_for_name.c \ inquire_names_for_mech.c \ + process_context_token.c \ release_buffer.c \ release_cred.c \ release_name.c \ release_oid_set.c \ - process_context_token.c \ + sequence.c \ test_oid_set_member.c \ + ticket_flags.c \ unwrap.c \ v1.c \ verify_mic.c \ - wrap.c \ - address_to_krb5addr.c + wrap.c + +gen_files= \ + asn1_ContextFlags.c \ + asn1_MechType.c \ + asn1_MechTypeList.c \ + asn1_NegTokenInit.c \ + asn1_NegTokenTarg.c \ + asn1_NegotiationToken.c + +SRCS+=${gen_files} MAN+= gssapi.3 @@ -91,8 +119,10 @@ MLINKS+=gss_acquire_cred.3 gss_accept_sec_context.3 \ gss_acquire_cred.3 gss_inquire_cred_by_mech.3 \ gss_acquire_cred.3 gss_inquire_mechs_for_name.3 \ gss_acquire_cred.3 gss_inquire_names_for_mech.3 \ + gss_acquire_cred.3 gss_krb5_ccache_name.3 \ gss_acquire_cred.3 gss_krb5_copy_ccache.3 \ gss_acquire_cred.3 gss_krb5_compat_des3_mic.3 \ + gss_acquire_cred.3 gss_krb5_get_tkt_flags.3 \ gss_acquire_cred.3 gss_process_context_token.3 \ gss_acquire_cred.3 gss_release_buffer.3 \ gss_acquire_cred.3 gss_release_cred.3 \ @@ -113,4 +143,8 @@ CFLAGS+=-I${KRB5SRC}/lib/krb5 -I${KRB5SRC}/lib/ \ -I${KRB5SRC}/lib/asn1 -I. \ -DSHA1_CTX=SHA_CTX +regen: + cd ${GENDIR}; asn1_compile $(DIR_GSSAPI)/spnego.asn1 spnego_asn1; \ + for f in *.x; do mv $$f `echo $$f | sed s,.x$$,.c,g`; done + .include <bsd.lib.mk> diff --git a/lib/libgssapi/generated/asn1_ContextFlags.c b/lib/libgssapi/generated/asn1_ContextFlags.c new file mode 100644 index 00000000000..af16a0c69b5 --- /dev/null +++ b/lib/libgssapi/generated/asn1_ContextFlags.c @@ -0,0 +1,146 @@ +/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */ +/* Do not edit */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#include <spnego_asn1.h> +#include <asn1_err.h> +#include <der.h> +#include <parse_units.h> + +#define BACK if (e) return e; p -= l; len -= l; ret += l + +int +encode_ContextFlags(unsigned char *p, size_t len, const ContextFlags *data, size_t *size) +{ +size_t ret = 0; +size_t l; +int i, e; + +i = 0; +{ +unsigned char c = 0; +*p-- = c; len--; ret++; +c = 0; +*p-- = c; len--; ret++; +c = 0; +*p-- = c; len--; ret++; +c = 0; +if(data->integFlag) c |= 1<<1; +if(data->confFlag) c |= 1<<2; +if(data->anonFlag) c |= 1<<3; +if(data->sequenceFlag) c |= 1<<4; +if(data->replayFlag) c |= 1<<5; +if(data->mutualFlag) c |= 1<<6; +if(data->delegFlag) c |= 1<<7; +*p-- = c; +*p-- = 0; +len -= 2; +ret += 2; +} + +e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, PRIM,UT_BitString, &l); +BACK; +*size = ret; +return 0; +} + +#define FORW if(e) goto fail; p += l; len -= l; ret += l + +int +decode_ContextFlags(const unsigned char *p, size_t len, ContextFlags *data, size_t *size) +{ +size_t ret = 0, reallen; +size_t l; +int e; + +memset(data, 0, sizeof(*data)); +reallen = 0; +e = der_match_tag_and_length (p, len, ASN1_C_UNIV, PRIM, UT_BitString,&reallen, &l); +FORW; +if(len < reallen) +return ASN1_OVERRUN; +p++; +len--; +reallen--; +ret++; +data->delegFlag = (*p >> 7) & 1; +data->mutualFlag = (*p >> 6) & 1; +data->replayFlag = (*p >> 5) & 1; +data->sequenceFlag = (*p >> 4) & 1; +data->anonFlag = (*p >> 3) & 1; +data->confFlag = (*p >> 2) & 1; +data->integFlag = (*p >> 1) & 1; +p += reallen; len -= reallen; ret += reallen; +if(size) *size = ret; +return 0; +fail: +free_ContextFlags(data); +return e; +} + +void +free_ContextFlags(ContextFlags *data) +{ +} + +size_t +length_ContextFlags(const ContextFlags *data) +{ +size_t ret = 0; +ret += 7; +return ret; +} + +int +copy_ContextFlags(const ContextFlags *from, ContextFlags *to) +{ +*(to) = *(from); +return 0; +} + +unsigned ContextFlags2int(ContextFlags f) +{ +unsigned r = 0; +if(f.delegFlag) r |= (1U << 0); +if(f.mutualFlag) r |= (1U << 1); +if(f.replayFlag) r |= (1U << 2); +if(f.sequenceFlag) r |= (1U << 3); +if(f.anonFlag) r |= (1U << 4); +if(f.confFlag) r |= (1U << 5); +if(f.integFlag) r |= (1U << 6); +return r; +} + +ContextFlags int2ContextFlags(unsigned n) +{ + ContextFlags flags; + + flags.delegFlag = (n >> 0) & 1; + flags.mutualFlag = (n >> 1) & 1; + flags.replayFlag = (n >> 2) & 1; + flags.sequenceFlag = (n >> 3) & 1; + flags.anonFlag = (n >> 4) & 1; + flags.confFlag = (n >> 5) & 1; + flags.integFlag = (n >> 6) & 1; + return flags; +} + +static struct units ContextFlags_units[] = { + {"integFlag", 1U << 6}, + {"confFlag", 1U << 5}, + {"anonFlag", 1U << 4}, + {"sequenceFlag", 1U << 3}, + {"replayFlag", 1U << 2}, + {"mutualFlag", 1U << 1}, + {"delegFlag", 1U << 0}, + {NULL, 0} +}; + +const struct units * asn1_ContextFlags_units(void){ +return ContextFlags_units; +} + diff --git a/lib/libgssapi/generated/asn1_MechType.c b/lib/libgssapi/generated/asn1_MechType.c new file mode 100644 index 00000000000..1dae57453be --- /dev/null +++ b/lib/libgssapi/generated/asn1_MechType.c @@ -0,0 +1,70 @@ +/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */ +/* Do not edit */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#include <spnego_asn1.h> +#include <asn1_err.h> +#include <der.h> +#include <parse_units.h> + +#define BACK if (e) return e; p -= l; len -= l; ret += l + +int +encode_MechType(unsigned char *p, size_t len, const MechType *data, size_t *size) +{ +size_t ret = 0; +size_t l; +int i, e; + +i = 0; +e = encode_oid(p, len, data, &l); +BACK; +*size = ret; +return 0; +} + +#define FORW if(e) goto fail; p += l; len -= l; ret += l + +int +decode_MechType(const unsigned char *p, size_t len, MechType *data, size_t *size) +{ +size_t ret = 0, reallen; +size_t l; +int e; + +memset(data, 0, sizeof(*data)); +reallen = 0; +e = decode_oid(p, len, data, &l); +FORW; +if(size) *size = ret; +return 0; +fail: +free_MechType(data); +return e; +} + +void +free_MechType(MechType *data) +{ +free_oid(data); +} + +size_t +length_MechType(const MechType *data) +{ +size_t ret = 0; +ret += length_oid(data); +return ret; +} + +int +copy_MechType(const MechType *from, MechType *to) +{ +if(copy_oid(from, to)) return ENOMEM; +return 0; +} + diff --git a/lib/libgssapi/generated/asn1_MechTypeList.c b/lib/libgssapi/generated/asn1_MechTypeList.c new file mode 100644 index 00000000000..b4ec8a23ef7 --- /dev/null +++ b/lib/libgssapi/generated/asn1_MechTypeList.c @@ -0,0 +1,115 @@ +/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */ +/* Do not edit */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#include <spnego_asn1.h> +#include <asn1_err.h> +#include <der.h> +#include <parse_units.h> + +#define BACK if (e) return e; p -= l; len -= l; ret += l + +int +encode_MechTypeList(unsigned char *p, size_t len, const MechTypeList *data, size_t *size) +{ +size_t ret = 0; +size_t l; +int i, e; + +i = 0; +for(i = (data)->len - 1; i >= 0; --i) { +int oldret = ret; +ret = 0; +e = encode_MechType(p, len, &(data)->val[i], &l); +BACK; +ret += oldret; +} +e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, &l); +BACK; +*size = ret; +return 0; +} + +#define FORW if(e) goto fail; p += l; len -= l; ret += l + +int +decode_MechTypeList(const unsigned char *p, size_t len, MechTypeList *data, size_t *size) +{ +size_t ret = 0, reallen; +size_t l; +int e; + +memset(data, 0, sizeof(*data)); +reallen = 0; +e = der_match_tag_and_length (p, len, ASN1_C_UNIV, CONS, UT_Sequence,&reallen, &l); +FORW; +if(len < reallen) +return ASN1_OVERRUN; +len = reallen; +{ +size_t origlen = len; +int oldret = ret; +ret = 0; +(data)->len = 0; +(data)->val = NULL; +while(ret < origlen) { +(data)->len++; +(data)->val = realloc((data)->val, sizeof(*((data)->val)) * (data)->len); +e = decode_MechType(p, len, &(data)->val[(data)->len-1], &l); +FORW; +len = origlen - ret; +} +ret += oldret; +} +if(size) *size = ret; +return 0; +fail: +free_MechTypeList(data); +return e; +} + +void +free_MechTypeList(MechTypeList *data) +{ +while((data)->len){ +free_MechType(&(data)->val[(data)->len-1]); +(data)->len--; +} +free((data)->val); +(data)->val = NULL; +} + +size_t +length_MechTypeList(const MechTypeList *data) +{ +size_t ret = 0; +{ +int oldret = ret; +int i; +ret = 0; +for(i = (data)->len - 1; i >= 0; --i){ +int oldret = ret; +ret = 0; +ret += length_MechType(&(data)->val[i]); +ret += oldret; +} +ret += 1 + length_len(ret) + oldret; +} +return ret; +} + +int +copy_MechTypeList(const MechTypeList *from, MechTypeList *to) +{ +if(((to)->val = malloc((from)->len * sizeof(*(to)->val))) == NULL && (from)->len != 0) +return ENOMEM; +for((to)->len = 0; (to)->len < (from)->len; (to)->len++){ +if(copy_MechType(&(from)->val[(to)->len], &(to)->val[(to)->len])) return ENOMEM; +} +return 0; +} + diff --git a/lib/libgssapi/generated/asn1_NegTokenInit.c b/lib/libgssapi/generated/asn1_NegTokenInit.c new file mode 100644 index 00000000000..5a68e81972b --- /dev/null +++ b/lib/libgssapi/generated/asn1_NegTokenInit.c @@ -0,0 +1,297 @@ +/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */ +/* Do not edit */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#include <spnego_asn1.h> +#include <asn1_err.h> +#include <der.h> +#include <parse_units.h> + +#define BACK if (e) return e; p -= l; len -= l; ret += l + +int +encode_NegTokenInit(unsigned char *p, size_t len, const NegTokenInit *data, size_t *size) +{ +size_t ret = 0; +size_t l; +int i, e; + +i = 0; +if((data)->mechListMIC) +{ +int oldret = ret; +ret = 0; +e = encode_octet_string(p, len, (data)->mechListMIC, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 3, &l); +BACK; +ret += oldret; +} +if((data)->mechToken) +{ +int oldret = ret; +ret = 0; +e = encode_octet_string(p, len, (data)->mechToken, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 2, &l); +BACK; +ret += oldret; +} +if((data)->reqFlags) +{ +int oldret = ret; +ret = 0; +e = encode_ContextFlags(p, len, (data)->reqFlags, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 1, &l); +BACK; +ret += oldret; +} +if((data)->mechTypes) +{ +int oldret = ret; +ret = 0; +e = encode_MechTypeList(p, len, (data)->mechTypes, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 0, &l); +BACK; +ret += oldret; +} +e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, &l); +BACK; +*size = ret; +return 0; +} + +#define FORW if(e) goto fail; p += l; len -= l; ret += l + +int +decode_NegTokenInit(const unsigned char *p, size_t len, NegTokenInit *data, size_t *size) +{ +size_t ret = 0, reallen; +size_t l; +int e; + +memset(data, 0, sizeof(*data)); +reallen = 0; +e = der_match_tag_and_length (p, len, ASN1_C_UNIV, CONS, UT_Sequence,&reallen, &l); +FORW; +{ +int dce_fix; +if((dce_fix = fix_dce(reallen, &len)) < 0) +return ASN1_BAD_FORMAT; +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 0, &l); +if (e) +(data)->mechTypes = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->mechTypes = malloc(sizeof(*(data)->mechTypes)); +if((data)->mechTypes == NULL) return ENOMEM; +e = decode_MechTypeList(p, len, (data)->mechTypes, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 1, &l); +if (e) +(data)->reqFlags = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->reqFlags = malloc(sizeof(*(data)->reqFlags)); +if((data)->reqFlags == NULL) return ENOMEM; +e = decode_ContextFlags(p, len, (data)->reqFlags, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 2, &l); +if (e) +(data)->mechToken = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->mechToken = malloc(sizeof(*(data)->mechToken)); +if((data)->mechToken == NULL) return ENOMEM; +e = decode_octet_string(p, len, (data)->mechToken, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 3, &l); +if (e) +(data)->mechListMIC = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->mechListMIC = malloc(sizeof(*(data)->mechListMIC)); +if((data)->mechListMIC == NULL) return ENOMEM; +e = decode_octet_string(p, len, (data)->mechListMIC, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +} +} +if(size) *size = ret; +return 0; +fail: +free_NegTokenInit(data); +return e; +} + +void +free_NegTokenInit(NegTokenInit *data) +{ +if((data)->mechTypes) { +free_MechTypeList((data)->mechTypes); +free((data)->mechTypes); +(data)->mechTypes = NULL; +} +if((data)->reqFlags) { +free_ContextFlags((data)->reqFlags); +free((data)->reqFlags); +(data)->reqFlags = NULL; +} +if((data)->mechToken) { +free_octet_string((data)->mechToken); +free((data)->mechToken); +(data)->mechToken = NULL; +} +if((data)->mechListMIC) { +free_octet_string((data)->mechListMIC); +free((data)->mechListMIC); +(data)->mechListMIC = NULL; +} +} + +size_t +length_NegTokenInit(const NegTokenInit *data) +{ +size_t ret = 0; +if((data)->mechTypes){ +int oldret = ret; +ret = 0; +ret += length_MechTypeList((data)->mechTypes); +ret += 1 + length_len(ret) + oldret; +} +if((data)->reqFlags){ +int oldret = ret; +ret = 0; +ret += length_ContextFlags((data)->reqFlags); +ret += 1 + length_len(ret) + oldret; +} +if((data)->mechToken){ +int oldret = ret; +ret = 0; +ret += length_octet_string((data)->mechToken); +ret += 1 + length_len(ret) + oldret; +} +if((data)->mechListMIC){ +int oldret = ret; +ret = 0; +ret += length_octet_string((data)->mechListMIC); +ret += 1 + length_len(ret) + oldret; +} +ret += 1 + length_len(ret); +return ret; +} + +int +copy_NegTokenInit(const NegTokenInit *from, NegTokenInit *to) +{ +if((from)->mechTypes) { +(to)->mechTypes = malloc(sizeof(*(to)->mechTypes)); +if((to)->mechTypes == NULL) return ENOMEM; +if(copy_MechTypeList((from)->mechTypes, (to)->mechTypes)) return ENOMEM; +}else +(to)->mechTypes = NULL; +if((from)->reqFlags) { +(to)->reqFlags = malloc(sizeof(*(to)->reqFlags)); +if((to)->reqFlags == NULL) return ENOMEM; +if(copy_ContextFlags((from)->reqFlags, (to)->reqFlags)) return ENOMEM; +}else +(to)->reqFlags = NULL; +if((from)->mechToken) { +(to)->mechToken = malloc(sizeof(*(to)->mechToken)); +if((to)->mechToken == NULL) return ENOMEM; +if(copy_octet_string((from)->mechToken, (to)->mechToken)) return ENOMEM; +}else +(to)->mechToken = NULL; +if((from)->mechListMIC) { +(to)->mechListMIC = malloc(sizeof(*(to)->mechListMIC)); +if((to)->mechListMIC == NULL) return ENOMEM; +if(copy_octet_string((from)->mechListMIC, (to)->mechListMIC)) return ENOMEM; +}else +(to)->mechListMIC = NULL; +return 0; +} + diff --git a/lib/libgssapi/generated/asn1_NegTokenTarg.c b/lib/libgssapi/generated/asn1_NegTokenTarg.c new file mode 100644 index 00000000000..c967fa6c69e --- /dev/null +++ b/lib/libgssapi/generated/asn1_NegTokenTarg.c @@ -0,0 +1,296 @@ +/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */ +/* Do not edit */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#include <spnego_asn1.h> +#include <asn1_err.h> +#include <der.h> +#include <parse_units.h> + +#define BACK if (e) return e; p -= l; len -= l; ret += l + +int +encode_NegTokenTarg(unsigned char *p, size_t len, const NegTokenTarg *data, size_t *size) +{ +size_t ret = 0; +size_t l; +int i, e; + +i = 0; +if((data)->mechListMIC) +{ +int oldret = ret; +ret = 0; +e = encode_octet_string(p, len, (data)->mechListMIC, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 3, &l); +BACK; +ret += oldret; +} +if((data)->responseToken) +{ +int oldret = ret; +ret = 0; +e = encode_octet_string(p, len, (data)->responseToken, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 2, &l); +BACK; +ret += oldret; +} +if((data)->supportedMech) +{ +int oldret = ret; +ret = 0; +e = encode_MechType(p, len, (data)->supportedMech, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 1, &l); +BACK; +ret += oldret; +} +if((data)->negResult) +{ +int oldret = ret; +ret = 0; +e = encode_enumerated(p, len, (data)->negResult, &l); +BACK; +e = der_put_length_and_tag (p, len, ret, ASN1_C_CONTEXT, CONS, 0, &l); +BACK; +ret += oldret; +} +e = der_put_length_and_tag (p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, &l); +BACK; +*size = ret; +return 0; +} + +#define FORW if(e) goto fail; p += l; len -= l; ret += l + +int +decode_NegTokenTarg(const unsigned char *p, size_t len, NegTokenTarg *data, size_t *size) +{ +size_t ret = 0, reallen; +size_t l; +int e; + +memset(data, 0, sizeof(*data)); +reallen = 0; +e = der_match_tag_and_length (p, len, ASN1_C_UNIV, CONS, UT_Sequence,&reallen, &l); +FORW; +{ +int dce_fix; +if((dce_fix = fix_dce(reallen, &len)) < 0) +return ASN1_BAD_FORMAT; +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 0, &l); +if (e) +(data)->negResult = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->negResult = malloc(sizeof(*(data)->negResult)); +if((data)->negResult == NULL) return ENOMEM; +e = decode_enumerated(p, len, (data)->negResult, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 1, &l); +if (e) +(data)->supportedMech = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->supportedMech = malloc(sizeof(*(data)->supportedMech)); +if((data)->supportedMech == NULL) return ENOMEM; +e = decode_MechType(p, len, (data)->supportedMech, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 2, &l); +if (e) +(data)->responseToken = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->responseToken = malloc(sizeof(*(data)->responseToken)); +if((data)->responseToken == NULL) return ENOMEM; +e = decode_octet_string(p, len, (data)->responseToken, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +{ +size_t newlen, oldlen; + +e = der_match_tag (p, len, ASN1_C_CONTEXT, CONS, 3, &l); +if (e) +(data)->mechListMIC = NULL; +else { +p += l; +len -= l; +ret += l; +e = der_get_length (p, len, &newlen, &l); +FORW; +{ +int dce_fix; +oldlen = len; +if((dce_fix = fix_dce(newlen, &len)) < 0)return ASN1_BAD_FORMAT; +(data)->mechListMIC = malloc(sizeof(*(data)->mechListMIC)); +if((data)->mechListMIC == NULL) return ENOMEM; +e = decode_octet_string(p, len, (data)->mechListMIC, &l); +FORW; +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +}else +len = oldlen - newlen; +} +} +} +if(dce_fix){ +e = der_match_tag_and_length (p, len, (Der_class)0, (Der_type)0, 0, &reallen, &l); +FORW; +} +} +if(size) *size = ret; +return 0; +fail: +free_NegTokenTarg(data); +return e; +} + +void +free_NegTokenTarg(NegTokenTarg *data) +{ +if((data)->negResult) { +free((data)->negResult); +(data)->negResult = NULL; +} +if((data)->supportedMech) { +free_MechType((data)->supportedMech); +free((data)->supportedMech); +(data)->supportedMech = NULL; +} +if((data)->responseToken) { +free_octet_string((data)->responseToken); +free((data)->responseToken); +(data)->responseToken = NULL; +} +if((data)->mechListMIC) { +free_octet_string((data)->mechListMIC); +free((data)->mechListMIC); +(data)->mechListMIC = NULL; +} +} + +size_t +length_NegTokenTarg(const NegTokenTarg *data) +{ +size_t ret = 0; +if((data)->negResult){ +int oldret = ret; +ret = 0; +ret += length_enumerated((data)->negResult); +ret += 1 + length_len(ret) + oldret; +} +if((data)->supportedMech){ +int oldret = ret; +ret = 0; +ret += length_MechType((data)->supportedMech); +ret += 1 + length_len(ret) + oldret; +} +if((data)->responseToken){ +int oldret = ret; +ret = 0; +ret += length_octet_string((data)->responseToken); +ret += 1 + length_len(ret) + oldret; +} +if((data)->mechListMIC){ +int oldret = ret; +ret = 0; +ret += length_octet_string((data)->mechListMIC); +ret += 1 + length_len(ret) + oldret; +} +ret += 1 + length_len(ret); +return ret; +} + +int +copy_NegTokenTarg(const NegTokenTarg *from, NegTokenTarg *to) +{ +if((from)->negResult) { +(to)->negResult = malloc(sizeof(*(to)->negResult)); +if((to)->negResult == NULL) return ENOMEM; +*((to)->negResult) = *((from)->negResult); +}else +(to)->negResult = NULL; +if((from)->supportedMech) { +(to)->supportedMech = malloc(sizeof(*(to)->supportedMech)); +if((to)->supportedMech == NULL) return ENOMEM; +if(copy_MechType((from)->supportedMech, (to)->supportedMech)) return ENOMEM; +}else +(to)->supportedMech = NULL; +if((from)->responseToken) { +(to)->responseToken = malloc(sizeof(*(to)->responseToken)); +if((to)->responseToken == NULL) return ENOMEM; +if(copy_octet_string((from)->responseToken, (to)->responseToken)) return ENOMEM; +}else +(to)->responseToken = NULL; +if((from)->mechListMIC) { +(to)->mechListMIC = malloc(sizeof(*(to)->mechListMIC)); +if((to)->mechListMIC == NULL) return ENOMEM; +if(copy_octet_string((from)->mechListMIC, (to)->mechListMIC)) return ENOMEM; +}else +(to)->mechListMIC = NULL; +return 0; +} + diff --git a/lib/libgssapi/generated/asn1_NegotiationToken.c b/lib/libgssapi/generated/asn1_NegotiationToken.c new file mode 100644 index 00000000000..4f49e4957e7 --- /dev/null +++ b/lib/libgssapi/generated/asn1_NegotiationToken.c @@ -0,0 +1,15 @@ +/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */ +/* Do not edit */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#include <spnego_asn1.h> +#include <asn1_err.h> +#include <der.h> +#include <parse_units.h> + +/* CHOICE */ +int asn1_NegotiationToken_dummy_holder = 1; diff --git a/lib/libgssapi/generated/asn1_files b/lib/libgssapi/generated/asn1_files new file mode 100644 index 00000000000..a2d2c187630 --- /dev/null +++ b/lib/libgssapi/generated/asn1_files @@ -0,0 +1 @@ +asn1_MechType.x asn1_MechTypeList.x asn1_ContextFlags.x asn1_NegTokenInit.x asn1_NegTokenTarg.x asn1_NegotiationToken.x diff --git a/lib/libgssapi/generated/spnego_asn1.h b/lib/libgssapi/generated/spnego_asn1.h new file mode 100644 index 00000000000..a3c88baf102 --- /dev/null +++ b/lib/libgssapi/generated/spnego_asn1.h @@ -0,0 +1,165 @@ +/* Generated from /home/biorn/src/lib/libgssapi/../../kerberosV/src/lib/gssapi/spnego.asn1 */ +/* Do not edit */ + +#ifndef __spnego_asn1_h__ +#define __spnego_asn1_h__ + +#include <stddef.h> +#include <time.h> + +time_t timegm (struct tm*); + +#ifndef __asn1_common_definitions__ +#define __asn1_common_definitions__ + +typedef struct heim_octet_string { + size_t length; + void *data; +} heim_octet_string; + +typedef char *heim_general_string; + +typedef char *heim_utf8_string; + +typedef struct heim_oid { + size_t length; + unsigned *components; +} heim_oid; + +#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \ + do { \ + (BL) = length_##T((S)); \ + (B) = malloc((BL)); \ + if((B) == NULL) { \ + (R) = ENOMEM; \ + } else { \ + (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \ + (S), (L)); \ + if((R) != 0) { \ + free((B)); \ + (B) = NULL; \ + } \ + } \ + } while (0) + +#endif + +/* +MechType ::= OBJECT IDENTIFIER +*/ + +typedef heim_oid MechType; + +int encode_MechType(unsigned char *, size_t, const MechType *, size_t *); +int decode_MechType(const unsigned char *, size_t, MechType *, size_t *); +void free_MechType (MechType *); +size_t length_MechType(const MechType *); +int copy_MechType (const MechType *, MechType *); + + +/* +MechTypeList ::= SEQUENCE OF MechType +*/ + +typedef struct MechTypeList { + unsigned int len; + MechType *val; +} MechTypeList; + +int encode_MechTypeList(unsigned char *, size_t, const MechTypeList *, size_t *); +int decode_MechTypeList(const unsigned char *, size_t, MechTypeList *, size_t *); +void free_MechTypeList (MechTypeList *); +size_t length_MechTypeList(const MechTypeList *); +int copy_MechTypeList (const MechTypeList *, MechTypeList *); + + +/* +ContextFlags ::= BIT STRING { + delegFlag(0), + mutualFlag(1), + replayFlag(2), + sequenceFlag(3), + anonFlag(4), + confFlag(5), + integFlag(6) +} +*/ + +typedef struct ContextFlags { + unsigned int delegFlag:1; + unsigned int mutualFlag:1; + unsigned int replayFlag:1; + unsigned int sequenceFlag:1; + unsigned int anonFlag:1; + unsigned int confFlag:1; + unsigned int integFlag:1; +} ContextFlags; + + +int encode_ContextFlags(unsigned char *, size_t, const ContextFlags *, size_t *); +int decode_ContextFlags(const unsigned char *, size_t, ContextFlags *, size_t *); +void free_ContextFlags (ContextFlags *); +size_t length_ContextFlags(const ContextFlags *); +int copy_ContextFlags (const ContextFlags *, ContextFlags *); +unsigned ContextFlags2int(ContextFlags); +ContextFlags int2ContextFlags(unsigned); +const struct units * asn1_ContextFlags_units(void); + +/* +NegTokenInit ::= SEQUENCE { + mechTypes[0] MechTypeList OPTIONAL, + reqFlags[1] ContextFlags OPTIONAL, + mechToken[2] OCTET STRING OPTIONAL, + mechListMIC[3] OCTET STRING OPTIONAL +} +*/ + +typedef struct NegTokenInit { + MechTypeList *mechTypes; + ContextFlags *reqFlags; + heim_octet_string *mechToken; + heim_octet_string *mechListMIC; +} NegTokenInit; + +int encode_NegTokenInit(unsigned char *, size_t, const NegTokenInit *, size_t *); +int decode_NegTokenInit(const unsigned char *, size_t, NegTokenInit *, size_t *); +void free_NegTokenInit (NegTokenInit *); +size_t length_NegTokenInit(const NegTokenInit *); +int copy_NegTokenInit (const NegTokenInit *, NegTokenInit *); + + +/* +NegTokenTarg ::= SEQUENCE { + negResult[0] ENUMERATED { + accept_completed(0), + accept_incomplete(1), + reject(2) + } OPTIONAL, + supportedMech[1] MechType OPTIONAL, + responseToken[2] OCTET STRING OPTIONAL, + mechListMIC[3] OCTET STRING OPTIONAL +} +*/ + +typedef struct NegTokenTarg { + enum { + accept_completed = 0, + accept_incomplete = 1, + reject = 2 + } *negResult; + + MechType *supportedMech; + heim_octet_string *responseToken; + heim_octet_string *mechListMIC; +} NegTokenTarg; + +int encode_NegTokenTarg(unsigned char *, size_t, const NegTokenTarg *, size_t *); +int decode_NegTokenTarg(const unsigned char *, size_t, NegTokenTarg *, size_t *); +void free_NegTokenTarg (NegTokenTarg *); +size_t length_NegTokenTarg(const NegTokenTarg *); +int copy_NegTokenTarg (const NegTokenTarg *, NegTokenTarg *); + + + + +#endif /* __spnego_asn1_h__ */ diff --git a/lib/libgssapi/shlib_version b/lib/libgssapi/shlib_version index d9961ea9fef..3066b9771e7 100644 --- a/lib/libgssapi/shlib_version +++ b/lib/libgssapi/shlib_version @@ -1,2 +1,2 @@ -major=4 +major=5 minor=0 |