summaryrefslogtreecommitdiffstats
path: root/src/include/krb5/keytab.h
blob: 5135f3eee3f55f6c1c9370e6c83087ff0820b0b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * include/krb5/keytab.h
 *
 * Copyright 1990 by the Massachusetts Institute of Technology.
 * All Rights Reserved.
 *
 * Export of this software from the United States of America may
 *   require a specific license from the United States Government.
 *   It is the responsibility of any person or organization contemplating
 *   export to obtain such a license before exporting.
 * 
 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
 * distribute this software and its documentation for any purpose and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of M.I.T. not be used in advertising or publicity pertaining
 * to distribution of the software without specific, written prior
 * permission.  M.I.T. makes no representations about the suitability of
 * this software for any purpose.  It is provided "as is" without express
 * or implied warranty.
 * 
 *
 * Keytab definitions.
 */


#ifndef KRB5_KEYTAB__
#define KRB5_KEYTAB__


/* XXX */
#define MAX_KEYTAB_NAME_LEN 1100 /* Long enough for MAXPATHLEN + some extra */

typedef krb5_pointer krb5_kt_cursor;	/* XXX */

typedef struct krb5_keytab_entry_st {
    krb5_magic magic;
    krb5_principal principal;	/* principal of this key */
    krb5_timestamp timestamp;   /* time entry written to keytable */
    krb5_kvno vno;		/* key version number */
    krb5_keyblock key;		/* the secret key */
} krb5_keytab_entry;


typedef struct _krb5_kt {
    krb5_magic magic;
    struct _krb5_kt_ops FAR *ops;
    krb5_pointer data;
} FAR *krb5_keytab;


typedef struct _krb5_kt_ops {
    krb5_magic magic;
    char FAR *prefix;
    /* routines always present */
    krb5_error_code (*resolve) 
	NPROTOTYPE((krb5_context,
		    const char FAR *,
		    krb5_keytab FAR *));
    krb5_error_code (*get_name) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab,
		    char FAR *,
		    int));
    krb5_error_code (*close) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab));
    krb5_error_code (*get) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab,
		    krb5_principal,
		    krb5_kvno,
		    krb5_keytype,
		    krb5_keytab_entry FAR *));
    krb5_error_code (*start_seq_get) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab,
		    krb5_kt_cursor FAR *));	
    krb5_error_code (*get_next) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab,
		    krb5_keytab_entry FAR *,
		    krb5_kt_cursor FAR *));
    krb5_error_code (*end_get) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab,
		    krb5_kt_cursor FAR *));
    /* routines to be included on extended version (write routines) */
    krb5_error_code (*add) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab,
		    krb5_keytab_entry FAR *));
    krb5_error_code (*remove) 
	NPROTOTYPE((krb5_context,
		    krb5_keytab,
		  krb5_keytab_entry FAR *));
} krb5_kt_ops;

#define krb5_kt_get_name(context, keytab, name, namelen) (*(keytab)->ops->get_name)(context, keytab,name,namelen)
#define krb5_kt_close(context, keytab) (*(keytab)->ops->close)(context, keytab)
#define krb5_kt_get_entry(context, keytab, principal, vno, keytype, entry) (*(keytab)->ops->get)(context, keytab, principal, vno, keytype, entry)
#define krb5_kt_start_seq_get(context, keytab, cursor) (*(keytab)->ops->start_seq_get)(context, keytab, cursor)
#define krb5_kt_next_entry(context, keytab, entry, cursor) (*(keytab)->ops->get_next)(context, keytab, entry, cursor)
#define krb5_kt_end_seq_get(context, keytab, cursor) (*(keytab)->ops->end_get)(context, keytab, cursor)
/* remove and add are functions, so that they can return NOWRITE
   if not a writable keytab */


extern krb5_kt_ops krb5_kt_dfl_ops;

#endif /* KRB5_KEYTAB__ */