ktfile.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
0258980882ae9b13d6496fb92f9a03e0174d2345dugan/*
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * Use is subject to license terms.
0258980882ae9b13d6496fb92f9a03e0174d2345dugan *
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * lib/krb5/keytab/file/ktfile.h
0258980882ae9b13d6496fb92f9a03e0174d2345dugan *
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * Copyright 1990 by the Massachusetts Institute of Technology.
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * All Rights Reserved.
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac *
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * Export of this software from the United States of America may
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * require a specific license from the United States Government.
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * It is the responsibility of any person or organization contemplating
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * export to obtain such a license before exporting.
0258980882ae9b13d6496fb92f9a03e0174d2345dugan *
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * distribute this software and its documentation for any purpose and
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * without fee is hereby granted, provided that the above copyright
3437829f938dbb44527d91fbbc5f430a1243c5a5JnRouvignac * notice appear in all copies and that both that copyright notice and
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * this permission notice appear in supporting documentation, and that
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * the name of M.I.T. not be used in advertising or publicity pertaining
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * to distribution of the software without specific, written prior
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * permission. Furthermore if you modify this software you must label
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * your software as modified software and not distribute it in such a
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * fashion that it might be confused with the original M.I.T. software.
50dc873c54509e599dd90f9761c2e513e745b2bcludo * M.I.T. makes no representations about the suitability of
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * this software for any purpose. It is provided "as is" without express
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * or implied warranty.
0258980882ae9b13d6496fb92f9a03e0174d2345dugan *
0258980882ae9b13d6496fb92f9a03e0174d2345dugan *
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * This header file contains information needed by internal routines
396f75ca15234ac35cb8990f241225330c19c43amatthew * of the file-based ticket cache implementation.
396f75ca15234ac35cb8990f241225330c19c43amatthew */
396f75ca15234ac35cb8990f241225330c19c43amatthew
0258980882ae9b13d6496fb92f9a03e0174d2345dugan#ifndef _KRB5_KTFILE
0258980882ae9b13d6496fb92f9a03e0174d2345dugan#define _KRB5_KTFILE
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
396f75ca15234ac35cb8990f241225330c19c43amatthew#pragma ident "%Z%%M% %I% %E% SMI"
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugan#include <stdio.h>
396f75ca15234ac35cb8990f241225330c19c43amatthew#include <sys/mman.h>
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthew/*
396f75ca15234ac35cb8990f241225330c19c43amatthew * Constants
396f75ca15234ac35cb8990f241225330c19c43amatthew */
396f75ca15234ac35cb8990f241225330c19c43amatthew#define IGNORE_VNO 0
396f75ca15234ac35cb8990f241225330c19c43amatthew#define IGNORE_ENCTYPE 0
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthew#define KRB5_KT_VNO_1 0x0501 /* krb v5, keytab version 1 (DCE compat) */
396f75ca15234ac35cb8990f241225330c19c43amatthew#define KRB5_KT_VNO 0x0502 /* krb v5, keytab version 2 (standard) */
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthew#define KRB5_KT_DEFAULT_VNO KRB5_KT_VNO
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
396f75ca15234ac35cb8990f241225330c19c43amatthew/*
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * Types
396f75ca15234ac35cb8990f241225330c19c43amatthew */
396f75ca15234ac35cb8990f241225330c19c43amatthewtypedef struct _krb5_ktfile_data {
396f75ca15234ac35cb8990f241225330c19c43amatthew char *name; /* Name of the file */
396f75ca15234ac35cb8990f241225330c19c43amatthew char *datap; /* ptr to the file data */
396f75ca15234ac35cb8990f241225330c19c43amatthew int version; /* Version number of keytab */
396f75ca15234ac35cb8990f241225330c19c43amatthew offset_t offset; /* current offset into the data buffer */
0258980882ae9b13d6496fb92f9a03e0174d2345dugan size_t filesize; /* size of original file */
0258980882ae9b13d6496fb92f9a03e0174d2345dugan size_t bufsize; /* total size of data buffer */
0258980882ae9b13d6496fb92f9a03e0174d2345dugan uchar_t writable:1; /* Was the file opened for writing? */
0258980882ae9b13d6496fb92f9a03e0174d2345dugan} krb5_ktfile_data;
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugan/*
0258980882ae9b13d6496fb92f9a03e0174d2345dugan * Macros
0258980882ae9b13d6496fb92f9a03e0174d2345dugan */
0258980882ae9b13d6496fb92f9a03e0174d2345dugan#define KTPRIVATE(id) ((krb5_ktfile_data *)(id)->data)
0258980882ae9b13d6496fb92f9a03e0174d2345dugan#define KTFILENAME(id) (((krb5_ktfile_data *)(id)->data)->name)
0258980882ae9b13d6496fb92f9a03e0174d2345dugan/*
0258980882ae9b13d6496fb92f9a03e0174d2345dugan#define KTFILEP(id) (((krb5_ktfile_data *)(id)->data)->openf)
396f75ca15234ac35cb8990f241225330c19c43amatthew*/
396f75ca15234ac35cb8990f241225330c19c43amatthew#define KTDATAP(id) (((krb5_ktfile_data *)(id)->data)->datap)
396f75ca15234ac35cb8990f241225330c19c43amatthew#define KTVERSION(id) (((krb5_ktfile_data *)(id)->data)->version)
396f75ca15234ac35cb8990f241225330c19c43amatthew#define KTOFFSET(id) (((krb5_ktfile_data *)(id)->data)->offset)
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewextern struct _krb5_kt_ops krb5_ktf_ops;
396f75ca15234ac35cb8990f241225330c19c43amatthewextern struct _krb5_kt_ops krb5_ktf_writable_ops;
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_resolve
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew const char *,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_wresolve
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew const char *,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_get_name
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab,
396f75ca15234ac35cb8990f241225330c19c43amatthew char *,
396f75ca15234ac35cb8990f241225330c19c43amatthew int));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_close
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_get_entry
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_const_principal,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_kvno,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_enctype,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab_entry *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_start_seq_get
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_kt_cursor *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_get_next
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab_entry *,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_kt_cursor *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_end_get
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_kt_cursor *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthew/* routines to be included on extended version (write routines) */
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_add
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab_entry *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code KRB5_CALLCONV krb5_ktfile_remove
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab_entry *));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code krb5_ktfileint_openr
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code krb5_ktfileint_openw
396f75ca15234ac35cb8990f241225330c19c43amatthew PROTOTYPE((krb5_context,
396f75ca15234ac35cb8990f241225330c19c43amatthew krb5_keytab));
396f75ca15234ac35cb8990f241225330c19c43amatthew
396f75ca15234ac35cb8990f241225330c19c43amatthewkrb5_error_code krb5_ktfileint_close
0258980882ae9b13d6496fb92f9a03e0174d2345dugan PROTOTYPE((krb5_context,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab));
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugankrb5_error_code krb5_ktfileint_read_entry
0258980882ae9b13d6496fb92f9a03e0174d2345dugan PROTOTYPE((krb5_context,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab_entry *));
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugankrb5_error_code krb5_ktfileint_write_entry
0258980882ae9b13d6496fb92f9a03e0174d2345dugan PROTOTYPE((krb5_context,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab_entry *));
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugankrb5_error_code krb5_ktfileint_delete_entry
0258980882ae9b13d6496fb92f9a03e0174d2345dugan PROTOTYPE((krb5_context,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_int32));
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugankrb5_error_code krb5_ktfileint_internal_read_entry
0258980882ae9b13d6496fb92f9a03e0174d2345dugan PROTOTYPE((krb5_context,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab_entry *,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_int32 *));
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugankrb5_error_code krb5_ktfileint_size_entry
0258980882ae9b13d6496fb92f9a03e0174d2345dugan PROTOTYPE((krb5_context,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab_entry *,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_int32 *));
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugankrb5_error_code krb5_ktfileint_find_slot
0258980882ae9b13d6496fb92f9a03e0174d2345dugan PROTOTYPE((krb5_context,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_keytab,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_int32 *,
0258980882ae9b13d6496fb92f9a03e0174d2345dugan krb5_int32 *));
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugan
0258980882ae9b13d6496fb92f9a03e0174d2345dugan#endif /* _KRB5_KTFILE */
0258980882ae9b13d6496fb92f9a03e0174d2345dugan