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
173
174
175
176
177
178
179
180
181
|
/* Copyright (C) 2012 the GSS-PROXY contributors, see COPYING for license */
#include "gss_plugin.h"
/* This will never be called, added only for completeness */
OM_uint32 gssi_indicate_mechs(OM_uint32 *minor_status, gss_OID_set *mech_set)
{
GSSI_TRACE();
*minor_status = 0;
return GSS_S_FAILURE;
}
OM_uint32 gssi_inquire_names_for_mech(OM_uint32 *minor_status,
gss_OID mech_type,
gss_OID_set *mech_names)
{
enum gpp_behavior behavior;
OM_uint32 tmaj, tmin;
OM_uint32 maj, min;
GSSI_TRACE();
behavior = gpp_get_behavior();
tmaj = GSS_S_COMPLETE;
tmin = 0;
/* See if we should try local first */
if (behavior == GPP_LOCAL_ONLY || behavior == GPP_LOCAL_FIRST) {
maj = gss_inquire_names_for_mech(&min,
gpp_special_mech(mech_type),
mech_names);
if (maj == GSS_S_COMPLETE || behavior == GPP_LOCAL_ONLY) {
goto done;
}
/* not successful, save actual local error if remote fallback fails */
tmaj = maj;
tmin = min;
}
/* Then try with remote */
if (behavior != GPP_LOCAL_ONLY) {
maj = gpm_inquire_names_for_mech(&min, mech_type, mech_names);
if (maj == GSS_S_COMPLETE || behavior == GPP_REMOTE_ONLY) {
goto done;
}
/* So remote failed, but we can fallback to local, try that */
maj = gss_inquire_names_for_mech(&min,
gpp_special_mech(mech_type),
mech_names);
}
done:
if (maj != GSS_S_COMPLETE && tmaj != GSS_S_COMPLETE) {
maj = tmaj;
min = tmin;
}
*minor_status = gpp_map_error(min);
return maj;
}
OM_uint32 gssi_inquire_attrs_for_mech(OM_uint32 *minor_status,
gss_OID mech,
gss_OID_set *mech_attrs,
gss_OID_set *known_mech_attrs)
{
enum gpp_behavior behavior;
OM_uint32 tmaj, tmin;
OM_uint32 maj, min;
GSSI_TRACE();
behavior = gpp_get_behavior();
tmaj = GSS_S_COMPLETE;
tmin = 0;
/* See if we should try local first */
if (behavior == GPP_LOCAL_ONLY || behavior == GPP_LOCAL_FIRST) {
maj = gss_inquire_attrs_for_mech(&min, gpp_special_mech(mech),
mech_attrs, known_mech_attrs);
if (maj == GSS_S_COMPLETE || behavior == GPP_LOCAL_ONLY) {
goto done;
}
/* not successful, save actual local error if remote fallback fails */
tmaj = maj;
tmin = min;
}
/* Then try with remote */
if (behavior != GPP_LOCAL_ONLY) {
maj = gpm_inquire_attrs_for_mech(&min, mech,
mech_attrs, known_mech_attrs);
if (maj == GSS_S_COMPLETE || behavior == GPP_REMOTE_ONLY) {
goto done;
}
/* So remote failed, but we can fallback to local, try that */
maj = gss_inquire_attrs_for_mech(&min, gpp_special_mech(mech),
mech_attrs, known_mech_attrs);
}
done:
if (maj != GSS_S_COMPLETE && tmaj != GSS_S_COMPLETE) {
maj = tmaj;
min = tmin;
}
*minor_status = gpp_map_error(min);
return maj;
}
OM_uint32 gssi_inquire_saslname_for_mech(OM_uint32 *minor_status,
const gss_OID desired_mech,
gss_buffer_t sasl_mech_name,
gss_buffer_t mech_name,
gss_buffer_t mech_description)
{
enum gpp_behavior behavior;
OM_uint32 tmaj, tmin;
OM_uint32 maj, min;
GSSI_TRACE();
behavior = gpp_get_behavior();
tmaj = GSS_S_COMPLETE;
tmin = 0;
/* See if we should try local first */
if (behavior == GPP_LOCAL_ONLY || behavior == GPP_LOCAL_FIRST) {
maj = gss_inquire_saslname_for_mech(&min,
gpp_special_mech(desired_mech),
sasl_mech_name, mech_name,
mech_description);
if (maj == GSS_S_COMPLETE || behavior == GPP_LOCAL_ONLY) {
goto done;
}
/* not successful, save actual local error if remote fallback fails */
tmaj = maj;
tmin = min;
}
/* Then try with remote */
if (behavior != GPP_LOCAL_ONLY) {
maj = gpm_inquire_saslname_for_mech(&min, desired_mech, sasl_mech_name,
mech_name, mech_description);
if (maj == GSS_S_COMPLETE || behavior == GPP_REMOTE_ONLY) {
goto done;
}
/* So remote failed, but we can fallback to local, try that */
maj = gss_inquire_saslname_for_mech(&min,
gpp_special_mech(desired_mech),
sasl_mech_name, mech_name,
mech_description);
}
done:
if (maj != GSS_S_COMPLETE && tmaj != GSS_S_COMPLETE) {
maj = tmaj;
min = tmin;
}
*minor_status = gpp_map_error(min);
return maj;
}
OM_uint32 gssi_inquire_mech_for_saslname(OM_uint32 *minor_status,
const gss_buffer_t sasl_mech_name,
gss_OID *mech_type)
{
GSSI_TRACE();
/* FIXME: How to call into mechglue ? */
return GSS_S_UNAVAILABLE;
}
|