Fix a regression in error handling
authorSimo Sorce <simo@redhat.com>
Fri, 20 May 2016 19:26:07 +0000 (15:26 -0400)
committerSimo Sorce <simo@redhat.com>
Fri, 20 May 2016 20:03:16 +0000 (16:03 -0400)
Commit fb6ffe0c50e166bf095736a051e4840bd5a5ad4f introduced a regression
in acquire_cred_from() where a processing error would be masked and a
GSS_COMPLETE status would be returned instead. This caused a credential
structure to be returned when no credentials are actually available.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Greg Hudson <ghudson@mit.edu>
src/gss_creds.c

index 82e72a780c0e2fe2c0393328d2591588f05e5ba5..bf8c1df619a4c46eceb82278e4d0ba40494e6492 100644 (file)
@@ -376,6 +376,7 @@ uint32_t gssntlm_acquire_cred_from(uint32_t *minor_status,
         }
         if (retmin) {
             set_GSSERR(retmin);
+            goto done;
         }
     } else if (cred_usage == GSS_C_ACCEPT) {
         if (name != NULL && name->type != GSSNTLM_NAME_SERVER) {
@@ -386,11 +387,14 @@ uint32_t gssntlm_acquire_cred_from(uint32_t *minor_status,
         retmin = get_server_creds(name, cred);
         if (retmin) {
             set_GSSERR(retmin);
+            goto done;
         }
     } else if (cred_usage == GSS_C_BOTH) {
         set_GSSERRS(ERR_NOTSUPPORTED, GSS_S_CRED_UNAVAIL);
+        goto done;
     } else {
         set_GSSERRS(ERR_BADARG, GSS_S_CRED_UNAVAIL);
+        goto done;
     }
 
     set_GSSERRS(0, GSS_S_COMPLETE);