Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_oldgaa_utils.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
24 #ifndef GLOBUS_OLDGAA_UTILS_H
25 #define GLOBUS_OLDGAA_UTILS_H
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /**********************************************************************
32  Include header files
33 **********************************************************************/
34 
35 #include <stdio.h> /* for FILE */
36 
37 /**********************************************************************
38  Define constants
39 **********************************************************************/
40 
41 #define GRID_CA_POLICY_FILENAME "ca-signing-policy.conf"
42 
43 #define OLDGAA_X509_AUTHORITY "X509"
44 
45 #define POSITIVE_RIGHTS "pos_rights"
46 #define NEGATIVE_RIGHTS "neg_rights"
47 
48 #define COND_PREFIX "cond_"
49 #define PRINCIPAL_ACCESS_PREFIX "access_"
50 #define PRINCIPAL_GRANTOR_PREFIX "grantor_"
51 #define POS_RIGHTS_PREFIX "pos"
52 #define NEG_RIGHTS_PREFIX "neg"
53 
54 #define COMMENT '#'
55 #define STRING_DELIMITER '\''
56 #define ESCAPE_CHARACTER '\\'
57 #define END_OF_LINE '\n'
58 
59 #define ERROR_WHILE_GETTING_DEFAULT_POLICY_LOCATION 100
60 #define ERROR_WHILE_RETRIEVING_POLICY 101
61 
62 #define ERROR_WHILE_PARSING_PRINCIPALS 200
63 #define ERROR_WHILE_PARSING_CONDITIONS 201
64 #define ERROR_WHILE_PARSING_RIGHTS 202
65 
66 
67 /* Context information about our state reading the policy file */
68 
69 typedef struct policy_file_context_struct policy_file_context,
70  *policy_file_context_ptr;
71 struct policy_file_context_struct {
72  char *str;
73  char *parse_error;
74  char *buf;
75  long buflen;
76  long index;
77 };
78 
79 /**********************************************************************
80  *
81  * Function Prototypes
82  *
83  **********************************************************************/
84 
85 /**********************************************************************
86  OLDGAA Cleanup Functions
87  **********************************************************************/
88 
89 oldgaa_error_code
90 oldgaa_globus_cleanup(oldgaa_sec_context_ptr *oldgaa_sc,
91  oldgaa_rights_ptr *rights,
92  oldgaa_options_ptr options,
93  oldgaa_answer_ptr *answer,
94  oldgaa_data_ptr policy_db,
95  oldgaa_sec_attrb_ptr *attributes);
96 
97 /**********************************************************************
98  OLDGAA Initialization Functions
99  **********************************************************************/
100 
101 oldgaa_error_code
102 oldgaa_globus_initialize(oldgaa_sec_context_ptr *oldgaa_sc,
103  oldgaa_rights_ptr *rights,
104  oldgaa_options_ptr *options,
105  oldgaa_data_ptr *policy_db,
106  char *subject,
107  char *signer,
108  char *path);
109 
110 
111 oldgaa_sec_context_ptr
112 oldgaa_globus_allocate_sec_context(char *signer);
113 
114 oldgaa_rights_ptr
115 oldgaa_globus_allocate_rights();
116 
117 /**********************************************************************
118  Policy Retrieving Functions
119  **********************************************************************/
120 
121 oldgaa_policy_ptr
122 oldgaa_globus_policy_retrieve(uint32 *minor_status,
123  oldgaa_data_ptr object,
124  oldgaa_data_ptr policy_db, ...);
125 
126 policy_file_context_ptr
127 oldgaa_globus_policy_file_open(const char *filename);
128 
129 void
130 oldgaa_globus_policy_file_close(policy_file_context_ptr pcontext);
131 
132 
133 /**********************************************************************
134  Policy Parsing Functions
135  **********************************************************************/
136 
137 oldgaa_error_code
138 oldgaa_globus_parse_policy (policy_file_context_ptr pcontext,
139  oldgaa_policy_ptr *policy_handle);
140 
141 oldgaa_error_code
142 oldgaa_globus_parse_rights(policy_file_context_ptr pcontext,
143  char *tmp_str,
144  oldgaa_rights_ptr *start,
145  int *cond_present,
146  int *end_of_entry);
147 
148 oldgaa_error_code
149 oldgaa_globus_parse_conditions( policy_file_context_ptr pcontext,
150  oldgaa_conditions_ptr *conditions,
151  char *tmp_str,
152  oldgaa_cond_bindings_ptr *list,
153  int *end_of_entry );
154 
155 void
156 oldgaa_globus_print_rights(oldgaa_rights_ptr rights);
157 
158 
159 void
160 oldgaa_globus_print_attributes(oldgaa_sec_attrb_ptr attributes);
161 
162 
163 oldgaa_error_code
164 oldgaa_globus_get_trusted_ca_list(oldgaa_sec_attrb_ptr *attributes,
165  oldgaa_policy_ptr policy_handle,
166  oldgaa_rights_ptr rights);
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* GLOBUS_OLDGAA_UTILS_H */