Skip to content

Fix a crash bug when s4u2proxy is configured #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ if [ x$FLAKE == xyes ]; then
flake8
fi

CFLAGS="-Werror"
#Disable -Werror until we can replace the HMAC stuff which gives warnings
#because it has been deprecated in OpenSSL 3.0
#CFLAGS="-Werror"
if [ x$COMPILER == xclang ]; then
CFLAGS+=" -Wno-missing-field-initializers"
CFLAGS+=" -Wno-missing-braces -Wno-cast-align"
Expand Down
22 changes: 13 additions & 9 deletions src/mod_auth_gssapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,9 @@ void mag_verify_config(request_rec *req, struct mag_config *cfg)
/* we check only once */
if (cfg->verified) return;

#ifdef HAVE_CRED_STORE
/* Check if cred store config is consistent with use_s4u2proxy.
* Although not strictly required it is generally adivsable to
* Although not strictly required it is generally advisable to
* set keytab, client_keytab, and ccache in the cred_store when
* use_s4u2proxy is set, this is to avoid easy mistakes that are
* very difficult to diagnose */
Expand All @@ -724,14 +725,16 @@ void mag_verify_config(request_rec *req, struct mag_config *cfg)
bool has_client_keytab = false;
bool has_ccache = false;

for (int i = 0; i < cfg->cred_store->count; i++) {
const char *key = cfg->cred_store->elements[i].key;
if (strcmp(key, "keytab") == 0) {
has_keytab = true;
} else if (strcmp(key, "client_keytab") == 0) {
has_client_keytab = true;
} else if (strcmp(key, "ccache") == 0) {
has_ccache = true;
if (cfg->cred_store) {
for (int i = 0; i < cfg->cred_store->count; i++) {
const char *key = cfg->cred_store->elements[i].key;
if (strcmp(key, "keytab") == 0) {
has_keytab = true;
} else if (strcmp(key, "client_keytab") == 0) {
has_client_keytab = true;
} else if (strcmp(key, "ccache") == 0) {
has_ccache = true;
}
}
}

Expand All @@ -751,6 +754,7 @@ void mag_verify_config(request_rec *req, struct mag_config *cfg)
"GssapiCredStore", "ccache");
}
}
#endif

cfg->verified = true;
}
Expand Down