2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2N/A * Copyright 1995 by the Massachusetts Institute of Technology. 2N/A * All Rights Reserved. 2N/A * Export of this software from the United States of America may 2N/A * require a specific license from the United States Government. 2N/A * It is the responsibility of any person or organization contemplating 2N/A * export to obtain such a license before exporting. 2N/A * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 2N/A * distribute this software and its documentation for any purpose and 2N/A * without fee is hereby granted, provided that the above copyright 2N/A * notice appear in all copies and that both that copyright notice and 2N/A * this permission notice appear in supporting documentation, and that 2N/A * the name of M.I.T. not be used in advertising or publicity pertaining 2N/A * to distribution of the software without specific, written prior 2N/A * permission. Furthermore if you modify this software you must label 2N/A * your software as modified software and not distribute it in such a 2N/A * fashion that it might be confused with the original M.I.T. software. 2N/A * M.I.T. makes no representations about the suitability of 2N/A * this software for any purpose. It is provided "as is" without express 2N/A * or implied warranty. 2N/A /* need to store the NULL for decoding */ 2N/A * Generate one lump of data from the krb5_db_entry. 2N/A * This data must be independent of byte order of the machine, 2N/A * compact and extensible. 2N/A * First allocate enough space for all the data. 2N/A * Need 2 bytes for the length of the base structure 2N/A * then 36 [ 8 * 4 + 2 * 2] bytes for the base information 2N/A * [ attributes, max_life, max_renewable_life, expiration, 2N/A * pw_expiration, last_success, last_failed, fail_auth_count ] 2N/A * [ n_key_data, n_tl_data ] 2N/A * then XX bytes [ e_length ] for the extra data [ e_data ] 2N/A * then XX bytes [ 2 for length + length for string ] for the principal, 2N/A * then (4 [type + length] + tl_data_length) bytes per tl_data 2N/A * then (4 + (4 + key_data_length) per key_data_contents) bytes per key_data 2N/A /* tl_data is a linked list */ 2N/A /* key_data is an array */ 2N/A * Now we go through entry again, this time copying data 2N/A * These first entries are always saved regardless of version 2N/A /* Max Renewable Life */ 2N/A /* When the client expires */ 2N/A /* When its passwd expires */ 2N/A /* Last successful passwd */ 2N/A /* Last failed passwd attempt */ 2N/A /* # of failed passwd attempt */ 2N/A /* # tl_data strutures */ 2N/A /* # key_data strutures */ 2N/A /* Put extended fields here */ 2N/A /* Any extra data that this version doesn't understand. */ 2N/A * Now we get to the principal. 2N/A * To squeze a few extra bytes out it is always assumed to come 2N/A * after the base type. 2N/A /* tl_data is a linked list, of type, legth, contents */ 2N/A /* key_data is an array */ 2N/A /* Zero out entry and NULL pointers */ 2N/A * undo the effects of encode_princ_contents. 2N/A * The first part is decoding the base type. If the base type is 2N/A * bigger than the original base type then the additional fields 2N/A * need to be filled in. If the base type is larger than any 2N/A * known base type the additional data goes in e_data. 2N/A /* First do the easy stuff */ 2N/A /* Max Renewable Life */ 2N/A /* When the client expires */ 2N/A /* When its passwd expires */ 2N/A /* Last successful passwd */ 2N/A /* Last failed passwd attempt */ 2N/A /* # of failed passwd attempt */ 2N/A /* # tl_data strutures */ 2N/A /* # key_data strutures */ 2N/A /* Check for extra data */ 2N/A * Get the principal name for the entry 2N/A * (stored as a string which gets unparsed.) 2N/A /* tl_data is a linked list */ 2N/A /* key_data is an array */ 2N/A /* key_data_ver determins number of elements and how to unparse them. */ 2N/A /* This isn't right. I'll fix it later */