krb5 commit: Fix error handling in gssint_mechglue_init()

Greg Hudson <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/c120ed5b211ee684b830a6722fc3ab3222afbfa1
commit c120ed5b211ee684b830a6722fc3ab3222afbfa1
Author: Greg Hudson <[email protected]>
Date:   Fri Jan 10 23:47:34 2020 -0500

    Fix error handling in gssint_mechglue_init()
    
    In the unlikely event that one of the functions called by
    gssint_mechglue_init() returns an error, return that error to the
    caller rather than continuing on and discarding the error status.
    Returning success when some of the operations failed could fool the
    library finalizer into thinking that initialization completed.
    Reported by Spencer Malone.
    
    ticket: 8864 (new)
    tags: pullup
    target_version: 1.18
    target_version: 1.17-next

 src/lib/gssapi/mechglue/g_initialize.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/lib/gssapi/mechglue/g_initialize.c b/src/lib/gssapi/mechglue/g_initialize.c
index 2f9ce7a..6d49700 100644
--- a/src/lib/gssapi/mechglue/g_initialize.c
+++ b/src/lib/gssapi/mechglue/g_initialize.c
@@ -114,11 +114,19 @@ gssint_mechglue_init(void)
 	add_error_table(&et_ggss_error_table);
 
 	err = k5_mutex_finish_init(&g_mechSetLock);
+	if (err)
+		return err;
 	err = k5_mutex_finish_init(&g_mechListLock);
+	if (err)
+		return err;
 
 #ifdef _GSS_STATIC_LINK
 	err = gss_krb5int_lib_init();
+	if (err)
+		return err;
 	err = gss_spnegoint_lib_init();
+	if (err)
+		return err;
 #endif
 
 	err = gssint_mecherrmap_init();
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.