svn rev #24919: trunk/src/lib/gssapi/krb5/

ghudson@MIT.EDU ghudson at MIT.EDU
Mon May 9 14:16:14 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=24919
Commit By: ghudson
Log Message:
Avoid calling gss_release_buffer() from the message-processing code
in lib/gssapi/krb5.



Changed Files:
U   trunk/src/lib/gssapi/krb5/k5unsealiov.c
U   trunk/src/lib/gssapi/krb5/util_crypt.c
Modified: trunk/src/lib/gssapi/krb5/k5unsealiov.c
===================================================================
--- trunk/src/lib/gssapi/krb5/k5unsealiov.c	2011-05-09 18:06:15 UTC (rev 24918)
+++ trunk/src/lib/gssapi/krb5/k5unsealiov.c	2011-05-09 18:16:14 UTC (rev 24919)
@@ -599,13 +599,9 @@
                                        tiov, i, toktype);
     if (major_status == GSS_S_COMPLETE)
         *data = *tdata;
-    else if (tdata->type & GSS_IOV_BUFFER_FLAG_ALLOCATED) {
-        OM_uint32 tmp;
+    else
+        kg_release_iov(tdata, 1);
 
-        gss_release_buffer(&tmp, &tdata->buffer);
-        tdata->type &= ~(GSS_IOV_BUFFER_FLAG_ALLOCATED);
-    }
-
 cleanup:
     if (tiov != NULL)
         free(tiov);

Modified: trunk/src/lib/gssapi/krb5/util_crypt.c
===================================================================
--- trunk/src/lib/gssapi/krb5/util_crypt.c	2011-05-09 18:06:15 UTC (rev 24918)
+++ trunk/src/lib/gssapi/krb5/util_crypt.c	2011-05-09 18:16:14 UTC (rev 24919)
@@ -308,7 +308,6 @@
                    const unsigned char *input_buf, size_t input_len,
                    unsigned char *output_buf)
 {
-    krb5_error_code code;
     krb5_data kd = make_data((char *) kd_data, kd_data_len);
     krb5_crypto_iov kiov;
 
@@ -657,13 +656,14 @@
 kg_release_iov(gss_iov_buffer_desc *iov, int iov_count)
 {
     int i;
-    OM_uint32 min_stat;
 
     assert(iov != GSS_C_NO_IOV_BUFFER);
 
     for (i = 0; i < iov_count; i++) {
         if (iov[i].type & GSS_IOV_BUFFER_FLAG_ALLOCATED) {
-            gss_release_buffer(&min_stat, &iov[i].buffer);
+            free(iov[i].buffer.value);
+            iov[i].buffer.length = 0;
+            iov[i].buffer.value = NULL;
             iov[i].type &= ~(GSS_IOV_BUFFER_FLAG_ALLOCATED);
         }
     }
@@ -677,7 +677,6 @@
     gss_iov_buffer_t data = NULL;
     size_t padlength, relative_padlength;
     unsigned char *p;
-    OM_uint32 minor;
 
     data = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_DATA);
     padding = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_PADDING);
@@ -730,11 +729,7 @@
 
     data->buffer.length -= relative_padlength;
 
-    if (padding->type & GSS_IOV_BUFFER_FLAG_ALLOCATED) {
-        gss_release_buffer(&minor, &padding->buffer);
-        padding->type &= ~(GSS_IOV_BUFFER_FLAG_ALLOCATED);
-    }
-
+    kg_release_iov(padding, 1);
     padding->buffer.length = 0;
     padding->buffer.value = NULL;
 




More information about the cvs-krb5 mailing list