Skip to content

Commit 0cea28e

Browse files
committed
Add support for delegate creds on basic auth
When doing fallback basic auth, we may also want to honor the configured directive about storing delegated credentials. Detect if we are configured to store them and set the appopriate init_sec_context flag that will cause the accept_sec_context call to get valid delegated credentials for later storage.
1 parent 384f937 commit 0cea28e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/mod_auth_gssapi.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ static int mag_auth(request_rec *req)
239239
const char *user_ccache = NULL;
240240
const char *orig_ccache = NULL;
241241
#endif
242+
uint32_t init_flags = 0;
242243

243244
type = ap_auth_type(req);
244245
if ((type == NULL) || (strcasecmp(type, "GSSAPI") != 0)) {
@@ -445,9 +446,15 @@ static int mag_auth(request_rec *req)
445446
"failed", maj, min));
446447
goto done;
447448
}
449+
450+
if (cfg->deleg_ccache_dir) {
451+
/* delegate ourselves credentials so we store them as requested */
452+
init_flags |= GSS_C_DELEG_FLAG;
453+
}
454+
448455
/* output and input are inverted here, this is intentional */
449456
maj = gss_init_sec_context(&min, user_cred, &user_ctx, server,
450-
GSS_C_NO_OID, 0, 300,
457+
GSS_C_NO_OID, init_flags, 300,
451458
GSS_C_NO_CHANNEL_BINDINGS, &output,
452459
NULL, &input, NULL, NULL);
453460
if (GSS_ERROR(maj)) {
@@ -473,7 +480,7 @@ static int mag_auth(request_rec *req)
473480
gss_release_buffer(&min, &input);
474481
/* output and input are inverted here, this is intentional */
475482
maj = gss_init_sec_context(&min, user_cred, &user_ctx, server,
476-
GSS_C_NO_OID, 0, 300,
483+
GSS_C_NO_OID, init_flags, 300,
477484
GSS_C_NO_CHANNEL_BINDINGS, &output,
478485
NULL, &input, NULL, NULL);
479486
if (GSS_ERROR(maj)) {

0 commit comments

Comments
 (0)