+2002-12-30 Ken Raeburn <raeburn@mit.edu>
+
+ * gss-misc.c (send_token, recv_token): Open-code the math to send
+ and receive the length as four bytes in network order, rather than
+ using the first four bytes of a size_t.
+
2002-08-29 Ken Raeburn <raeburn@mit.edu>
* Makefile.in: Revert $(S)=>/ change, for Windows support.
{
int len, ret;
unsigned char char_flags = (unsigned char) flags;
+ unsigned char lenbuf[4];
ret = write_all(s, (char *)&char_flags, 1);
if (ret != 1) {
return -1;
}
- len = htonl(tok->length);
+ if (tok->length > 0xffffffffUL)
+ abort();
+ lenbuf[0] = (tok->length >> 24) & 0xff;
+ lenbuf[1] = (tok->length >> 16) & 0xff;
+ lenbuf[2] = (tok->length >> 8) & 0xff;
+ lenbuf[3] = tok->length & 0xff;
- ret = write_all(s, (char *) &len, 4);
+ ret = write_all(s, lenbuf, 4);
if (ret < 0) {
perror("sending token length");
return -1;
{
int ret;
unsigned char char_flags;
+ unsigned char lenbuf[4];
ret = read_all(s, (char *) &char_flags, 1);
if (ret < 0) {
*flags = (int) char_flags;
}
- ret = read_all(s, (char *) &tok->length, 4);
+ ret = read_all(s, lenbuf, 4);
if (ret < 0) {
perror("reading token length");
return -1;
ret, 4);
return -1;
}
-
- tok->length = ntohl(tok->length);
+
+ tok->length = ((lenbuf[0] << 24)
+ | (lenbuf[1] << 16)
+ | (lenbuf[2] << 8)
+ | lenbuf[3]);
tok->value = (char *) malloc(tok->length ? tok->length : 1);
if (tok->length && tok->value == NULL) {
if (display_file)