Skip to content

Commit a47d4d4

Browse files
committed
Fix gss_localname with SPNEGO wrapping
This fixes a regression introduced with commit: 9c555e2 Thanks to Matt Woodyard for patient help in debugging this issue. Signed-off-by: Simo Sorce <simo@redhat.com>
1 parent dedf84d commit a47d4d4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/mod_auth_gssapi.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,11 +1268,21 @@ static int mag_complete(struct mag_req_cfg *req_cfg, struct mag_conn *mc,
12681268
#endif
12691269

12701270
if (cfg->map_to_local) {
1271-
/* We pass GSS_C_NO_OID here as passing mech_type does not work
1271+
/* We have to play heuristics here as gss_localname does not work
12721272
* as expected with SPNEGO-wrapped names.
12731273
* http://krbdev.mit.edu/rt/Ticket/Display.html?id=8782
12741274
*/
1275-
maj = gss_localname(&min, client, GSS_C_NO_OID, &lname);
1275+
maj = gss_localname(&min, client, mech_type, &lname);
1276+
if (maj != GSS_S_COMPLETE) {
1277+
uint32_t sub_maj, sub_min;
1278+
/* try fallback with no oid */
1279+
sub_maj = gss_localname(&sub_min, client, GSS_C_NO_OID, &lname);
1280+
if (sub_maj != GSS_S_UNAVAILABLE) {
1281+
/* use second call errors only if they are meaningful */
1282+
maj = sub_maj;
1283+
min = sub_min;
1284+
}
1285+
}
12761286
if (maj != GSS_S_COMPLETE) {
12771287
mag_post_error(req, cfg, MAG_GSS_ERR, maj, min,
12781288
"gss_localname() failed");

0 commit comments

Comments
 (0)