From ae11604e4e92e547030664d8cfc2e448ba66b976 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Mon, 18 Nov 1996 23:57:04 +0000 Subject: Mon Nov 18 17:01:38 1996 Thomas Bushnell, n/BSG * ops.c (guess_mode_use): Delete function. (netfs_report_access): Use fshelp_access instead of guess_mode_use. Change return type. Sat Nov 16 18:24:55 1996 Thomas Bushnell, n/BSG * Makefile (SRCS): Remove `cred.c'. * cred.c: Delete file. * nfs.h (struct netcred): Delete type. (cred_has_uid, cred_has_gid): Delete functions. (nfs_initialize_rpc): netcred arg now iouser. * ops.c: Change struct netcred to struct iouser throughout. * pager.c: Likewise. * cache.c (netfs_node_norefs): Likewise. * nfs.c (nfs_initialize_rpc): Convert use of netcred to iouser. --- nfs/cred.c | 116 ------------------------------------------------------------- 1 file changed, 116 deletions(-) delete mode 100644 nfs/cred.c (limited to 'nfs/cred.c') diff --git a/nfs/cred.c b/nfs/cred.c deleted file mode 100644 index b83ebaaf..00000000 --- a/nfs/cred.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Credential manipulation for NFS client - Copyright (C) 1995, 1996 Free Software Foundation, Inc. - Written by Michael I. Bushnell, p/BSG. - - This file is part of the GNU Hurd. - - The GNU Hurd is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - The GNU Hurd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ - -#include -#include - -#include "nfs.h" - -/* This lock must always be held when manipulating the reference count - on credential structures. */ -static spin_lock_t cred_refcnt_lock = SPIN_LOCK_INITIALIZER; - -/* Interpret CRED, returning newly malloced storage describing the - user identification references in UIDS, NUIDS, GIDS, and NGIDS. - See for details. */ -void -netfs_interpret_credential (struct netcred *cred, uid_t **uids, - int *nuids, uid_t **gids, int *ngids) -{ - /* Who says C isn't APL? */ - bcopy (cred->uids, *uids = malloc ((*nuids = cred->nuids) * sizeof (uid_t)), - cred->nuids * sizeof (uid_t)); - bcopy (cred->gids, *gids = malloc ((*ngids = cred->ngids) * sizeof (uid_t)), - cred->ngids * sizeof (uid_t)); -} - -/* Return a new reference to CRED. See for details. */ -struct netcred * -netfs_copy_credential (struct netcred *cred) -{ - spin_lock (&cred_refcnt_lock); - cred->refcnt++; - spin_unlock (&cred_refcnt_lock); - return cred; -} - -/* Drop a reference to CRED. See for details. */ -void -netfs_drop_credential (struct netcred *cred) -{ - spin_lock (&cred_refcnt_lock); - cred->refcnt--; - - if (!cred->refcnt) - { - spin_unlock (&cred_refcnt_lock); - free (cred); - } - else - spin_unlock (&cred_refcnt_lock); -} - -/* Make and return a new credential referring to the user identified - by UIDS, NUIDS, GIDS, and NGIDS. See for - details. */ -struct netcred * -netfs_make_credential (uid_t *uids, - int nuids, - uid_t *gids, - int ngids) -{ - struct netcred *cred; - - cred = malloc (sizeof (struct netcred) - + nuids * sizeof (uid_t) - + ngids * sizeof (uid_t)); - cred->uids = (void *) cred + sizeof (struct netcred); - cred->gids = (void *) cred->uids + nuids * sizeof (uid_t); - cred->nuids = nuids; - cred->ngids = ngids; - cred->refcnt = 1; - - bcopy (uids, cred->uids, nuids + sizeof (uid_t)); - bcopy (gids, cred->gids, ngids + sizeof (uid_t)); - - return cred; -} - -/* Return nonzero iff CRED contains user id UID. */ -int -cred_has_uid (struct netcred *cred, uid_t uid) -{ - int i; - for (i = 0; i < cred->nuids; i++) - if (cred->uids[i] == uid) - return 1; - return 0; -} - -/* Return nonzero iff CRED contains group id GID. */ -int -cred_has_gid (struct netcred *cred, gid_t gid) -{ - int i; - for (i = 0; i < cred->ngids; i++) - if (cred->gids[i] == gid) - return 1; - return 0; -} -- cgit v1.2.3