]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/gssd/gssd.h
gssd: Use /run/user/${UID} instead of /run/user/${USER}
[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          256
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_USER_CRED_DIR                      "/run/user/%U"
49 #define GSSD_DEFAULT_CRED_PREFIX                "krb5cc"
50 #define GSSD_DEFAULT_MACHINE_CRED_SUFFIX        "machine"
51 #define GSSD_DEFAULT_KEYTAB_FILE                "/etc/krb5.keytab"
52 #define GSSD_SERVICE_NAME                       "nfs"
53 #define GSSD_SERVICE_NAME_LEN                   3
54 #define GSSD_MAX_CCACHE_SEARCH                  16
55
56 /*
57  * The gss mechanisms that we can handle
58  */
59 enum {AUTHTYPE_KRB5, AUTHTYPE_LIPKEY};
60
61
62
63 extern char                     pipefs_dir[PATH_MAX];
64 extern char                     keytabfile[PATH_MAX];
65 extern char                     *ccachesearch[];
66 extern int                      use_memcache;
67 extern int                      root_uses_machine_creds;
68 extern unsigned int             context_timeout;
69 extern char                     *preferred_realm;
70
71 TAILQ_HEAD(clnt_list_head, clnt_info) clnt_list;
72
73 struct clnt_info {
74         TAILQ_ENTRY(clnt_info)  list;
75         char                    *dirname;
76         int                     dir_fd;
77         char                    *servicename;
78         char                    *servername;
79         int                     prog;
80         int                     vers;
81         char                    *protocol;
82         int                     krb5_fd;
83         int                     krb5_poll_index;
84         int                     krb5_close_me;
85         int                     gssd_fd;
86         int                     gssd_poll_index;
87         int                     gssd_close_me;
88         struct sockaddr_storage addr;
89 };
90
91 TAILQ_HEAD(topdirs_list_head, topdirs_info) topdirs_list;
92
93 struct topdirs_info {
94         TAILQ_ENTRY(topdirs_info)   list;
95         char                    *dirname;
96         int                     fd;
97 };
98
99 void init_client_list(void);
100 int update_client_list(void);
101 void handle_krb5_upcall(struct clnt_info *clp);
102 void handle_gssd_upcall(struct clnt_info *clp);
103 void gssd_run(void);
104
105
106 #endif /* _RPC_GSSD_H_ */