Diff for /libaitrpc/src/cli.c between versions 1.16.8.3 and 1.16.8.5

version 1.16.8.3, 2013/08/22 11:52:20 version 1.16.8.5, 2013/08/22 12:11:35
Line 353  rpc_pkt_Receive(int sock, int type, sockaddr_t * __res Line 353  rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
                         return -1;                          return -1;
                 }                  }
   
   payload:
                 if (type == SOCK_STREAM) {                  if (type == SOCK_STREAM) {
                         memset(buf, 0, blen);                          memset(buf, 0, blen);
                         ret = recv(sock, buf, blen, 0);                          ret = recv(sock, buf, blen, 0);
Line 390  rpc_pkt_Receive(int sock, int type, sockaddr_t * __res Line 391  rpc_pkt_Receive(int sock, int type, sockaddr_t * __res
   
                                 /* calc estimated length */                                  /* calc estimated length */
                                 rpc = (struct tagRPCCall*) buf;                                  rpc = (struct tagRPCCall*) buf;
                                estlen = ntohs(rpc->call_len) + blen;                                estlen = ntohl(rpc->call_len) + blen;
                                printf("ret = %d len=%d\n", ret, estlen); 
                                 if (estlen > AIT_LEN(pkt))                                  if (estlen > AIT_LEN(pkt))
                                         AIT_RE_BUF(pkt, estlen);                                          AIT_RE_BUF(pkt, estlen);
                                 buf = AIT_GET_BUF(pkt) + blen;                                  buf = AIT_GET_BUF(pkt) + blen;
                                 blen = AIT_LEN(pkt) - blen;                                  blen = AIT_LEN(pkt) - blen;
                                   goto payload;
                         } else                          } else
                                 ret += sizeof(struct tagRPCCall);                                  ret += sizeof(struct tagRPCCall);
                 }                  }
Line 462  rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t Line 463  rpc_pkt_Request(ait_val_t * __restrict pkt, rpc_sess_t
         }          }
   
         /* total packet length */          /* total packet length */
        rpc->call_len = htons(len);        rpc->call_len = htonl(len);
   
         if (!nocrc) {          if (!nocrc) {
                 /* calculate CRC */                  /* calculate CRC */
Line 503  rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t  Line 504  rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t 
                 /* calculate CRC */                  /* calculate CRC */
                 crc = ntohs(rpc->call_crc);                  crc = ntohs(rpc->call_crc);
                 rpc->call_crc ^= rpc->call_crc;                  rpc->call_crc ^= rpc->call_crc;
                if (crc != crcFletcher16((u_short*) buf, ntohs(rpc->call_len) / 2)) {                if (crc != crcFletcher16((u_short*) buf, ntohl(rpc->call_len) / 2)) {
                         rpc_SetErr(ERPCMISMATCH, "Bad CRC RPC packet");                          rpc_SetErr(ERPCMISMATCH, "Bad CRC RPC packet");
                         return -1;                          return -1;
                 }                  }
Line 529  rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t  Line 530  rpc_pkt_Replay(ait_val_t * __restrict pkt, rpc_sess_t 
                 rpc_SetErr(EMSGSIZE, "Reply RPC packet not enough buffer space ...");                  rpc_SetErr(EMSGSIZE, "Reply RPC packet not enough buffer space ...");
                 return -1;                  return -1;
         }          }
        if (len > ntohs(rpc->call_len) - sizeof(struct tagRPCCall)) {        if (len > ntohl(rpc->call_len) - sizeof(struct tagRPCCall)) {
                 rpc_SetErr(EMSGSIZE, "Reply RPC packet is too short ...");                  rpc_SetErr(EMSGSIZE, "Reply RPC packet is too short ...");
                 return -1;                  return -1;
         }          }

Removed from v.1.16.8.3  
changed lines
  Added in v.1.16.8.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>