nfs-ganesha 1.4

gssd.h

Go to the documentation of this file.
00001 /*
00002   Copyright (c) 2004 The Regents of the University of Michigan.
00003   All rights reserved.
00004 
00005   Redistribution and use in source and binary forms, with or without
00006   modification, are permitted provided that the following conditions
00007   are met:
00008 
00009   1. Redistributions of source code must retain the above copyright
00010      notice, this list of conditions and the following disclaimer.
00011   2. Redistributions in binary form must reproduce the above copyright
00012      notice, this list of conditions and the following disclaimer in the
00013      documentation and/or other materials provided with the distribution.
00014   3. Neither the name of the University nor the names of its
00015      contributors may be used to endorse or promote products derived
00016      from this software without specific prior written permission.
00017 
00018   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
00019   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00020   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021   DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00022   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
00025   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00026   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00027   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 */
00030 
00031 #ifndef _RPC_GSSD_H_
00032 #define _RPC_GSSD_H_
00033 
00034 #include <sys/types.h>
00035 #include <sys/queue.h>
00036 #include <gssapi/gssapi.h>
00037 
00038 #define MAX_FILE_NAMELEN        32
00039 #define FD_ALLOC_BLOCK          256
00040 #ifndef GSSD_PIPEFS_DIR
00041 #define GSSD_PIPEFS_DIR         "/var/lib/nfs/rpc_pipefs"
00042 #endif
00043 /* #define INFO                 "info" */
00044 #define KRB5                    "krb5"
00045 #define DNOTIFY_SIGNAL          (SIGRTMIN + 3)
00046 
00047 #define GSSD_DEFAULT_CRED_DIR                   "/tmp"
00048 #define GSSD_DEFAULT_CRED_PREFIX                "krb5cc_"
00049 #define GSSD_DEFAULT_MACHINE_CRED_SUFFIX        "machine"
00050 #define GSSD_DEFAULT_KEYTAB_FILE                "/etc/krb5.keytab"
00051 #define GSSD_SERVICE_NAME                       "nfs"
00052 #define GSSD_SERVICE_NAME_LEN                   3
00053 #define GSSD_MAX_CCACHE_SEARCH                  16
00054 
00055 /*
00056  * The gss mechanisms that we can handle
00057  */
00058 enum {AUTHTYPE_KRB5, AUTHTYPE_SPKM3, AUTHTYPE_LIPKEY};
00059 
00060 
00061 
00062 extern char                     pipefs_dir[PATH_MAX];
00063 extern char                     keytabfile[PATH_MAX];
00064 extern char                     *ccachesearch[];
00065 extern int                      use_memcache;
00066 extern int                      root_uses_machine_creds;
00067 extern unsigned int             context_timeout;
00068 extern char                     *preferred_realm;
00069 
00070 TAILQ_HEAD(clnt_list_head, clnt_info) clnt_list;
00071 
00072 struct clnt_info {
00073         TAILQ_ENTRY(clnt_info)  list;
00074         char                    *dirname;
00075         int                     dir_fd;
00076         char                    *servicename;
00077         char                    *servername;
00078         int                     prog;
00079         int                     vers;
00080         char                    *protocol;
00081         int                     krb5_fd;
00082         int                     krb5_poll_index;
00083         int                     spkm3_fd;
00084         int                     spkm3_poll_index;
00085         int                     gssd_fd;
00086         int                     gssd_poll_index;
00087         struct sockaddr_storage addr;
00088 };
00089 
00090 TAILQ_HEAD(topdirs_list_head, topdirs_info) topdirs_list;
00091 
00092 struct topdirs_info {
00093         TAILQ_ENTRY(topdirs_info)   list;
00094         char                    *dirname;
00095         int                     fd;
00096 };
00097 
00098 void init_client_list(void);
00099 int update_client_list(void);
00100 void handle_krb5_upcall(struct clnt_info *clp);
00101 void handle_spkm3_upcall(struct clnt_info *clp);
00102 void handle_gssd_upcall(struct clnt_info *clp);
00103 void gssd_run(void);
00104 
00105 
00106 #endif /* _RPC_GSSD_H_ */