blob: 380152603d1e003de8590487844a2b2cc7184b73 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Neil Brown <neilb@cse.unsw.edu.au>
3 * J. Bruce Fields <bfields@umich.edu>
4 * Andy Adamson <andros@umich.edu>
5 * Dug Song <dugsong@monkey.org>
6 *
7 * RPCSEC_GSS server authentication.
8 * This implements RPCSEC_GSS as defined in rfc2203 (rpcsec_gss) and rfc2078
9 * (gssapi)
10 *
11 * The RPCSEC_GSS involves three stages:
12 * 1/ context creation
13 * 2/ data exchange
14 * 3/ context destruction
15 *
16 * Context creation is handled largely by upcalls to user-space.
17 * In particular, GSS_Accept_sec_context is handled by an upcall
18 * Data exchange is handled entirely within the kernel
19 * In particular, GSS_GetMIC, GSS_VerifyMIC, GSS_Seal, GSS_Unseal are in-kernel.
20 * Context destruction is handled in-kernel
21 * GSS_Delete_sec_context is in-kernel
22 *
23 * Context creation is initiated by a RPCSEC_GSS_INIT request arriving.
24 * The context handle and gss_token are used as a key into the rpcsec_init cache.
25 * The content of this cache includes some of the outputs of GSS_Accept_sec_context,
26 * being major_status, minor_status, context_handle, reply_token.
27 * These are sent back to the client.
28 * Sequence window management is handled by the kernel. The window size if currently
29 * a compile time constant.
30 *
31 * When user-space is happy that a context is established, it places an entry
32 * in the rpcsec_context cache. The key for this cache is the context_handle.
33 * The content includes:
34 * uid/gidlist - for determining access rights
35 * mechanism type
36 * mechanism specific information, such as a key
37 *
38 */
39
40#include <linux/types.h>
41#include <linux/module.h>
42#include <linux/pagemap.h>
43
44#include <linux/sunrpc/auth_gss.h>
45#include <linux/sunrpc/svcauth.h>
46#include <linux/sunrpc/gss_err.h>
47#include <linux/sunrpc/svcauth.h>
48#include <linux/sunrpc/svcauth_gss.h>
49#include <linux/sunrpc/cache.h>
50
51#ifdef RPC_DEBUG
52# define RPCDBG_FACILITY RPCDBG_AUTH
53#endif
54
55/* The rpcsec_init cache is used for mapping RPCSEC_GSS_{,CONT_}INIT requests
56 * into replies.
57 *
58 * Key is context handle (\x if empty) and gss_token.
59 * Content is major_status minor_status (integers) context_handle, reply_token.
60 *
61 */
62
63static int netobj_equal(struct xdr_netobj *a, struct xdr_netobj *b)
64{
65 return a->len == b->len && 0 == memcmp(a->data, b->data, a->len);
66}
67
68#define RSI_HASHBITS 6
69#define RSI_HASHMAX (1<<RSI_HASHBITS)
70#define RSI_HASHMASK (RSI_HASHMAX-1)
71
72struct rsi {
73 struct cache_head h;
74 struct xdr_netobj in_handle, in_token;
75 struct xdr_netobj out_handle, out_token;
76 int major_status, minor_status;
77};
78
79static struct cache_head *rsi_table[RSI_HASHMAX];
80static struct cache_detail rsi_cache;
NeilBrownd4d11ea2006-03-27 01:15:04 -080081static struct rsi *rsi_update(struct rsi *new, struct rsi *old);
82static struct rsi *rsi_lookup(struct rsi *item);
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
84static void rsi_free(struct rsi *rsii)
85{
86 kfree(rsii->in_handle.data);
87 kfree(rsii->in_token.data);
88 kfree(rsii->out_handle.data);
89 kfree(rsii->out_token.data);
90}
91
92static void rsi_put(struct cache_head *item, struct cache_detail *cd)
93{
94 struct rsi *rsii = container_of(item, struct rsi, h);
95 if (cache_put(item, cd)) {
96 rsi_free(rsii);
97 kfree(rsii);
98 }
99}
100
101static inline int rsi_hash(struct rsi *item)
102{
103 return hash_mem(item->in_handle.data, item->in_handle.len, RSI_HASHBITS)
104 ^ hash_mem(item->in_token.data, item->in_token.len, RSI_HASHBITS);
105}
106
NeilBrownd4d11ea2006-03-27 01:15:04 -0800107static int rsi_match(struct cache_head *a, struct cache_head *b)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108{
NeilBrownd4d11ea2006-03-27 01:15:04 -0800109 struct rsi *item = container_of(a, struct rsi, h);
110 struct rsi *tmp = container_of(b, struct rsi, h);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 return netobj_equal(&item->in_handle, &tmp->in_handle)
112 && netobj_equal(&item->in_token, &tmp->in_token);
113}
114
115static int dup_to_netobj(struct xdr_netobj *dst, char *src, int len)
116{
117 dst->len = len;
118 dst->data = (len ? kmalloc(len, GFP_KERNEL) : NULL);
119 if (dst->data)
120 memcpy(dst->data, src, len);
121 if (len && !dst->data)
122 return -ENOMEM;
123 return 0;
124}
125
126static inline int dup_netobj(struct xdr_netobj *dst, struct xdr_netobj *src)
127{
128 return dup_to_netobj(dst, src->data, src->len);
129}
130
NeilBrownd4d11ea2006-03-27 01:15:04 -0800131static void rsi_init(struct cache_head *cnew, struct cache_head *citem)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132{
NeilBrownd4d11ea2006-03-27 01:15:04 -0800133 struct rsi *new = container_of(cnew, struct rsi, h);
134 struct rsi *item = container_of(citem, struct rsi, h);
135
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 new->out_handle.data = NULL;
137 new->out_handle.len = 0;
138 new->out_token.data = NULL;
139 new->out_token.len = 0;
140 new->in_handle.len = item->in_handle.len;
141 item->in_handle.len = 0;
142 new->in_token.len = item->in_token.len;
143 item->in_token.len = 0;
144 new->in_handle.data = item->in_handle.data;
145 item->in_handle.data = NULL;
146 new->in_token.data = item->in_token.data;
147 item->in_token.data = NULL;
148}
149
NeilBrownd4d11ea2006-03-27 01:15:04 -0800150static void update_rsi(struct cache_head *cnew, struct cache_head *citem)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151{
NeilBrownd4d11ea2006-03-27 01:15:04 -0800152 struct rsi *new = container_of(cnew, struct rsi, h);
153 struct rsi *item = container_of(citem, struct rsi, h);
154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 BUG_ON(new->out_handle.data || new->out_token.data);
156 new->out_handle.len = item->out_handle.len;
157 item->out_handle.len = 0;
158 new->out_token.len = item->out_token.len;
159 item->out_token.len = 0;
160 new->out_handle.data = item->out_handle.data;
161 item->out_handle.data = NULL;
162 new->out_token.data = item->out_token.data;
163 item->out_token.data = NULL;
164
165 new->major_status = item->major_status;
166 new->minor_status = item->minor_status;
167}
168
NeilBrownd4d11ea2006-03-27 01:15:04 -0800169static struct cache_head *rsi_alloc(void)
170{
171 struct rsi *rsii = kmalloc(sizeof(*rsii), GFP_KERNEL);
172 if (rsii)
173 return &rsii->h;
174 else
175 return NULL;
176}
177
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178static void rsi_request(struct cache_detail *cd,
179 struct cache_head *h,
180 char **bpp, int *blen)
181{
182 struct rsi *rsii = container_of(h, struct rsi, h);
183
184 qword_addhex(bpp, blen, rsii->in_handle.data, rsii->in_handle.len);
185 qword_addhex(bpp, blen, rsii->in_token.data, rsii->in_token.len);
186 (*bpp)[-1] = '\n';
187}
188
189
190static int rsi_parse(struct cache_detail *cd,
191 char *mesg, int mlen)
192{
193 /* context token expiry major minor context token */
194 char *buf = mesg;
195 char *ep;
196 int len;
197 struct rsi rsii, *rsip = NULL;
198 time_t expiry;
199 int status = -EINVAL;
200
201 memset(&rsii, 0, sizeof(rsii));
202 /* handle */
203 len = qword_get(&mesg, buf, mlen);
204 if (len < 0)
205 goto out;
206 status = -ENOMEM;
207 if (dup_to_netobj(&rsii.in_handle, buf, len))
208 goto out;
209
210 /* token */
211 len = qword_get(&mesg, buf, mlen);
212 status = -EINVAL;
213 if (len < 0)
214 goto out;
215 status = -ENOMEM;
216 if (dup_to_netobj(&rsii.in_token, buf, len))
217 goto out;
218
NeilBrownd4d11ea2006-03-27 01:15:04 -0800219 rsip = rsi_lookup(&rsii);
220 if (!rsip)
221 goto out;
222
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 rsii.h.flags = 0;
224 /* expiry */
225 expiry = get_expiry(&mesg);
226 status = -EINVAL;
227 if (expiry == 0)
228 goto out;
229
230 /* major/minor */
231 len = qword_get(&mesg, buf, mlen);
232 if (len < 0)
233 goto out;
234 if (len == 0) {
235 goto out;
236 } else {
237 rsii.major_status = simple_strtoul(buf, &ep, 10);
238 if (*ep)
239 goto out;
240 len = qword_get(&mesg, buf, mlen);
241 if (len <= 0)
242 goto out;
243 rsii.minor_status = simple_strtoul(buf, &ep, 10);
244 if (*ep)
245 goto out;
246
247 /* out_handle */
248 len = qword_get(&mesg, buf, mlen);
249 if (len < 0)
250 goto out;
251 status = -ENOMEM;
252 if (dup_to_netobj(&rsii.out_handle, buf, len))
253 goto out;
254
255 /* out_token */
256 len = qword_get(&mesg, buf, mlen);
257 status = -EINVAL;
258 if (len < 0)
259 goto out;
260 status = -ENOMEM;
261 if (dup_to_netobj(&rsii.out_token, buf, len))
262 goto out;
263 }
264 rsii.h.expiry_time = expiry;
NeilBrownd4d11ea2006-03-27 01:15:04 -0800265 rsip = rsi_update(&rsii, rsip);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266 status = 0;
267out:
268 rsi_free(&rsii);
269 if (rsip)
270 rsi_put(&rsip->h, &rsi_cache);
NeilBrownd4d11ea2006-03-27 01:15:04 -0800271 else
272 status = -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 return status;
274}
275
276static struct cache_detail rsi_cache = {
Bruce Allanf35279d2005-09-06 15:17:08 -0700277 .owner = THIS_MODULE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278 .hash_size = RSI_HASHMAX,
279 .hash_table = rsi_table,
280 .name = "auth.rpcsec.init",
281 .cache_put = rsi_put,
282 .cache_request = rsi_request,
283 .cache_parse = rsi_parse,
NeilBrownd4d11ea2006-03-27 01:15:04 -0800284 .match = rsi_match,
285 .init = rsi_init,
286 .update = update_rsi,
287 .alloc = rsi_alloc,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288};
289
NeilBrownd4d11ea2006-03-27 01:15:04 -0800290static struct rsi *rsi_lookup(struct rsi *item)
291{
292 struct cache_head *ch;
293 int hash = rsi_hash(item);
294
295 ch = sunrpc_cache_lookup(&rsi_cache, &item->h, hash);
296 if (ch)
297 return container_of(ch, struct rsi, h);
298 else
299 return NULL;
300}
301
302static struct rsi *rsi_update(struct rsi *new, struct rsi *old)
303{
304 struct cache_head *ch;
305 int hash = rsi_hash(new);
306
307 ch = sunrpc_cache_update(&rsi_cache, &new->h,
308 &old->h, hash);
309 if (ch)
310 return container_of(ch, struct rsi, h);
311 else
312 return NULL;
313}
314
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315
316/*
317 * The rpcsec_context cache is used to store a context that is
318 * used in data exchange.
319 * The key is a context handle. The content is:
320 * uid, gidlist, mechanism, service-set, mech-specific-data
321 */
322
323#define RSC_HASHBITS 10
324#define RSC_HASHMAX (1<<RSC_HASHBITS)
325#define RSC_HASHMASK (RSC_HASHMAX-1)
326
327#define GSS_SEQ_WIN 128
328
329struct gss_svc_seq_data {
330 /* highest seq number seen so far: */
331 int sd_max;
332 /* for i such that sd_max-GSS_SEQ_WIN < i <= sd_max, the i-th bit of
333 * sd_win is nonzero iff sequence number i has been seen already: */
334 unsigned long sd_win[GSS_SEQ_WIN/BITS_PER_LONG];
335 spinlock_t sd_lock;
336};
337
338struct rsc {
339 struct cache_head h;
340 struct xdr_netobj handle;
341 struct svc_cred cred;
342 struct gss_svc_seq_data seqdata;
343 struct gss_ctx *mechctx;
344};
345
346static struct cache_head *rsc_table[RSC_HASHMAX];
347static struct cache_detail rsc_cache;
NeilBrown17f834b62006-03-27 01:15:05 -0800348static struct rsc *rsc_update(struct rsc *new, struct rsc *old);
349static struct rsc *rsc_lookup(struct rsc *item);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350
351static void rsc_free(struct rsc *rsci)
352{
353 kfree(rsci->handle.data);
354 if (rsci->mechctx)
355 gss_delete_sec_context(&rsci->mechctx);
356 if (rsci->cred.cr_group_info)
357 put_group_info(rsci->cred.cr_group_info);
358}
359
360static void rsc_put(struct cache_head *item, struct cache_detail *cd)
361{
362 struct rsc *rsci = container_of(item, struct rsc, h);
363
364 if (cache_put(item, cd)) {
365 rsc_free(rsci);
366 kfree(rsci);
367 }
368}
369
370static inline int
371rsc_hash(struct rsc *rsci)
372{
373 return hash_mem(rsci->handle.data, rsci->handle.len, RSC_HASHBITS);
374}
375
NeilBrown17f834b62006-03-27 01:15:05 -0800376static int
377rsc_match(struct cache_head *a, struct cache_head *b)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378{
NeilBrown17f834b62006-03-27 01:15:05 -0800379 struct rsc *new = container_of(a, struct rsc, h);
380 struct rsc *tmp = container_of(b, struct rsc, h);
381
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 return netobj_equal(&new->handle, &tmp->handle);
383}
384
NeilBrown17f834b62006-03-27 01:15:05 -0800385static void
386rsc_init(struct cache_head *cnew, struct cache_head *ctmp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387{
NeilBrown17f834b62006-03-27 01:15:05 -0800388 struct rsc *new = container_of(cnew, struct rsc, h);
389 struct rsc *tmp = container_of(ctmp, struct rsc, h);
390
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 new->handle.len = tmp->handle.len;
392 tmp->handle.len = 0;
393 new->handle.data = tmp->handle.data;
394 tmp->handle.data = NULL;
395 new->mechctx = NULL;
396 new->cred.cr_group_info = NULL;
397}
398
NeilBrown17f834b62006-03-27 01:15:05 -0800399static void
400update_rsc(struct cache_head *cnew, struct cache_head *ctmp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401{
NeilBrown17f834b62006-03-27 01:15:05 -0800402 struct rsc *new = container_of(cnew, struct rsc, h);
403 struct rsc *tmp = container_of(ctmp, struct rsc, h);
404
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 new->mechctx = tmp->mechctx;
406 tmp->mechctx = NULL;
407 memset(&new->seqdata, 0, sizeof(new->seqdata));
408 spin_lock_init(&new->seqdata.sd_lock);
409 new->cred = tmp->cred;
410 tmp->cred.cr_group_info = NULL;
411}
412
NeilBrown17f834b62006-03-27 01:15:05 -0800413static struct cache_head *
414rsc_alloc(void)
415{
416 struct rsc *rsci = kmalloc(sizeof(*rsci), GFP_KERNEL);
417 if (rsci)
418 return &rsci->h;
419 else
420 return NULL;
421}
422
Linus Torvalds1da177e2005-04-16 15:20:36 -0700423static int rsc_parse(struct cache_detail *cd,
424 char *mesg, int mlen)
425{
426 /* contexthandle expiry [ uid gid N <n gids> mechname ...mechdata... ] */
427 char *buf = mesg;
428 int len, rv;
429 struct rsc rsci, *rscp = NULL;
430 time_t expiry;
431 int status = -EINVAL;
432
433 memset(&rsci, 0, sizeof(rsci));
434 /* context handle */
435 len = qword_get(&mesg, buf, mlen);
436 if (len < 0) goto out;
437 status = -ENOMEM;
438 if (dup_to_netobj(&rsci.handle, buf, len))
439 goto out;
440
441 rsci.h.flags = 0;
442 /* expiry */
443 expiry = get_expiry(&mesg);
444 status = -EINVAL;
445 if (expiry == 0)
446 goto out;
447
NeilBrown17f834b62006-03-27 01:15:05 -0800448 rscp = rsc_lookup(&rsci);
449 if (!rscp)
450 goto out;
451
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 /* uid, or NEGATIVE */
453 rv = get_int(&mesg, &rsci.cred.cr_uid);
454 if (rv == -EINVAL)
455 goto out;
456 if (rv == -ENOENT)
457 set_bit(CACHE_NEGATIVE, &rsci.h.flags);
458 else {
459 int N, i;
460 struct gss_api_mech *gm;
461
462 /* gid */
463 if (get_int(&mesg, &rsci.cred.cr_gid))
464 goto out;
465
466 /* number of additional gid's */
467 if (get_int(&mesg, &N))
468 goto out;
469 status = -ENOMEM;
470 rsci.cred.cr_group_info = groups_alloc(N);
471 if (rsci.cred.cr_group_info == NULL)
472 goto out;
473
474 /* gid's */
475 status = -EINVAL;
476 for (i=0; i<N; i++) {
477 gid_t gid;
478 if (get_int(&mesg, &gid))
479 goto out;
480 GROUP_AT(rsci.cred.cr_group_info, i) = gid;
481 }
482
483 /* mech name */
484 len = qword_get(&mesg, buf, mlen);
485 if (len < 0)
486 goto out;
487 gm = gss_mech_get_by_name(buf);
488 status = -EOPNOTSUPP;
489 if (!gm)
490 goto out;
491
492 status = -EINVAL;
493 /* mech-specific data: */
494 len = qword_get(&mesg, buf, mlen);
495 if (len < 0) {
496 gss_mech_put(gm);
497 goto out;
498 }
J. Bruce Fields5fb8b492006-01-18 17:43:26 -0800499 status = gss_import_sec_context(buf, len, gm, &rsci.mechctx);
500 if (status) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 gss_mech_put(gm);
502 goto out;
503 }
504 gss_mech_put(gm);
505 }
506 rsci.h.expiry_time = expiry;
NeilBrown17f834b62006-03-27 01:15:05 -0800507 rscp = rsc_update(&rsci, rscp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 status = 0;
509out:
510 rsc_free(&rsci);
511 if (rscp)
512 rsc_put(&rscp->h, &rsc_cache);
NeilBrown17f834b62006-03-27 01:15:05 -0800513 else
514 status = -ENOMEM;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 return status;
516}
517
518static struct cache_detail rsc_cache = {
Bruce Allanf35279d2005-09-06 15:17:08 -0700519 .owner = THIS_MODULE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 .hash_size = RSC_HASHMAX,
521 .hash_table = rsc_table,
522 .name = "auth.rpcsec.context",
523 .cache_put = rsc_put,
524 .cache_parse = rsc_parse,
NeilBrown17f834b62006-03-27 01:15:05 -0800525 .match = rsc_match,
526 .init = rsc_init,
527 .update = update_rsc,
528 .alloc = rsc_alloc,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529};
530
NeilBrown17f834b62006-03-27 01:15:05 -0800531static struct rsc *rsc_lookup(struct rsc *item)
532{
533 struct cache_head *ch;
534 int hash = rsc_hash(item);
535
536 ch = sunrpc_cache_lookup(&rsc_cache, &item->h, hash);
537 if (ch)
538 return container_of(ch, struct rsc, h);
539 else
540 return NULL;
541}
542
543static struct rsc *rsc_update(struct rsc *new, struct rsc *old)
544{
545 struct cache_head *ch;
546 int hash = rsc_hash(new);
547
548 ch = sunrpc_cache_update(&rsc_cache, &new->h,
549 &old->h, hash);
550 if (ch)
551 return container_of(ch, struct rsc, h);
552 else
553 return NULL;
554}
555
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556
557static struct rsc *
558gss_svc_searchbyctx(struct xdr_netobj *handle)
559{
560 struct rsc rsci;
561 struct rsc *found;
562
563 memset(&rsci, 0, sizeof(rsci));
564 if (dup_to_netobj(&rsci.handle, handle->data, handle->len))
565 return NULL;
NeilBrown17f834b62006-03-27 01:15:05 -0800566 found = rsc_lookup(&rsci);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 rsc_free(&rsci);
568 if (!found)
569 return NULL;
570 if (cache_check(&rsc_cache, &found->h, NULL))
571 return NULL;
572 return found;
573}
574
575/* Implements sequence number algorithm as specified in RFC 2203. */
576static int
577gss_check_seq_num(struct rsc *rsci, int seq_num)
578{
579 struct gss_svc_seq_data *sd = &rsci->seqdata;
580
581 spin_lock(&sd->sd_lock);
582 if (seq_num > sd->sd_max) {
583 if (seq_num >= sd->sd_max + GSS_SEQ_WIN) {
584 memset(sd->sd_win,0,sizeof(sd->sd_win));
585 sd->sd_max = seq_num;
586 } else while (sd->sd_max < seq_num) {
587 sd->sd_max++;
588 __clear_bit(sd->sd_max % GSS_SEQ_WIN, sd->sd_win);
589 }
590 __set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win);
591 goto ok;
592 } else if (seq_num <= sd->sd_max - GSS_SEQ_WIN) {
593 goto drop;
594 }
595 /* sd_max - GSS_SEQ_WIN < seq_num <= sd_max */
596 if (__test_and_set_bit(seq_num % GSS_SEQ_WIN, sd->sd_win))
597 goto drop;
598ok:
599 spin_unlock(&sd->sd_lock);
600 return 1;
601drop:
602 spin_unlock(&sd->sd_lock);
603 return 0;
604}
605
606static inline u32 round_up_to_quad(u32 i)
607{
608 return (i + 3 ) & ~3;
609}
610
611static inline int
612svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o)
613{
614 int l;
615
616 if (argv->iov_len < 4)
617 return -1;
618 o->len = ntohl(svc_getu32(argv));
619 l = round_up_to_quad(o->len);
620 if (argv->iov_len < l)
621 return -1;
622 o->data = argv->iov_base;
623 argv->iov_base += l;
624 argv->iov_len -= l;
625 return 0;
626}
627
628static inline int
629svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o)
630{
631 u32 *p;
632
633 if (resv->iov_len + 4 > PAGE_SIZE)
634 return -1;
635 svc_putu32(resv, htonl(o->len));
636 p = resv->iov_base + resv->iov_len;
637 resv->iov_len += round_up_to_quad(o->len);
638 if (resv->iov_len > PAGE_SIZE)
639 return -1;
640 memcpy(p, o->data, o->len);
641 memset((u8 *)p + o->len, 0, round_up_to_quad(o->len) - o->len);
642 return 0;
643}
644
645/* Verify the checksum on the header and return SVC_OK on success.
646 * Otherwise, return SVC_DROP (in the case of a bad sequence number)
647 * or return SVC_DENIED and indicate error in authp.
648 */
649static int
650gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci,
651 u32 *rpcstart, struct rpc_gss_wire_cred *gc, u32 *authp)
652{
653 struct gss_ctx *ctx_id = rsci->mechctx;
654 struct xdr_buf rpchdr;
655 struct xdr_netobj checksum;
656 u32 flavor = 0;
657 struct kvec *argv = &rqstp->rq_arg.head[0];
658 struct kvec iov;
659
660 /* data to compute the checksum over: */
661 iov.iov_base = rpcstart;
662 iov.iov_len = (u8 *)argv->iov_base - (u8 *)rpcstart;
663 xdr_buf_from_iov(&iov, &rpchdr);
664
665 *authp = rpc_autherr_badverf;
666 if (argv->iov_len < 4)
667 return SVC_DENIED;
668 flavor = ntohl(svc_getu32(argv));
669 if (flavor != RPC_AUTH_GSS)
670 return SVC_DENIED;
671 if (svc_safe_getnetobj(argv, &checksum))
672 return SVC_DENIED;
673
674 if (rqstp->rq_deferred) /* skip verification of revisited request */
675 return SVC_OK;
J. Bruce Fields00fd6e12005-10-13 16:55:18 -0400676 if (gss_verify_mic(ctx_id, &rpchdr, &checksum) != GSS_S_COMPLETE) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700677 *authp = rpcsec_gsserr_credproblem;
678 return SVC_DENIED;
679 }
680
681 if (gc->gc_seq > MAXSEQ) {
682 dprintk("RPC: svcauth_gss: discarding request with large sequence number %d\n",
683 gc->gc_seq);
684 *authp = rpcsec_gsserr_ctxproblem;
685 return SVC_DENIED;
686 }
687 if (!gss_check_seq_num(rsci, gc->gc_seq)) {
688 dprintk("RPC: svcauth_gss: discarding request with old sequence number %d\n",
689 gc->gc_seq);
690 return SVC_DROP;
691 }
692 return SVC_OK;
693}
694
695static int
Andy Adamson822f1002006-01-18 17:43:24 -0800696gss_write_null_verf(struct svc_rqst *rqstp)
697{
698 u32 *p;
699
700 svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_NULL));
701 p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len;
702 /* don't really need to check if head->iov_len > PAGE_SIZE ... */
703 *p++ = 0;
704 if (!xdr_ressize_check(rqstp, p))
705 return -1;
706 return 0;
707}
708
709static int
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq)
711{
712 u32 xdr_seq;
713 u32 maj_stat;
714 struct xdr_buf verf_data;
715 struct xdr_netobj mic;
716 u32 *p;
717 struct kvec iov;
718
719 svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_GSS));
720 xdr_seq = htonl(seq);
721
722 iov.iov_base = &xdr_seq;
723 iov.iov_len = sizeof(xdr_seq);
724 xdr_buf_from_iov(&iov, &verf_data);
725 p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len;
726 mic.data = (u8 *)(p + 1);
J. Bruce Fields00fd6e12005-10-13 16:55:18 -0400727 maj_stat = gss_get_mic(ctx_id, &verf_data, &mic);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700728 if (maj_stat != GSS_S_COMPLETE)
729 return -1;
730 *p++ = htonl(mic.len);
731 memset((u8 *)p + mic.len, 0, round_up_to_quad(mic.len) - mic.len);
732 p += XDR_QUADLEN(mic.len);
733 if (!xdr_ressize_check(rqstp, p))
734 return -1;
735 return 0;
736}
737
738struct gss_domain {
739 struct auth_domain h;
740 u32 pseudoflavor;
741};
742
743static struct auth_domain *
744find_gss_auth_domain(struct gss_ctx *ctx, u32 svc)
745{
746 char *name;
747
748 name = gss_service_to_auth_domain_name(ctx->mech_type, svc);
749 if (!name)
750 return NULL;
751 return auth_domain_find(name);
752}
753
NeilBrownefc36aa2006-03-27 01:14:59 -0800754static struct auth_ops svcauthops_gss;
755
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756int
757svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name)
758{
759 struct gss_domain *new;
760 struct auth_domain *test;
761 int stat = -ENOMEM;
762
763 new = kmalloc(sizeof(*new), GFP_KERNEL);
764 if (!new)
765 goto out;
NeilBrownefc36aa2006-03-27 01:14:59 -0800766 kref_init(&new->h.ref);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767 new->h.name = kmalloc(strlen(name) + 1, GFP_KERNEL);
768 if (!new->h.name)
769 goto out_free_dom;
770 strcpy(new->h.name, name);
NeilBrownefc36aa2006-03-27 01:14:59 -0800771 new->h.flavour = &svcauthops_gss;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772 new->pseudoflavor = pseudoflavor;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773
NeilBrownefc36aa2006-03-27 01:14:59 -0800774 test = auth_domain_lookup(name, &new->h);
775 if (test != &new->h) { /* XXX Duplicate registration? */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776 auth_domain_put(&new->h);
NeilBrownefc36aa2006-03-27 01:14:59 -0800777 /* dangling ref-count... */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700778 goto out;
779 }
780 return 0;
781
782out_free_dom:
783 kfree(new);
784out:
785 return stat;
786}
787
788EXPORT_SYMBOL(svcauth_gss_register_pseudoflavor);
789
790static inline int
791read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj)
792{
793 u32 raw;
794 int status;
795
796 status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj));
797 if (status)
798 return status;
799 *obj = ntohl(raw);
800 return 0;
801}
802
803/* It would be nice if this bit of code could be shared with the client.
804 * Obstacles:
805 * The client shouldn't malloc(), would have to pass in own memory.
806 * The server uses base of head iovec as read pointer, while the
807 * client uses separate pointer. */
808static int
809unwrap_integ_data(struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx)
810{
811 int stat = -EINVAL;
812 u32 integ_len, maj_stat;
813 struct xdr_netobj mic;
814 struct xdr_buf integ_buf;
815
816 integ_len = ntohl(svc_getu32(&buf->head[0]));
817 if (integ_len & 3)
818 goto out;
819 if (integ_len > buf->len)
820 goto out;
821 if (xdr_buf_subsegment(buf, &integ_buf, 0, integ_len))
822 BUG();
823 /* copy out mic... */
824 if (read_u32_from_xdr_buf(buf, integ_len, &mic.len))
825 BUG();
826 if (mic.len > RPC_MAX_AUTH_SIZE)
827 goto out;
828 mic.data = kmalloc(mic.len, GFP_KERNEL);
829 if (!mic.data)
830 goto out;
831 if (read_bytes_from_xdr_buf(buf, integ_len + 4, mic.data, mic.len))
832 goto out;
J. Bruce Fields00fd6e12005-10-13 16:55:18 -0400833 maj_stat = gss_verify_mic(ctx, &integ_buf, &mic);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834 if (maj_stat != GSS_S_COMPLETE)
835 goto out;
836 if (ntohl(svc_getu32(&buf->head[0])) != seq)
837 goto out;
838 stat = 0;
839out:
840 return stat;
841}
842
843struct gss_svc_data {
844 /* decoded gss client cred: */
845 struct rpc_gss_wire_cred clcred;
846 /* pointer to the beginning of the procedure-specific results,
847 * which may be encrypted/checksummed in svcauth_gss_release: */
848 u32 *body_start;
849 struct rsc *rsci;
850};
851
852static int
853svcauth_gss_set_client(struct svc_rqst *rqstp)
854{
855 struct gss_svc_data *svcdata = rqstp->rq_auth_data;
856 struct rsc *rsci = svcdata->rsci;
857 struct rpc_gss_wire_cred *gc = &svcdata->clcred;
858
859 rqstp->rq_client = find_gss_auth_domain(rsci->mechctx, gc->gc_svc);
860 if (rqstp->rq_client == NULL)
861 return SVC_DENIED;
862 return SVC_OK;
863}
864
Kevin Coffman91a47622006-01-18 17:43:25 -0800865static inline int
866gss_write_init_verf(struct svc_rqst *rqstp, struct rsi *rsip)
867{
868 struct rsc *rsci;
869
870 if (rsip->major_status != GSS_S_COMPLETE)
871 return gss_write_null_verf(rqstp);
872 rsci = gss_svc_searchbyctx(&rsip->out_handle);
873 if (rsci == NULL) {
874 rsip->major_status = GSS_S_NO_CONTEXT;
875 return gss_write_null_verf(rqstp);
876 }
877 return gss_write_verf(rqstp, rsci->mechctx, GSS_SEQ_WIN);
878}
879
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880/*
881 * Accept an rpcsec packet.
882 * If context establishment, punt to user space
883 * If data exchange, verify/decrypt
884 * If context destruction, handle here
885 * In the context establishment and destruction case we encode
886 * response here and return SVC_COMPLETE.
887 */
888static int
889svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
890{
891 struct kvec *argv = &rqstp->rq_arg.head[0];
892 struct kvec *resv = &rqstp->rq_res.head[0];
893 u32 crlen;
894 struct xdr_netobj tmpobj;
895 struct gss_svc_data *svcdata = rqstp->rq_auth_data;
896 struct rpc_gss_wire_cred *gc;
897 struct rsc *rsci = NULL;
898 struct rsi *rsip, rsikey;
899 u32 *rpcstart;
900 u32 *reject_stat = resv->iov_base + resv->iov_len;
901 int ret;
902
903 dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",argv->iov_len);
904
905 *authp = rpc_autherr_badcred;
906 if (!svcdata)
907 svcdata = kmalloc(sizeof(*svcdata), GFP_KERNEL);
908 if (!svcdata)
909 goto auth_err;
910 rqstp->rq_auth_data = svcdata;
911 svcdata->body_start = NULL;
912 svcdata->rsci = NULL;
913 gc = &svcdata->clcred;
914
915 /* start of rpc packet is 7 u32's back from here:
916 * xid direction rpcversion prog vers proc flavour
917 */
918 rpcstart = argv->iov_base;
919 rpcstart -= 7;
920
921 /* credential is:
922 * version(==1), proc(0,1,2,3), seq, service (1,2,3), handle
923 * at least 5 u32s, and is preceeded by length, so that makes 6.
924 */
925
926 if (argv->iov_len < 5 * 4)
927 goto auth_err;
928 crlen = ntohl(svc_getu32(argv));
929 if (ntohl(svc_getu32(argv)) != RPC_GSS_VERSION)
930 goto auth_err;
931 gc->gc_proc = ntohl(svc_getu32(argv));
932 gc->gc_seq = ntohl(svc_getu32(argv));
933 gc->gc_svc = ntohl(svc_getu32(argv));
934 if (svc_safe_getnetobj(argv, &gc->gc_ctx))
935 goto auth_err;
936 if (crlen != round_up_to_quad(gc->gc_ctx.len) + 5 * 4)
937 goto auth_err;
938
939 if ((gc->gc_proc != RPC_GSS_PROC_DATA) && (rqstp->rq_proc != 0))
940 goto auth_err;
941
942 /*
943 * We've successfully parsed the credential. Let's check out the
944 * verifier. An AUTH_NULL verifier is allowed (and required) for
945 * INIT and CONTINUE_INIT requests. AUTH_RPCSEC_GSS is required for
946 * PROC_DATA and PROC_DESTROY.
947 *
948 * AUTH_NULL verifier is 0 (AUTH_NULL), 0 (length).
949 * AUTH_RPCSEC_GSS verifier is:
950 * 6 (AUTH_RPCSEC_GSS), length, checksum.
951 * checksum is calculated over rpcheader from xid up to here.
952 */
953 *authp = rpc_autherr_badverf;
954 switch (gc->gc_proc) {
955 case RPC_GSS_PROC_INIT:
956 case RPC_GSS_PROC_CONTINUE_INIT:
957 if (argv->iov_len < 2 * 4)
958 goto auth_err;
959 if (ntohl(svc_getu32(argv)) != RPC_AUTH_NULL)
960 goto auth_err;
961 if (ntohl(svc_getu32(argv)) != 0)
962 goto auth_err;
963 break;
964 case RPC_GSS_PROC_DATA:
965 case RPC_GSS_PROC_DESTROY:
966 *authp = rpcsec_gsserr_credproblem;
967 rsci = gss_svc_searchbyctx(&gc->gc_ctx);
968 if (!rsci)
969 goto auth_err;
970 switch (gss_verify_header(rqstp, rsci, rpcstart, gc, authp)) {
971 case SVC_OK:
972 break;
973 case SVC_DENIED:
974 goto auth_err;
975 case SVC_DROP:
976 goto drop;
977 }
978 break;
979 default:
980 *authp = rpc_autherr_rejectedcred;
981 goto auth_err;
982 }
983
984 /* now act upon the command: */
985 switch (gc->gc_proc) {
986 case RPC_GSS_PROC_INIT:
987 case RPC_GSS_PROC_CONTINUE_INIT:
988 *authp = rpc_autherr_badcred;
989 if (gc->gc_proc == RPC_GSS_PROC_INIT && gc->gc_ctx.len != 0)
990 goto auth_err;
991 memset(&rsikey, 0, sizeof(rsikey));
992 if (dup_netobj(&rsikey.in_handle, &gc->gc_ctx))
993 goto drop;
994 *authp = rpc_autherr_badverf;
995 if (svc_safe_getnetobj(argv, &tmpobj)) {
996 kfree(rsikey.in_handle.data);
997 goto auth_err;
998 }
999 if (dup_netobj(&rsikey.in_token, &tmpobj)) {
1000 kfree(rsikey.in_handle.data);
1001 goto drop;
1002 }
1003
NeilBrownd4d11ea2006-03-27 01:15:04 -08001004 rsip = rsi_lookup(&rsikey);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001005 rsi_free(&rsikey);
1006 if (!rsip) {
1007 goto drop;
1008 }
1009 switch(cache_check(&rsi_cache, &rsip->h, &rqstp->rq_chandle)) {
1010 case -EAGAIN:
1011 goto drop;
1012 case -ENOENT:
1013 goto drop;
1014 case 0:
Kevin Coffman91a47622006-01-18 17:43:25 -08001015 if (gss_write_init_verf(rqstp, rsip))
1016 goto drop;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001017 if (resv->iov_len + 4 > PAGE_SIZE)
1018 goto drop;
1019 svc_putu32(resv, rpc_success);
1020 if (svc_safe_putnetobj(resv, &rsip->out_handle))
1021 goto drop;
1022 if (resv->iov_len + 3 * 4 > PAGE_SIZE)
1023 goto drop;
1024 svc_putu32(resv, htonl(rsip->major_status));
1025 svc_putu32(resv, htonl(rsip->minor_status));
1026 svc_putu32(resv, htonl(GSS_SEQ_WIN));
1027 if (svc_safe_putnetobj(resv, &rsip->out_token))
1028 goto drop;
1029 rqstp->rq_client = NULL;
1030 }
1031 goto complete;
1032 case RPC_GSS_PROC_DESTROY:
1033 set_bit(CACHE_NEGATIVE, &rsci->h.flags);
1034 if (resv->iov_len + 4 > PAGE_SIZE)
1035 goto drop;
1036 svc_putu32(resv, rpc_success);
1037 goto complete;
1038 case RPC_GSS_PROC_DATA:
1039 *authp = rpcsec_gsserr_ctxproblem;
1040 if (gss_write_verf(rqstp, rsci->mechctx, gc->gc_seq))
1041 goto auth_err;
1042 rqstp->rq_cred = rsci->cred;
1043 get_group_info(rsci->cred.cr_group_info);
1044 *authp = rpc_autherr_badcred;
1045 switch (gc->gc_svc) {
1046 case RPC_GSS_SVC_NONE:
1047 break;
1048 case RPC_GSS_SVC_INTEGRITY:
1049 if (unwrap_integ_data(&rqstp->rq_arg,
1050 gc->gc_seq, rsci->mechctx))
1051 goto auth_err;
1052 /* placeholders for length and seq. number: */
1053 svcdata->body_start = resv->iov_base + resv->iov_len;
1054 svc_putu32(resv, 0);
1055 svc_putu32(resv, 0);
1056 break;
1057 case RPC_GSS_SVC_PRIVACY:
1058 /* currently unsupported */
1059 default:
1060 goto auth_err;
1061 }
1062 svcdata->rsci = rsci;
1063 cache_get(&rsci->h);
1064 ret = SVC_OK;
1065 goto out;
1066 }
1067auth_err:
1068 /* Restore write pointer to original value: */
1069 xdr_ressize_check(rqstp, reject_stat);
1070 ret = SVC_DENIED;
1071 goto out;
1072complete:
1073 ret = SVC_COMPLETE;
1074 goto out;
1075drop:
1076 ret = SVC_DROP;
1077out:
1078 if (rsci)
1079 rsc_put(&rsci->h, &rsc_cache);
1080 return ret;
1081}
1082
1083static int
1084svcauth_gss_release(struct svc_rqst *rqstp)
1085{
1086 struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data;
1087 struct rpc_gss_wire_cred *gc = &gsd->clcred;
1088 struct xdr_buf *resbuf = &rqstp->rq_res;
1089 struct xdr_buf integ_buf;
1090 struct xdr_netobj mic;
1091 struct kvec *resv;
1092 u32 *p;
1093 int integ_offset, integ_len;
1094 int stat = -EINVAL;
1095
1096 if (gc->gc_proc != RPC_GSS_PROC_DATA)
1097 goto out;
1098 /* Release can be called twice, but we only wrap once. */
1099 if (gsd->body_start == NULL)
1100 goto out;
1101 /* normally not set till svc_send, but we need it here: */
1102 resbuf->len = resbuf->head[0].iov_len
1103 + resbuf->page_len + resbuf->tail[0].iov_len;
1104 switch (gc->gc_svc) {
1105 case RPC_GSS_SVC_NONE:
1106 break;
1107 case RPC_GSS_SVC_INTEGRITY:
1108 p = gsd->body_start;
1109 gsd->body_start = NULL;
1110 /* move accept_stat to right place: */
1111 memcpy(p, p + 2, 4);
1112 /* don't wrap in failure case: */
1113 /* Note: counting on not getting here if call was not even
1114 * accepted! */
1115 if (*p != rpc_success) {
1116 resbuf->head[0].iov_len -= 2 * 4;
1117 goto out;
1118 }
1119 p++;
1120 integ_offset = (u8 *)(p + 1) - (u8 *)resbuf->head[0].iov_base;
1121 integ_len = resbuf->len - integ_offset;
1122 BUG_ON(integ_len % 4);
1123 *p++ = htonl(integ_len);
1124 *p++ = htonl(gc->gc_seq);
1125 if (xdr_buf_subsegment(resbuf, &integ_buf, integ_offset,
1126 integ_len))
1127 BUG();
1128 if (resbuf->page_len == 0
1129 && resbuf->tail[0].iov_len + RPC_MAX_AUTH_SIZE
1130 < PAGE_SIZE) {
1131 BUG_ON(resbuf->tail[0].iov_len);
1132 /* Use head for everything */
1133 resv = &resbuf->head[0];
1134 } else if (resbuf->tail[0].iov_base == NULL) {
1135 /* copied from nfsd4_encode_read */
1136 svc_take_page(rqstp);
1137 resbuf->tail[0].iov_base = page_address(rqstp
1138 ->rq_respages[rqstp->rq_resused-1]);
1139 rqstp->rq_restailpage = rqstp->rq_resused-1;
1140 resbuf->tail[0].iov_len = 0;
1141 resv = &resbuf->tail[0];
1142 } else {
1143 resv = &resbuf->tail[0];
1144 }
1145 mic.data = (u8 *)resv->iov_base + resv->iov_len + 4;
J. Bruce Fields00fd6e12005-10-13 16:55:18 -04001146 if (gss_get_mic(gsd->rsci->mechctx, &integ_buf, &mic))
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147 goto out_err;
1148 svc_putu32(resv, htonl(mic.len));
1149 memset(mic.data + mic.len, 0,
1150 round_up_to_quad(mic.len) - mic.len);
1151 resv->iov_len += XDR_QUADLEN(mic.len) << 2;
1152 /* not strictly required: */
1153 resbuf->len += XDR_QUADLEN(mic.len) << 2;
1154 BUG_ON(resv->iov_len > PAGE_SIZE);
1155 break;
1156 case RPC_GSS_SVC_PRIVACY:
1157 default:
1158 goto out_err;
1159 }
1160
1161out:
1162 stat = 0;
1163out_err:
1164 if (rqstp->rq_client)
1165 auth_domain_put(rqstp->rq_client);
1166 rqstp->rq_client = NULL;
1167 if (rqstp->rq_cred.cr_group_info)
1168 put_group_info(rqstp->rq_cred.cr_group_info);
1169 rqstp->rq_cred.cr_group_info = NULL;
1170 if (gsd->rsci)
1171 rsc_put(&gsd->rsci->h, &rsc_cache);
1172 gsd->rsci = NULL;
1173
1174 return stat;
1175}
1176
1177static void
1178svcauth_gss_domain_release(struct auth_domain *dom)
1179{
1180 struct gss_domain *gd = container_of(dom, struct gss_domain, h);
1181
1182 kfree(dom->name);
1183 kfree(gd);
1184}
1185
1186static struct auth_ops svcauthops_gss = {
1187 .name = "rpcsec_gss",
1188 .owner = THIS_MODULE,
1189 .flavour = RPC_AUTH_GSS,
1190 .accept = svcauth_gss_accept,
1191 .release = svcauth_gss_release,
1192 .domain_release = svcauth_gss_domain_release,
1193 .set_client = svcauth_gss_set_client,
1194};
1195
1196int
1197gss_svc_init(void)
1198{
1199 int rv = svc_auth_register(RPC_AUTH_GSS, &svcauthops_gss);
1200 if (rv == 0) {
1201 cache_register(&rsc_cache);
1202 cache_register(&rsi_cache);
1203 }
1204 return rv;
1205}
1206
1207void
1208gss_svc_shutdown(void)
1209{
Bruce Allanf35279d2005-09-06 15:17:08 -07001210 if (cache_unregister(&rsc_cache))
1211 printk(KERN_ERR "auth_rpcgss: failed to unregister rsc cache\n");
1212 if (cache_unregister(&rsi_cache))
1213 printk(KERN_ERR "auth_rpcgss: failed to unregister rsi cache\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001214 svc_auth_unregister(RPC_AUTH_GSS);
1215}