@@ -64,13 +64,15 @@ static gss_OID_desc gss_mech_ntlm_OID_desc = {.length = STRING_LENGTH(gss_ntlm_o
64
64
PER_FUNCTION_BLOCK(gss_set_cred_option) \
65
65
PER_FUNCTION_BLOCK(GSS_KRB5_CRED_NO_CI_FLAGS_X)
66
66
67
+ #define GSS_KRB5_CRED_NO_CI_FLAGS_X_AVAILABLE (gss_set_cred_option_ptr != NULL && GSS_KRB5_CRED_NO_CI_FLAGS_X_ptr != NULL)
68
+
67
69
#else
68
70
69
71
#define FOR_ALL_OPTIONAL_GSS_FUNCTIONS
70
72
71
73
#endif //HAVE_GSS_KRB5_CRED_NO_CI_FLAGS_X
72
74
73
- #define FOR_ALL_GSS_FUNCTIONS \
75
+ #define FOR_ALL_REQUIRED_GSS_FUNCTIONS \
74
76
PER_FUNCTION_BLOCK(gss_accept_sec_context) \
75
77
PER_FUNCTION_BLOCK(gss_acquire_cred) \
76
78
PER_FUNCTION_BLOCK(gss_acquire_cred_with_password) \
@@ -91,6 +93,9 @@ static gss_OID_desc gss_mech_ntlm_OID_desc = {.length = STRING_LENGTH(gss_ntlm_o
91
93
PER_FUNCTION_BLOCK(gss_wrap) \
92
94
PER_FUNCTION_BLOCK(GSS_C_NT_USER_NAME) \
93
95
PER_FUNCTION_BLOCK(GSS_C_NT_HOSTBASED_SERVICE) \
96
+
97
+ #define FOR_ALL_GSS_FUNCTIONS \
98
+ FOR_ALL_REQUIRED_GSS_FUNCTIONS \
94
99
FOR_ALL_OPTIONAL_GSS_FUNCTIONS
95
100
96
101
// define indirection pointers for all functions, like
@@ -145,19 +150,27 @@ static int32_t ensure_gss_shim_initialized()
145
150
dlclose (lib );
146
151
}
147
152
148
- // initialize indirection pointers for all functions, like:
153
+ // initialize indirection pointers for all required functions, like:
149
154
// gss_accept_sec_context_ptr = (TYPEOF(gss_accept_sec_context)*)dlsym(s_gssLib, "gss_accept_sec_context");
150
155
// if (gss_accept_sec_context_ptr == NULL) { fprintf(stderr, "Cannot get symbol %s from %s \nError: %s\n", "gss_accept_sec_context", gss_lib_name, dlerror()); return -1; }
151
156
#define PER_FUNCTION_BLOCK (fn ) \
152
157
fn##_ptr = (TYPEOF(fn)*)dlsym(s_gssLib, #fn); \
153
158
if (fn##_ptr == NULL) { fprintf(stderr, "Cannot get symbol " #fn " from %s \nError: %s\n", gss_lib_name, dlerror()); return -1; }
154
-
155
- FOR_ALL_GSS_FUNCTIONS
159
+ FOR_ALL_REQUIRED_GSS_FUNCTIONS
160
+ #undef PER_FUNCTION_BLOCK
161
+ // for optional functions skip the error check
162
+ #define PER_FUNCTION_BLOCK (fn ) \
163
+ fn##_ptr = (TYPEOF(fn)*)dlsym(s_gssLib, #fn);
164
+ FOR_ALL_OPTIONAL_GSS_FUNCTIONS
156
165
#undef PER_FUNCTION_BLOCK
157
166
158
167
return 0 ;
159
168
}
160
169
170
+ #else // GSS_SHIM
171
+
172
+ #define GSS_KRB5_CRED_NO_CI_FLAGS_X_AVAILABLE 1
173
+
161
174
#endif // GSS_SHIM
162
175
163
176
// transfers ownership of the underlying data from gssBuffer to PAL_GssBuffer
@@ -190,7 +203,7 @@ static uint32_t AcquireCredSpNego(uint32_t* minorStatus,
190
203
191
204
// call gss_set_cred_option with GSS_KRB5_CRED_NO_CI_FLAGS_X to support Kerberos Sign Only option from *nix client against a windows server
192
205
#if HAVE_GSS_KRB5_CRED_NO_CI_FLAGS_X
193
- if (majorStatus == GSS_S_COMPLETE )
206
+ if (majorStatus == GSS_S_COMPLETE && GSS_KRB5_CRED_NO_CI_FLAGS_X_AVAILABLE )
194
207
{
195
208
GssBuffer emptyBuffer = GSS_C_EMPTY_BUFFER ;
196
209
uint32_t tempMinorStatus ;
@@ -622,7 +635,7 @@ static uint32_t AcquireCredWithPassword(uint32_t* minorStatus,
622
635
623
636
// call gss_set_cred_option with GSS_KRB5_CRED_NO_CI_FLAGS_X to support Kerberos Sign Only option from *nix client against a windows server
624
637
#if HAVE_GSS_KRB5_CRED_NO_CI_FLAGS_X
625
- if (!isNtlm && majorStatus == GSS_S_COMPLETE )
638
+ if (!isNtlm && majorStatus == GSS_S_COMPLETE && GSS_KRB5_CRED_NO_CI_FLAGS_X_AVAILABLE )
626
639
{
627
640
GssBuffer emptyBuffer = GSS_C_EMPTY_BUFFER ;
628
641
uint32_t tempMinorStatus ;
0 commit comments