]> git.decadent.org.uk Git - nfs-utils.git/blob - support/rpc/include/rpc/auth_gss.h
Add debugging to better detect negotiation of enctype not supported by kernel
[nfs-utils.git] / support / rpc / include / rpc / auth_gss.h
1 /*
2   auth_gss.h
3
4   Copyright (c) 2000 The Regents of the University of Michigan.
5   All rights reserved.
6
7   Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>.
8   All rights reserved, all wrongs reversed.
9
10   Redistribution and use in source and binary forms, with or without
11   modification, are permitted provided that the following conditions
12   are met:
13
14   1. Redistributions of source code must retain the above copyright
15      notice, this list of conditions and the following disclaimer.
16   2. Redistributions in binary form must reproduce the above copyright
17      notice, this list of conditions and the following disclaimer in the
18      documentation and/or other materials provided with the distribution.
19   3. Neither the name of the University nor the names of its
20      contributors may be used to endorse or promote products derived
21      from this software without specific prior written permission.
22
23   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
24   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26   DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
35 */
36
37 #ifndef _RPC_AUTH_GSS_H
38 #define _RPC_AUTH_GSS_H
39
40 #include <rpc/clnt.h>
41 #include <gssapi/gssapi.h>
42
43 /* RPCSEC_GSS control procedures. */
44 typedef enum {
45         RPCSEC_GSS_DATA = 0,
46         RPCSEC_GSS_INIT = 1,
47         RPCSEC_GSS_CONTINUE_INIT = 2,
48         RPCSEC_GSS_DESTROY = 3
49 } rpc_gss_proc_t;
50
51 /* RPCSEC_GSS services. */
52 typedef enum {
53         RPCSEC_GSS_SVC_NONE = 1,
54         RPCSEC_GSS_SVC_INTEGRITY = 2,
55         RPCSEC_GSS_SVC_PRIVACY = 3
56 } rpc_gss_svc_t;
57
58 #define RPCSEC_GSS_VERSION      1
59
60 /* RPCSEC_GSS security triple. */
61 struct rpc_gss_sec {
62         gss_OID         mech;           /* mechanism */
63         gss_qop_t       qop;            /* quality of protection */
64         rpc_gss_svc_t   svc;            /* service */
65         gss_cred_id_t   cred;           /* cred handle */
66         u_int           req_flags;      /* req flags for init_sec_context */
67 };
68
69 /* Private data required for kernel implementation */
70 struct authgss_private_data {
71         gss_ctx_id_t    pd_ctx;         /* Session context handle */
72         gss_buffer_desc pd_ctx_hndl;    /* Credentials context handle */
73         u_int           pd_seq_win;     /* Sequence window */
74 };
75
76 /* Credentials. */
77 struct rpc_gss_cred {
78         u_int           gc_v;           /* version */
79         rpc_gss_proc_t  gc_proc;        /* control procedure */
80         u_int           gc_seq;         /* sequence number */
81         rpc_gss_svc_t   gc_svc;         /* service */
82         gss_buffer_desc gc_ctx;         /* context handle */
83 };
84
85 /* Context creation response. */
86 struct rpc_gss_init_res {
87         gss_buffer_desc         gr_ctx;         /* context handle */
88         u_int                   gr_major;       /* major status */
89         u_int                   gr_minor;       /* minor status */
90         u_int                   gr_win;         /* sequence window */
91         gss_buffer_desc         gr_token;       /* token */
92 };
93
94 /* Maximum sequence number value. */
95 #define MAXSEQ          0x80000000
96
97 /* Prototypes. */
98 __BEGIN_DECLS
99 bool_t  xdr_rpc_gss_cred        __P((XDR *xdrs, struct rpc_gss_cred *p));
100 bool_t  xdr_rpc_gss_init_args   __P((XDR *xdrs, gss_buffer_desc *p));
101 bool_t  xdr_rpc_gss_init_res    __P((XDR *xdrs, struct rpc_gss_init_res *p));
102 bool_t  xdr_rpc_gss_data        __P((XDR *xdrs, xdrproc_t xdr_func,
103                                      caddr_t xdr_ptr, gss_ctx_id_t ctx,
104                                      gss_qop_t qop, rpc_gss_svc_t svc,
105                                      u_int seq));
106
107 AUTH   *authgss_create          __P((CLIENT *, gss_name_t,
108                                      struct rpc_gss_sec *));
109 AUTH   *authgss_create_default  __P((CLIENT *, char *, struct rpc_gss_sec *));
110 bool_t authgss_service          __P((AUTH *auth, int svc));
111 bool_t authgss_get_private_data __P((AUTH *auth,
112                                      struct authgss_private_data *));
113
114
115 void    log_debug               __P((const char *fmt, ...));
116 void    log_status              __P((char *m, OM_uint32 major,
117                                      OM_uint32 minor));
118 void    log_hexdump             __P((const u_char *buf, int len, int offset));
119
120 __END_DECLS
121
122 #endif /* !_RPC_AUTH_GSS_H */