74cd0f5c51c8887b5fb625904dccb376a8deade1
3 * $Id: checkpath.h,v 1.2 2001/01/25 22:16:02 mdw Exp $
5 * Check a path for safety
7 * (c) 1999 Mark Wooding
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of chkpath.
14 * chkpath is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * chkpath is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with chkpath; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Revision history --------------------------------------------------*
31 * $Log: checkpath.h,v $
32 * Revision 1.2 2001/01/25 22:16:02 mdw
33 * Make flags be unsigned.
35 * Revision 1.1.1.1 1999/04/06 20:12:07 mdw
47 /*----- Header files ------------------------------------------------------*/
50 #include <sys/types.h>
52 /*----- Data structures ---------------------------------------------------*/
54 /* --- Search request --- *
56 * This contains parameters from the caller to control what problems are
57 * looked for, and what to do when they're found.
61 uid_t cp_uid
; /* Uid that's considered OK */
62 gid_t cp_gid
[NGROUPS_MAX
+ 1]; /* Array of groups that are OK */
63 int cp_gids
; /* Number of groups in the array */
64 int cp_verbose
; /* Verbosity level to spit up */
65 unsigned cp_what
; /* What things to check for */
66 void (*cp_report
)(int /*what*/, int /*verb*/,
67 const char */
*dir*/
, const char */
*msg*/
,
69 void *cp_arg
; /* Argument for cp_report */
72 /* --- Flags for `@what@' fields in the above --- */
74 #define CP_ERROR 1u /* Error report */
75 #define CP_WRWORLD 2u /* Check write by world */
76 #define CP_WRGRP 4u /* Check write by any group */
77 #define CP_WROTHGRP 8u /* Check write by other group */
78 #define CP_WROTHUSR 16u /* Check write by other user */
79 #define CP_SYMLINK 32u /* Report symbolic links */
80 #define CP_REPORT 64u /* Make user-readable reports */
81 #define CP_STICKYOK 128u /* Don't care if sticky is set */
83 /*----- Functions provided ------------------------------------------------*/
85 /* --- @path_check@ --- *
87 * Arguments: @const char *p@ = directory name which needs checking
88 * @struct chkpath *cp@ = caller parameters for the check
90 * Returns: Zero if all is well, otherwise bitmask of problems.
92 * Use: Scrutinises a directory path to see what evil things other
93 * users could do to it.
96 extern int path_check(const char */
*p*/
, struct chkpath */
*cp*/
);
98 /* --- @path_setids@ --- *
100 * Arguments: @struct chkpath *cp@ = pointer to block to fill in
104 * Use: Fills in the user ids and things in the structure.
107 extern void path_setids(struct chkpath */
*cp*/
);
109 /*----- That's all, folks -------------------------------------------------*/