Added edg_wll_gss_unread() to unget already received data back to the buffer so it...
authorDaniel Kouřil <kouril@ics.muni.cz>
Thu, 2 Jul 2009 14:48:39 +0000 (14:48 +0000)
committerDaniel Kouřil <kouril@ics.muni.cz>
Thu, 2 Jul 2009 14:48:39 +0000 (14:48 +0000)
org.glite.security.gss/interface/glite_gss.h
org.glite.security.gss/src/glite_gss.c

index ae3971c..4a41cfa 100644 (file)
@@ -155,6 +155,11 @@ int
 edg_wll_gss_equal_subj(const char *a,
                       const char *b);
 
+int
+edg_wll_gss_unread(edg_wll_GssConnection *connection,
+                   void *data,
+                   size_t len);
+
 
 #ifdef __cplusplus
 } 
index 61ce138..5474767 100644 (file)
@@ -1459,3 +1459,26 @@ edg_wll_gss_equal_subj(const char *a, const char *b)
        free(an); free(bn);
        return res;
 }
+
+int
+edg_wll_gss_unread(edg_wll_GssConnection *con, void *data, size_t len)
+{
+   char *tmp;
+
+   if (len == 0)
+       return 0;
+
+   tmp = malloc(len + con->bufsize);
+   if (tmp == NULL)
+       return ENOMEM;
+
+   memcpy(tmp, data, len);
+   if (con->bufsize > 0)
+       memcpy(tmp + len, con->buffer, con->bufsize);
+
+   free(con->buffer);
+   con->buffer = tmp;
+   con->bufsize += len;
+
+   return 0;
+}