Skip to content

Commit 463d932

Browse files
committed
Fix a crash bug when s4u2proxy is configured
If no cred store options are present at all the code now crashes trying to access the structure that should hold the options as it is NULL. Also add ifdefs that were missed in the original patch. Signed-off-by: Simo Sorce <[email protected]>
1 parent 925a9cd commit 463d932

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/mod_auth_gssapi.c

+13-9
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,9 @@ void mag_verify_config(request_rec *req, struct mag_config *cfg)
714714
/* we check only once */
715715
if (cfg->verified) return;
716716

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

727-
for (int i = 0; i < cfg->cred_store->count; i++) {
728-
const char *key = cfg->cred_store->elements[i].key;
729-
if (strcmp(key, "keytab") == 0) {
730-
has_keytab = true;
731-
} else if (strcmp(key, "client_keytab") == 0) {
732-
has_client_keytab = true;
733-
} else if (strcmp(key, "ccache") == 0) {
734-
has_ccache = true;
728+
if (cfg->cred_store) {
729+
for (int i = 0; i < cfg->cred_store->count; i++) {
730+
const char *key = cfg->cred_store->elements[i].key;
731+
if (strcmp(key, "keytab") == 0) {
732+
has_keytab = true;
733+
} else if (strcmp(key, "client_keytab") == 0) {
734+
has_client_keytab = true;
735+
} else if (strcmp(key, "ccache") == 0) {
736+
has_ccache = true;
737+
}
735738
}
736739
}
737740

@@ -751,6 +754,7 @@ void mag_verify_config(request_rec *req, struct mag_config *cfg)
751754
"GssapiCredStore", "ccache");
752755
}
753756
}
757+
#endif
754758

755759
cfg->verified = true;
756760
}

0 commit comments

Comments
 (0)