File: globus_oldgaa_utils.h

package info (click to toggle)
globus-gsi-callback 6.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,760 kB
  • sloc: sh: 11,067; ansic: 5,658; makefile: 92
file content (172 lines) | stat: -rw-r--r-- 5,695 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
 * Copyright 1999-2006 University of Chicago
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file globus_oldgaa_utils.h
 * @brief Old GAA Utils
 * @details
 * This header file used internally by the Globus-OLDGAA routines
 */

#ifndef GLOBUS_OLDGAA_UTILS_H
#define GLOBUS_OLDGAA_UTILS_H

#ifdef __cplusplus
extern "C" {
#endif

/**********************************************************************
                             Include header files
**********************************************************************/

#include <stdio.h> /* for FILE */

/**********************************************************************
                               Define constants
**********************************************************************/

#define GRID_CA_POLICY_FILENAME "ca-signing-policy.conf"

#define OLDGAA_X509_AUTHORITY        "X509"
 
#define POSITIVE_RIGHTS           "pos_rights"
#define NEGATIVE_RIGHTS           "neg_rights"

#define COND_PREFIX               "cond_"
#define PRINCIPAL_ACCESS_PREFIX   "access_"
#define PRINCIPAL_GRANTOR_PREFIX  "grantor_"
#define POS_RIGHTS_PREFIX         "pos"
#define NEG_RIGHTS_PREFIX         "neg"

#define COMMENT  			'#'
#define STRING_DELIMITER                '\''
#define ESCAPE_CHARACTER                '\\'
#define END_OF_LINE	         	'\n'

#define ERROR_WHILE_GETTING_DEFAULT_POLICY_LOCATION  100
#define ERROR_WHILE_RETRIEVING_POLICY  101

#define ERROR_WHILE_PARSING_PRINCIPALS 200
#define ERROR_WHILE_PARSING_CONDITIONS 201
#define ERROR_WHILE_PARSING_RIGHTS     202


/* Context information about our state reading the policy file */

typedef struct policy_file_context_struct  policy_file_context, 
                                          *policy_file_context_ptr;
struct policy_file_context_struct {
 char  *str;
 char  *parse_error;  
 char  *buf;
 long  buflen;
 long  index;
};

/**********************************************************************
 *
 * Function Prototypes
 *
 **********************************************************************/

/**********************************************************************
  OLDGAA Cleanup Functions 
 **********************************************************************/

oldgaa_error_code
oldgaa_globus_cleanup(oldgaa_sec_context_ptr *oldgaa_sc,
                   oldgaa_rights_ptr      *rights,
                   oldgaa_options_ptr      options,
                   oldgaa_answer_ptr      *answer,  
                   oldgaa_data_ptr         policy_db,
                   oldgaa_sec_attrb_ptr   *attributes);

/**********************************************************************
  OLDGAA Initialization Functions 
 **********************************************************************/

oldgaa_error_code
oldgaa_globus_initialize(oldgaa_sec_context_ptr       *oldgaa_sc,
                      oldgaa_rights_ptr            *rights,
                      oldgaa_options_ptr           *options,
                      oldgaa_data_ptr              *policy_db, 
                      char                      *subject, 
                      char                      *signer,
                      char                      *path);


oldgaa_sec_context_ptr
oldgaa_globus_allocate_sec_context(char *signer);

oldgaa_rights_ptr
oldgaa_globus_allocate_rights();

/**********************************************************************
  Policy Retrieving Functions 
 **********************************************************************/

oldgaa_policy_ptr
oldgaa_globus_policy_retrieve(uint32      *minor_status,
                           oldgaa_data_ptr object,
                           oldgaa_data_ptr policy_db, ...);

policy_file_context_ptr 
oldgaa_globus_policy_file_open(const char *filename);

void
oldgaa_globus_policy_file_close(policy_file_context_ptr  pcontext);


/**********************************************************************
  Policy Parsing Functions 
 **********************************************************************/

oldgaa_error_code  
oldgaa_globus_parse_policy (policy_file_context_ptr  pcontext,
                         oldgaa_policy_ptr          *policy_handle);

oldgaa_error_code
oldgaa_globus_parse_rights(policy_file_context_ptr  pcontext,
             char                    *tmp_str,
             oldgaa_rights_ptr          *start,
             int                     *cond_present,
             int                     *end_of_entry);

oldgaa_error_code
oldgaa_globus_parse_conditions( policy_file_context_ptr  pcontext,
                  oldgaa_conditions_ptr      *conditions,                  
                  char                    *tmp_str,
                  oldgaa_cond_bindings_ptr   *list, 
                  int                     *end_of_entry );

void
oldgaa_globus_print_rights(oldgaa_rights_ptr rights);


void
oldgaa_globus_print_attributes(oldgaa_sec_attrb_ptr attributes);


oldgaa_error_code
oldgaa_globus_get_trusted_ca_list(oldgaa_sec_attrb_ptr *attributes,
                               oldgaa_policy_ptr     policy_handle,
                               oldgaa_rights_ptr     rights);

#ifdef __cplusplus
}
#endif

#endif /* GLOBUS_OLDGAA_UTILS_H */