Heimdal goes a bit too far. The input_cred_handle argument to gss_add_cred() should be gss_cred_id_t, not gss_const_cred_id_t, since if you don't give it an output_cred_handle pointer then gss_add-cred() mutates the input_cred_handle.