Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle MIC/Wrap security layers correctly even if no user is given
This is obviously cut&copied all over the net. (found nearly identical code including comments in the mutt email client, the upstream calendarserver/pykerberos code and a few other places). And it is wrong if 'user' is empty. RFC 4752 Section 3.1 states the responsibilities of the client side a SASL GSSAPI Authentication. We get the last package from the server in this step, and have to GSS_Unwrap() and inspect the security_layer offerings of the server. This is done and logged here (even if not perfect). Once the offered security layers are known, the client has to send the one used. In the code before the patch this was kind of ok (GSS_AUTH_P_NONE) for the case when there is a authorization ID given, but broken for the case when no user was given. The code just replied with anything the server offers, even if totally unable to handle that, which leads to errors if the established security context is used for further communication (e.g. in LDAP). In addition, these options should be synced with the gssflags of the context, e.g. fail if the server does not honour the requested security. (not that it makes any sense to request any higher security, as the client doesn't handle it.)
- Loading branch information