X-Git-Url: https://git.distorted.org.uk/~mdw/checkpath/blobdiff_plain/263d6e0d5b3272ea76ed646258ee945fae8a096f..e0d83cefbc0d0fec6a9e59a97a2191da6d8e61b4:/checkpath.h diff --git a/checkpath.h b/checkpath.h index d52eac9..5b2e938 100644 --- a/checkpath.h +++ b/checkpath.h @@ -1,7 +1,5 @@ /* -*-c-*- * - * $Id: checkpath.h,v 1.4 2004/04/08 01:36:22 mdw Exp $ - * * Check a path for safety * * (c) 1999 Mark Wooding @@ -88,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*/);