]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/gssd/gssd.h
Allow gssd ccaches in MEMORY: rather than FILE:
[nfs-utils.git] / utils / gssd / gssd.h
1 /*
2   Copyright (c) 2004 The Regents of the University of Michigan.
3   All rights reserved.
4
5   Redistribution and use in source and binary forms, with or without
6   modification, are permitted provided that the following conditions
7   are met:
8
9   1. Redistributions of source code must retain the above copyright
10      notice, this list of conditions and the following disclaimer.
11   2. Redistributions in binary form must reproduce the above copyright
12      notice, this list of conditions and the following disclaimer in the
13      documentation and/or other materials provided with the distribution.
14   3. Neither the name of the University nor the names of its
15      contributors may be used to endorse or promote products derived
16      from this software without specific prior written permission.
17
18   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21   DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef _RPC_GSSD_H_
32 #define _RPC_GSSD_H_
33
34 #include <sys/types.h>
35 #include <sys/queue.h>
36 #include <gssapi/gssapi.h>
37
38 #define MAX_FILE_NAMELEN        32
39 #define FD_ALLOC_BLOCK          32
40 #ifndef GSSD_PIPEFS_DIR
41 #define GSSD_PIPEFS_DIR         "/var/lib/nfs/rpc_pipefs"
42 #endif
43 #define INFO                    "info"
44 #define KRB5                    "krb5"
45 #define DNOTIFY_SIGNAL          (SIGRTMIN + 3)
46
47 #define GSSD_DEFAULT_CRED_DIR                   "/tmp"
48 #define GSSD_DEFAULT_CRED_PREFIX                "krb5cc_"
49 #define GSSD_DEFAULT_MACHINE_CRED_SUFFIX        "machine"
50 #define GSSD_DEFAULT_KEYTAB_FILE                "/etc/krb5.keytab"
51 #define GSSD_SERVICE_NAME                       "nfs"
52 #define GSSD_SERVICE_NAME_LEN                   3
53
54 /*
55  * The gss mechanisms that we can handle
56  */
57 enum {AUTHTYPE_KRB5, AUTHTYPE_SPKM3, AUTHTYPE_LIPKEY};
58
59
60
61 extern char                     pipefsdir[PATH_MAX];
62 extern char                     keytabfile[PATH_MAX];
63 extern char                     ccachedir[PATH_MAX];
64 extern int                      use_memcache;
65
66 TAILQ_HEAD(clnt_list_head, clnt_info) clnt_list;
67
68 struct clnt_info {
69         TAILQ_ENTRY(clnt_info)  list;
70         char                    *dirname;
71         int                     dir_fd;
72         char                    *servicename;
73         char                    *servername;
74         int                     prog;
75         int                     vers;
76         char                    *protocol;
77         int                     krb5_fd;
78         int                     krb5_poll_index;
79         int                     spkm3_fd;
80         int                     spkm3_poll_index;
81 };
82
83 void init_client_list(void);
84 int update_client_list(void);
85 void handle_krb5_upcall(struct clnt_info *clp);
86 void handle_spkm3_upcall(struct clnt_info *clp);
87 int gssd_acquire_cred(char *server_name);
88 void gssd_run(void);
89
90
91 #endif /* _RPC_GSSD_H_ */