| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssh/src/msg.c | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | int | - | ||||||||||||
| 9 | ssh_msg_send(int fd, u_char type, struct sshbuf *m) | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | u_char buf[5]; | - | ||||||||||||
| 12 | u_int mlen = sshbuf_len(m); | - | ||||||||||||
| 13 | - | |||||||||||||
| 14 | debug3("ssh_msg_send: type %u", (unsigned int)type & 0xff); | - | ||||||||||||
| 15 | - | |||||||||||||
| 16 | put_u32(buf, mlen + 1); | - | ||||||||||||
| 17 | buf[4] = type; | - | ||||||||||||
| 18 |  if (atomicio((ssize_t (*)(int, void *, size_t))write, fd, buf, sizeof(buf)) != sizeof(buf)
  | 0 | ||||||||||||
| 19 | error("ssh_msg_send: write"); | - | ||||||||||||
| 20 |   return never executed:   (-1);return (-1);never executed:  return (-1); | 0 | ||||||||||||
| 21 | } | - | ||||||||||||
| 22 |  if (atomicio((ssize_t (*)(int, void *, size_t))write, fd, sshbuf_mutable_ptr(m), mlen) != mlen
  | 0 | ||||||||||||
| 23 | error("ssh_msg_send: write"); | - | ||||||||||||
| 24 |   return never executed:   (-1);return (-1);never executed:  return (-1); | 0 | ||||||||||||
| 25 | } | - | ||||||||||||
| 26 |  return never executed:   (0);return (0);never executed:  return (0); | 0 | ||||||||||||
| 27 | } | - | ||||||||||||
| 28 | - | |||||||||||||
| 29 | int | - | ||||||||||||
| 30 | ssh_msg_recv(int fd, struct sshbuf *m) | - | ||||||||||||
| 31 | { | - | ||||||||||||
| 32 | u_char buf[4], *p; | - | ||||||||||||
| 33 | u_int msg_len; | - | ||||||||||||
| 34 | int r; | - | ||||||||||||
| 35 | - | |||||||||||||
| 36 | debug3("ssh_msg_recv entering"); | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 |  if (atomicio(read, fd, buf, sizeof(buf)) != sizeof(buf)
  | 0 | ||||||||||||
| 39 | if ( | - | ||||||||||||
| 40 |      (*
 
  | 0 | ||||||||||||
| 41 |            != 
  | 0 | ||||||||||||
| 42 |               32
  | 0 | ||||||||||||
| 43 | ) | - | ||||||||||||
| 44 |    error("ssh_msg_recv: read: header"); never executed:  error("ssh_msg_recv: read: header"); | 0 | ||||||||||||
| 45 |   return never executed:   (-1);return (-1);never executed:  return (-1); | 0 | ||||||||||||
| 46 | } | - | ||||||||||||
| 47 | msg_len = get_u32(buf); | - | ||||||||||||
| 48 |  if (msg_len > 256 * 1024
  | 0 | ||||||||||||
| 49 | error("ssh_msg_recv: read: bad msg_len %u", msg_len); | - | ||||||||||||
| 50 |   return never executed:   (-1);return (-1);never executed:  return (-1); | 0 | ||||||||||||
| 51 | } | - | ||||||||||||
| 52 | sshbuf_reset(m); | - | ||||||||||||
| 53 |  if ((
 
  | 0 | ||||||||||||
| 54 | error("%s: buffer error: %s", __func__, ssh_err(r)); | - | ||||||||||||
| 55 |   return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||
| 56 | } | - | ||||||||||||
| 57 |  if (atomicio(read, fd, p, msg_len) != msg_len
  | 0 | ||||||||||||
| 58 | error("ssh_msg_recv: read: %s", strerror( | - | ||||||||||||
| 59 | (*__errno_location ()) | - | ||||||||||||
| 60 | )); | - | ||||||||||||
| 61 |   return never executed:   (-1);return (-1);never executed:  return (-1); | 0 | ||||||||||||
| 62 | } | - | ||||||||||||
| 63 |  return never executed:   (0);return (0);never executed:  return (0); | 0 | ||||||||||||
| 64 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |