Thread: [Libsysio-commit] HEAD: libsysio/include creds.h
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2006-12-12 00:49:01
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31845 Added Files: creds.h Log Message: add missing creds.h --- NEW FILE --- /* * This Cplant(TM) source code is the property of Sandia National * Laboratories. * * This Cplant(TM) source code is copyrighted by Sandia National * Laboratories. * * The redistribution of this Cplant(TM) source code is subject to the * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * * Cplant(TM) Copyright 1998-2003 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States * Government. */ /* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Questions or comments about this library should be sent to: * * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 * Albuquerque, NM 87185-1110 * * le...@sa... */ #include <unistd.h> #ifndef _CREDS_H_ #define _CREDS_H_ /* * Data structure for user credentials */ struct creds { uid_t creds_uid; gid_t *creds_gids; int creds_ngids; }; #endif |
From: Lee W. <lw...@us...> - 2007-06-29 15:32:44
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9804 Modified Files: creds.h Log Message: Add definition for a root user, _SYSIO_ROOT_UID, and a test based on the credentials, _sysio_root_user(). Index: creds.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/creds.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -b -B -p -r1.1 -r1.2 --- creds.h 12 Dec 2006 00:48:58 -0000 1.1 +++ creds.h 29 Jun 2007 15:32:39 -0000 1.2 @@ -47,6 +47,11 @@ #define _CREDS_H_ /* + * Superuser's UID. + */ +#define _SYSIO_ROOT_UID 0 + +/* * Data structure for user credentials */ @@ -56,4 +61,12 @@ struct creds { int creds_ngids; }; + +#ifdef _SYSIO_ROOT_UID +/* + * Is caller the superuser? + */ +#define _sysio_is_root(_crp) \ + ((_crp)->creds_uid == _SYSIO_ROOT_UID) +#endif #endif |
From: Lee W. <lw...@us...> - 2007-11-20 17:31:35
|
Update of /cvsroot/libsysio/libsysio/include In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24859/include Modified Files: creds.h Log Message: if _SYSIO_ROOT_UID was not defined then _sysio_is_root was also not defined. Fixed. It just replaces with a zero (not root), now. Index: creds.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/creds.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -b -B -p -r1.2 -r1.3 --- creds.h 29 Jun 2007 15:32:39 -0000 1.2 +++ creds.h 20 Nov 2007 17:31:29 -0000 1.3 @@ -62,11 +62,13 @@ struct creds { }; -#ifdef _SYSIO_ROOT_UID /* * Is caller the superuser? */ +#ifdef _SYSIO_ROOT_UID #define _sysio_is_root(_crp) \ ((_crp)->creds_uid == _SYSIO_ROOT_UID) +#else + (0) #endif #endif |
From: Lee W. <lw...@us...> - 2009-05-05 16:30:35
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29952/include Modified Files: creds.h Log Message: Modified to allow the package user to specify alternate routines for the acquisition of credentials and implementation of permission check policy. In order to arrange the acquisition of alternate credentials, the pointers to _sysio_get_credentials and _sysio_put_credentials should be overwritten. Your get_credentials routine should set the passed pointer to a credentials structure with the uid and gids set with the real values, if the formal called 'effective', is zero or the effective values if non-zero. Your put_credentials routine is called when the core no longer requires your credentials. If you do not need a release routine, you may set _sysio_put_credentials to NULL. In order to arrange the use of an alternate permission check the pointer to _sysio_check_permission should be overwritten. If any of these pointers are overwritten by the user, it must be done prior to calling _sysio_init and may not be reset thereafter. Index: creds.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/creds.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- creds.h 20 Nov 2007 17:31:29 -0000 1.3 +++ creds.h 5 May 2009 16:30:18 -0000 1.4 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2003 Sandia Corporation. + * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -36,7 +36,7 @@ * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 - * Albuquerque, NM 87185-1110 + * Albuquerque, NM 87185-1319 * * le...@sa... */ @@ -71,4 +71,10 @@ struct creds { #else (0) #endif + +struct pnode; + +extern int (*_sysio_get_credentials)(struct creds **, int); +extern void (*_sysio_put_credentials)(struct creds *); +extern int (*_sysio_check_permission)(struct pnode *, struct creds *, int); #endif |