NegoEx broke GSSAPI in BIND 9

Ondřej Surý <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.devel
Message-ID <[email protected]>
Hi,

there’s a regression in krb5 1.18.x that broke SPNEGO usage in BIND 9.

There’s a little bit of history there - historically BIND 9 used internal implementation
of SPNEGO and that still works.  But in the development version, I did drop the
internal implementation in favor of using KRB5 SPNEGO mechanism implementation.

We don’t do anything fancy, the code is basically:

#ifndef GSS_KRB5_MECHANISM
static unsigned char krb5_mech_oid_bytes[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7,
                                              0x12, 0x01, 0x02, 0x02 };
static gss_OID_desc __gss_krb5_mechanism_oid_desc = {
       sizeof(krb5_mech_oid_bytes), krb5_mech_oid_bytes
};
#define GSS_KRB5_MECHANISM (&__gss_krb5_mechanism_oid_desc)
#endif /* ifndef GSS_KRB5_MECHANISM */

#ifndef GSS_SPNEGO_MECHANISM
static unsigned char spnego_mech_oid_bytes[] = { 0x2b, 0x06, 0x01,
                                                0x05, 0x05, 0x02 };
static gss_OID_desc __gss_spnego_mechanism_oid_desc = {
       sizeof(spnego_mech_oid_bytes), spnego_mech_oid_bytes
};
#define GSS_SPNEGO_MECHANISM (&__gss_spnego_mechanism_oid_desc)
#endif /* ifndef GSS_SPNEGO_MECHANISM */

[…]

static OM_uint32
mech_oid_set_create(OM_uint32 *minor, gss_OID_set *mech_oid_set) {
       OM_uint32 gret;

       gret = gss_create_empty_oid_set(minor, mech_oid_set);
       if (gret != GSS_S_COMPLETE) {
               return (gret);
       }

       gret = gss_add_oid_set_member(minor, GSS_KRB5_MECHANISM, mech_oid_set);
       if (gret != GSS_S_COMPLETE) {
               goto release;
       }

       gret = gss_add_oid_set_member(minor, GSS_SPNEGO_MECHANISM,
                                     mech_oid_set);
       if (gret != GSS_S_COMPLETE) {
               goto release;
       }

release:
       REQUIRE(gss_release_oid_set(minor, mech_oid_set) == GSS_S_COMPLETE);

       return (gret);
}

static void
mech_oid_set_release(gss_OID_set *mech_oid_set) {
       OM_uint32 minor;

       REQUIRE(gss_release_oid_set(&minor, mech_oid_set) == GSS_S_COMPLETE);
}

and then it’s used like this:

       gss_OID_set mech_oid_set;

[…]

       gret = mech_oid_set_create(&minor, &mech_oid_set);
       if (gret != GSS_S_COMPLETE) {
               gss_log(3, "failed to create OID_set: %s",
                       gss_error_tostring(gret, minor, buf, sizeof(buf)));
               return (ISC_R_FAILURE);
       }

       gret = gss_acquire_cred(&minor, gname, GSS_C_INDEFINITE, mech_oid_set,
                               usage, cred, NULL, &lifetime);


Unfortunately, this stopped working since 1.18.1, but perhaps we were doing something
wrong from the beginning. Honestly, looking at the GSSAPI is like reading tea leaves :-),
so I would appreciate if I can get some pointers where to start with the debugging.

The code is working in 1.17.1 and it’s neither working in 1.18.1 nor master branch (I saw
some fixes in there, so I tried).

Thanks,
Ondrej
--
Ondřej Surý
[email protected]

_______________________________________________
krbdev mailing list             [email protected]
https://mailman.mit.edu/mailman/listinfo/krbdev
signature.asc (application/pgp-signature, 963 B)
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEw2Gx4wKVQ+vGJel9g3Kkd++uWcIFAl7E+a1fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEMz
NjFCMUUzMDI5NTQzRUJDNjI1RTk3RDgzNzJBNDc3RUZBRTU5QzIACgkQg3Kkd++u
WcKJeQ/9Ew0faT2nAAi+Xh0FGxLzBw4XZiLN2E3bAJiLyYvbjZ9bF8+OLbifl5H+
WRwojlK9FOMnDq6++jZq1XRz+JCCD8Jdfa7D+eqXrbC90c+vDuFtlYyFnjZZuYV8
xq88miMX4uHmh8sKQ74Ca7V84hCotz6mQE8dKMqd4Cmtr24QdBlkHK97urbSymJB
9MYGVoy2wO+XmWZYl87G/aV85EorzGMJe2vilNtfH4cNQDcNpQN3PFR8rfgeJdpb
uHKhd7oS+XqUVu1jDAx2IXg343nj0Xa1CeC1kFtDyICkT8rrs2LojxrVIjvNfyJg
HYhCYjZglWYDTY1rYtN15crIOrOw2QttCxrbg7wulIQg/elmbuEPNJlj2V5nmD8C
EfbLhN+pxBPBlRd3SfgEJo7IxrFjdK2eW+kqk6Q79sERNdEI1D6m0LyMVWhYHPsR
O0gQpKVymlXqTLnVCF8EY54A/2dcuCC4v/F44F/329uFbS6usJnk0pZL6vqbFi0a
ck0sOlt5BUB4yFgVXJjc+xyuw+J59J/iRhIrMDel75A7aQYSrZkDIj7Opn9X8eNv
AuiHghJjv9qRRsfEpF0K36ZbnKKuf7NZVL+3g3tX8Kq9WxbCnaMamSgQAvq8N+Jv
nUpsmcF8cvKF2JRWgvsCp0q9hZqqlcEZVhQKmUrdymD83d+g28o=
=xSVa
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.