better error/special situation handling in recv_token()
authorMiloš Mulač <mulac@civ.zcu.cz>
Wed, 11 Oct 2006 14:29:13 +0000 (14:29 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Wed, 11 Oct 2006 14:29:13 +0000 (14:29 +0000)
- prevent some rare-but-hard-to-catch errors

org.glite.security.gsoap-plugin/src/glite_gss.c

index e13a63d..eda6021 100644 (file)
@@ -366,8 +366,12 @@ recv_token(int sock, void **token, size_t *token_length, struct timeval *to)
            goto end;
         }
       }
-      if (count == 0 && tl == 0 && errno == 0)
-        return EDG_WLL_GSS_ERROR_EOF; 
+
+      if (count==0) {
+         if (tl==0) 
+            return EDG_WLL_GSS_ERROR_EOF;
+         else goto end;
+      }
       tmp=realloc(t, tl + count);
       if (tmp == NULL) {
         errno = ENOMEM;
@@ -832,6 +836,7 @@ edg_wll_gss_read(edg_wll_GssConnection *connection, void *buf, size_t bufsize,
         /* XXX cleanup */
         return ret;
 
+
       maj_stat = gss_unwrap(&min_stat, connection->context, &input_token,
                            &output_token, NULL, NULL);
       gss_release_buffer(&min_stat, &input_token);