X-Git-Url: https://git.distorted.org.uk/~mdw/checkpath/blobdiff_plain/d7b5ee0cc2a612023bb20492a75af4a7a23e856b..b8eb35c13263163e9849ee3fbdc1bc8bd5c5167b:/checkpath.h diff --git a/checkpath.h b/checkpath.h index 726f9f8..5b2e938 100644 --- a/checkpath.h +++ b/checkpath.h @@ -1,13 +1,11 @@ /* -*-c-*- * - * $Id: checkpath.h,v 1.3 2003/01/25 23:58:44 mdw Exp $ - * * Check a path for safety * * (c) 1999 Mark Wooding */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of chkpath. * @@ -15,31 +13,17 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * chkpath 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 chkpath; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: checkpath.h,v $ - * Revision 1.3 2003/01/25 23:58:44 mdw - * Make guts into official library. - * - * Revision 1.2 2001/01/25 22:16:02 mdw - * Make flags be unsigned. - * - * Revision 1.1.1.1 1999/04/06 20:12:07 mdw - * Import new project. - * - */ - #ifndef CHECKPATH_H #define CHECKPATH_H @@ -102,13 +86,63 @@ struct checkpath { extern unsigned checkpath(const char */*p*/, const struct checkpath */*cp*/); +/* --- @checkpath_addgid@ --- * + * + * Arguments: @struct checkpath *cp@ = pointer to block to fill in + * @gid_t g@ = group id to add + * + * Returns: Zero if successful, nonzero if the array is full. + * + * Use: Adds the group @g@ to the structure. + */ + +extern int checkpath_addgid(struct checkpath */*cp*/, gid_t /*g*/); + +/* --- @checkpath_setuid@ --- * + * + * Arguments: @struct checkpath *cp@ = pointer to block to fill in + * + * Returns: --- + * + * Use: Fills in the @cp_uid@ slot of the structure with the real uid + * of the current process. + */ + +extern void checkpath_setuid(struct checkpath */*cp*/); + +/* --- @checkpath_setgid@ --- * + * + * Arguments: @struct checkpath *cp@ = pointer to block to fill in + * + * Returns: Zero if successful, nonzero if the array is full. + * + * Use: Adds the real gid of the current process to the @cp_gid@ + * array. + */ + +extern int checkpath_setgid(/*cp*/); + +/* --- @checkpath_setgroups@ --- * + * + * Arguments: @struct checkpath *cp@ = pointer to block to fill in + * + * Returns: Zero if successful, nonzero if the array is full. + * + * Use: Adds the current process's supplementary groups to the + * @cp_gid@ table. + */ + +extern int checkpath_setgroups(struct checkpath */*cp*/); + /* --- @checkpath_setids@ --- * * * Arguments: @struct checkpath *cp@ = pointer to block to fill in * * Returns: --- * - * Use: Fills in the user ids and things in the structure. + * Use: Fills in the user ids and things in the structure. This is + * equivalent to setting @cp_gids = 0@ and then calling + * @_setuid@, @_setgid@ and @_setgroups@. It can't fail. */ extern void checkpath_setids(struct checkpath */*cp*/);