File: lcmaps_globus.h

package info (click to toggle)
lcmaps 1.6.6-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,016 kB
  • ctags: 1,428
  • sloc: sh: 11,191; ansic: 9,519; makefile: 530; lex: 184; perl: 92; yacc: 60
file content (170 lines) | stat: -rw-r--r-- 5,941 bytes parent folder | download | duplicates (2)
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
/*
 * Copyright (c) Members of the EGEE Collaboration. 2004-2010. 
 * See http://www.eu-egee.org/partners/ for details on the copyright
 * holders.  
 * 
 * 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.
 *
 */

/**
   \defgroup LcmapsGlobusInterface  The LCMAPS Globus dependent interfaces
   
    \brief These interface functions require Globus data types
    
    This part of the API defines types and functions for the Globus
    GSI interface.  This includes all of the interfaces found in
    lcmaps_openssl.h, and lcmaps_basic.h.

    \ingroup LcmapsInterface
*/

/**
    \file   lcmaps_globus.h
    \brief  GSS dependent functions of the LCMAPS library.
    \author Martijn Steenbakkers for the EU DataGrid.
    \author Oscar Koeroo for the EGEE project.

    This header contains the declarations of the LCMAPS library functions:
    -# lcmaps_run():
        To do the user mapping
    -# lcmaps_run_and_return_username():
        To do the user mapping and return the user name
    -# lcmaps_run_and_return_poolindex():
        To do the user mapping and return the poolindex

    And the following
    -# lcmaps_return_poolindex()
        Returns the poolindex based on fixed arguments:
                security context, buffer and buffer length
    -# lcmaps_return_poolindex_from_gss_cred()
        Returns the poolindex based on fixed arguments:
                gss credential, buffer and buffer length

    \ingroup LcmapsGlobusInterface
*/

#ifndef LCMAPS_GLOBUS_H
#define LCMAPS_GLOBUS_H


/******************************************************************************
                             Include header files
******************************************************************************/
/* Needed for NULL */
#include <stdio.h>
#include <gssapi.h>
#include "_lcmaps.h"
#include "lcmaps_types.h"
#include "lcmaps_openssl.h"

/******************************************************************************
 *                 Module definition
 *****************************************************************************/


/*!
    \brief let LCMAPS handle the user mapping

    Do the user mapping based on the user's gss (gsi) credential and the job
    request.
    As a back-up for empty credentials the user DN may be specified as well.
    This is the legacy lcmaps interface and is used by
        the \b gatekeeper.

    \param user_dn_tmp user DN
    \param user_cred   GSS/GSI user credential
    \param request     authorization request as RSL string

    \retval 0 mapping succeeded.
    \retval 1 mapping failed.
*/
typedef int lcmaps_run_t(
        char * user_dn_tmp,
        gss_cred_id_t user_cred,
        lcmaps_request_t request
);


/*!
    \brief let LCMAPS handle the user mapping and return user name

    do the user mapping based on the provided list of policies (first successful
    policy found in the lcmaps policy file (lcmaps.db) will result in the user
    mapping) and return user name.
    As a back-up for empty credentials the user DN may be specified as well.
    For this \b ALLOW_EMPTY_CREDENTIALS should be defined.
    This interface is used by the
        \b GridFTP server.

    \param user_dn_tmp user DN
    \param user_cred   GSS/GSI user credential
    \param request     authorization request as RSL string
    \param usernamep   pointer to user name (to be freed by calling application).
                       Note: usernamep should be non-NULL at the start !
    \param npols       number of policies to be considered for evaluation
    \param policynames the names of the policies to be considered for evaluation

    \retval 0 mapping succeeded.
    \retval 1 mapping failed.
*/
typedef int lcmaps_run_and_return_username_t(
        char * user_dn_tmp,
        gss_cred_id_t user_cred,
        lcmaps_request_t request,
        char ** usernamep,
        int npols,
        char ** policynames
);


/*!
    \brief let LCMAPS handle the user mapping and return a poolindex

    do the user mapping based on the provided list of policies (first successful
    policy found in the lcmaps policy file (lcmaps.db) will result in the user
    mapping) and return the poolindex
    As a back-up for empty credentials the user DN may be specified as well.
    For this \b ALLOW_EMPTY_CREDENTIALS should be defined.
    This interface was intended to be used by a wrapper function for the 
        \b WorkSpace \b Service (WSS, f.q.a. Dynamic Account Service - DAS).

    \param user_dn_tmp user DN
    \param user_cred   GSS/GSI user credential
    \param request     authorization request as RSL string
    \param poolindexp  pointer to poolindex (to be freed by calling application).
                       Note: poolindex should be non-NULL at the start !
    \param npols       number of policies to be considered for evaluation
    \param policynames the names of the policies to be considered for evaluation

    \retval 0 mapping succeeded.
    \retval 1 mapping failed.
*/
typedef int lcmaps_run_and_return_poolindex_t(
        char * user_dn_tmp,
        gss_cred_id_t user_cred,
        lcmaps_request_t request,
        char ** poolindexp,
        int npols,
        char ** policynames
);



# ifndef LCMAPS_USE_DLOPEN
lcmaps_run_t lcmaps_run;
lcmaps_run_and_return_username_t lcmaps_run_and_return_username;
lcmaps_run_and_return_poolindex_t lcmaps_run_and_return_poolindex;
# endif /* LCMAPS_USE_DLOPEN */

#endif /* LCMAPS_GLOBUS_H */