Commit | Line | Data |
---|---|---|
04c6839a WJ |
1 | /* policy.c - SecurityPolicy abstract syntax */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/dsap/common/RCS/policy.c,v 7.1 91/02/22 09:19:58 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/dsap/common/RCS/policy.c,v 7.1 91/02/22 09:19:58 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: policy.c,v $ | |
12 | * Revision 7.1 91/02/22 09:19:58 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 90/08/24 12:10:43 mrose | |
16 | * *** empty log message *** | |
17 | * | |
18 | */ | |
19 | ||
20 | /* | |
21 | * NOTICE | |
22 | * | |
23 | * Acquisition, use, and distribution of this module and related | |
24 | * materials are subject to the restrictions of a license agreement. | |
25 | * Consult the Preface in the User's Manual for the full terms of | |
26 | * this agreement. | |
27 | * | |
28 | */ | |
29 | ||
30 | ||
31 | #include "cmd_srch.h" | |
32 | #include "quipu/policy.h" | |
33 | ||
34 | /* | |
35 | * This syntax is not yet implemented. However, the following routines for | |
36 | * handling security policies are used by some applications. | |
37 | */ | |
38 | ||
39 | static CMD_TABLE permtab[] = { | |
40 | "detect", POLICY_ACCESS_DETECT, | |
41 | "read", POLICY_ACCESS_READ, | |
42 | "add", POLICY_ACCESS_ADD, | |
43 | "write", POLICY_ACCESS_WRITE, | |
44 | "all", POLICY_ACCESS_ALL, | |
45 | "none", 0, | |
46 | NULLCP, 0 | |
47 | }; | |
48 | ||
49 | unsigned str2permission(str) | |
50 | char *str; | |
51 | { | |
52 | char *cp; | |
53 | unsigned result = 0; | |
54 | ||
55 | while (str && (*str != '\0')) | |
56 | { | |
57 | cp = index(str, '$'); | |
58 | if (cp != NULLCP) | |
59 | *cp++ = '\0'; | |
60 | result |= cmd_srch(str, permtab); | |
61 | str = cp; | |
62 | } | |
63 | return (result); | |
64 | } | |
65 |