1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* lib/krb5/ccache/scc.h */
3 /*
4  * Copyright 1990,1991 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 /*
28  *
29  * This file contains constant and function declarations used in the
30  * file-based credential cache routines.
31  */
32 
33 #ifndef __KRB5_FILE_CCACHE__
34 #define __KRB5_FILE_CCACHE__
35 
36 #include "k5-int.h"
37 #include <stdio.h>
38 
39 #define KRB5_OK 0
40 
41 #define KRB5_SCC_MAXLEN 100
42 
43 /*
44  * SCC version 2 contains type information for principals.  SCC
45  * version 1 does not.  The code will accept either, and depending on
46  * what KRB5_SCC_DEFAULT_FVNO is set to, it will create version 1 or
47  * version 2 SCC caches.
48  *
49  */
50 
51 #define KRB5_SCC_FVNO_1   0x0501        /* krb v5, scc v1 */
52 #define KRB5_SCC_FVNO_2   0x0502        /* krb v5, scc v2 */
53 #define KRB5_SCC_FVNO_3   0x0503        /* krb v5, scc v3 */
54 #define KRB5_SCC_FVNO_4   0x0504        /* krb v5, scc v4 */
55 
56 #define SCC_OPEN_AND_ERASE      1
57 #define SCC_OPEN_RDWR           2
58 #define SCC_OPEN_RDONLY         3
59 
60 /* Credential file header tags.
61  * The header tags are constructed as:
62  *     krb5_ui_2       tag
63  *     krb5_ui_2       len
64  *     krb5_octet      data[len]
65  * This format allows for older versions of the fcc processing code to skip
66  * past unrecognized tag formats.
67  */
68 #define SCC_TAG_DELTATIME       1
69 
70 #ifndef TKT_ROOT
71 #define TKT_ROOT "/tmp/tkt"
72 #endif
73 
74 typedef struct _krb5_scc_data {
75     char *filename;
76     FILE *file;
77     krb5_flags flags;
78     char stdio_buffer[BUFSIZ];
79     int version;
80 } krb5_scc_data;
81 
82 /* An off_t can be arbitrarily complex */
83 typedef struct _krb5_scc_cursor {
84     long pos;
85 } krb5_scc_cursor;
86 
87 /* DO NOT ADD ANYTHING AFTER THIS #endif */
88 #endif /* __KRB5_FILE_CCACHE__ */
89