2
* Copyright 1999-2006 University of Chicago
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
19
* @file globus_gram_client_attr.h Attribute Functions
22
* $Source: /home/globdev/CVS/globus-packages/gram/client/source/globus_gram_client_attr.c,v $
23
* $Date: 2009/11/19 02:01:59 $
24
* $Revision: 1.5.20.1 $
29
#include "globus_i_gram_client.h"
32
* @brief Initialize a GRAM client attribute
33
* @ingroup globus_gram_client_attr
36
* The @a globus_gram_client_attr_init() function creates a new opaque
37
* structure that can be used to specify custom attributes for performing
38
* GRAM client operations.
41
* An output parameter which will be set to the newly initialized
45
* Upon success, @a globus_gram_client_attr_init() modifies the @a attr
46
* parameter to point to a new GRAM client attribute and returns
47
* @a GLOBUS_SUCCESS. If an error occurs, @a globus_gram_client_attr_init()
48
* returns an integer error code and value of @a attr is undefined.
50
* @retval GLOBUS_SUCCESS
52
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
54
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_MALLOC_FAILED
57
* @see globus_gram_client_attr_destroy()
60
globus_gram_client_attr_init(
61
globus_gram_client_attr_t * attr)
63
globus_i_gram_client_attr_t * iattr;
67
return GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
69
iattr = globus_libc_calloc(1, sizeof(globus_i_gram_client_attr_t));
73
return GLOBUS_GRAM_PROTOCOL_ERROR_MALLOC_FAILED;
75
iattr->delegation_mode = GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY;
77
*attr = (void*) iattr;
79
return GLOBUS_SUCCESS;
83
* @brief Destroy a GRAM client attribute
84
* @ingroup globus_gram_client_attr
87
* The @a globus_gram_client_attr_destroy() function destroys and frees
88
* a GRAM client attribute. After this function returns, the value pointed
89
* to by @a attr is no longer valid and must not be used.
92
* A pointer to the attribute to destroy. All data associated with
93
* the attribute will be freed and it will be an invalid attribute.
96
* Upon success, @a globus_gram_client_attr_destroy() destroys the
97
* attribute pointed to by the @a attr parameter and sets it to an invalid
98
* state. If an error occurs, @a globus_gram_client_attr_destroy()
99
* returns an integer error code and value of @a attr is unchanged.
101
* @retval GLOBUS_SUCCESS
103
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
106
* @see globus_gram_client_attr_init()
109
globus_gram_client_attr_destroy(
110
globus_gram_client_attr_t * attr)
112
int rc = GLOBUS_SUCCESS;
113
globus_i_gram_client_attr_t * iattr;
117
rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
121
iattr = (globus_i_gram_client_attr_t *) *attr;
124
rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
128
globus_libc_free(iattr);
134
/* globus_gram_client_attr_destroy() */
137
* @brief Set a GRAM client attribute's security credential
138
* @ingroup globus_gram_client_attr
141
* The @a globus_gram_client_attr_set_credential() function sets the
142
* value of the @b credential in an attribute to the GSSAPI credential
143
* named by the @a credential parameter. This is done as a shallow copy, so
144
* the value of @a credential must not be freed until the attribute will
148
* The attribute set to modify to use the credential named by the
149
* @a credential parameter.
151
* The GSSAPI credential to use with the attribute named by the @a attr
152
* parameter. This may be @a GSS_C_NO_CREDENTIAL to set the attribute
153
* to use the default security credential.
156
* Upon success, @a globus_gram_client_attr_set_credential() modifies the
157
* the attribute pointed to by the @a attr parameter to use the credential
158
* specified by the @a credential parameter and returns @a GLOBUS_SUCCESS.
159
* If an error occurs, @a globus_gram_client_attr_set_credential()
160
* returns an integer error code and the attribute named by @a attr is
163
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
164
* An invalid attribute set was passed to this function.
166
* @see globus_gram_client_attr_get_credential()
169
globus_gram_client_attr_set_credential(
170
globus_gram_client_attr_t attr,
171
gss_cred_id_t credential)
173
int rc = GLOBUS_SUCCESS;
174
globus_i_gram_client_attr_t * iattr;
178
rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
181
iattr = (globus_i_gram_client_attr_t *) attr;
182
iattr->credential = credential;
186
/* globus_gram_client_attr_set_credential() */
189
* @brief Get a GRAM client attribute's security credential
190
* @ingroup globus_gram_client_attr
193
* The @a globus_gram_client_attr_get_credential() function gets the
194
* value of the @b credential in an attribute and modifies the @a credential
195
* parameter to point to it. This is a shallow copy.
198
* The attribute set to query for its @a credential.
200
* An output parameter that will be initialized to point to the GSSAPI
201
* credential which the @a attr is currently using.
204
* Upon success, @a globus_gram_client_attr_get_credential() modifies the
205
* the value pointed to by the @a credential parameter to be the same
206
* credential as that being used by the attribute named by the @a attr
207
* parameter and returns @a GLOBUS_SUCCESS.
208
* If an error occurs, @a globus_gram_client_attr_get_credential()
209
* returns an integer error code and the value pointed to by the
210
* @a credential parameter is undefined.
212
* @retval GLOBUS_SUCCESS
214
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
216
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER
219
* @see globus_gram_client_attr_set_credential()
222
globus_gram_client_attr_get_credential(
223
globus_gram_client_attr_t attr,
224
gss_cred_id_t * credential)
226
int rc = GLOBUS_SUCCESS;
227
globus_i_gram_client_attr_t * iattr;
229
iattr = (globus_i_gram_client_attr_t *) attr;
233
rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
237
if (credential == NULL)
239
rc = GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER;
243
*credential = iattr->credential;
250
* @brief Set a GRAM client attribute's delegation mode
251
* @ingroup globus_gram_client_attr
254
* The @a globus_gram_client_attr_set_delegation_mode() function sets the
255
* value of the @b delegation_mode in an attribute to the delegation mode
256
* in the @a mode parameter.
258
* The GRAM client supports the following delegation modes:
259
* - @b GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY
260
* - @b GLOBUS_IO_SECURE_DELEGATION_MODE_FULL_PROXY
263
* The attribute set to modify to use the delegation mode in the
266
* The new value of the delegation mode.
269
* Upon success, @a globus_gram_client_attr_set_delegation_mode() modifies
270
* the the attribute named by the @a attr parameter to use the delegation
271
* mode in the @a mode parameter and returns GLOBUS_SUCCESS.
272
* If an error occurs, @a globus_gram_client_attr_set_delegation_mode()
273
* returns an integer error code and the @a delegation_mode attribute
274
* value is unchanged.
276
* @retval GLOBUS_SUCCESS
278
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
281
* @see globus_gram_client_attr_get_delegation_mode()
284
globus_gram_client_attr_set_delegation_mode(
285
globus_gram_client_attr_t attr,
286
globus_io_secure_delegation_mode_t mode)
288
int rc = GLOBUS_SUCCESS;
289
globus_i_gram_client_attr_t * iattr;
293
rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
296
if (mode != GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY &&
297
mode != GLOBUS_IO_SECURE_DELEGATION_MODE_FULL_PROXY)
299
rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
302
iattr = (globus_i_gram_client_attr_t *) attr;
303
iattr->delegation_mode = mode;
309
* @brief Get a GRAM client attribute's security credential
310
* @ingroup globus_gram_client_attr
313
* The @a globus_gram_client_attr_get_delegation_mode() function gets the
314
* value of the @b delegation_mode in an attribute and modifies the
315
* @a mode parameter to point to its value.
318
* The attribute set to query for its @a delegation_mode.
320
* An output parameter that will be set to point to the delegation mode
321
* which the @a attr is currently using.
324
* Upon success, @a globus_gram_client_attr_get_delegation_mode() modifies
325
* the the value pointed to by the @a mode parameter as described above
326
* and returns @a GLOBUS_SUCCESS.
327
* If an error occurs, @a globus_gram_client_attr_get_delegation_mode()
328
* returns an integer error code and the value pointed to by the
329
* @a mode parameter is undefined.
333
* @retval GLOBUS_SUCCESS
335
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR
337
* @retval GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER
340
* @see globus_gram_client_attr_get_delegation_mode()
343
globus_gram_client_attr_get_delegation_mode(
344
globus_gram_client_attr_t attr,
345
globus_io_secure_delegation_mode_t *mode)
347
int rc = GLOBUS_SUCCESS;
348
globus_i_gram_client_attr_t * iattr;
350
iattr = (globus_i_gram_client_attr_t *) attr;
354
rc = GLOBUS_GRAM_PROTOCOL_ERROR_INVALID_ATTR;
360
rc = GLOBUS_GRAM_PROTOCOL_ERROR_NULL_PARAMETER;
364
*mode = iattr->delegation_mode;
369
/* globus_gram_client_attr_get_delegation_mode() */