gss: Check add_builtin() errors
This commit is contained in:
		| @@ -230,8 +230,10 @@ add_builtin(gssapi_mech_interface mech) | ||||
| 	free(m); | ||||
| 	return minor_status; | ||||
|     } | ||||
|     gss_add_oid_set_member(&minor_status, | ||||
| 			   &m->gm_mech.gm_mech_oid, &_gss_mech_oids); | ||||
|  | ||||
|     if (gss_add_oid_set_member(&minor_status, &m->gm_mech.gm_mech_oid, | ||||
|                                &_gss_mech_oids) != GSS_S_COMPLETE) | ||||
|         return ENOMEM; | ||||
|  | ||||
|     /* pick up the oid sets of names */ | ||||
|  | ||||
| @@ -239,8 +241,11 @@ add_builtin(gssapi_mech_interface mech) | ||||
| 	(*m->gm_mech.gm_inquire_names_for_mech)(&minor_status, | ||||
| 	    &m->gm_mech.gm_mech_oid, &m->gm_name_types); | ||||
|  | ||||
|     if (m->gm_name_types == NULL) | ||||
| 	gss_create_empty_oid_set(&minor_status, &m->gm_name_types); | ||||
|     if (m->gm_name_types == NULL && | ||||
| 	gss_create_empty_oid_set(&minor_status, | ||||
|                                  &m->gm_name_types) != GSS_S_COMPLETE) { | ||||
|         return ENOMEM; | ||||
|     } | ||||
|  | ||||
|     HEIM_TAILQ_INSERT_TAIL(&_gss_mechs, m, gm_link); | ||||
|     return 0; | ||||
| @@ -290,9 +295,15 @@ _gss_load_mech(void) | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	add_builtin(__gss_krb5_initialize()); | ||||
| 	add_builtin(__gss_spnego_initialize()); | ||||
| 	add_builtin(__gss_ntlm_initialize()); | ||||
| 	if (add_builtin(__gss_krb5_initialize())) | ||||
|             _gss_mg_log(1, "Out of memory while adding builtin Kerberos GSS " | ||||
|                         "mechanism to the GSS mechanism switch"); | ||||
| 	if (add_builtin(__gss_spnego_initialize())) | ||||
|             _gss_mg_log(1, "Out of memory while adding builtin SPNEGO " | ||||
|                         "mechanism to the GSS mechanism switch"); | ||||
| 	if (add_builtin(__gss_ntlm_initialize())) | ||||
|             _gss_mg_log(1, "Out of memory while adding builtin NTLM " | ||||
|                         "mechanism to the GSS mechanism switch"); | ||||
|  | ||||
| #ifdef HAVE_DLOPEN | ||||
| 	fp = fopen(conf ? conf : _PATH_GSS_MECH, "r"); | ||||
| @@ -463,7 +474,9 @@ _gss_load_mech(void) | ||||
| out: | ||||
|  | ||||
| #endif | ||||
| 	add_builtin(__gss_sanon_initialize()); | ||||
| 	if (add_builtin(__gss_sanon_initialize())) | ||||
|             _gss_mg_log(1, "Out of memory while adding builtin SANON " | ||||
|                         "mechanism to the GSS mechanism switch"); | ||||
| 	HEIMDAL_MUTEX_unlock(&_gss_mech_mutex); | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Nicolas Williams
					Nicolas Williams