rxkad: fix bg-fcrypt to work with roken
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 23 Nov 2010 17:11:46 +0000 (12:11 -0500)
committerJeffrey Altman <jaltman@openafs.org>
Wed, 24 Nov 2010 05:33:06 +0000 (21:33 -0800)
On Windows, roken.h defines iov_len as len and iov_base as buf
so that it can use _WSABUF as the iovec structure.  This has negative
consequences when there are local variables iov_len and iov_base
as the same time as there are variables len and buf.  This was the
case in bg-fcrypt rxkad_EncryptPacket and rxkad_DecryptPacket.
As a result, rxkad compiled cleanly but did the wrong thing.
This patchset renames iov_len to ilen and iov_base to ibase in order
to avoid this issue.

Change-Id: Iede2d249b6399fed3e718e782b9bf1315fada93b
Reviewed-on: http://gerrit.openafs.org/3350
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/rxkad/bg-fcrypt.c

index 756b76e..92e3814 100644 (file)
@@ -635,14 +635,14 @@ rxkad_EncryptPacket(const struct rx_connection * rx_connection_not_used,
 
     memcpy(ivec, iv, sizeof(ivec));    /* Must use copy of iv */
     for (frag = &packet->wirevec[1]; len; frag++) {
-       int iov_len = frag->iov_len;
-       afs_uint32 *iov_bas = (afs_uint32 *) frag->iov_base;
-       if (iov_len == 0)
+       int ilen = frag->iov_len;
+       afs_uint32 *ibas = (afs_uint32 *) frag->iov_base;
+       if (ilen == 0)
            return RXKADDATALEN;        /* Length mismatch */
-       if (len < iov_len)
-           iov_len = len;      /* Don't process to much data */
-       fc_cbc_enc(iov_bas, iov_bas, iov_len, sched, ivec);
-       len -= iov_len;
+       if (len < ilen)
+           ilen = len; /* Don't process to much data */
+       fc_cbc_enc(ibas, ibas, ilen, sched, ivec);
+       len -= ilen;
     }
     return 0;
 }
@@ -662,14 +662,14 @@ rxkad_DecryptPacket(const struct rx_connection * rx_connection_not_used,
     ADD_RXKAD_STATS(bytesDecrypted[rxkad_TypeIndex(tp->type)],len);
     memcpy(ivec, iv, sizeof(ivec));    /* Must use copy of iv */
     for (frag = &packet->wirevec[1]; len > 0; frag++) {
-       int iov_len = frag->iov_len;
-       afs_uint32 *iov_bas = (afs_uint32 *) frag->iov_base;
-       if (iov_len == 0)
+       int ilen = frag->iov_len;
+       afs_uint32 *ibas = (afs_uint32 *) frag->iov_base;
+       if (ilen == 0)
            return RXKADDATALEN;        /* Length mismatch */
-       if (len < iov_len)
-           iov_len = len;      /* Don't process to much data */
-       fc_cbc_dec(iov_bas, iov_bas, iov_len, sched, ivec);
-       len -= iov_len;
+       if (len < ilen)
+           ilen = len; /* Don't process to much data */
+       fc_cbc_dec(ibas, ibas, ilen, sched, ivec);
+       len -= ilen;
     }
     return 0;
 }