-: 0:Source:krb5_decode_kdc.c -: 0:Graph:/var/tsitkova/Sources/v10/trunk/src/lib/krb5/asn.1/krb5_decode_kdc.so.gcno -: 0:Data:/var/tsitkova/Sources/v10/trunk/src/lib/krb5/asn.1/krb5_decode_kdc.so.gcda -: 0:Runs:1602 -: 0:Programs:1 -: 1:/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -: 2:/* lib/krb5/asn.1/krb5_decode_kdc.c */ -: 3:/* -: 4: * Copyright 1994, 2008. 2010 by the Massachusetts Institute of Technology. -: 5: * All Rights Reserved. -: 6: * -: 7: * Export of this software from the United States of America may -: 8: * require a specific license from the United States Government. -: 9: * It is the responsibility of any person or organization contemplating -: 10: * export to obtain such a license before exporting. -: 11: * -: 12: * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and -: 13: * distribute this software and its documentation for any purpose and -: 14: * without fee is hereby granted, provided that the above copyright -: 15: * notice appear in all copies and that both that copyright notice and -: 16: * this permission notice appear in supporting documentation, and that -: 17: * the name of M.I.T. not be used in advertising or publicity pertaining -: 18: * to distribution of the software without specific, written prior -: 19: * permission. Furthermore if you modify this software you must label -: 20: * your software as modified software and not distribute it in such a -: 21: * fashion that it might be confused with the original M.I.T. software. -: 22: * M.I.T. makes no representations about the suitability of -: 23: * this software for any purpose. It is provided "as is" without express -: 24: * or implied warranty. -: 25: */ -: 26: -: 27:#include "k5-int.h" -: 28:#include "krbasn1.h" -: 29:#include "krb5_decode_macros.h" -: 30: -: 31:krb5_error_code 1090: 32:decode_krb5_as_req(const krb5_data *code, krb5_kdc_req **repptr) -: 33:{ 1090: 34: setup_no_length(krb5_kdc_req *); 1090: 35: alloc_field(rep); 1090: 36: clear_field(rep,padata); 1090: 37: clear_field(rep,client); 1090: 38: clear_field(rep,server); 1090: 39: clear_field(rep,ktype); 1090: 40: clear_field(rep,addresses); 1090: 41: clear_field(rep,authorization_data.ciphertext.data); 1090: 42: clear_field(rep,unenc_authdata); 1090: 43: clear_field(rep,second_ticket); -: 44: 1090: 45: check_apptag(10); 1087: 46: retval = asn1_decode_kdc_req(&buf,rep); 1087: 47: if (retval) clean_return(retval); -: 48:#ifdef KRB5_MSGTYPE_STRICT -: 49: if (rep->msg_type != KRB5_AS_REQ) clean_return(KRB5_BADMSGTYPE); -: 50:#endif -: 51: 621: 52: cleanup_manual(); -: 53:error_out: 469: 54: krb5_free_kdc_req(NULL, rep); 469: 55: return retval; -: 56:} -: 57: -: 58:krb5_error_code 1019: 59:decode_krb5_tgs_req(const krb5_data *code, krb5_kdc_req **repptr) -: 60:{ 1019: 61: setup_no_length(krb5_kdc_req *); 1019: 62: alloc_field(rep); 1019: 63: clear_field(rep,padata); 1019: 64: clear_field(rep,client); 1019: 65: clear_field(rep,server); 1019: 66: clear_field(rep,ktype); 1019: 67: clear_field(rep,addresses); 1019: 68: clear_field(rep,authorization_data.ciphertext.data); 1019: 69: clear_field(rep,unenc_authdata); 1019: 70: clear_field(rep,second_ticket); -: 71: 1019: 72: check_apptag(12); 1016: 73: retval = asn1_decode_kdc_req(&buf,rep); 1016: 74: if (retval) clean_return(retval); -: 75:#ifdef KRB5_MSGTYPE_STRICT -: 76: if (rep->msg_type != KRB5_TGS_REQ) clean_return(KRB5_BADMSGTYPE); -: 77:#endif -: 78: 550: 79: cleanup_manual(); -: 80:error_out: 469: 81: krb5_free_kdc_req(NULL, rep); 469: 82: return retval; -: 83:} -: 84: -: 85:krb5_error_code 779: 86:decode_krb5_kdc_req_body(const krb5_data *code, krb5_kdc_req **repptr) -: 87:{ 779: 88: setup_buf_only(krb5_kdc_req *); 779: 89: alloc_field(rep); -: 90: 779: 91: retval = asn1_decode_kdc_req_body(&buf,rep); 779: 92: if (retval) clean_return(retval); -: 93: 386: 94: cleanup(free); -: 95:} -: 96: -: 97:krb5_error_code 12: 98:decode_krb5_fast_req(const krb5_data *code, krb5_fast_req **repptr) -: 99:{ 12: 100: setup(krb5_fast_req *); 12: 101: alloc_field(rep); 12: 102: alloc_field(rep->req_body); 12: 103: clear_field(rep, req_body->padata); 12: 104: {begin_structure(); 12: 105: get_field(rep->fast_options, 0, asn1_decode_krb5_flags); 12: 106: opt_field(rep->req_body->padata, 1, asn1_decode_sequence_of_pa_data); 12: 107: get_field(*(rep->req_body), 2, asn1_decode_kdc_req_body); 12: 108: end_structure(); } 12: 109: rep->magic = KV5M_FAST_REQ; 12: 110: cleanup_manual(); -: 111:error_out: #####: 112: if (rep) { #####: 113: if (rep->req_body) #####: 114: krb5_free_kdc_req(0, rep->req_body); #####: 115: free(rep); -: 116: } #####: 117: return retval; -: 118:} -: 119: -: 120:krb5_error_code 12: 121:decode_krb5_pa_fx_fast_request(const krb5_data *code, krb5_fast_armored_req **repptr) -: 122:{ 12: 123: setup(krb5_fast_armored_req *); 12: 124: alloc_field(rep); 12: 125: clear_field(rep, armor); -: 126: { -: 127: int indef KRB5_ATTR_UNUSED; -: 128: unsigned int taglen KRB5_ATTR_UNUSED; 12: 129: next_tag_from_buf(buf); 12: 130: if (tagnum != 0) #####: 131: clean_return(ASN1_BAD_ID); -: 132: } 12: 133: {begin_structure(); 12: 134: opt_field(rep->armor, 0, asn1_decode_fast_armor_ptr); 12: 135: get_field(rep->req_checksum, 1, asn1_decode_checksum); 12: 136: get_field(rep->enc_part, 2, asn1_decode_encrypted_data); 12: 137: end_structure();} 12: 138: rep->magic = KV5M_FAST_ARMORED_REQ; 12: 139: cleanup(free); -: 140:} -: 141: -: 142:#ifndef DISABLE_PKINIT -: 143:krb5_error_code 2: 144:decode_krb5_pa_pk_as_req(const krb5_data *code, krb5_pa_pk_as_req **repptr) -: 145:{ 2: 146: setup_buf_only(krb5_pa_pk_as_req *); 2: 147: alloc_field(rep); -: 148: 2: 149: retval = asn1_decode_pa_pk_as_req(&buf, rep); 2: 150: if (retval) clean_return(retval); -: 151: 2: 152: cleanup(free); -: 153:} -: 154: -: 155:krb5_error_code #####: 156:decode_krb5_pa_pk_as_req_draft9(const krb5_data *code, -: 157: krb5_pa_pk_as_req_draft9 **repptr) -: 158:{ #####: 159: setup_buf_only(krb5_pa_pk_as_req_draft9 *); #####: 160: alloc_field(rep); -: 161: #####: 162: retval = asn1_decode_pa_pk_as_req_draft9(&buf, rep); #####: 163: if (retval) clean_return(retval); -: 164: #####: 165: cleanup(free); -: 166:} -: 167:#endif /* DISABLE_PKINIT */