264 kmem_free(ran, sizeof (*ran));
265 }
266
267 list_destroy(&ren->ren_authlist);
268 exi_rele(ren->ren_exi);
269 kmem_free(ren, sizeof (*ren));
270 }
271 }
272
273 void
274 nfsauth_zone_fini(nfs_globals_t *ng)
275 {
276 nfsauth_globals_t *nag = ng->nfs_auth;
277
278 ng->nfs_auth = NULL;
279
280 list_destroy(&nag->refreshq_queue);
281 cv_destroy(&nag->refreshq_cv);
282 mutex_destroy(&nag->refreshq_lock);
283 mutex_destroy(&nag->mountd_lock);
284 kmem_free(nag, sizeof (*nag));
285 }
286
287 /*
288 * Convert the address in a netbuf to
289 * a hash index for the auth_cache table.
290 */
291 static int
292 hash(struct netbuf *a)
293 {
294 int i, h = 0;
295
296 for (i = 0; i < a->len; i++)
297 h ^= a->buf[i];
298
299 return (h & (AUTH_TABLESIZE - 1));
300 }
301
302 /*
303 * Mask out the components of an
858 nfsauth_globals_t *nag;
859 struct netbuf *taddrmask;
860 struct netbuf addr; /* temporary copy of client's address */
861 const struct netbuf *claddr;
862 avl_tree_t *tree;
863 struct auth_cache ac; /* used as a template for avl_find() */
864 struct auth_cache_clnt *c;
865 struct auth_cache_clnt acc; /* used as a template for avl_find() */
866 struct auth_cache *p = NULL;
867 int access;
868
869 uid_t tmpuid;
870 gid_t tmpgid;
871 uint_t tmpngids;
872 gid_t *tmpgids;
873
874 avl_index_t where; /* used for avl_find()/avl_insert() */
875
876 ASSERT(cr != NULL);
877
878 nag = nfsauth_get_zg();
879
880 /*
881 * Now check whether this client already
882 * has an entry for this flavor in the cache
883 * for this export.
884 * Get the caller's address, mask off the
885 * parts of the address that do not identify
886 * the host (port number, etc), and then hash
887 * it to find the chain of cache entries.
888 */
889
890 claddr = svc_getrpccaller(req->rq_xprt);
891 addr = *claddr;
892 addr.buf = kmem_alloc(addr.maxlen, KM_SLEEP);
893 bcopy(claddr->buf, addr.buf, claddr->len);
894
895 SVC_GETADDRMASK(req->rq_xprt, SVC_TATTR_ADDRMASK, (void **)&taddrmask);
896 ASSERT(taddrmask != NULL);
897 addrmask(&addr, taddrmask);
|
264 kmem_free(ran, sizeof (*ran));
265 }
266
267 list_destroy(&ren->ren_authlist);
268 exi_rele(ren->ren_exi);
269 kmem_free(ren, sizeof (*ren));
270 }
271 }
272
273 void
274 nfsauth_zone_fini(nfs_globals_t *ng)
275 {
276 nfsauth_globals_t *nag = ng->nfs_auth;
277
278 ng->nfs_auth = NULL;
279
280 list_destroy(&nag->refreshq_queue);
281 cv_destroy(&nag->refreshq_cv);
282 mutex_destroy(&nag->refreshq_lock);
283 mutex_destroy(&nag->mountd_lock);
284 /* Extra cleanup. */
285 if (nag->mountd_dh != NULL)
286 door_ki_rele(nag->mountd_dh);
287 kmem_free(nag, sizeof (*nag));
288 }
289
290 /*
291 * Convert the address in a netbuf to
292 * a hash index for the auth_cache table.
293 */
294 static int
295 hash(struct netbuf *a)
296 {
297 int i, h = 0;
298
299 for (i = 0; i < a->len; i++)
300 h ^= a->buf[i];
301
302 return (h & (AUTH_TABLESIZE - 1));
303 }
304
305 /*
306 * Mask out the components of an
861 nfsauth_globals_t *nag;
862 struct netbuf *taddrmask;
863 struct netbuf addr; /* temporary copy of client's address */
864 const struct netbuf *claddr;
865 avl_tree_t *tree;
866 struct auth_cache ac; /* used as a template for avl_find() */
867 struct auth_cache_clnt *c;
868 struct auth_cache_clnt acc; /* used as a template for avl_find() */
869 struct auth_cache *p = NULL;
870 int access;
871
872 uid_t tmpuid;
873 gid_t tmpgid;
874 uint_t tmpngids;
875 gid_t *tmpgids;
876
877 avl_index_t where; /* used for avl_find()/avl_insert() */
878
879 ASSERT(cr != NULL);
880
881 ASSERT3P(curzone->zone_id, ==, exi->exi_zoneid);
882 nag = nfsauth_get_zg();
883
884 /*
885 * Now check whether this client already
886 * has an entry for this flavor in the cache
887 * for this export.
888 * Get the caller's address, mask off the
889 * parts of the address that do not identify
890 * the host (port number, etc), and then hash
891 * it to find the chain of cache entries.
892 */
893
894 claddr = svc_getrpccaller(req->rq_xprt);
895 addr = *claddr;
896 addr.buf = kmem_alloc(addr.maxlen, KM_SLEEP);
897 bcopy(claddr->buf, addr.buf, claddr->len);
898
899 SVC_GETADDRMASK(req->rq_xprt, SVC_TATTR_ADDRMASK, (void **)&taddrmask);
900 ASSERT(taddrmask != NULL);
901 addrmask(&addr, taddrmask);
|