From: Jeffrey Altman Date: Tue, 23 Nov 2010 17:11:46 +0000 (-0500) Subject: rxkad: fix bg-fcrypt to work with roken X-Git-Tag: upstream/1.8.0_pre1^2~4468 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=000fb2e45a126ea864292b4dd85b216cdb9b6ee0;p=packages%2Fo%2Fopenafs.git rxkad: fix bg-fcrypt to work with roken 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 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/rxkad/bg-fcrypt.c b/src/rxkad/bg-fcrypt.c index 756b76eef..92e3814e1 100644 --- a/src/rxkad/bg-fcrypt.c +++ b/src/rxkad/bg-fcrypt.c @@ -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; }