ssh_agent_new:
  130|     10|ssh_agent ssh_agent_new(struct ssh_session_struct *session) {
  131|     10|  ssh_agent agent = NULL;
  132|       |
  133|     10|  agent = malloc(sizeof(struct ssh_agent_struct));
  134|     10|  if (agent == NULL) {
  ------------------
  |  Branch (134:7): [True: 0, False: 10]
  ------------------
  135|      0|    return NULL;
  136|      0|  }
  137|     10|  ZERO_STRUCTP(agent);
  ------------------
  |  |  330|     10|#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
  |  |  ------------------
  |  |  |  Branch (330:34): [True: 10, False: 0]
  |  |  |  Branch (330:93): [Folded - Ignored]
  |  |  ------------------
  ------------------
  138|       |
  139|     10|  agent->count = 0;
  140|     10|  agent->sock = ssh_socket_new(session);
  141|     10|  if (agent->sock == NULL) {
  ------------------
  |  Branch (141:7): [True: 0, False: 10]
  ------------------
  142|      0|    SAFE_FREE(agent);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  143|      0|    return NULL;
  144|      0|  }
  145|     10|  agent->channel = NULL;
  146|     10|  return agent;
  147|     10|}
ssh_agent_close:
  206|     10|void ssh_agent_close(struct ssh_agent_struct *agent) {
  207|     10|  if (agent == NULL) {
  ------------------
  |  Branch (207:7): [True: 0, False: 10]
  ------------------
  208|      0|    return;
  209|      0|  }
  210|       |
  211|     10|  ssh_socket_close(agent->sock);
  212|     10|}
ssh_agent_free:
  214|     10|void ssh_agent_free(ssh_agent agent) {
  215|     10|  if (agent) {
  ------------------
  |  Branch (215:7): [True: 10, False: 0]
  ------------------
  216|     10|    if (agent->ident) {
  ------------------
  |  Branch (216:9): [True: 0, False: 10]
  ------------------
  217|      0|      SSH_BUFFER_FREE(agent->ident);
  ------------------
  |  |  834|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 0, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  218|      0|    }
  219|     10|    if (agent->sock) {
  ------------------
  |  Branch (219:9): [True: 10, False: 0]
  ------------------
  220|     10|      ssh_agent_close(agent);
  221|     10|      ssh_socket_free(agent->sock);
  222|     10|    }
  223|     10|    SAFE_FREE(agent);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 10, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  224|     10|  }
  225|     10|}

ssh_agent_state_free:
  872|     10|{
  873|     10|    struct ssh_agent_state_struct *state = data;
  874|       |
  875|     10|    if (state) {
  ------------------
  |  Branch (875:9): [True: 0, False: 10]
  ------------------
  876|      0|        SSH_STRING_FREE_CHAR(state->comment);
  ------------------
  |  |  804|      0|    do { if ((x) != NULL) { ssh_string_free_char(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (804:14): [True: 0, False: 0]
  |  |  |  Branch (804:74): [Folded - Ignored]
  |  |  ------------------
  ------------------
  877|      0|        ssh_key_free(state->pubkey);
  878|      0|        free (state);
  879|      0|    }
  880|     10|}

ssh_buffer_new:
  121|     60|{
  122|     60|    struct ssh_buffer_struct *buf = NULL;
  123|     60|    int rc;
  124|       |
  125|     60|    buf = calloc(1, sizeof(struct ssh_buffer_struct));
  126|     60|    if (buf == NULL) {
  ------------------
  |  Branch (126:9): [True: 0, False: 60]
  ------------------
  127|      0|        return NULL;
  128|      0|    }
  129|       |
  130|       |    /*
  131|       |     * Always preallocate 64 bytes.
  132|       |     *
  133|       |     * -1 for realloc_buffer magic.
  134|       |     */
  135|     60|    rc = ssh_buffer_allocate_size(buf, 64 - 1);
  136|     60|    if (rc != 0) {
  ------------------
  |  Branch (136:9): [True: 0, False: 60]
  ------------------
  137|      0|        SAFE_FREE(buf);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  138|      0|        return NULL;
  139|      0|    }
  140|     60|    buffer_verify(buf);
  141|       |
  142|     60|    return buf;
  143|     60|}
ssh_buffer_free:
  151|     60|{
  152|     60|    if (buffer == NULL) {
  ------------------
  |  Branch (152:9): [True: 0, False: 60]
  ------------------
  153|      0|        return;
  154|      0|    }
  155|     60|    buffer_verify(buffer);
  156|       |
  157|     60|    if (buffer->secure && buffer->allocated > 0) {
  ------------------
  |  Branch (157:9): [True: 0, False: 60]
  |  Branch (157:27): [True: 0, False: 0]
  ------------------
  158|       |        /* burn the data */
  159|      0|        explicit_bzero(buffer->data, buffer->allocated);
  160|      0|        SAFE_FREE(buffer->data);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  161|       |
  162|      0|        explicit_bzero(buffer, sizeof(struct ssh_buffer_struct));
  163|     60|    } else {
  164|     60|        SAFE_FREE(buffer->data);
  ------------------
  |  |  324|     60|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 60, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  165|     60|    }
  166|     60|    SAFE_FREE(buffer);
  ------------------
  |  |  324|     60|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 60, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|     60|}
ssh_buffer_allocate_size:
  343|     60|{
  344|     60|    buffer_verify(buffer);
  345|       |
  346|     60|    if (buffer->allocated < len) {
  ------------------
  |  Branch (346:9): [True: 60, False: 0]
  ------------------
  347|     60|        if (buffer->pos > 0) {
  ------------------
  |  Branch (347:13): [True: 0, False: 60]
  ------------------
  348|      0|            buffer_shift(buffer);
  349|      0|        }
  350|     60|        if (realloc_buffer(buffer, len) < 0) {
  ------------------
  |  Branch (350:13): [True: 0, False: 60]
  ------------------
  351|      0|            return -1;
  352|      0|        }
  353|     60|    }
  354|       |
  355|     60|    buffer_verify(buffer);
  356|       |
  357|     60|    return 0;
  358|     60|}
buffer.c:realloc_buffer:
  183|     60|{
  184|     60|    uint32_t smallest = 1;
  185|     60|    uint8_t *new = NULL;
  186|       |
  187|     60|    buffer_verify(buffer);
  188|       |
  189|       |    /* Find the smallest power of two which is greater or equal to needed */
  190|    420|    while(smallest <= needed) {
  ------------------
  |  Branch (190:11): [True: 360, False: 60]
  ------------------
  191|    360|        if (smallest == 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 360]
  ------------------
  192|      0|            return -1;
  193|      0|        }
  194|    360|        smallest <<= 1;
  195|    360|    }
  196|     60|    needed = smallest;
  197|       |
  198|     60|    if (needed > BUFFER_SIZE_MAX) {
  ------------------
  |  |   57|     60|#define BUFFER_SIZE_MAX 0x10000000
  ------------------
  |  Branch (198:9): [True: 0, False: 60]
  ------------------
  199|      0|        return -1;
  200|      0|    }
  201|       |
  202|     60|    if (buffer->secure) {
  ------------------
  |  Branch (202:9): [True: 0, False: 60]
  ------------------
  203|      0|        new = malloc(needed);
  204|      0|        if (new == NULL) {
  ------------------
  |  Branch (204:13): [True: 0, False: 0]
  ------------------
  205|      0|            return -1;
  206|      0|        }
  207|      0|        memcpy(new, buffer->data, buffer->used);
  208|      0|        explicit_bzero(buffer->data, buffer->used);
  209|      0|        SAFE_FREE(buffer->data);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  210|     60|    } else {
  211|     60|        new = realloc(buffer->data, needed);
  212|     60|        if (new == NULL) {
  ------------------
  |  Branch (212:13): [True: 0, False: 60]
  ------------------
  213|      0|            return -1;
  214|      0|        }
  215|     60|    }
  216|     60|    buffer->data = new;
  217|     60|    buffer->allocated = needed;
  218|       |
  219|     60|    buffer_verify(buffer);
  220|     60|    return 0;
  221|     60|}

ssh_config_parse_string:
 1251|     10|{
 1252|     10|    char line[MAX_LINE_SIZE] = {0};
 1253|     10|    const char *c = input, *line_start = input;
 1254|     10|    unsigned int line_num = 0, line_len;
 1255|     10|    int parsing, rv;
 1256|       |
 1257|     10|    SSH_LOG(SSH_LOG_DEBUG, "Reading configuration data from string:");
  ------------------
  |  |  251|     10|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1258|     10|    SSH_LOG(SSH_LOG_DEBUG, "START\n%s\nEND", input);
  ------------------
  |  |  251|     10|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1259|       |
 1260|     10|    parsing = 1;
 1261|  1.16k|    while (1) {
  ------------------
  |  Branch (1261:12): [Folded - Ignored]
  ------------------
 1262|  1.16k|        line_num++;
 1263|  1.16k|        line_start = c;
 1264|  1.16k|        c = strchr(line_start, '\n');
 1265|  1.16k|        if (c == NULL) {
  ------------------
  |  Branch (1265:13): [True: 10, False: 1.15k]
  ------------------
 1266|       |            /* if there is no newline at the end of the string */
 1267|     10|            c = strchr(line_start, '\0');
 1268|     10|        }
 1269|  1.16k|        if (c == NULL) {
  ------------------
  |  Branch (1269:13): [True: 0, False: 1.16k]
  ------------------
 1270|       |            /* should not happen, would mean a string without trailing '\0' */
 1271|      0|            SSH_LOG(SSH_LOG_TRACE, "No trailing '\\0' in config string");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1272|      0|            return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1273|      0|        }
 1274|  1.16k|        line_len = c - line_start;
 1275|  1.16k|        if (line_len > MAX_LINE_SIZE - 1) {
  ------------------
  |  |   52|  1.16k|#define MAX_LINE_SIZE 1024
  ------------------
  |  Branch (1275:13): [True: 8, False: 1.15k]
  ------------------
 1276|      8|            SSH_LOG(SSH_LOG_TRACE, "Line %u too long: %u characters",
  ------------------
  |  |  251|      8|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1277|      8|                    line_num, line_len);
 1278|      8|            return SSH_ERROR;
  ------------------
  |  |  312|      8|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1279|      8|        }
 1280|  1.15k|        memcpy(line, line_start, line_len);
 1281|  1.15k|        line[line_len] = '\0';
 1282|  1.15k|        SSH_LOG(SSH_LOG_DEBUG, "Line %u: %s", line_num, line);
  ------------------
  |  |  251|  1.15k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1283|  1.15k|        rv = ssh_config_parse_line(session, line, line_num, &parsing, 0, false);
 1284|  1.15k|        if (rv < 0) {
  ------------------
  |  Branch (1284:13): [True: 0, False: 1.15k]
  ------------------
 1285|      0|            return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1286|      0|        }
 1287|  1.15k|        if (*c == '\0') {
  ------------------
  |  Branch (1287:13): [True: 2, False: 1.15k]
  ------------------
 1288|      2|            break;
 1289|      2|        }
 1290|  1.15k|        c++;
 1291|  1.15k|    }
 1292|       |
 1293|      2|    return SSH_OK;
  ------------------
  |  |  311|      2|#define SSH_OK 0     /* No error */
  ------------------
 1294|     10|}
config.c:ssh_config_parse_line:
  582|  1.15k|{
  583|  1.15k|  enum ssh_config_opcode_e opcode;
  584|  1.15k|  const char *p = NULL, *p2 = NULL;
  585|  1.15k|  char *s = NULL, *x = NULL;
  586|  1.15k|  char *keyword = NULL;
  587|  1.15k|  char *lowerhost = NULL;
  588|  1.15k|  size_t len;
  589|  1.15k|  int i, rv;
  590|  1.15k|  uint8_t *seen = session->opts.options_seen;
  591|  1.15k|  long l;
  592|  1.15k|  int64_t ll;
  593|       |
  594|       |  /* Ignore empty lines */
  595|  1.15k|  if (line == NULL || *line == '\0') {
  ------------------
  |  Branch (595:7): [True: 0, False: 1.15k]
  |  Branch (595:23): [True: 327, False: 828]
  ------------------
  596|    327|    return 0;
  597|    327|  }
  598|       |
  599|    828|  x = s = strdup(line);
  600|    828|  if (s == NULL) {
  ------------------
  |  Branch (600:7): [True: 0, False: 828]
  ------------------
  601|      0|    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  602|      0|    return -1;
  603|      0|  }
  604|       |
  605|       |  /* Remove trailing spaces */
  606|    843|  for (len = strlen(s) - 1; len > 0; len--) {
  ------------------
  |  Branch (606:29): [True: 787, False: 56]
  ------------------
  607|    787|    if (! isspace(s[len])) {
  ------------------
  |  Branch (607:9): [True: 772, False: 15]
  ------------------
  608|    772|      break;
  609|    772|    }
  610|     15|    s[len] = '\0';
  611|     15|  }
  612|       |
  613|    828|  keyword = ssh_config_get_token(&s);
  614|    828|  if (keyword == NULL || *keyword == '#' ||
  ------------------
  |  Branch (614:7): [True: 0, False: 828]
  |  Branch (614:26): [True: 0, False: 828]
  ------------------
  615|    828|      *keyword == '\0' || *keyword == '\n') {
  ------------------
  |  Branch (615:7): [True: 4, False: 824]
  |  Branch (615:27): [True: 0, False: 824]
  ------------------
  616|      4|    SAFE_FREE(x);
  ------------------
  |  |  324|      4|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 4, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  617|      4|    return 0;
  618|      4|  }
  619|       |
  620|    824|  opcode = ssh_config_get_opcode(keyword);
  621|    824|  if (*parsing == 1 &&
  ------------------
  |  Branch (621:7): [True: 120, False: 704]
  ------------------
  622|    824|      opcode != SOC_HOST &&
  ------------------
  |  Branch (622:7): [True: 118, False: 2]
  ------------------
  623|    824|      opcode != SOC_MATCH &&
  ------------------
  |  Branch (623:7): [True: 115, False: 3]
  ------------------
  624|    824|      opcode != SOC_INCLUDE &&
  ------------------
  |  Branch (624:7): [True: 115, False: 0]
  ------------------
  625|    824|      opcode != SOC_IDENTITY &&
  ------------------
  |  Branch (625:7): [True: 110, False: 5]
  ------------------
  626|    824|      opcode > SOC_UNSUPPORTED &&
  ------------------
  |  Branch (626:7): [True: 7, False: 103]
  ------------------
  627|    824|      opcode < SOC_MAX) { /* Ignore all unknown types here */
  ------------------
  |  Branch (627:7): [True: 7, False: 0]
  ------------------
  628|       |      /* Skip all the options that were already applied */
  629|      7|      if (seen[opcode] != 0) {
  ------------------
  |  Branch (629:11): [True: 3, False: 4]
  ------------------
  630|      3|          SAFE_FREE(x);
  ------------------
  |  |  324|      3|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 3, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  631|      3|          return 0;
  632|      3|      }
  633|      4|      seen[opcode] = 1;
  634|      4|  }
  635|       |
  636|    821|  switch (opcode) {
  637|      4|    case SOC_INCLUDE: /* recursive include of other files */
  ------------------
  |  Branch (637:5): [True: 4, False: 817]
  ------------------
  638|       |
  639|      4|      p = ssh_config_get_str_tok(&s, NULL);
  640|      4|      if (p && *parsing) {
  ------------------
  |  Branch (640:11): [True: 2, False: 2]
  |  Branch (640:16): [True: 0, False: 2]
  ------------------
  641|      0|        char *path = ssh_config_make_absolute(session, p, global);
  642|      0|        if (path == NULL) {
  ------------------
  |  Branch (642:13): [True: 0, False: 0]
  ------------------
  643|      0|          SSH_LOG(SSH_LOG_WARN, "line %d: Failed to allocate memory "
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  644|      0|                  "for the include path expansion", count);
  645|      0|          SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  646|      0|          return -1;
  647|      0|        }
  648|      0|#if defined(HAVE_GLOB) && defined(HAVE_GLOB_GL_FLAGS_MEMBER)
  649|      0|        local_parse_glob(session, path, parsing, depth + 1, global);
  650|       |#else
  651|       |        local_parse_file(session, path, parsing, depth + 1, global);
  652|       |#endif /* HAVE_GLOB */
  653|      0|        free(path);
  654|      0|      }
  655|      4|      break;
  656|       |
  657|     75|    case SOC_MATCH: {
  ------------------
  |  Branch (657:5): [True: 75, False: 746]
  ------------------
  658|     75|        bool negate;
  659|     75|        int result = 1;
  660|     75|        size_t args = 0;
  661|     75|        enum ssh_config_match_e opt;
  662|     75|        char *localuser = NULL;
  663|       |
  664|     75|        *parsing = 0;
  665|    155|        do {
  666|    155|            p = p2 = ssh_config_get_str_tok(&s, NULL);
  667|    155|            if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (667:17): [True: 75, False: 80]
  |  Branch (667:30): [True: 0, False: 80]
  ------------------
  668|     75|                break;
  669|     75|            }
  670|     80|            args++;
  671|     80|            SSH_LOG(SSH_LOG_DEBUG, "line %d: Processing Match keyword '%s'",
  ------------------
  |  |  251|     80|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  672|     80|                    count, p);
  673|       |
  674|       |            /* If the option is prefixed with ! the result should be negated */
  675|     80|            negate = false;
  676|     80|            if (p[0] == '!') {
  ------------------
  |  Branch (676:17): [True: 0, False: 80]
  ------------------
  677|      0|                negate = true;
  678|      0|                p++;
  679|      0|            }
  680|       |
  681|     80|            opt = ssh_config_get_match_opcode(p);
  682|     80|            switch (opt) {
  683|      0|            case MATCH_ALL:
  ------------------
  |  Branch (683:13): [True: 0, False: 80]
  ------------------
  684|      0|                p = ssh_config_get_str_tok(&s, NULL);
  685|      0|                if (args <= 2 && (p == NULL || p[0] == '\0')) {
  ------------------
  |  Branch (685:21): [True: 0, False: 0]
  |  Branch (685:35): [True: 0, False: 0]
  |  Branch (685:48): [True: 0, False: 0]
  ------------------
  686|       |                    /* The first or second, but last argument. The "all" keyword
  687|       |                     * can be prefixed with either "final" or "canonical"
  688|       |                     * keywords which do not have any effect here. */
  689|      0|                    if (negate == true) {
  ------------------
  |  Branch (689:25): [True: 0, False: 0]
  ------------------
  690|      0|                        result = 0;
  691|      0|                    }
  692|      0|                    break;
  693|      0|                }
  694|       |
  695|      0|                ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  696|      0|                              "line %d: ERROR - Match all cannot be combined with "
  697|      0|                              "other Match attributes", count);
  698|      0|                SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  699|      0|                return -1;
  700|       |
  701|      0|            case MATCH_FINAL:
  ------------------
  |  Branch (701:13): [True: 0, False: 80]
  ------------------
  702|      3|            case MATCH_CANONICAL:
  ------------------
  |  Branch (702:13): [True: 3, False: 77]
  ------------------
  703|      3|                SSH_LOG(SSH_LOG_DEBUG,
  ------------------
  |  |  251|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  704|      3|                        "line %d: Unsupported Match keyword '%s', skipping",
  705|      3|                        count,
  706|      3|                        p);
  707|       |                /* Not set any result here -- the result is dependent on the
  708|       |                 * following matches after this keyword */
  709|      3|                break;
  710|       |
  711|     77|            case MATCH_EXEC:
  ------------------
  |  Branch (711:13): [True: 77, False: 3]
  ------------------
  712|       |                /* Skip one argument (including in quotes) */
  713|     77|                p = ssh_config_get_token(&s);
  714|     77|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (714:21): [True: 0, False: 77]
  |  Branch (714:34): [True: 0, False: 77]
  ------------------
  715|      0|                    SSH_LOG(SSH_LOG_TRACE, "line %d: Match keyword "
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  716|      0|                            "'%s' requires argument", count, p2);
  717|      0|                    SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  718|      0|                    return -1;
  719|      0|                }
  720|     77|                if (result != 1) {
  ------------------
  |  Branch (720:21): [True: 2, False: 75]
  ------------------
  721|      2|                    SSH_LOG(SSH_LOG_DEBUG, "line %d: Skipped match exec "
  ------------------
  |  |  251|      2|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  722|      2|                            "'%s' as previous conditions already failed.",
  723|      2|                            count, p2);
  724|      2|                    continue;
  725|      2|                }
  726|     75|                result &= ssh_match_exec(session, p, negate);
  727|     75|                args++;
  728|     75|                break;
  729|       |
  730|      0|            case MATCH_LOCALUSER:
  ------------------
  |  Branch (730:13): [True: 0, False: 80]
  ------------------
  731|       |                /* Here we match only one argument */
  732|      0|                p = ssh_config_get_str_tok(&s, NULL);
  733|      0|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (733:21): [True: 0, False: 0]
  |  Branch (733:34): [True: 0, False: 0]
  ------------------
  734|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  735|      0|                                  "line %d: ERROR - Match user keyword "
  736|      0|                                  "requires argument", count);
  737|      0|                    SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  738|      0|                    return -1;
  739|      0|                }
  740|      0|                localuser = ssh_get_local_username();
  741|      0|                if (localuser == NULL) {
  ------------------
  |  Branch (741:21): [True: 0, False: 0]
  ------------------
  742|      0|                    SSH_LOG(SSH_LOG_TRACE, "line %d: Can not get local username "
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  743|      0|                            "for conditional matching.", count);
  744|      0|                    SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  745|      0|                    return -1;
  746|      0|                }
  747|      0|                result &= ssh_config_match(localuser, p, negate);
  748|      0|                SAFE_FREE(localuser);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  749|      0|                args++;
  750|      0|                break;
  751|       |
  752|      0|            case MATCH_ORIGINALHOST:
  ------------------
  |  Branch (752:13): [True: 0, False: 80]
  ------------------
  753|       |                /* Skip one argument */
  754|      0|                p = ssh_config_get_str_tok(&s, NULL);
  755|      0|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (755:21): [True: 0, False: 0]
  |  Branch (755:34): [True: 0, False: 0]
  ------------------
  756|      0|                    SSH_LOG(SSH_LOG_TRACE, "line %d: Match keyword "
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  757|      0|                            "'%s' requires argument", count, p2);
  758|      0|                    SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  759|      0|                    return -1;
  760|      0|                }
  761|      0|                args++;
  762|      0|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  763|      0|                        "line %d: Unsupported Match keyword '%s', ignoring",
  764|      0|                        count,
  765|      0|                        p2);
  766|      0|                result = 0;
  767|      0|                break;
  768|       |
  769|      0|            case MATCH_HOST:
  ------------------
  |  Branch (769:13): [True: 0, False: 80]
  ------------------
  770|       |                /* Here we match only one argument */
  771|      0|                p = ssh_config_get_str_tok(&s, NULL);
  772|      0|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (772:21): [True: 0, False: 0]
  |  Branch (772:34): [True: 0, False: 0]
  ------------------
  773|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  774|      0|                                  "line %d: ERROR - Match host keyword "
  775|      0|                                  "requires argument", count);
  776|      0|                    SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  777|      0|                    return -1;
  778|      0|                }
  779|      0|                result &= ssh_config_match(session->opts.host, p, negate);
  780|      0|                args++;
  781|      0|                break;
  782|       |
  783|      0|            case MATCH_USER:
  ------------------
  |  Branch (783:13): [True: 0, False: 80]
  ------------------
  784|       |                /* Here we match only one argument */
  785|      0|                p = ssh_config_get_str_tok(&s, NULL);
  786|      0|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (786:21): [True: 0, False: 0]
  |  Branch (786:34): [True: 0, False: 0]
  ------------------
  787|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  788|      0|                                  "line %d: ERROR - Match user keyword "
  789|      0|                                  "requires argument", count);
  790|      0|                    SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  791|      0|                    return -1;
  792|      0|                }
  793|      0|                result &= ssh_config_match(session->opts.username, p, negate);
  794|      0|                args++;
  795|      0|                break;
  796|       |
  797|      0|            case MATCH_UNKNOWN:
  ------------------
  |  Branch (797:13): [True: 0, False: 80]
  ------------------
  798|      0|            default:
  ------------------
  |  Branch (798:13): [True: 0, False: 80]
  ------------------
  799|      0|                ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  800|      0|                              "ERROR - Unknown argument '%s' for Match keyword", p);
  801|      0|                SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  802|      0|                return -1;
  803|     80|            }
  804|     80|        } while (p != NULL && p[0] != '\0');
  ------------------
  |  Branch (804:18): [True: 80, False: 0]
  |  Branch (804:31): [True: 80, False: 0]
  ------------------
  805|     75|        if (args == 0) {
  ------------------
  |  Branch (805:13): [True: 0, False: 75]
  ------------------
  806|      0|            ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  807|      0|                          "ERROR - Match keyword requires an argument");
  808|      0|            SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  809|      0|            return -1;
  810|      0|        }
  811|     75|        *parsing = result;
  812|     75|        break;
  813|     75|    }
  814|     14|    case SOC_HOST: {
  ------------------
  |  Branch (814:5): [True: 14, False: 807]
  ------------------
  815|     14|        int ok = 0, result = -1;
  816|       |
  817|     14|        *parsing = 0;
  818|     14|        lowerhost = (session->opts.host) ? ssh_lowercase(session->opts.host) : NULL;
  ------------------
  |  Branch (818:21): [True: 14, False: 0]
  ------------------
  819|     14|        for (p = ssh_config_get_str_tok(&s, NULL);
  820|     83|             p != NULL && p[0] != '\0';
  ------------------
  |  Branch (820:14): [True: 69, False: 14]
  |  Branch (820:27): [True: 69, False: 0]
  ------------------
  821|     69|             p = ssh_config_get_str_tok(&s, NULL)) {
  822|     69|             if (ok >= 0) {
  ------------------
  |  Branch (822:18): [True: 69, False: 0]
  ------------------
  823|     69|               ok = match_hostname(lowerhost, p, strlen(p));
  824|     69|               if (result == -1 && ok < 0) {
  ------------------
  |  Branch (824:20): [True: 63, False: 6]
  |  Branch (824:36): [True: 0, False: 63]
  ------------------
  825|      0|                   result = 0;
  826|     69|               } else if (result == -1 && ok > 0) {
  ------------------
  |  Branch (826:27): [True: 63, False: 6]
  |  Branch (826:43): [True: 3, False: 60]
  ------------------
  827|      3|                   result = 1;
  828|      3|               }
  829|     69|            }
  830|     69|        }
  831|     14|        SAFE_FREE(lowerhost);
  ------------------
  |  |  324|     14|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 14, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  832|     14|        if (result != -1) {
  ------------------
  |  Branch (832:13): [True: 3, False: 11]
  ------------------
  833|      3|            *parsing = result;
  834|      3|        }
  835|     14|        break;
  836|     75|    }
  837|      0|    case SOC_HOSTNAME:
  ------------------
  |  Branch (837:5): [True: 0, False: 821]
  ------------------
  838|      0|      p = ssh_config_get_str_tok(&s, NULL);
  839|      0|      if (p && *parsing) {
  ------------------
  |  Branch (839:11): [True: 0, False: 0]
  |  Branch (839:16): [True: 0, False: 0]
  ------------------
  840|      0|        char *z = ssh_path_expand_escape(session, p);
  841|      0|        if (z == NULL) {
  ------------------
  |  Branch (841:13): [True: 0, False: 0]
  ------------------
  842|      0|            z = strdup(p);
  843|      0|        }
  844|      0|        ssh_options_set(session, SSH_OPTIONS_HOST, z);
  845|      0|        free(z);
  846|      0|      }
  847|      0|      break;
  848|     34|    case SOC_PORT:
  ------------------
  |  Branch (848:5): [True: 34, False: 787]
  ------------------
  849|     34|        p = ssh_config_get_str_tok(&s, NULL);
  850|     34|        if (p && *parsing) {
  ------------------
  |  Branch (850:13): [True: 9, False: 25]
  |  Branch (850:18): [True: 1, False: 8]
  ------------------
  851|      1|            ssh_options_set(session, SSH_OPTIONS_PORT_STR, p);
  852|      1|        }
  853|     34|        break;
  854|      0|    case SOC_USERNAME:
  ------------------
  |  Branch (854:5): [True: 0, False: 821]
  ------------------
  855|      0|      if (session->opts.username == NULL) {
  ------------------
  |  Branch (855:11): [True: 0, False: 0]
  ------------------
  856|      0|          p = ssh_config_get_str_tok(&s, NULL);
  857|      0|          if (p && *parsing) {
  ------------------
  |  Branch (857:15): [True: 0, False: 0]
  |  Branch (857:20): [True: 0, False: 0]
  ------------------
  858|      0|            ssh_options_set(session, SSH_OPTIONS_USER, p);
  859|      0|         }
  860|      0|      }
  861|      0|      break;
  862|     23|    case SOC_IDENTITY:
  ------------------
  |  Branch (862:5): [True: 23, False: 798]
  ------------------
  863|     23|      p = ssh_config_get_str_tok(&s, NULL);
  864|     23|      if (p && *parsing) {
  ------------------
  |  Branch (864:11): [True: 22, False: 1]
  |  Branch (864:16): [True: 5, False: 17]
  ------------------
  865|      5|        ssh_options_set(session, SSH_OPTIONS_ADD_IDENTITY, p);
  866|      5|      }
  867|     23|      break;
  868|      0|    case SOC_CIPHERS:
  ------------------
  |  Branch (868:5): [True: 0, False: 821]
  ------------------
  869|      0|      p = ssh_config_get_str_tok(&s, NULL);
  870|      0|      if (p && *parsing) {
  ------------------
  |  Branch (870:11): [True: 0, False: 0]
  |  Branch (870:16): [True: 0, False: 0]
  ------------------
  871|      0|        ssh_options_set(session, SSH_OPTIONS_CIPHERS_C_S, p);
  872|      0|        ssh_options_set(session, SSH_OPTIONS_CIPHERS_S_C, p);
  873|      0|      }
  874|      0|      break;
  875|      0|    case SOC_MACS:
  ------------------
  |  Branch (875:5): [True: 0, False: 821]
  ------------------
  876|      0|      p = ssh_config_get_str_tok(&s, NULL);
  877|      0|      if (p && *parsing) {
  ------------------
  |  Branch (877:11): [True: 0, False: 0]
  |  Branch (877:16): [True: 0, False: 0]
  ------------------
  878|      0|        ssh_options_set(session, SSH_OPTIONS_HMAC_C_S, p);
  879|      0|        ssh_options_set(session, SSH_OPTIONS_HMAC_S_C, p);
  880|      0|      }
  881|      0|      break;
  882|      0|    case SOC_COMPRESSION:
  ------------------
  |  Branch (882:5): [True: 0, False: 821]
  ------------------
  883|      0|      i = ssh_config_get_yesno(&s, -1);
  884|      0|      if (i >= 0 && *parsing) {
  ------------------
  |  Branch (884:11): [True: 0, False: 0]
  |  Branch (884:21): [True: 0, False: 0]
  ------------------
  885|      0|        if (i) {
  ------------------
  |  Branch (885:13): [True: 0, False: 0]
  ------------------
  886|      0|          ssh_options_set(session, SSH_OPTIONS_COMPRESSION, "yes");
  887|      0|        } else {
  888|      0|          ssh_options_set(session, SSH_OPTIONS_COMPRESSION, "no");
  889|      0|        }
  890|      0|      }
  891|      0|      break;
  892|      0|    case SOC_TIMEOUT:
  ------------------
  |  Branch (892:5): [True: 0, False: 821]
  ------------------
  893|      0|      l = ssh_config_get_long(&s, -1);
  894|      0|      if (l >= 0 && *parsing) {
  ------------------
  |  Branch (894:11): [True: 0, False: 0]
  |  Branch (894:21): [True: 0, False: 0]
  ------------------
  895|      0|        ssh_options_set(session, SSH_OPTIONS_TIMEOUT, &l);
  896|      0|      }
  897|      0|      break;
  898|      3|    case SOC_STRICTHOSTKEYCHECK:
  ------------------
  |  Branch (898:5): [True: 3, False: 818]
  ------------------
  899|      3|      i = ssh_config_get_yesno(&s, -1);
  900|      3|      if (i >= 0 && *parsing) {
  ------------------
  |  Branch (900:11): [True: 0, False: 3]
  |  Branch (900:21): [True: 0, False: 0]
  ------------------
  901|      0|        ssh_options_set(session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &i);
  902|      0|      }
  903|      3|      break;
  904|      0|    case SOC_KNOWNHOSTS:
  ------------------
  |  Branch (904:5): [True: 0, False: 821]
  ------------------
  905|      0|      p = ssh_config_get_str_tok(&s, NULL);
  906|      0|      if (p && *parsing) {
  ------------------
  |  Branch (906:11): [True: 0, False: 0]
  |  Branch (906:16): [True: 0, False: 0]
  ------------------
  907|      0|        ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, p);
  908|      0|      }
  909|      0|      break;
  910|      0|    case SOC_PROXYCOMMAND:
  ------------------
  |  Branch (910:5): [True: 0, False: 821]
  ------------------
  911|      0|      p = ssh_config_get_cmd(&s);
  912|       |      /* We share the seen value with the ProxyJump */
  913|      0|      if (p && *parsing && !seen[SOC_PROXYJUMP]) {
  ------------------
  |  Branch (913:11): [True: 0, False: 0]
  |  Branch (913:16): [True: 0, False: 0]
  |  Branch (913:28): [True: 0, False: 0]
  ------------------
  914|      0|        ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, p);
  915|      0|      }
  916|      0|      break;
  917|      6|    case SOC_PROXYJUMP:
  ------------------
  |  Branch (917:5): [True: 6, False: 815]
  ------------------
  918|      6|        p = ssh_config_get_str_tok(&s, NULL);
  919|      6|        if (p == NULL) {
  ------------------
  |  Branch (919:13): [True: 0, False: 6]
  ------------------
  920|      0|            SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  921|      0|            return -1;
  922|      0|        }
  923|       |        /* We share the seen value with the ProxyCommand */
  924|      6|        rv = ssh_config_parse_proxy_jump(session, p,
  925|      6|                                         (*parsing && !seen[SOC_PROXYCOMMAND]));
  ------------------
  |  Branch (925:43): [True: 0, False: 6]
  |  Branch (925:55): [True: 0, False: 0]
  ------------------
  926|      6|        if (rv != SSH_OK) {
  ------------------
  |  |  311|      6|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (926:13): [True: 0, False: 6]
  ------------------
  927|      0|            SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  928|      0|            return -1;
  929|      0|        }
  930|      6|        break;
  931|      6|    case SOC_GSSAPISERVERIDENTITY:
  ------------------
  |  Branch (931:5): [True: 4, False: 817]
  ------------------
  932|      4|      p = ssh_config_get_str_tok(&s, NULL);
  933|      4|      if (p && *parsing) {
  ------------------
  |  Branch (933:11): [True: 0, False: 4]
  |  Branch (933:16): [True: 0, False: 0]
  ------------------
  934|      0|        ssh_options_set(session, SSH_OPTIONS_GSSAPI_SERVER_IDENTITY, p);
  935|      0|      }
  936|      4|      break;
  937|      0|    case SOC_GSSAPICLIENTIDENTITY:
  ------------------
  |  Branch (937:5): [True: 0, False: 821]
  ------------------
  938|      0|      p = ssh_config_get_str_tok(&s, NULL);
  939|      0|      if (p && *parsing) {
  ------------------
  |  Branch (939:11): [True: 0, False: 0]
  |  Branch (939:16): [True: 0, False: 0]
  ------------------
  940|      0|        ssh_options_set(session, SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY, p);
  941|      0|      }
  942|      0|      break;
  943|      3|    case SOC_GSSAPIDELEGATECREDENTIALS:
  ------------------
  |  Branch (943:5): [True: 3, False: 818]
  ------------------
  944|      3|      i = ssh_config_get_yesno(&s, -1);
  945|      3|      if (i >=0 && *parsing) {
  ------------------
  |  Branch (945:11): [True: 0, False: 3]
  |  Branch (945:20): [True: 0, False: 0]
  ------------------
  946|      0|        ssh_options_set(session, SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS, &i);
  947|      0|      }
  948|      3|      break;
  949|      0|    case SOC_BINDADDRESS:
  ------------------
  |  Branch (949:5): [True: 0, False: 821]
  ------------------
  950|      0|        p = ssh_config_get_str_tok(&s, NULL);
  951|      0|        if (p && *parsing) {
  ------------------
  |  Branch (951:13): [True: 0, False: 0]
  |  Branch (951:18): [True: 0, False: 0]
  ------------------
  952|      0|            ssh_options_set(session, SSH_OPTIONS_BINDADDR, p);
  953|      0|        }
  954|      0|        break;
  955|      0|    case SOC_GLOBALKNOWNHOSTSFILE:
  ------------------
  |  Branch (955:5): [True: 0, False: 821]
  ------------------
  956|      0|        p = ssh_config_get_str_tok(&s, NULL);
  957|      0|        if (p && *parsing) {
  ------------------
  |  Branch (957:13): [True: 0, False: 0]
  |  Branch (957:18): [True: 0, False: 0]
  ------------------
  958|      0|            ssh_options_set(session, SSH_OPTIONS_GLOBAL_KNOWNHOSTS, p);
  959|      0|        }
  960|      0|        break;
  961|      4|    case SOC_LOGLEVEL:
  ------------------
  |  Branch (961:5): [True: 4, False: 817]
  ------------------
  962|      4|        p = ssh_config_get_str_tok(&s, NULL);
  963|      4|        if (p && *parsing) {
  ------------------
  |  Branch (963:13): [True: 4, False: 0]
  |  Branch (963:18): [True: 0, False: 4]
  ------------------
  964|      0|            int value = -1;
  965|       |
  966|      0|            if (strcasecmp(p, "quiet") == 0) {
  ------------------
  |  Branch (966:17): [True: 0, False: 0]
  ------------------
  967|      0|                value = SSH_LOG_NONE;
  ------------------
  |  |  350|      0|#define SSH_LOG_NONE 0
  ------------------
  968|      0|            } else if (strcasecmp(p, "fatal") == 0 ||
  ------------------
  |  Branch (968:24): [True: 0, False: 0]
  ------------------
  969|      0|                    strcasecmp(p, "error")== 0) {
  ------------------
  |  Branch (969:21): [True: 0, False: 0]
  ------------------
  970|      0|                value = SSH_LOG_WARN;
  ------------------
  |  |  352|      0|#define SSH_LOG_WARN 1
  ------------------
  971|      0|            } else if (strcasecmp(p, "verbose") == 0 ||
  ------------------
  |  Branch (971:24): [True: 0, False: 0]
  ------------------
  972|      0|                    strcasecmp(p, "info") == 0) {
  ------------------
  |  Branch (972:21): [True: 0, False: 0]
  ------------------
  973|      0|                value = SSH_LOG_INFO;
  ------------------
  |  |  354|      0|#define SSH_LOG_INFO 2
  ------------------
  974|      0|            } else if (strcasecmp(p, "DEBUG") == 0 ||
  ------------------
  |  Branch (974:24): [True: 0, False: 0]
  ------------------
  975|      0|                    strcasecmp(p, "DEBUG1") == 0) {
  ------------------
  |  Branch (975:21): [True: 0, False: 0]
  ------------------
  976|      0|                value = SSH_LOG_DEBUG;
  ------------------
  |  |  356|      0|#define SSH_LOG_DEBUG 3
  ------------------
  977|      0|            } else if (strcasecmp(p, "DEBUG2") == 0 ||
  ------------------
  |  Branch (977:24): [True: 0, False: 0]
  ------------------
  978|      0|                    strcasecmp(p, "DEBUG3") == 0) {
  ------------------
  |  Branch (978:21): [True: 0, False: 0]
  ------------------
  979|      0|                value = SSH_LOG_TRACE;
  ------------------
  |  |  358|      0|#define SSH_LOG_TRACE 4
  ------------------
  980|      0|            }
  981|      0|            if (value != -1) {
  ------------------
  |  Branch (981:17): [True: 0, False: 0]
  ------------------
  982|      0|                ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &value);
  983|      0|            }
  984|      0|        }
  985|      4|        break;
  986|      0|    case SOC_HOSTKEYALGORITHMS:
  ------------------
  |  Branch (986:5): [True: 0, False: 821]
  ------------------
  987|      0|        p = ssh_config_get_str_tok(&s, NULL);
  988|      0|        if (p && *parsing) {
  ------------------
  |  Branch (988:13): [True: 0, False: 0]
  |  Branch (988:18): [True: 0, False: 0]
  ------------------
  989|      0|            ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, p);
  990|      0|        }
  991|      0|        break;
  992|      0|    case SOC_PUBKEYACCEPTEDKEYTYPES:
  ------------------
  |  Branch (992:5): [True: 0, False: 821]
  ------------------
  993|      0|        p = ssh_config_get_str_tok(&s, NULL);
  994|      0|        if (p && *parsing) {
  ------------------
  |  Branch (994:13): [True: 0, False: 0]
  |  Branch (994:18): [True: 0, False: 0]
  ------------------
  995|      0|            ssh_options_set(session, SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES, p);
  996|      0|        }
  997|      0|        break;
  998|      0|    case SOC_KEXALGORITHMS:
  ------------------
  |  Branch (998:5): [True: 0, False: 821]
  ------------------
  999|      0|        p = ssh_config_get_str_tok(&s, NULL);
 1000|      0|        if (p && *parsing) {
  ------------------
  |  Branch (1000:13): [True: 0, False: 0]
  |  Branch (1000:18): [True: 0, False: 0]
  ------------------
 1001|      0|            ssh_options_set(session, SSH_OPTIONS_KEY_EXCHANGE, p);
 1002|      0|        }
 1003|      0|        break;
 1004|     44|    case SOC_REKEYLIMIT:
  ------------------
  |  Branch (1004:5): [True: 44, False: 777]
  ------------------
 1005|       |        /* Parse the data limit */
 1006|     44|        p = ssh_config_get_str_tok(&s, NULL);
 1007|     44|        if (p == NULL) {
  ------------------
  |  Branch (1007:13): [True: 0, False: 44]
  ------------------
 1008|      0|            break;
 1009|     44|        } else if (strcmp(p, "default") == 0) {
  ------------------
  |  Branch (1009:20): [True: 0, False: 44]
  ------------------
 1010|       |            /* Default rekey limits enforced automatically */
 1011|      0|            ll = 0;
 1012|     44|        } else {
 1013|     44|            char *endp = NULL;
 1014|     44|            ll = strtoll(p, &endp, 10);
 1015|     44|            if (p == endp || ll < 0) {
  ------------------
  |  Branch (1015:17): [True: 0, False: 44]
  |  Branch (1015:30): [True: 0, False: 44]
  ------------------
 1016|       |                /* No number or negative */
 1017|      0|                SSH_LOG(SSH_LOG_TRACE, "Invalid argument to rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1018|      0|                break;
 1019|      0|            }
 1020|     44|            switch (*endp) {
 1021|      0|            case 'G':
  ------------------
  |  Branch (1021:13): [True: 0, False: 44]
  ------------------
 1022|      0|                if (ll > LLONG_MAX / 1024) {
  ------------------
  |  Branch (1022:21): [True: 0, False: 0]
  ------------------
 1023|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1024|      0|                    ll = -1;
 1025|      0|                    break;
 1026|      0|                }
 1027|      0|                ll = ll * 1024;
 1028|      0|                FALL_THROUGH;
  ------------------
  |  |  412|      0|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1029|      0|            case 'M':
  ------------------
  |  Branch (1029:13): [True: 0, False: 44]
  ------------------
 1030|      0|                if (ll > LLONG_MAX / 1024) {
  ------------------
  |  Branch (1030:21): [True: 0, False: 0]
  ------------------
 1031|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1032|      0|                    ll = -1;
 1033|      0|                    break;
 1034|      0|                }
 1035|      0|                ll = ll * 1024;
 1036|      0|                FALL_THROUGH;
  ------------------
  |  |  412|      0|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1037|      0|            case 'K':
  ------------------
  |  Branch (1037:13): [True: 0, False: 44]
  ------------------
 1038|      0|                if (ll > LLONG_MAX / 1024) {
  ------------------
  |  Branch (1038:21): [True: 0, False: 0]
  ------------------
 1039|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1040|      0|                    ll = -1;
 1041|      0|                    break;
 1042|      0|                }
 1043|      0|                ll = ll * 1024;
 1044|      0|                endp++;
 1045|      0|                FALL_THROUGH;
  ------------------
  |  |  412|      0|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1046|     40|            case '\0':
  ------------------
  |  Branch (1046:13): [True: 40, False: 4]
  ------------------
 1047|       |                /* just the number */
 1048|     40|                break;
 1049|      4|            default:
  ------------------
  |  Branch (1049:13): [True: 4, False: 40]
  ------------------
 1050|       |                /* Invalid suffix */
 1051|      4|                ll = -1;
 1052|      4|                break;
 1053|     44|            }
 1054|     44|            if (*endp != ' ' && *endp != '\0') {
  ------------------
  |  Branch (1054:17): [True: 44, False: 0]
  |  Branch (1054:33): [True: 4, False: 40]
  ------------------
 1055|      4|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  251|      4|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1056|      4|                        "Invalid trailing characters after the rekey limit: %s",
 1057|      4|                        endp);
 1058|      4|                break;
 1059|      4|            }
 1060|     44|        }
 1061|     40|        if (ll > -1 && *parsing) {
  ------------------
  |  Branch (1061:13): [True: 40, False: 0]
  |  Branch (1061:24): [True: 0, False: 40]
  ------------------
 1062|      0|            uint64_t v = (uint64_t)ll;
 1063|      0|            ssh_options_set(session, SSH_OPTIONS_REKEY_DATA, &v);
 1064|      0|        }
 1065|       |        /* Parse the time limit */
 1066|     40|        p = ssh_config_get_str_tok(&s, NULL);
 1067|     40|        if (p == NULL) {
  ------------------
  |  Branch (1067:13): [True: 0, False: 40]
  ------------------
 1068|      0|            break;
 1069|     40|        } else if (strcmp(p, "none") == 0) {
  ------------------
  |  Branch (1069:20): [True: 0, False: 40]
  ------------------
 1070|      0|            ll = 0;
 1071|     40|        } else {
 1072|     40|            char *endp = NULL;
 1073|     40|            ll = strtoll(p, &endp, 10);
 1074|     40|            if (p == endp || ll < 0) {
  ------------------
  |  Branch (1074:17): [True: 0, False: 40]
  |  Branch (1074:30): [True: 0, False: 40]
  ------------------
 1075|       |                /* No number or negative */
 1076|      0|                SSH_LOG(SSH_LOG_TRACE, "Invalid argument to rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1077|      0|                break;
 1078|      0|            }
 1079|     40|            switch (*endp) {
 1080|     14|            case 'w':
  ------------------
  |  Branch (1080:13): [True: 14, False: 26]
  ------------------
 1081|     17|            case 'W':
  ------------------
  |  Branch (1081:13): [True: 3, False: 37]
  ------------------
 1082|     17|                if (ll > LLONG_MAX / 7) {
  ------------------
  |  Branch (1082:21): [True: 14, False: 3]
  ------------------
 1083|     14|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  251|     14|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1084|     14|                    ll = -1;
 1085|     14|                    break;
 1086|     14|                }
 1087|      3|                ll = ll * 7;
 1088|      3|                FALL_THROUGH;
  ------------------
  |  |  412|      3|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1089|      3|            case 'd':
  ------------------
  |  Branch (1089:13): [True: 0, False: 40]
  ------------------
 1090|      3|            case 'D':
  ------------------
  |  Branch (1090:13): [True: 0, False: 40]
  ------------------
 1091|      3|                if (ll > LLONG_MAX / 24) {
  ------------------
  |  Branch (1091:21): [True: 0, False: 3]
  ------------------
 1092|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1093|      0|                    ll = -1;
 1094|      0|                    break;
 1095|      0|                }
 1096|      3|                ll = ll * 24;
 1097|      3|                FALL_THROUGH;
  ------------------
  |  |  412|      3|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1098|      7|            case 'h':
  ------------------
  |  Branch (1098:13): [True: 4, False: 36]
  ------------------
 1099|      7|            case 'H':
  ------------------
  |  Branch (1099:13): [True: 0, False: 40]
  ------------------
 1100|      7|                if (ll > LLONG_MAX / 60) {
  ------------------
  |  Branch (1100:21): [True: 0, False: 7]
  ------------------
 1101|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1102|      0|                    ll = -1;
 1103|      0|                    break;
 1104|      0|                }
 1105|      7|                ll = ll * 60;
 1106|      7|                FALL_THROUGH;
  ------------------
  |  |  412|      7|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1107|      7|            case 'm':
  ------------------
  |  Branch (1107:13): [True: 0, False: 40]
  ------------------
 1108|      7|            case 'M':
  ------------------
  |  Branch (1108:13): [True: 0, False: 40]
  ------------------
 1109|      7|                if (ll > LLONG_MAX / 60) {
  ------------------
  |  Branch (1109:21): [True: 0, False: 7]
  ------------------
 1110|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1111|      0|                    ll = -1;
 1112|      0|                    break;
 1113|      0|                }
 1114|      7|                ll = ll * 60;
 1115|      7|                FALL_THROUGH;
  ------------------
  |  |  412|      7|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1116|      7|            case 's':
  ------------------
  |  Branch (1116:13): [True: 0, False: 40]
  ------------------
 1117|      9|            case 'S':
  ------------------
  |  Branch (1117:13): [True: 2, False: 38]
  ------------------
 1118|      9|                endp++;
 1119|      9|                FALL_THROUGH;
  ------------------
  |  |  412|      9|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1120|      9|            case '\0':
  ------------------
  |  Branch (1120:13): [True: 0, False: 40]
  ------------------
 1121|       |                /* just the number */
 1122|      9|                break;
 1123|     17|            default:
  ------------------
  |  Branch (1123:13): [True: 17, False: 23]
  ------------------
 1124|       |                /* Invalid suffix */
 1125|     17|                ll = -1;
 1126|     17|                break;
 1127|     40|            }
 1128|     40|            if (*endp != '\0') {
  ------------------
  |  Branch (1128:17): [True: 40, False: 0]
  ------------------
 1129|     40|                SSH_LOG(SSH_LOG_TRACE, "Invalid trailing characters after the"
  ------------------
  |  |  251|     40|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1130|     40|                        " rekey limit: %s", endp);
 1131|     40|                break;
 1132|     40|            }
 1133|     40|        }
 1134|      0|        if (ll > -1 && *parsing) {
  ------------------
  |  Branch (1134:13): [True: 0, False: 0]
  |  Branch (1134:24): [True: 0, False: 0]
  ------------------
 1135|      0|            uint32_t v = (uint32_t)ll;
 1136|      0|            ssh_options_set(session, SSH_OPTIONS_REKEY_TIME, &v);
 1137|      0|        }
 1138|      0|        break;
 1139|      0|    case SOC_GSSAPIAUTHENTICATION:
  ------------------
  |  Branch (1139:5): [True: 0, False: 821]
  ------------------
 1140|      0|    case SOC_KBDINTERACTIVEAUTHENTICATION:
  ------------------
  |  Branch (1140:5): [True: 0, False: 821]
  ------------------
 1141|      0|    case SOC_PASSWORDAUTHENTICATION:
  ------------------
  |  Branch (1141:5): [True: 0, False: 821]
  ------------------
 1142|      0|    case SOC_PUBKEYAUTHENTICATION:
  ------------------
  |  Branch (1142:5): [True: 0, False: 821]
  ------------------
 1143|      0|        i = ssh_config_get_yesno(&s, 0);
 1144|      0|        if (i>=0 && *parsing) {
  ------------------
  |  Branch (1144:13): [True: 0, False: 0]
  |  Branch (1144:21): [True: 0, False: 0]
  ------------------
 1145|      0|            switch(opcode){
 1146|      0|            case SOC_GSSAPIAUTHENTICATION:
  ------------------
  |  Branch (1146:13): [True: 0, False: 0]
  ------------------
 1147|      0|                ssh_options_set(session, SSH_OPTIONS_GSSAPI_AUTH, &i);
 1148|      0|                break;
 1149|      0|            case SOC_KBDINTERACTIVEAUTHENTICATION:
  ------------------
  |  Branch (1149:13): [True: 0, False: 0]
  ------------------
 1150|      0|                ssh_options_set(session, SSH_OPTIONS_KBDINT_AUTH, &i);
 1151|      0|                break;
 1152|      0|            case SOC_PASSWORDAUTHENTICATION:
  ------------------
  |  Branch (1152:13): [True: 0, False: 0]
  ------------------
 1153|      0|                ssh_options_set(session, SSH_OPTIONS_PASSWORD_AUTH, &i);
 1154|      0|                break;
 1155|      0|            case SOC_PUBKEYAUTHENTICATION:
  ------------------
  |  Branch (1155:13): [True: 0, False: 0]
  ------------------
 1156|      0|                ssh_options_set(session, SSH_OPTIONS_PUBKEY_AUTH, &i);
 1157|      0|                break;
 1158|       |            /* make gcc happy */
 1159|      0|            default:
  ------------------
  |  Branch (1159:13): [True: 0, False: 0]
  ------------------
 1160|      0|                break;
 1161|      0|            }
 1162|      0|        }
 1163|      0|        break;
 1164|      3|    case SOC_NA:
  ------------------
  |  Branch (1164:5): [True: 3, False: 818]
  ------------------
 1165|      3|      SSH_LOG(SSH_LOG_TRACE, "Unapplicable option: %s, line: %d",
  ------------------
  |  |  251|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1166|      3|              keyword, count);
 1167|      3|      break;
 1168|      0|    case SOC_UNSUPPORTED:
  ------------------
  |  Branch (1168:5): [True: 0, False: 821]
  ------------------
 1169|      0|      SSH_LOG(SSH_LOG_RARE, "Unsupported option: %s, line: %d",
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1170|      0|              keyword, count);
 1171|      0|      break;
 1172|    592|    case SOC_UNKNOWN:
  ------------------
  |  Branch (1172:5): [True: 592, False: 229]
  ------------------
 1173|    592|      SSH_LOG(SSH_LOG_TRACE, "Unknown option: %s, line: %d",
  ------------------
  |  |  251|    592|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1174|    592|              keyword, count);
 1175|    592|      break;
 1176|      0|    case SOC_IDENTITYAGENT:
  ------------------
  |  Branch (1176:5): [True: 0, False: 821]
  ------------------
 1177|      0|      p = ssh_config_get_str_tok(&s, NULL);
 1178|      0|      if (p && *parsing) {
  ------------------
  |  Branch (1178:11): [True: 0, False: 0]
  |  Branch (1178:16): [True: 0, False: 0]
  ------------------
 1179|      0|          ssh_options_set(session, SSH_OPTIONS_IDENTITY_AGENT, p);
 1180|      0|      }
 1181|      0|      break;
 1182|     12|    case SOC_IDENTITIESONLY:
  ------------------
  |  Branch (1182:5): [True: 12, False: 809]
  ------------------
 1183|     12|      i = ssh_config_get_yesno(&s, -1);
 1184|     12|      if (i >= 0 && *parsing) {
  ------------------
  |  Branch (1184:11): [True: 0, False: 12]
  |  Branch (1184:21): [True: 0, False: 0]
  ------------------
 1185|      0|        bool b = i;
 1186|      0|        ssh_options_set(session, SSH_OPTIONS_IDENTITIES_ONLY, &b);
 1187|      0|      }
 1188|     12|      break;
 1189|      0|    default:
  ------------------
  |  Branch (1189:5): [True: 0, False: 821]
  ------------------
 1190|      0|      ssh_set_error(session, SSH_FATAL, "ERROR - unimplemented opcode: %d",
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1191|      0|              opcode);
 1192|      0|      SAFE_FREE(x);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1193|      0|      return -1;
 1194|      0|      break;
 1195|    821|  }
 1196|       |
 1197|    821|  SAFE_FREE(x);
  ------------------
  |  |  324|    821|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 821, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1198|    821|  return 0;
 1199|    821|}
config.c:ssh_config_get_opcode:
  186|    824|static enum ssh_config_opcode_e ssh_config_get_opcode(char *keyword) {
  187|    824|  int i;
  188|       |
  189|  58.2k|  for (i = 0; ssh_config_keyword_table[i].name != NULL; i++) {
  ------------------
  |  Branch (189:15): [True: 57.6k, False: 592]
  ------------------
  190|  57.6k|    if (strcasecmp(keyword, ssh_config_keyword_table[i].name) == 0) {
  ------------------
  |  Branch (190:9): [True: 232, False: 57.4k]
  ------------------
  191|    232|      return ssh_config_keyword_table[i].opcode;
  192|    232|    }
  193|  57.6k|  }
  194|       |
  195|    592|  return SOC_UNKNOWN;
  196|    824|}
config.c:ssh_config_get_match_opcode:
  273|     80|{
  274|     80|    size_t i;
  275|       |
  276|    314|    for (i = 0; ssh_config_match_keyword_table[i].name != NULL; i++) {
  ------------------
  |  Branch (276:17): [True: 314, False: 0]
  ------------------
  277|    314|        if (strcasecmp(keyword, ssh_config_match_keyword_table[i].name) == 0) {
  ------------------
  |  Branch (277:13): [True: 80, False: 234]
  ------------------
  278|     80|            return ssh_config_match_keyword_table[i].opcode;
  279|     80|        }
  280|    314|    }
  281|       |
  282|      0|    return MATCH_UNKNOWN;
  283|     80|}
config.c:ssh_match_exec:
  407|     75|{
  408|     75|    int rv, result = 0;
  409|     75|    char *cmd = NULL;
  410|       |
  411|       |    /* TODO There should be more supported expansions */
  412|     75|    cmd = ssh_path_expand_escape(session, command);
  413|     75|    if (cmd == NULL) {
  ------------------
  |  Branch (413:9): [True: 68, False: 7]
  ------------------
  414|     68|        return 0;
  415|     68|    }
  416|      7|    rv = ssh_exec_shell(cmd);
  417|      7|    if (rv > 0 && negate == true) {
  ------------------
  |  Branch (417:9): [True: 7, False: 0]
  |  Branch (417:19): [True: 0, False: 7]
  ------------------
  418|      0|        result = 1;
  419|      7|    } else if (rv == 0 && negate == false) {
  ------------------
  |  Branch (419:16): [True: 0, False: 7]
  |  Branch (419:27): [True: 0, False: 0]
  ------------------
  420|      0|        result = 1;
  421|      0|    }
  422|      7|    SSH_LOG(SSH_LOG_TRACE, "%s 'exec' command '%s'%s (rv=%d)",
  ------------------
  |  |  251|     28|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (251:34): [True: 0, False: 7]
  |  |  |  Branch (251:34): [True: 0, False: 7]
  |  |  ------------------
  ------------------
  423|      7|            result == 1 ? "Matched" : "Not matched", cmd,
  424|      7|            negate == true ? " (negated)" : "", rv);
  425|      7|    free(cmd);
  426|      7|    return result;
  427|     75|}
config.c:ssh_exec_shell:
  318|      7|{
  319|      7|    char *shell = NULL;
  320|      7|    pid_t pid;
  321|      7|    int status, devnull, rc;
  322|      7|    char err_msg[SSH_ERRNO_MSG_MAX] = {0};
  323|       |
  324|      7|    shell = getenv("SHELL");
  325|      7|    if (shell == NULL || shell[0] == '\0') {
  ------------------
  |  Branch (325:9): [True: 7, False: 0]
  |  Branch (325:26): [True: 0, False: 0]
  ------------------
  326|      7|        shell = (char *)"/bin/sh";
  327|      7|    }
  328|       |
  329|      7|    rc = access(shell, X_OK);
  330|      7|    if (rc != 0) {
  ------------------
  |  Branch (330:9): [True: 0, False: 7]
  ------------------
  331|      0|        SSH_LOG(SSH_LOG_WARN, "The shell '%s' is not executable", shell);
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  332|      0|        return -1;
  333|      0|    }
  334|       |
  335|       |    /* Need this to redirect subprocess stdin/out */
  336|      7|    devnull = open("/dev/null", O_RDWR);
  337|      7|    if (devnull == -1) {
  ------------------
  |  Branch (337:9): [True: 0, False: 7]
  ------------------
  338|      0|        SSH_LOG(SSH_LOG_WARN, "Failed to open(/dev/null): %s",
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  339|      0|                ssh_strerror(errno, err_msg, SSH_ERRNO_MSG_MAX));
  340|      0|        return -1;
  341|      0|    }
  342|       |
  343|      7|    SSH_LOG(SSH_LOG_DEBUG, "Running command '%s'", cmd);
  ------------------
  |  |  251|      7|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  344|      7|    pid = fork();
  345|      7|    if (pid == 0) { /* Child */
  ------------------
  |  Branch (345:9): [True: 0, False: 7]
  ------------------
  346|      0|        char *argv[4];
  347|       |
  348|       |        /* Redirect child stdin and stdout. Leave stderr */
  349|      0|        rc = dup2(devnull, STDIN_FILENO);
  350|      0|        if (rc == -1) {
  ------------------
  |  Branch (350:13): [True: 0, False: 0]
  ------------------
  351|      0|            SSH_LOG(SSH_LOG_WARN, "dup2: %s",
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  352|      0|                    ssh_strerror(errno, err_msg, SSH_ERRNO_MSG_MAX));
  353|      0|            exit(1);
  354|      0|        }
  355|      0|        rc = dup2(devnull, STDOUT_FILENO);
  356|      0|        if (rc == -1) {
  ------------------
  |  Branch (356:13): [True: 0, False: 0]
  ------------------
  357|      0|            SSH_LOG(SSH_LOG_WARN, "dup2: %s",
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  358|      0|                    ssh_strerror(errno, err_msg, SSH_ERRNO_MSG_MAX));
  359|      0|            exit(1);
  360|      0|        }
  361|      0|        if (devnull > STDERR_FILENO) {
  ------------------
  |  Branch (361:13): [True: 0, False: 0]
  ------------------
  362|      0|            close(devnull);
  363|      0|        }
  364|       |
  365|      0|        argv[0] = shell;
  366|      0|        argv[1] = (char *) "-c";
  367|      0|        argv[2] = strdup(cmd);
  368|      0|        argv[3] = NULL;
  369|       |
  370|      0|        rc = execv(argv[0], argv);
  371|      0|        if (rc == -1) {
  ------------------
  |  Branch (371:13): [True: 0, False: 0]
  ------------------
  372|      0|            SSH_LOG(SSH_LOG_WARN, "Failed to execute command '%s': %s", cmd,
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  373|      0|                    ssh_strerror(errno, err_msg, SSH_ERRNO_MSG_MAX));
  374|       |            /* Die with signal to make this error apparent to parent. */
  375|      0|            signal(SIGTERM, SIG_DFL);
  376|      0|            kill(getpid(), SIGTERM);
  377|      0|            _exit(1);
  378|      0|        }
  379|      0|    }
  380|       |
  381|       |    /* Parent */
  382|      7|    close(devnull);
  383|      7|    if (pid == -1) { /* Error */
  ------------------
  |  Branch (383:9): [True: 0, False: 7]
  ------------------
  384|      0|        SSH_LOG(SSH_LOG_WARN, "Failed to fork child: %s",
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  385|      0|                ssh_strerror(errno, err_msg, SSH_ERRNO_MSG_MAX));
  386|      0|        return -1;
  387|       |
  388|      0|    }
  389|       |
  390|      7|    while (waitpid(pid, &status, 0) == -1) {
  ------------------
  |  Branch (390:12): [True: 0, False: 7]
  ------------------
  391|      0|        if (errno != EINTR) {
  ------------------
  |  Branch (391:13): [True: 0, False: 0]
  ------------------
  392|      0|            SSH_LOG(SSH_LOG_WARN, "waitpid failed: %s",
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  393|      0|                    ssh_strerror(errno, err_msg, SSH_ERRNO_MSG_MAX));
  394|      0|            return -1;
  395|      0|        }
  396|      0|    }
  397|      7|    if (!WIFEXITED(status)) {
  ------------------
  |  Branch (397:9): [True: 0, False: 7]
  ------------------
  398|      0|        SSH_LOG(SSH_LOG_WARN, "Command %s exited abnormally", cmd);
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  399|      0|        return -1;
  400|      0|    }
  401|      7|    SSH_LOG(SSH_LOG_TRACE, "Command '%s' returned %d", cmd, WEXITSTATUS(status));
  ------------------
  |  |  251|      7|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  402|      7|    return WEXITSTATUS(status);
  403|      7|}
config.c:ssh_config_parse_proxy_jump:
  435|      6|{
  436|      6|    char *c = NULL, *cp = NULL, *endp = NULL;
  437|      6|    char *username = NULL;
  438|      6|    char *hostname = NULL;
  439|      6|    char *port = NULL;
  440|      6|    char *next = NULL;
  441|      6|    int cmp, rv = SSH_ERROR;
  ------------------
  |  |  312|      6|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  442|      6|    bool parse_entry = do_parsing;
  443|       |
  444|       |    /* Special value none disables the proxy */
  445|      6|    cmp = strcasecmp(s, "none");
  446|      6|    if (cmp == 0 && do_parsing) {
  ------------------
  |  Branch (446:9): [True: 6, False: 0]
  |  Branch (446:21): [True: 0, False: 6]
  ------------------
  447|      0|        ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, s);
  448|      0|        return SSH_OK;
  ------------------
  |  |  311|      0|#define SSH_OK 0     /* No error */
  ------------------
  449|      0|    }
  450|       |
  451|       |    /* This is comma-separated list of [user@]host[:port] entries */
  452|      6|    c = strdup(s);
  453|      6|    if (c == NULL) {
  ------------------
  |  Branch (453:9): [True: 0, False: 6]
  ------------------
  454|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  455|      0|        return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  456|      0|    }
  457|       |
  458|      6|    cp = c;
  459|      6|    do {
  460|      6|        endp = strchr(cp, ',');
  461|      6|        if (endp != NULL) {
  ------------------
  |  Branch (461:13): [True: 0, False: 6]
  ------------------
  462|       |            /* Split out the token */
  463|      0|            *endp = '\0';
  464|      0|        }
  465|      6|        if (parse_entry) {
  ------------------
  |  Branch (465:13): [True: 0, False: 6]
  ------------------
  466|       |            /* We actually care only about the first item */
  467|      0|            rv = ssh_config_parse_uri(cp, &username, &hostname, &port);
  468|       |            /* The rest of the list needs to be passed on */
  469|      0|            if (endp != NULL) {
  ------------------
  |  Branch (469:17): [True: 0, False: 0]
  ------------------
  470|      0|                next = strdup(endp + 1);
  471|      0|                if (next == NULL) {
  ------------------
  |  Branch (471:21): [True: 0, False: 0]
  ------------------
  472|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  473|      0|                    rv = SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  474|      0|                }
  475|      0|            }
  476|      6|        } else {
  477|       |            /* The rest is just sanity-checked to avoid failures later */
  478|      6|            rv = ssh_config_parse_uri(cp, NULL, NULL, NULL);
  479|      6|        }
  480|      6|        if (rv != SSH_OK) {
  ------------------
  |  |  311|      6|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (480:13): [True: 0, False: 6]
  ------------------
  481|      0|            goto out;
  482|      0|        }
  483|      6|        parse_entry = 0;
  484|      6|        if (endp != NULL) {
  ------------------
  |  Branch (484:13): [True: 0, False: 6]
  ------------------
  485|      0|            cp = endp + 1;
  486|      6|        } else {
  487|      6|            cp = NULL; /* end */
  488|      6|        }
  489|      6|    } while (cp != NULL);
  ------------------
  |  Branch (489:14): [True: 0, False: 6]
  ------------------
  490|       |
  491|      6|    if (hostname != NULL && do_parsing) {
  ------------------
  |  Branch (491:9): [True: 0, False: 6]
  |  Branch (491:29): [True: 0, False: 0]
  ------------------
  492|      0|        char com[512] = {0};
  493|       |
  494|      0|        rv = snprintf(com, sizeof(com), "ssh%s%s%s%s%s%s -W '[%%h]:%%p' %s",
  495|      0|                      username ? " -l " : "",
  ------------------
  |  Branch (495:23): [True: 0, False: 0]
  ------------------
  496|      0|                      username ? username : "",
  ------------------
  |  Branch (496:23): [True: 0, False: 0]
  ------------------
  497|      0|                      port ? " -p " : "",
  ------------------
  |  Branch (497:23): [True: 0, False: 0]
  ------------------
  498|      0|                      port ? port : "",
  ------------------
  |  Branch (498:23): [True: 0, False: 0]
  ------------------
  499|      0|                      next ? " -J " : "",
  ------------------
  |  Branch (499:23): [True: 0, False: 0]
  ------------------
  500|      0|                      next ? next : "",
  ------------------
  |  Branch (500:23): [True: 0, False: 0]
  ------------------
  501|      0|                      hostname);
  502|      0|        if (rv < 0 || rv >= (int)sizeof(com)) {
  ------------------
  |  Branch (502:13): [True: 0, False: 0]
  |  Branch (502:23): [True: 0, False: 0]
  ------------------
  503|      0|            SSH_LOG(SSH_LOG_TRACE, "Too long ProxyJump configuration line");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  504|      0|            rv = SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  505|      0|            goto out;
  506|      0|        }
  507|      0|        ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, com);
  508|      0|    }
  509|      6|    rv = SSH_OK;
  ------------------
  |  |  311|      6|#define SSH_OK 0     /* No error */
  ------------------
  510|       |
  511|      6|out:
  512|      6|    SAFE_FREE(username);
  ------------------
  |  |  324|      6|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 6]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  513|      6|    SAFE_FREE(hostname);
  ------------------
  |  |  324|      6|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 6]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  514|      6|    SAFE_FREE(port);
  ------------------
  |  |  324|      6|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 6]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  515|      6|    SAFE_FREE(next);
  ------------------
  |  |  324|      6|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 6]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  516|      6|    SAFE_FREE(c);
  ------------------
  |  |  324|      6|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 6, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  517|      6|    return rv;
  518|      6|}

ssh_config_get_token:
   77|  1.32k|{
   78|  1.32k|    register char *c;
   79|  1.32k|    bool had_equal = false;
   80|  1.32k|    char *r = NULL;
   81|       |
   82|       |    /* Ignore leading spaces */
   83|  1.37k|    for (c = *str; *c; c++) {
  ------------------
  |  Branch (83:20): [True: 1.26k, False: 113]
  ------------------
   84|  1.26k|        if (! isblank(*c)) {
  ------------------
  |  Branch (84:13): [True: 1.20k, False: 59]
  ------------------
   85|  1.20k|            break;
   86|  1.20k|        }
   87|  1.26k|    }
   88|       |
   89|       |    /* If we start with quote, return the whole quoted block */
   90|  1.32k|    if (*c == '\"') {
  ------------------
  |  Branch (90:9): [True: 31, False: 1.28k]
  ------------------
   91|     47|        for (r = ++c; *c; c++) {
  ------------------
  |  Branch (91:23): [True: 16, False: 31]
  ------------------
   92|     16|            if (*c == '\"' || *c == '\n') {
  ------------------
  |  Branch (92:17): [True: 0, False: 16]
  |  Branch (92:31): [True: 0, False: 16]
  ------------------
   93|      0|                *c = '\0';
   94|      0|                c++;
   95|      0|                break;
   96|      0|            }
   97|       |            /* XXX Unmatched quotes extend to the end of line */
   98|     16|        }
   99|  1.28k|    } else {
  100|       |        /* Otherwise terminate on space, equal or newline */
  101|  12.2k|        for (r = c; *c; c++) {
  ------------------
  |  Branch (101:21): [True: 11.5k, False: 643]
  ------------------
  102|  11.5k|            if (*c == '\0') {
  ------------------
  |  Branch (102:17): [True: 0, False: 11.5k]
  ------------------
  103|      0|                goto out;
  104|  11.5k|            } else if (isblank(*c) || *c == '=' || *c == '\n') {
  ------------------
  |  Branch (104:39): [True: 23, False: 10.9k]
  |  Branch (104:52): [True: 0, False: 10.9k]
  ------------------
  105|    646|                had_equal = (*c == '=');
  106|    646|                *c = '\0';
  107|    646|                c++;
  108|    646|                break;
  109|    646|            }
  110|  11.5k|        }
  111|  1.28k|    }
  112|       |
  113|       |    /* Skip any other remaining whitespace */
  114|  1.35k|    while (isblank(*c) || *c == '\n' || (!had_equal && *c == '=')) {
  ------------------
  |  Branch (114:27): [True: 0, False: 1.32k]
  |  Branch (114:42): [True: 1.29k, False: 23]
  |  Branch (114:56): [True: 0, False: 1.29k]
  ------------------
  115|     30|        if (*c == '=') {
  ------------------
  |  Branch (115:13): [True: 0, False: 30]
  ------------------
  116|      0|            had_equal = true;
  117|      0|        }
  118|     30|        c++;
  119|     30|    }
  120|  1.32k|out:
  121|  1.32k|    *str = c;
  122|  1.32k|    return r;
  123|  1.32k|}
ssh_config_get_str_tok:
  143|    415|{
  144|    415|    char *p;
  145|       |
  146|    415|    p = ssh_config_get_token(str);
  147|    415|    if (p && *p) {
  ------------------
  |  Branch (147:9): [True: 415, False: 0]
  |  Branch (147:14): [True: 291, False: 124]
  ------------------
  148|    291|        return p;
  149|    291|    }
  150|       |
  151|    124|    return def;
  152|    415|}
ssh_config_get_yesno:
  155|     18|{
  156|     18|    const char *p;
  157|       |
  158|     18|    p = ssh_config_get_str_tok(str, NULL);
  159|     18|    if (p == NULL) {
  ------------------
  |  Branch (159:9): [True: 3, False: 15]
  ------------------
  160|      3|        return notfound;
  161|      3|    }
  162|       |
  163|     15|    if (strncasecmp(p, "yes", 3) == 0) {
  ------------------
  |  Branch (163:9): [True: 0, False: 15]
  ------------------
  164|      0|        return 1;
  165|     15|    } else if (strncasecmp(p, "no", 2) == 0) {
  ------------------
  |  Branch (165:16): [True: 0, False: 15]
  ------------------
  166|      0|        return 0;
  167|      0|    }
  168|       |
  169|     15|    return notfound;
  170|     15|}
ssh_config_parse_uri:
  176|      6|{
  177|      6|    char *endp = NULL;
  178|      6|    long port_n;
  179|       |
  180|       |    /* Sanitize inputs */
  181|      6|    if (username != NULL) {
  ------------------
  |  Branch (181:9): [True: 0, False: 6]
  ------------------
  182|      0|        *username = NULL;
  183|      0|    }
  184|      6|    if (hostname != NULL) {
  ------------------
  |  Branch (184:9): [True: 0, False: 6]
  ------------------
  185|      0|        *hostname = NULL;
  186|      0|    }
  187|      6|    if (port != NULL) {
  ------------------
  |  Branch (187:9): [True: 0, False: 6]
  ------------------
  188|      0|        *port = NULL;
  189|      0|    }
  190|       |
  191|       |    /* Username part (optional) */
  192|      6|    endp = strchr(tok, '@');
  193|      6|    if (endp != NULL) {
  ------------------
  |  Branch (193:9): [True: 0, False: 6]
  ------------------
  194|       |        /* Zero-length username is not valid */
  195|      0|        if (tok == endp) {
  ------------------
  |  Branch (195:13): [True: 0, False: 0]
  ------------------
  196|      0|            goto error;
  197|      0|        }
  198|      0|        if (username != NULL) {
  ------------------
  |  Branch (198:13): [True: 0, False: 0]
  ------------------
  199|      0|            *username = strndup(tok, endp - tok);
  200|      0|            if (*username == NULL) {
  ------------------
  |  Branch (200:17): [True: 0, False: 0]
  ------------------
  201|      0|                goto error;
  202|      0|            }
  203|      0|        }
  204|      0|        tok = endp + 1;
  205|       |        /* If there is second @ character, this does not look like our URI */
  206|      0|        endp = strchr(tok, '@');
  207|      0|        if (endp != NULL) {
  ------------------
  |  Branch (207:13): [True: 0, False: 0]
  ------------------
  208|      0|            goto error;
  209|      0|        }
  210|      0|    }
  211|       |
  212|       |    /* Hostname */
  213|      6|    if (*tok == '[') {
  ------------------
  |  Branch (213:9): [True: 0, False: 6]
  ------------------
  214|       |        /* IPv6 address is enclosed with square brackets */
  215|      0|        tok++;
  216|      0|        endp = strchr(tok, ']');
  217|      0|        if (endp == NULL) {
  ------------------
  |  Branch (217:13): [True: 0, False: 0]
  ------------------
  218|      0|            goto error;
  219|      0|        }
  220|      6|    } else {
  221|       |        /* Hostnames or aliases expand to the last colon or to the end */
  222|      6|        endp = strrchr(tok, ':');
  223|      6|        if (endp == NULL) {
  ------------------
  |  Branch (223:13): [True: 6, False: 0]
  ------------------
  224|      6|            endp = strchr(tok, '\0');
  225|      6|        }
  226|      6|    }
  227|      6|    if (tok == endp) {
  ------------------
  |  Branch (227:9): [True: 0, False: 6]
  ------------------
  228|       |        /* Zero-length hostnames are not valid */
  229|      0|        goto error;
  230|      0|    }
  231|      6|    if (hostname != NULL) {
  ------------------
  |  Branch (231:9): [True: 0, False: 6]
  ------------------
  232|      0|        *hostname = strndup(tok, endp - tok);
  233|      0|        if (*hostname == NULL) {
  ------------------
  |  Branch (233:13): [True: 0, False: 0]
  ------------------
  234|      0|            goto error;
  235|      0|        }
  236|      0|    }
  237|       |    /* Skip also the closing bracket */
  238|      6|    if (*endp == ']') {
  ------------------
  |  Branch (238:9): [True: 0, False: 6]
  ------------------
  239|      0|        endp++;
  240|      0|    }
  241|       |
  242|       |    /* Port (optional) */
  243|      6|    if (*endp != '\0') {
  ------------------
  |  Branch (243:9): [True: 0, False: 6]
  ------------------
  244|      0|        char *port_end = NULL;
  245|       |
  246|       |        /* Verify the port is valid positive number */
  247|      0|        port_n = strtol(endp + 1, &port_end, 10);
  248|      0|        if (port_n < 1 || *port_end != '\0') {
  ------------------
  |  Branch (248:13): [True: 0, False: 0]
  |  Branch (248:27): [True: 0, False: 0]
  ------------------
  249|      0|            SSH_LOG(SSH_LOG_TRACE, "Failed to parse port number."
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  250|      0|                    " The value '%ld' is invalid or there are some"
  251|      0|                    " trailing characters: '%s'", port_n, port_end);
  252|      0|            goto error;
  253|      0|        }
  254|      0|        if (port != NULL) {
  ------------------
  |  Branch (254:13): [True: 0, False: 0]
  ------------------
  255|      0|            *port = strdup(endp + 1);
  256|      0|            if (*port == NULL) {
  ------------------
  |  Branch (256:17): [True: 0, False: 0]
  ------------------
  257|      0|                goto error;
  258|      0|            }
  259|      0|        }
  260|      0|    }
  261|       |
  262|      6|    return SSH_OK;
  ------------------
  |  |  311|      6|#define SSH_OK 0     /* No error */
  ------------------
  263|       |
  264|      0|error:
  265|      0|    if (username != NULL) {
  ------------------
  |  Branch (265:9): [True: 0, False: 0]
  ------------------
  266|      0|        SAFE_FREE(*username);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  267|      0|    }
  268|      0|    if (hostname != NULL) {
  ------------------
  |  Branch (268:9): [True: 0, False: 0]
  ------------------
  269|      0|        SAFE_FREE(*hostname);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  270|      0|    }
  271|      0|    if (port != NULL) {
  ------------------
  |  Branch (271:9): [True: 0, False: 0]
  ------------------
  272|      0|        SAFE_FREE(*port);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  273|      0|    }
  274|      0|    return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  275|      6|}

ssh_dh_init:
  230|      2|{
  231|      2|    unsigned long g_int = 2 ;	/* G is defined as 2 by the ssh2 standards */
  232|      2|    int rc;
  233|      2|    if (dh_crypto_initialized) {
  ------------------
  |  Branch (233:9): [True: 0, False: 2]
  ------------------
  234|      0|        return SSH_OK;
  ------------------
  |  |  311|      0|#define SSH_OK 0     /* No error */
  ------------------
  235|      0|    }
  236|      2|    dh_crypto_initialized = 1;
  237|       |
  238|      2|    ssh_dh_generator = bignum_new();
  ------------------
  |  |   68|      2|#define bignum_new() BN_new()
  ------------------
  239|      2|    if (ssh_dh_generator == NULL) {
  ------------------
  |  Branch (239:9): [True: 0, False: 2]
  ------------------
  240|      0|        goto error;
  241|      0|    }
  242|      2|    rc = bignum_set_word(ssh_dh_generator, g_int);
  ------------------
  |  |   75|      2|#define bignum_set_word(bn,n) BN_set_word(bn,n)
  ------------------
  243|      2|    if (rc != 1) {
  ------------------
  |  Branch (243:9): [True: 0, False: 2]
  ------------------
  244|      0|        goto error;
  245|      0|    }
  246|       |
  247|      2|    bignum_bin2bn(p_group1_value, P_GROUP1_LEN, &ssh_dh_group1);
  ------------------
  |  |   77|      2|    do {                                     \
  |  |   78|      2|        (*dest) = BN_new();                  \
  |  |   79|      2|        if ((*dest) != NULL) {               \
  |  |  ------------------
  |  |  |  Branch (79:13): [True: 2, False: 0]
  |  |  ------------------
  |  |   80|      2|            BN_bin2bn(data,datalen,(*dest)); \
  |  |   81|      2|        }                                    \
  |  |   82|      2|    } while(0)
  |  |  ------------------
  |  |  |  Branch (82:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|      2|    if (ssh_dh_group1 == NULL) {
  ------------------
  |  Branch (248:9): [True: 0, False: 2]
  ------------------
  249|      0|        goto error;
  250|      0|    }
  251|      2|    bignum_bin2bn(p_group14_value, P_GROUP14_LEN, &ssh_dh_group14);
  ------------------
  |  |   77|      2|    do {                                     \
  |  |   78|      2|        (*dest) = BN_new();                  \
  |  |   79|      2|        if ((*dest) != NULL) {               \
  |  |  ------------------
  |  |  |  Branch (79:13): [True: 2, False: 0]
  |  |  ------------------
  |  |   80|      2|            BN_bin2bn(data,datalen,(*dest)); \
  |  |   81|      2|        }                                    \
  |  |   82|      2|    } while(0)
  |  |  ------------------
  |  |  |  Branch (82:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  252|      2|    if (ssh_dh_group14 == NULL) {
  ------------------
  |  Branch (252:9): [True: 0, False: 2]
  ------------------
  253|      0|        goto error;
  254|      0|    }
  255|      2|    bignum_bin2bn(p_group16_value, P_GROUP16_LEN, &ssh_dh_group16);
  ------------------
  |  |   77|      2|    do {                                     \
  |  |   78|      2|        (*dest) = BN_new();                  \
  |  |   79|      2|        if ((*dest) != NULL) {               \
  |  |  ------------------
  |  |  |  Branch (79:13): [True: 2, False: 0]
  |  |  ------------------
  |  |   80|      2|            BN_bin2bn(data,datalen,(*dest)); \
  |  |   81|      2|        }                                    \
  |  |   82|      2|    } while(0)
  |  |  ------------------
  |  |  |  Branch (82:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  256|      2|    if (ssh_dh_group16 == NULL) {
  ------------------
  |  Branch (256:9): [True: 0, False: 2]
  ------------------
  257|      0|        goto error;
  258|      0|    }
  259|      2|    bignum_bin2bn(p_group18_value, P_GROUP18_LEN, &ssh_dh_group18);
  ------------------
  |  |   77|      2|    do {                                     \
  |  |   78|      2|        (*dest) = BN_new();                  \
  |  |   79|      2|        if ((*dest) != NULL) {               \
  |  |  ------------------
  |  |  |  Branch (79:13): [True: 2, False: 0]
  |  |  ------------------
  |  |   80|      2|            BN_bin2bn(data,datalen,(*dest)); \
  |  |   81|      2|        }                                    \
  |  |   82|      2|    } while(0)
  |  |  ------------------
  |  |  |  Branch (82:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  260|      2|    if (ssh_dh_group18 == NULL) {
  ------------------
  |  Branch (260:9): [True: 0, False: 2]
  ------------------
  261|      0|        goto error;
  262|      0|    }
  263|       |
  264|      2|    return 0;
  265|      0|error:
  266|      0|    ssh_dh_finalize();
  267|      0|    return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  268|      2|}

ssh_dh_cleanup:
  442|     10|{
  443|     10|    if (crypto->dh_ctx != NULL) {
  ------------------
  |  Branch (443:9): [True: 0, False: 10]
  ------------------
  444|      0|#if OPENSSL_VERSION_NUMBER < 0x30000000L
  445|      0|        DH_free(crypto->dh_ctx->keypair[0]);
  446|      0|        DH_free(crypto->dh_ctx->keypair[1]);
  447|       |#else
  448|       |        EVP_PKEY_free(crypto->dh_ctx->keypair[0]);
  449|       |        EVP_PKEY_free(crypto->dh_ctx->keypair[1]);
  450|       |#endif /* OPENSSL_VERSION_NUMBER */
  451|      0|        free(crypto->dh_ctx);
  452|      0|        crypto->dh_ctx = NULL;
  453|      0|    }
  454|     10|}

_ssh_set_error:
   57|     69|{
   58|     69|    struct ssh_common_struct *err = error;
   59|     69|    va_list va;
   60|       |
   61|     69|    va_start(va, descr);
   62|     69|    vsnprintf(err->error.error_buffer, ERROR_BUFFERLEN, descr, va);
  ------------------
  |  |  189|     69|#define ERROR_BUFFERLEN 1024
  ------------------
   63|     69|    va_end(va);
   64|       |
   65|     69|    err->error.error_code = code;
   66|     69|    if (ssh_get_log_level() == SSH_LOG_TRACE) {
  ------------------
  |  |  358|     69|#define SSH_LOG_TRACE 4
  ------------------
  |  Branch (66:9): [True: 0, False: 69]
  ------------------
   67|      0|        ssh_log_function(SSH_LOG_TRACE,
  ------------------
  |  |  358|      0|#define SSH_LOG_TRACE 4
  ------------------
   68|      0|                         function,
   69|      0|                         err->error.error_buffer);
   70|      0|    }
   71|     69|}
_ssh_set_error_invalid:
  101|      1|{
  102|      1|    _ssh_set_error(error, SSH_FATAL, function,
  103|      1|                   "Invalid argument in %s", function);
  104|      1|}

libssh_constructor:
  114|      2|{
  115|       |
  116|      2|    int rc;
  117|       |
  118|      2|    rc = _ssh_init(1);
  119|       |
  120|      2|    if (rc < 0) {
  ------------------
  |  Branch (120:9): [True: 0, False: 2]
  ------------------
  121|      0|        fprintf(stderr, "Error in auto_init()\n");
  122|      0|    }
  123|       |
  124|      2|    return;
  125|      2|}
ssh_init:
  156|     10|int ssh_init(void) {
  157|     10|    return _ssh_init(0);
  158|     10|}
ssh_finalize:
  241|     10|int ssh_finalize(void) {
  242|     10|    return _ssh_finalize(0);
  243|     10|}
init.c:_ssh_init:
   62|     12|static int _ssh_init(unsigned constructor) {
   63|       |
   64|     12|    int rc = 0;
   65|       |
   66|     12|    if (!constructor) {
  ------------------
  |  Branch (66:9): [True: 10, False: 2]
  ------------------
   67|     10|        ssh_mutex_lock(&ssh_init_mutex);
   68|     10|    }
   69|       |
   70|     12|    _ssh_initialized++;
   71|       |
   72|     12|    if (_ssh_initialized > 1) {
  ------------------
  |  Branch (72:9): [True: 10, False: 2]
  ------------------
   73|     10|        rc = _ssh_init_ret;
   74|     10|        goto _ret;
   75|     10|    }
   76|       |
   77|      2|    rc = ssh_threads_init();
   78|      2|    if (rc) {
  ------------------
  |  Branch (78:9): [True: 0, False: 2]
  ------------------
   79|      0|        goto _ret;
   80|      0|    }
   81|       |
   82|      2|    rc = ssh_crypto_init();
   83|      2|    if (rc) {
  ------------------
  |  Branch (83:9): [True: 0, False: 2]
  ------------------
   84|      0|        goto _ret;
   85|      0|    }
   86|       |
   87|      2|    rc = ssh_dh_init();
   88|      2|    if (rc) {
  ------------------
  |  Branch (88:9): [True: 0, False: 2]
  ------------------
   89|      0|        goto _ret;
   90|      0|    }
   91|       |
   92|      2|    rc = ssh_socket_init();
   93|      2|    if (rc) {
  ------------------
  |  Branch (93:9): [True: 0, False: 2]
  ------------------
   94|      0|        goto _ret;
   95|      0|    }
   96|       |
   97|     12|_ret:
   98|     12|    _ssh_init_ret = rc;
   99|       |
  100|     12|    if (!constructor) {
  ------------------
  |  Branch (100:9): [True: 10, False: 2]
  ------------------
  101|     10|        ssh_mutex_unlock(&ssh_init_mutex);
  102|     10|    }
  103|       |
  104|     12|    return rc;
  105|      2|}
init.c:_ssh_finalize:
  160|     10|static int _ssh_finalize(unsigned destructor) {
  161|       |
  162|     10|    if (!destructor) {
  ------------------
  |  Branch (162:9): [True: 10, False: 0]
  ------------------
  163|     10|        ssh_mutex_lock(&ssh_init_mutex);
  164|       |
  165|     10|        if (_ssh_initialized > 1) {
  ------------------
  |  Branch (165:13): [True: 10, False: 0]
  ------------------
  166|     10|            _ssh_initialized--;
  167|     10|            ssh_mutex_unlock(&ssh_init_mutex);
  168|     10|            return 0;
  169|     10|        }
  170|       |
  171|      0|        if (_ssh_initialized == 1) {
  ------------------
  |  Branch (171:13): [True: 0, False: 0]
  ------------------
  172|      0|            if (_ssh_init_ret < 0) {
  ------------------
  |  Branch (172:17): [True: 0, False: 0]
  ------------------
  173|      0|                ssh_mutex_unlock(&ssh_init_mutex);
  174|      0|                return 0;
  175|      0|            }
  176|      0|        }
  177|      0|    }
  178|       |
  179|       |    /* If the counter reaches zero or it is the destructor calling, finalize */
  180|      0|    ssh_dh_finalize();
  181|      0|    ssh_crypto_finalize();
  182|      0|    ssh_socket_cleanup();
  183|       |    /* It is important to finalize threading after CRYPTO because
  184|       |     * it still depends on it */
  185|      0|    ssh_threads_finalize();
  186|       |
  187|      0|    _ssh_initialized = 0;
  188|       |
  189|      0|    if (!destructor) {
  ------------------
  |  Branch (189:9): [True: 0, False: 0]
  ------------------
  190|      0|        ssh_mutex_unlock(&ssh_init_mutex);
  191|      0|    }
  192|       |
  193|       |#if (defined(_WIN32) && !defined(HAVE_PTHREAD))
  194|       |    if (ssh_init_mutex != NULL) {
  195|       |        DeleteCriticalSection(ssh_init_mutex);
  196|       |        SAFE_FREE(ssh_init_mutex);
  197|       |    }
  198|       |#endif
  199|       |
  200|      0|    return 0;
  201|     10|}

ssh_crypto_init:
 1373|      2|{
 1374|       |#ifndef HAVE_OPENSSL_EVP_CHACHA20
 1375|       |    size_t i;
 1376|       |#endif
 1377|       |
 1378|      2|    if (libcrypto_initialized) {
  ------------------
  |  Branch (1378:9): [True: 0, False: 2]
  ------------------
 1379|      0|        return SSH_OK;
  ------------------
  |  |  311|      0|#define SSH_OK 0     /* No error */
  ------------------
 1380|      0|    }
 1381|      2|    if (OpenSSL_version_num() != OPENSSL_VERSION_NUMBER){
  ------------------
  |  Branch (1381:9): [True: 0, False: 2]
  ------------------
 1382|      0|        SSH_LOG(SSH_LOG_DEBUG, "libssh compiled with %s "
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1383|      0|            "headers, currently running with %s.",
 1384|      0|            OPENSSL_VERSION_TEXT,
 1385|      0|            OpenSSL_version(OpenSSL_version_num())
 1386|      0|        );
 1387|      0|    }
 1388|       |#ifdef CAN_DISABLE_AESNI
 1389|       |    /*
 1390|       |     * disable AES-NI when running within Valgrind, because they generate
 1391|       |     * too many "uninitialized memory access" false positives
 1392|       |     */
 1393|       |    if (RUNNING_ON_VALGRIND){
 1394|       |        SSH_LOG(SSH_LOG_INFO, "Running within Valgrind, disabling AES-NI");
 1395|       |        /* Bit #57 denotes AES-NI instruction set extension */
 1396|       |        OPENSSL_ia32cap &= ~(1LL << 57);
 1397|       |    }
 1398|       |#endif /* CAN_DISABLE_AESNI */
 1399|       |
 1400|       |#ifndef HAVE_OPENSSL_EVP_CHACHA20
 1401|       |    for (i = 0; ssh_ciphertab[i].name != NULL; i++) {
 1402|       |        int cmp;
 1403|       |
 1404|       |        cmp = strcmp(ssh_ciphertab[i].name, "chacha20-poly1305@openssh.com");
 1405|       |        if (cmp == 0) {
 1406|       |            memcpy(&ssh_ciphertab[i],
 1407|       |                   ssh_get_chacha20poly1305_cipher(),
 1408|       |                   sizeof(struct ssh_cipher_struct));
 1409|       |            break;
 1410|       |        }
 1411|       |    }
 1412|       |#endif /* HAVE_OPENSSL_EVP_CHACHA20 */
 1413|       |
 1414|      2|    libcrypto_initialized = 1;
 1415|       |
 1416|      2|    return SSH_OK;
  ------------------
  |  |  311|      2|#define SSH_OK 0     /* No error */
  ------------------
 1417|      2|}

_ssh_log:
  140|  1.94k|{
  141|  1.94k|    va_list va;
  142|       |
  143|  1.94k|    if (verbosity <= ssh_get_log_level()) {
  ------------------
  |  Branch (143:9): [True: 0, False: 1.94k]
  ------------------
  144|      0|        va_start(va, format);
  145|      0|        ssh_vlog(verbosity, function, format, &va);
  146|      0|        va_end(va);
  147|      0|    }
  148|  1.94k|}
ssh_get_log_level:
  210|  2.01k|int ssh_get_log_level(void) {
  211|  2.01k|  return ssh_log_level;
  212|  2.01k|}

match_pattern_list:
  134|     69|    size_t len, int dolower) {
  135|     69|  char sub[1024];
  136|     69|  int negated;
  137|     69|  int got_positive;
  138|     69|  size_t i, subi;
  139|       |
  140|     69|  got_positive = 0;
  141|    138|  for (i = 0; i < len;) {
  ------------------
  |  Branch (141:15): [True: 69, False: 69]
  ------------------
  142|       |    /* Check if the subpattern is negated. */
  143|     69|    if (pattern[i] == '!') {
  ------------------
  |  Branch (143:9): [True: 0, False: 69]
  ------------------
  144|      0|      negated = 1;
  145|      0|      i++;
  146|     69|    } else {
  147|     69|      negated = 0;
  148|     69|    }
  149|       |
  150|       |    /*
  151|       |     * Extract the subpattern up to a comma or end.  Convert the
  152|       |     * subpattern to lowercase.
  153|       |     */
  154|     69|    for (subi = 0;
  155|    681|        i < len && subi < sizeof(sub) - 1 && pattern[i] != ',';
  ------------------
  |  Branch (155:9): [True: 612, False: 69]
  |  Branch (155:20): [True: 612, False: 0]
  |  Branch (155:46): [True: 612, False: 0]
  ------------------
  156|    612|        subi++, i++) {
  157|    612|      sub[subi] = dolower && isupper(pattern[i]) ?
  ------------------
  |  Branch (157:19): [True: 612, False: 0]
  ------------------
  158|    474|        (char)tolower(pattern[i]) : pattern[i];
  159|    612|    }
  160|       |
  161|       |    /* If subpattern too long, return failure (no match). */
  162|     69|    if (subi >= sizeof(sub) - 1) {
  ------------------
  |  Branch (162:9): [True: 0, False: 69]
  ------------------
  163|      0|      return 0;
  164|      0|    }
  165|       |
  166|       |    /* If the subpattern was terminated by a comma, skip the comma. */
  167|     69|    if (i < len && pattern[i] == ',') {
  ------------------
  |  Branch (167:9): [True: 0, False: 69]
  |  Branch (167:20): [True: 0, False: 0]
  ------------------
  168|      0|      i++;
  169|      0|    }
  170|       |
  171|       |    /* Null-terminate the subpattern. */
  172|     69|    sub[subi] = '\0';
  173|       |
  174|       |    /* Try to match the subpattern against the string. */
  175|     69|    if (match_pattern(string, sub, MAX_MATCH_RECURSION)) {
  ------------------
  |  |   46|     69|#define MAX_MATCH_RECURSION 16
  ------------------
  |  Branch (175:9): [True: 3, False: 66]
  ------------------
  176|      3|      if (negated) {
  ------------------
  |  Branch (176:11): [True: 0, False: 3]
  ------------------
  177|      0|        return -1;        /* Negative */
  178|      3|      } else {
  179|      3|        got_positive = 1; /* Positive */
  180|      3|      }
  181|      3|    }
  182|     69|  }
  183|       |
  184|       |  /*
  185|       |   * Return success if got a positive match.  If there was a negative
  186|       |   * match, we have already returned -1 and never get here.
  187|       |   */
  188|     69|  return got_positive;
  189|     69|}
match_hostname:
  198|     69|int match_hostname(const char *host, const char *pattern, unsigned int len) {
  199|     69|  return match_pattern_list(host, pattern, len, 1);
  200|     69|}
match.c:match_pattern:
   53|     69|{
   54|     69|    bool had_asterisk = false;
   55|       |
   56|     69|    if (s == NULL || pattern == NULL || limit <= 0) {
  ------------------
  |  Branch (56:9): [True: 0, False: 69]
  |  Branch (56:22): [True: 0, False: 69]
  |  Branch (56:41): [True: 0, False: 69]
  ------------------
   57|      0|        return 0;
   58|      0|    }
   59|       |
   60|     81|    for (;;) {
   61|       |        /* If at end of pattern, accept if also at end of string. */
   62|     81|        if (*pattern == '\0') {
  ------------------
  |  Branch (62:13): [True: 3, False: 78]
  ------------------
   63|      3|            return (*s == '\0');
   64|      3|        }
   65|       |
   66|       |        /* Skip all the asterisks and adjacent question marks */
   67|    108|        while (*pattern == '*' || (had_asterisk && *pattern == '?')) {
  ------------------
  |  Branch (67:16): [True: 30, False: 78]
  |  Branch (67:36): [True: 9, False: 69]
  |  Branch (67:52): [True: 0, False: 9]
  ------------------
   68|     30|            if (*pattern == '*') {
  ------------------
  |  Branch (68:17): [True: 30, False: 0]
  ------------------
   69|     30|                had_asterisk = true;
   70|     30|            }
   71|     30|            pattern++;
   72|     30|        }
   73|       |
   74|     78|        if (had_asterisk) {
  ------------------
  |  Branch (74:13): [True: 9, False: 69]
  ------------------
   75|       |            /* If at end of pattern, accept immediately. */
   76|      9|            if (!*pattern)
  ------------------
  |  Branch (76:17): [True: 3, False: 6]
  ------------------
   77|      3|                return 1;
   78|       |
   79|       |            /* If next character in pattern is known, optimize. */
   80|      6|            if (*pattern != '?') {
  ------------------
  |  Branch (80:17): [True: 6, False: 0]
  ------------------
   81|       |                /*
   82|       |                 * Look instances of the next character in
   83|       |                 * pattern, and try to match starting from
   84|       |                 * those.
   85|       |                 */
   86|     72|                for (; *s; s++)
  ------------------
  |  Branch (86:24): [True: 66, False: 6]
  ------------------
   87|     66|                    if (*s == *pattern && match_pattern(s + 1, pattern + 1, limit - 1)) {
  ------------------
  |  Branch (87:25): [True: 0, False: 66]
  |  Branch (87:43): [True: 0, False: 0]
  ------------------
   88|      0|                        return 1;
   89|      0|                    }
   90|       |                /* Failed. */
   91|      6|                return 0;
   92|      6|            }
   93|       |            /*
   94|       |             * Move ahead one character at a time and try to
   95|       |             * match at each position.
   96|       |             */
   97|      0|            for (; *s; s++) {
  ------------------
  |  Branch (97:20): [True: 0, False: 0]
  ------------------
   98|      0|                if (match_pattern(s, pattern, limit - 1)) {
  ------------------
  |  Branch (98:21): [True: 0, False: 0]
  ------------------
   99|      0|                    return 1;
  100|      0|                }
  101|      0|            }
  102|       |            /* Failed. */
  103|      0|            return 0;
  104|      0|        }
  105|       |        /*
  106|       |         * There must be at least one more character in the string.
  107|       |         * If we are at the end, fail.
  108|       |         */
  109|     69|        if (!*s) {
  ------------------
  |  Branch (109:13): [True: 0, False: 69]
  ------------------
  110|      0|            return 0;
  111|      0|        }
  112|       |
  113|       |        /* Check if the next character of the string is acceptable. */
  114|     69|        if (*pattern != '?' && *pattern != *s) {
  ------------------
  |  Branch (114:13): [True: 60, False: 9]
  |  Branch (114:32): [True: 57, False: 3]
  ------------------
  115|     57|            return 0;
  116|     57|        }
  117|       |
  118|       |        /* Move to the next character, both in string and in pattern. */
  119|     12|        s++;
  120|     12|        pattern++;
  121|     12|    }
  122|       |
  123|       |    /* NOTREACHED */
  124|      0|    return 0;
  125|     69|}

ssh_get_user_home_dir:
  248|     10|{
  249|     10|    char *szPath = NULL;
  250|     10|    struct passwd pwd;
  251|     10|    struct passwd *pwdbuf = NULL;
  252|     10|    char buf[NSS_BUFLEN_PASSWD] = {0};
  253|     10|    int rc;
  254|       |
  255|     10|    rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
  256|     10|    if (rc != 0 || pwdbuf == NULL ) {
  ------------------
  |  Branch (256:9): [True: 0, False: 10]
  |  Branch (256:20): [True: 0, False: 10]
  ------------------
  257|      0|        szPath = getenv("HOME");
  258|      0|        if (szPath == NULL) {
  ------------------
  |  Branch (258:13): [True: 0, False: 0]
  ------------------
  259|      0|            return NULL;
  260|      0|        }
  261|      0|        snprintf(buf, sizeof(buf), "%s", szPath);
  262|       |
  263|      0|        return strdup(buf);
  264|      0|    }
  265|       |
  266|     10|    szPath = strdup(pwd.pw_dir);
  267|       |
  268|     10|    return szPath;
  269|     10|}
ssh_get_local_username:
  307|      3|{
  308|      3|    struct passwd pwd;
  309|      3|    struct passwd *pwdbuf = NULL;
  310|      3|    char buf[NSS_BUFLEN_PASSWD];
  311|      3|    char *name;
  312|      3|    int rc;
  313|       |
  314|      3|    rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
  315|      3|    if (rc != 0 || pwdbuf == NULL) {
  ------------------
  |  Branch (315:9): [True: 0, False: 3]
  |  Branch (315:20): [True: 0, False: 3]
  ------------------
  316|      0|        return NULL;
  317|      0|    }
  318|       |
  319|      3|    name = strdup(pwd.pw_name);
  320|       |
  321|      3|    if (name == NULL) {
  ------------------
  |  Branch (321:9): [True: 0, False: 3]
  ------------------
  322|      0|        return NULL;
  323|      0|    }
  324|       |
  325|      3|    return name;
  326|      3|}
ssh_lowercase:
  361|     14|{
  362|     14|  char *new, *p;
  363|       |
  364|     14|  if (str == NULL) {
  ------------------
  |  Branch (364:7): [True: 0, False: 14]
  ------------------
  365|      0|    return NULL;
  366|      0|  }
  367|       |
  368|     14|  new = strdup(str);
  369|     14|  if (new == NULL) {
  ------------------
  |  Branch (369:7): [True: 0, False: 14]
  ------------------
  370|      0|    return NULL;
  371|      0|  }
  372|       |
  373|    168|  for (p = new; *p; p++) {
  ------------------
  |  Branch (373:17): [True: 154, False: 14]
  ------------------
  374|    154|    *p = tolower(*p);
  375|    154|  }
  376|       |
  377|     14|  return new;
  378|     14|}
ssh_list_new:
  675|     30|{
  676|     30|    struct ssh_list *ret = malloc(sizeof(struct ssh_list));
  677|     30|    if (!ret)
  ------------------
  |  Branch (677:9): [True: 0, False: 30]
  ------------------
  678|      0|        return NULL;
  679|     30|    ret->root = ret->end = NULL;
  680|     30|    return ret;
  681|     30|}
ssh_list_free:
  684|     40|{
  685|     40|    struct ssh_iterator *ptr, *next;
  686|     40|    if (!list)
  ------------------
  |  Branch (686:9): [True: 10, False: 30]
  ------------------
  687|     10|        return;
  688|     30|    ptr = list->root;
  689|     30|    while (ptr) {
  ------------------
  |  Branch (689:12): [True: 0, False: 30]
  ------------------
  690|      0|        next = ptr->next;
  691|      0|        SAFE_FREE(ptr);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  692|      0|        ptr = next;
  693|      0|    }
  694|     30|    SAFE_FREE(list);
  ------------------
  |  |  324|     30|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 30, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  695|     30|}
ssh_list_get_iterator:
  698|     10|{
  699|     10|    if (!list)
  ------------------
  |  Branch (699:9): [True: 10, False: 0]
  ------------------
  700|     10|        return NULL;
  701|      0|    return list->root;
  702|     10|}
ssh_list_append:
  745|     30|{
  746|     30|  struct ssh_iterator *iterator = NULL;
  747|       |
  748|     30|  if (list == NULL) {
  ------------------
  |  Branch (748:7): [True: 0, False: 30]
  ------------------
  749|      0|      return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  750|      0|  }
  751|       |
  752|     30|  iterator = ssh_iterator_new(data);
  753|     30|  if (iterator == NULL) {
  ------------------
  |  Branch (753:7): [True: 0, False: 30]
  ------------------
  754|      0|      return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  755|      0|  }
  756|       |
  757|     30|  if(!list->end){
  ------------------
  |  Branch (757:6): [True: 10, False: 20]
  ------------------
  758|       |    /* list is empty */
  759|     10|    list->root=list->end=iterator;
  760|     20|  } else {
  761|       |    /* put it on end of list */
  762|     20|    list->end->next=iterator;
  763|     20|    list->end=iterator;
  764|     20|  }
  765|     30|  return SSH_OK;
  ------------------
  |  |  311|     30|#define SSH_OK 0     /* No error */
  ------------------
  766|     30|}
ssh_list_prepend:
  769|      5|{
  770|      5|  struct ssh_iterator *it = NULL;
  771|       |
  772|      5|  if (list == NULL) {
  ------------------
  |  Branch (772:7): [True: 0, False: 5]
  ------------------
  773|      0|      return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  774|      0|  }
  775|       |
  776|      5|  it = ssh_iterator_new(data);
  777|      5|  if (it == NULL) {
  ------------------
  |  Branch (777:7): [True: 0, False: 5]
  ------------------
  778|      0|    return SSH_ERROR;
  ------------------
  |  |  312|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  779|      0|  }
  780|       |
  781|      5|  if (list->end == NULL) {
  ------------------
  |  Branch (781:7): [True: 0, False: 5]
  ------------------
  782|       |    /* list is empty */
  783|      0|    list->root = list->end = it;
  784|      5|  } else {
  785|       |    /* set as new root */
  786|      5|    it->next = list->root;
  787|      5|    list->root = it;
  788|      5|  }
  789|       |
  790|      5|  return SSH_OK;
  ------------------
  |  |  311|      5|#define SSH_OK 0     /* No error */
  ------------------
  791|      5|}
_ssh_list_pop_head:
  835|     65|{
  836|     65|  struct ssh_iterator *iterator = NULL;
  837|     65|  const void *data = NULL;
  838|       |
  839|     65|  if (list == NULL) {
  ------------------
  |  Branch (839:7): [True: 0, False: 65]
  ------------------
  840|      0|      return NULL;
  841|      0|  }
  842|       |
  843|     65|  iterator = list->root;
  844|     65|  if (iterator == NULL) {
  ------------------
  |  Branch (844:7): [True: 30, False: 35]
  ------------------
  845|     30|      return NULL;
  846|     30|  }
  847|     35|  data=iterator->data;
  848|     35|  list->root=iterator->next;
  849|     35|  if(list->end==iterator)
  ------------------
  |  Branch (849:6): [True: 10, False: 25]
  ------------------
  850|     10|    list->end=NULL;
  851|     35|  SAFE_FREE(iterator);
  ------------------
  |  |  324|     35|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 35, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  852|     35|  return data;
  853|     65|}
ssh_path_expand_tilde:
 1073|     85|{
 1074|     85|    char *h = NULL, *r;
 1075|     85|    const char *p;
 1076|     85|    size_t ld;
 1077|     85|    size_t lh = 0;
 1078|       |
 1079|     85|    if (d[0] != '~') {
  ------------------
  |  Branch (1079:9): [True: 75, False: 10]
  ------------------
 1080|     75|        return strdup(d);
 1081|     75|    }
 1082|     10|    d++;
 1083|       |
 1084|       |    /* handle ~user/path */
 1085|     10|    p = strchr(d, '/');
 1086|     10|    if (p != NULL && p > d) {
  ------------------
  |  Branch (1086:9): [True: 10, False: 0]
  |  Branch (1086:22): [True: 0, False: 10]
  ------------------
 1087|       |#ifdef _WIN32
 1088|       |        return strdup(d);
 1089|       |#else
 1090|      0|        struct passwd *pw;
 1091|      0|        size_t s = p - d;
 1092|      0|        char u[128];
 1093|       |
 1094|      0|        if (s >= sizeof(u)) {
  ------------------
  |  Branch (1094:13): [True: 0, False: 0]
  ------------------
 1095|      0|            return NULL;
 1096|      0|        }
 1097|      0|        memcpy(u, d, s);
 1098|      0|        u[s] = '\0';
 1099|      0|        pw = getpwnam(u);
 1100|      0|        if (pw == NULL) {
  ------------------
  |  Branch (1100:13): [True: 0, False: 0]
  ------------------
 1101|      0|            return NULL;
 1102|      0|        }
 1103|      0|        ld = strlen(p);
 1104|      0|        h = strdup(pw->pw_dir);
 1105|      0|#endif
 1106|     10|    } else {
 1107|     10|        ld = strlen(d);
 1108|     10|        p = (char *) d;
 1109|     10|        h = ssh_get_user_home_dir();
 1110|     10|    }
 1111|     10|    if (h == NULL) {
  ------------------
  |  Branch (1111:9): [True: 0, False: 10]
  ------------------
 1112|      0|        return NULL;
 1113|      0|    }
 1114|     10|    lh = strlen(h);
 1115|       |
 1116|     10|    r = malloc(ld + lh + 1);
 1117|     10|    if (r == NULL) {
  ------------------
  |  Branch (1117:9): [True: 0, False: 10]
  ------------------
 1118|      0|        SAFE_FREE(h);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1119|      0|        return NULL;
 1120|      0|    }
 1121|       |
 1122|     10|    if (lh > 0) {
  ------------------
  |  Branch (1122:9): [True: 10, False: 0]
  ------------------
 1123|     10|        memcpy(r, h, lh);
 1124|     10|    }
 1125|     10|    SAFE_FREE(h);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 10, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1126|     10|    memcpy(r + lh, p, ld + 1);
 1127|       |
 1128|     10|    return r;
 1129|     10|}
ssh_path_expand_escape:
 1146|     75|{
 1147|     75|    char host[NI_MAXHOST] = {0};
 1148|     75|    char *buf = NULL;
 1149|     75|    char *r = NULL;
 1150|     75|    char *x = NULL;
 1151|     75|    const char *p;
 1152|     75|    size_t i, l;
 1153|       |
 1154|     75|    r = ssh_path_expand_tilde(s);
 1155|     75|    if (r == NULL) {
  ------------------
  |  Branch (1155:9): [True: 0, False: 75]
  ------------------
 1156|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1157|      0|        return NULL;
 1158|      0|    }
 1159|       |
 1160|     75|    if (strlen(r) > MAX_BUF_SIZE) {
  ------------------
  |  |  200|     75|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1160:9): [True: 0, False: 75]
  ------------------
 1161|      0|        ssh_set_error(session, SSH_FATAL, "string to expand too long");
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1162|      0|        free(r);
 1163|      0|        return NULL;
 1164|      0|    }
 1165|       |
 1166|     75|    buf = malloc(MAX_BUF_SIZE);
  ------------------
  |  |  200|     75|#define MAX_BUF_SIZE 4096
  ------------------
 1167|     75|    if (buf == NULL) {
  ------------------
  |  Branch (1167:9): [True: 0, False: 75]
  ------------------
 1168|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1169|      0|        free(r);
 1170|      0|        return NULL;
 1171|      0|    }
 1172|       |
 1173|     75|    p = r;
 1174|     75|    buf[0] = '\0';
 1175|       |
 1176|    229|    for (i = 0; *p != '\0'; p++) {
  ------------------
  |  Branch (1176:17): [True: 222, False: 7]
  ------------------
 1177|    222|        if (*p != '%') {
  ------------------
  |  Branch (1177:13): [True: 151, False: 71]
  ------------------
 1178|    151|        escape:
 1179|    151|            buf[i] = *p;
 1180|    151|            i++;
 1181|    151|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  200|    151|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1181:17): [True: 0, False: 151]
  ------------------
 1182|      0|                free(buf);
 1183|      0|                free(r);
 1184|      0|                return NULL;
 1185|      0|            }
 1186|    151|            buf[i] = '\0';
 1187|    151|            continue;
 1188|    151|        }
 1189|       |
 1190|     71|        p++;
 1191|     71|        if (*p == '\0') {
  ------------------
  |  Branch (1191:13): [True: 0, False: 71]
  ------------------
 1192|      0|            break;
 1193|      0|        }
 1194|       |
 1195|     71|        switch (*p) {
 1196|      0|            case '%':
  ------------------
  |  Branch (1196:13): [True: 0, False: 71]
  ------------------
 1197|      0|                goto escape;
 1198|      0|            case 'd':
  ------------------
  |  Branch (1198:13): [True: 0, False: 71]
  ------------------
 1199|      0|                if (session->opts.sshdir) {
  ------------------
  |  Branch (1199:21): [True: 0, False: 0]
  ------------------
 1200|      0|                    x = strdup(session->opts.sshdir);
 1201|      0|                } else {
 1202|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1203|      0|                            "Cannot expand sshdir");
 1204|      0|                    free(buf);
 1205|      0|                    free(r);
 1206|      0|                    return NULL;
 1207|      0|                }
 1208|      0|                break;
 1209|      3|            case 'u':
  ------------------
  |  Branch (1209:13): [True: 3, False: 68]
  ------------------
 1210|      3|                x = ssh_get_local_username();
 1211|      3|                break;
 1212|      0|            case 'l':
  ------------------
  |  Branch (1212:13): [True: 0, False: 71]
  ------------------
 1213|      0|                if (gethostname(host, sizeof(host) == 0)) {
  ------------------
  |  Branch (1213:21): [True: 0, False: 0]
  ------------------
 1214|      0|                    x = strdup(host);
 1215|      0|                }
 1216|      0|                break;
 1217|      0|            case 'h':
  ------------------
  |  Branch (1217:13): [True: 0, False: 71]
  ------------------
 1218|      0|                if (session->opts.host) {
  ------------------
  |  Branch (1218:21): [True: 0, False: 0]
  ------------------
 1219|      0|                    x = strdup(session->opts.host);
 1220|      0|                } else {
 1221|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1222|      0|                            "Cannot expand host");
 1223|      0|                    free(buf);
 1224|      0|                    free(r);
 1225|      0|                    return NULL;
 1226|      0|                }
 1227|      0|                break;
 1228|     68|            case 'r':
  ------------------
  |  Branch (1228:13): [True: 68, False: 3]
  ------------------
 1229|     68|                if (session->opts.username) {
  ------------------
  |  Branch (1229:21): [True: 0, False: 68]
  ------------------
 1230|      0|                    x = strdup(session->opts.username);
 1231|     68|                } else {
 1232|     68|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|     68|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1233|     68|                            "Cannot expand username");
 1234|     68|                    free(buf);
 1235|     68|                    free(r);
 1236|     68|                    return NULL;
 1237|     68|                }
 1238|      0|                break;
 1239|      0|            case 'p':
  ------------------
  |  Branch (1239:13): [True: 0, False: 71]
  ------------------
 1240|      0|                {
 1241|      0|                  char tmp[6];
 1242|       |
 1243|      0|                  snprintf(tmp, sizeof(tmp), "%hu",
 1244|      0|                           (uint16_t)(session->opts.port > 0 ? session->opts.port
  ------------------
  |  Branch (1244:39): [True: 0, False: 0]
  ------------------
 1245|      0|                                                             : 22));
 1246|      0|                  x = strdup(tmp);
 1247|      0|                }
 1248|      0|                break;
 1249|      0|            default:
  ------------------
  |  Branch (1249:13): [True: 0, False: 71]
  ------------------
 1250|      0|                ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1251|      0|                        "Wrong escape sequence detected");
 1252|      0|                free(buf);
 1253|      0|                free(r);
 1254|      0|                return NULL;
 1255|     71|        }
 1256|       |
 1257|      3|        if (x == NULL) {
  ------------------
  |  Branch (1257:13): [True: 0, False: 3]
  ------------------
 1258|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1259|      0|            free(buf);
 1260|      0|            free(r);
 1261|      0|            return NULL;
 1262|      0|        }
 1263|       |
 1264|      3|        i += strlen(x);
 1265|      3|        if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  200|      3|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1265:13): [True: 0, False: 3]
  ------------------
 1266|      0|            ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1267|      0|                    "String too long");
 1268|      0|            free(buf);
 1269|      0|            free(x);
 1270|      0|            free(r);
 1271|      0|            return NULL;
 1272|      0|        }
 1273|      3|        l = strlen(buf);
 1274|      3|        strncpy(buf + l, x, MAX_BUF_SIZE - l - 1);
  ------------------
  |  |  200|      3|#define MAX_BUF_SIZE 4096
  ------------------
 1275|      3|        buf[i] = '\0';
 1276|      3|        SAFE_FREE(x);
  ------------------
  |  |  324|      3|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 3, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1277|      3|    }
 1278|       |
 1279|      7|    free(r);
 1280|       |
 1281|       |    /* strip the unused space by realloc */
 1282|      7|    x = realloc(buf, strlen(buf) + 1);
 1283|      7|    if (x == NULL) {
  ------------------
  |  Branch (1283:9): [True: 0, False: 7]
  ------------------
 1284|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1285|      0|        free(buf);
 1286|      0|    }
 1287|      7|    return x;
 1288|     75|}
misc.c:ssh_iterator_new:
  734|     35|{
  735|     35|    struct ssh_iterator *iterator = malloc(sizeof(struct ssh_iterator));
  736|       |
  737|     35|    if (!iterator)
  ------------------
  |  Branch (737:9): [True: 0, False: 35]
  ------------------
  738|      0|        return NULL;
  739|     35|    iterator->next = NULL;
  740|     35|    iterator->data = data;
  741|     35|    return iterator;
  742|     35|}

ssh_options_set:
  547|     26|{
  548|     26|    const char *v;
  549|     26|    char *p, *q;
  550|     26|    long int i;
  551|     26|    unsigned int u;
  552|     26|    int rc;
  553|     26|    char **wanted_methods = session->opts.wanted_methods;
  554|       |
  555|     26|    if (session == NULL) {
  ------------------
  |  Branch (555:9): [True: 0, False: 26]
  ------------------
  556|      0|        return -1;
  557|      0|    }
  558|       |
  559|     26|    switch (type) {
  560|     10|        case SSH_OPTIONS_HOST:
  ------------------
  |  Branch (560:9): [True: 10, False: 16]
  ------------------
  561|     10|            v = value;
  562|     10|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (562:17): [True: 0, False: 10]
  |  Branch (562:30): [True: 0, False: 10]
  ------------------
  563|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  564|      0|                return -1;
  565|     10|            } else {
  566|     10|                q = strdup(value);
  567|     10|                if (q == NULL) {
  ------------------
  |  Branch (567:21): [True: 0, False: 10]
  ------------------
  568|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  569|      0|                    return -1;
  570|      0|                }
  571|     10|                p = strrchr(q, '@');
  572|       |
  573|     10|                SAFE_FREE(session->opts.host);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  574|       |
  575|     10|                if (p) {
  ------------------
  |  Branch (575:21): [True: 0, False: 10]
  ------------------
  576|      0|                    *p = '\0';
  577|      0|                    session->opts.host = strdup(p + 1);
  578|      0|                    if (session->opts.host == NULL) {
  ------------------
  |  Branch (578:25): [True: 0, False: 0]
  ------------------
  579|      0|                        SAFE_FREE(q);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  580|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  581|      0|                        return -1;
  582|      0|                    }
  583|       |
  584|      0|                    SAFE_FREE(session->opts.username);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  585|      0|                    session->opts.username = strdup(q);
  586|      0|                    SAFE_FREE(q);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  587|      0|                    if (session->opts.username == NULL) {
  ------------------
  |  Branch (587:25): [True: 0, False: 0]
  ------------------
  588|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  589|      0|                        return -1;
  590|      0|                    }
  591|     10|                } else {
  592|     10|                    session->opts.host = q;
  593|     10|                }
  594|     10|            }
  595|     10|            break;
  596|     10|        case SSH_OPTIONS_PORT:
  ------------------
  |  Branch (596:9): [True: 0, False: 26]
  ------------------
  597|      0|            if (value == NULL) {
  ------------------
  |  Branch (597:17): [True: 0, False: 0]
  ------------------
  598|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  599|      0|                return -1;
  600|      0|            } else {
  601|      0|                int *x = (int *) value;
  602|      0|                if (*x <= 0) {
  ------------------
  |  Branch (602:21): [True: 0, False: 0]
  ------------------
  603|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  604|      0|                    return -1;
  605|      0|                }
  606|       |
  607|      0|                session->opts.port = *x & 0xffffU;
  608|      0|            }
  609|      0|            break;
  610|      1|        case SSH_OPTIONS_PORT_STR:
  ------------------
  |  Branch (610:9): [True: 1, False: 25]
  ------------------
  611|      1|            v = value;
  612|      1|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (612:17): [True: 0, False: 1]
  |  Branch (612:30): [True: 0, False: 1]
  ------------------
  613|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  614|      0|                return -1;
  615|      1|            } else {
  616|      1|                q = strdup(v);
  617|      1|                if (q == NULL) {
  ------------------
  |  Branch (617:21): [True: 0, False: 1]
  ------------------
  618|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  619|      0|                    return -1;
  620|      0|                }
  621|      1|                i = strtol(q, &p, 10);
  622|      1|                if (q == p) {
  ------------------
  |  Branch (622:21): [True: 1, False: 0]
  ------------------
  623|      1|                    SAFE_FREE(q);
  ------------------
  |  |  324|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 1, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  624|      1|                }
  625|      1|                SAFE_FREE(q);
  ------------------
  |  |  324|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 1]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  626|      1|                if (i <= 0) {
  ------------------
  |  Branch (626:21): [True: 1, False: 0]
  ------------------
  627|      1|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      1|    _ssh_set_error_invalid(error, __func__)
  ------------------
  628|      1|                    return -1;
  629|      1|                }
  630|       |
  631|      0|                session->opts.port = i & 0xffffU;
  632|      0|            }
  633|      0|            break;
  634|      0|        case SSH_OPTIONS_FD:
  ------------------
  |  Branch (634:9): [True: 0, False: 26]
  ------------------
  635|      0|            if (value == NULL) {
  ------------------
  |  Branch (635:17): [True: 0, False: 0]
  ------------------
  636|      0|                session->opts.fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  122|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  637|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  638|      0|                return -1;
  639|      0|            } else {
  640|      0|                socket_t *x = (socket_t *) value;
  641|      0|                if (*x < 0) {
  ------------------
  |  Branch (641:21): [True: 0, False: 0]
  ------------------
  642|      0|                    session->opts.fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  122|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  643|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  644|      0|                    return -1;
  645|      0|                }
  646|       |
  647|      0|                session->opts.fd = *x & 0xffff;
  648|      0|            }
  649|      0|            break;
  650|      0|        case SSH_OPTIONS_BINDADDR:
  ------------------
  |  Branch (650:9): [True: 0, False: 26]
  ------------------
  651|      0|            v = value;
  652|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (652:17): [True: 0, False: 0]
  |  Branch (652:30): [True: 0, False: 0]
  ------------------
  653|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  654|      0|                return -1;
  655|      0|            }
  656|       |
  657|      0|            q = strdup(v);
  658|      0|            if (q == NULL) {
  ------------------
  |  Branch (658:17): [True: 0, False: 0]
  ------------------
  659|      0|                return -1;
  660|      0|            }
  661|      0|            SAFE_FREE(session->opts.bindaddr);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  662|      0|            session->opts.bindaddr = q;
  663|      0|            break;
  664|      0|        case SSH_OPTIONS_USER:
  ------------------
  |  Branch (664:9): [True: 0, False: 26]
  ------------------
  665|      0|            v = value;
  666|      0|            SAFE_FREE(session->opts.username);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  667|      0|            if (v == NULL) {
  ------------------
  |  Branch (667:17): [True: 0, False: 0]
  ------------------
  668|      0|                q = ssh_get_local_username();
  669|      0|                if (q == NULL) {
  ------------------
  |  Branch (669:21): [True: 0, False: 0]
  ------------------
  670|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  671|      0|                    return -1;
  672|      0|                }
  673|      0|                session->opts.username = q;
  674|      0|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (674:24): [True: 0, False: 0]
  ------------------
  675|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  676|      0|                return -1;
  677|      0|            } else { /* username provided */
  678|      0|                session->opts.username = strdup(value);
  679|      0|                if (session->opts.username == NULL) {
  ------------------
  |  Branch (679:21): [True: 0, False: 0]
  ------------------
  680|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  681|      0|                    return -1;
  682|      0|                }
  683|      0|            }
  684|      0|            break;
  685|     10|        case SSH_OPTIONS_SSH_DIR:
  ------------------
  |  Branch (685:9): [True: 10, False: 16]
  ------------------
  686|     10|            v = value;
  687|     10|            SAFE_FREE(session->opts.sshdir);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  688|     10|            if (v == NULL) {
  ------------------
  |  Branch (688:17): [True: 10, False: 0]
  ------------------
  689|     10|                session->opts.sshdir = ssh_path_expand_tilde("~/.ssh");
  690|     10|                if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (690:21): [True: 0, False: 10]
  ------------------
  691|      0|                    return -1;
  692|      0|                }
  693|     10|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (693:24): [True: 0, False: 0]
  ------------------
  694|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  695|      0|                return -1;
  696|      0|            } else {
  697|      0|                session->opts.sshdir = ssh_path_expand_tilde(v);
  698|      0|                if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (698:21): [True: 0, False: 0]
  ------------------
  699|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  700|      0|                    return -1;
  701|      0|                }
  702|      0|            }
  703|     10|            break;
  704|     10|        case SSH_OPTIONS_IDENTITY:
  ------------------
  |  Branch (704:9): [True: 0, False: 26]
  ------------------
  705|      5|        case SSH_OPTIONS_ADD_IDENTITY:
  ------------------
  |  Branch (705:9): [True: 5, False: 21]
  ------------------
  706|      5|            v = value;
  707|      5|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (707:17): [True: 0, False: 5]
  |  Branch (707:30): [True: 0, False: 5]
  ------------------
  708|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  709|      0|                return -1;
  710|      0|            }
  711|      5|            q = strdup(v);
  712|      5|            if (q == NULL) {
  ------------------
  |  Branch (712:17): [True: 0, False: 5]
  ------------------
  713|      0|                return -1;
  714|      0|            }
  715|      5|            if (session->opts.exp_flags & SSH_OPT_EXP_FLAG_IDENTITY) {
  ------------------
  |  |  100|      5|#define SSH_OPT_EXP_FLAG_IDENTITY 0x8
  ------------------
  |  Branch (715:17): [True: 0, False: 5]
  ------------------
  716|      0|                rc = ssh_list_append(session->opts.identity_non_exp, q);
  717|      5|            } else {
  718|      5|                rc = ssh_list_prepend(session->opts.identity_non_exp, q);
  719|      5|            }
  720|      5|            if (rc < 0) {
  ------------------
  |  Branch (720:17): [True: 0, False: 5]
  ------------------
  721|      0|                free(q);
  722|      0|                return -1;
  723|      0|            }
  724|      5|            break;
  725|      5|        case SSH_OPTIONS_KNOWNHOSTS:
  ------------------
  |  Branch (725:9): [True: 0, False: 26]
  ------------------
  726|      0|            v = value;
  727|      0|            SAFE_FREE(session->opts.knownhosts);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  728|      0|            if (v == NULL) {
  ------------------
  |  Branch (728:17): [True: 0, False: 0]
  ------------------
  729|       |                /* The default value will be set by the ssh_options_apply() */
  730|      0|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (730:24): [True: 0, False: 0]
  ------------------
  731|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  732|      0|                return -1;
  733|      0|            } else {
  734|      0|                session->opts.knownhosts = strdup(v);
  735|      0|                if (session->opts.knownhosts == NULL) {
  ------------------
  |  Branch (735:21): [True: 0, False: 0]
  ------------------
  736|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  737|      0|                    return -1;
  738|      0|                }
  739|      0|                session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_KNOWNHOSTS;
  ------------------
  |  |   97|      0|#define SSH_OPT_EXP_FLAG_KNOWNHOSTS 0x1
  ------------------
  740|      0|            }
  741|      0|            break;
  742|      0|        case SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
  ------------------
  |  Branch (742:9): [True: 0, False: 26]
  ------------------
  743|      0|            v = value;
  744|      0|            SAFE_FREE(session->opts.global_knownhosts);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  745|      0|            if (v == NULL) {
  ------------------
  |  Branch (745:17): [True: 0, False: 0]
  ------------------
  746|      0|                session->opts.global_knownhosts =
  747|      0|                    strdup("/etc/ssh/ssh_known_hosts");
  748|      0|                if (session->opts.global_knownhosts == NULL) {
  ------------------
  |  Branch (748:21): [True: 0, False: 0]
  ------------------
  749|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  750|      0|                    return -1;
  751|      0|                }
  752|      0|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (752:24): [True: 0, False: 0]
  ------------------
  753|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  754|      0|                return -1;
  755|      0|            } else {
  756|      0|                session->opts.global_knownhosts = strdup(v);
  757|      0|                if (session->opts.global_knownhosts == NULL) {
  ------------------
  |  Branch (757:21): [True: 0, False: 0]
  ------------------
  758|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  759|      0|                    return -1;
  760|      0|                }
  761|      0|                session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_GLOBAL_KNOWNHOSTS;
  ------------------
  |  |   98|      0|#define SSH_OPT_EXP_FLAG_GLOBAL_KNOWNHOSTS 0x2
  ------------------
  762|      0|            }
  763|      0|            break;
  764|      0|        case SSH_OPTIONS_TIMEOUT:
  ------------------
  |  Branch (764:9): [True: 0, False: 26]
  ------------------
  765|      0|            if (value == NULL) {
  ------------------
  |  Branch (765:17): [True: 0, False: 0]
  ------------------
  766|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  767|      0|                return -1;
  768|      0|            } else {
  769|      0|                long *x = (long *) value;
  770|      0|                if (*x < 0) {
  ------------------
  |  Branch (770:21): [True: 0, False: 0]
  ------------------
  771|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  772|      0|                    return -1;
  773|      0|                }
  774|       |
  775|      0|                session->opts.timeout = *x & 0xffffffffU;
  776|      0|            }
  777|      0|            break;
  778|      0|        case SSH_OPTIONS_TIMEOUT_USEC:
  ------------------
  |  Branch (778:9): [True: 0, False: 26]
  ------------------
  779|      0|            if (value == NULL) {
  ------------------
  |  Branch (779:17): [True: 0, False: 0]
  ------------------
  780|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  781|      0|                return -1;
  782|      0|            } else {
  783|      0|                long *x = (long *) value;
  784|      0|                if (*x < 0) {
  ------------------
  |  Branch (784:21): [True: 0, False: 0]
  ------------------
  785|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  786|      0|                    return -1;
  787|      0|                }
  788|       |
  789|      0|                session->opts.timeout_usec = *x & 0xffffffffU;
  790|      0|            }
  791|      0|            break;
  792|      0|        case SSH_OPTIONS_SSH1:
  ------------------
  |  Branch (792:9): [True: 0, False: 26]
  ------------------
  793|      0|            break;
  794|      0|        case SSH_OPTIONS_SSH2:
  ------------------
  |  Branch (794:9): [True: 0, False: 26]
  ------------------
  795|      0|            break;
  796|      0|        case SSH_OPTIONS_LOG_VERBOSITY:
  ------------------
  |  Branch (796:9): [True: 0, False: 26]
  ------------------
  797|      0|            if (value == NULL) {
  ------------------
  |  Branch (797:17): [True: 0, False: 0]
  ------------------
  798|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  799|      0|                return -1;
  800|      0|            } else {
  801|      0|                int *x = (int *) value;
  802|      0|                if (*x < 0) {
  ------------------
  |  Branch (802:21): [True: 0, False: 0]
  ------------------
  803|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  804|      0|                    return -1;
  805|      0|                }
  806|       |
  807|      0|                session->common.log_verbosity = *x & 0xffffU;
  808|      0|                ssh_set_log_level(*x & 0xffffU);
  809|      0|            }
  810|      0|            break;
  811|      0|        case SSH_OPTIONS_LOG_VERBOSITY_STR:
  ------------------
  |  Branch (811:9): [True: 0, False: 26]
  ------------------
  812|      0|            v = value;
  813|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (813:17): [True: 0, False: 0]
  |  Branch (813:30): [True: 0, False: 0]
  ------------------
  814|      0|                session->common.log_verbosity = 0;
  815|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  816|      0|                return -1;
  817|      0|            } else {
  818|      0|                q = strdup(v);
  819|      0|                if (q == NULL) {
  ------------------
  |  Branch (819:21): [True: 0, False: 0]
  ------------------
  820|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  821|      0|                    return -1;
  822|      0|                }
  823|      0|                i = strtol(q, &p, 10);
  824|      0|                if (q == p) {
  ------------------
  |  Branch (824:21): [True: 0, False: 0]
  ------------------
  825|      0|                    SAFE_FREE(q);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  826|      0|                }
  827|      0|                SAFE_FREE(q);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  828|      0|                if (i < 0) {
  ------------------
  |  Branch (828:21): [True: 0, False: 0]
  ------------------
  829|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  830|      0|                    return -1;
  831|      0|                }
  832|       |
  833|      0|                session->common.log_verbosity = i & 0xffffU;
  834|      0|                ssh_set_log_level(i & 0xffffU);
  835|      0|            }
  836|      0|            break;
  837|      0|        case SSH_OPTIONS_CIPHERS_C_S:
  ------------------
  |  Branch (837:9): [True: 0, False: 26]
  ------------------
  838|      0|            v = value;
  839|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (839:17): [True: 0, False: 0]
  |  Branch (839:30): [True: 0, False: 0]
  ------------------
  840|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  841|      0|                return -1;
  842|      0|            } else {
  843|      0|                rc = ssh_options_set_algo(session,
  844|      0|                                          SSH_CRYPT_C_S,
  845|      0|                                          v,
  846|      0|                                          &wanted_methods[SSH_CRYPT_C_S]);
  847|      0|                if (rc < 0)
  ------------------
  |  Branch (847:21): [True: 0, False: 0]
  ------------------
  848|      0|                    return -1;
  849|      0|            }
  850|      0|            break;
  851|      0|        case SSH_OPTIONS_CIPHERS_S_C:
  ------------------
  |  Branch (851:9): [True: 0, False: 26]
  ------------------
  852|      0|            v = value;
  853|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (853:17): [True: 0, False: 0]
  |  Branch (853:30): [True: 0, False: 0]
  ------------------
  854|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  855|      0|                return -1;
  856|      0|            } else {
  857|      0|                rc = ssh_options_set_algo(session,
  858|      0|                                          SSH_CRYPT_S_C,
  859|      0|                                          v,
  860|      0|                                          &wanted_methods[SSH_CRYPT_S_C]);
  861|      0|                if (rc < 0)
  ------------------
  |  Branch (861:21): [True: 0, False: 0]
  ------------------
  862|      0|                    return -1;
  863|      0|            }
  864|      0|            break;
  865|      0|        case SSH_OPTIONS_KEY_EXCHANGE:
  ------------------
  |  Branch (865:9): [True: 0, False: 26]
  ------------------
  866|      0|            v = value;
  867|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (867:17): [True: 0, False: 0]
  |  Branch (867:30): [True: 0, False: 0]
  ------------------
  868|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  869|      0|                return -1;
  870|      0|            } else {
  871|      0|                rc = ssh_options_set_algo(session,
  872|      0|                                          SSH_KEX,
  873|      0|                                          v,
  874|      0|                                          &wanted_methods[SSH_KEX]);
  875|      0|                if (rc < 0)
  ------------------
  |  Branch (875:21): [True: 0, False: 0]
  ------------------
  876|      0|                    return -1;
  877|      0|            }
  878|      0|            break;
  879|      0|        case SSH_OPTIONS_HOSTKEYS:
  ------------------
  |  Branch (879:9): [True: 0, False: 26]
  ------------------
  880|      0|            v = value;
  881|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (881:17): [True: 0, False: 0]
  |  Branch (881:30): [True: 0, False: 0]
  ------------------
  882|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  883|      0|                return -1;
  884|      0|            } else {
  885|      0|                rc = ssh_options_set_algo(session,
  886|      0|                                          SSH_HOSTKEYS,
  887|      0|                                          v,
  888|      0|                                          &wanted_methods[SSH_HOSTKEYS]);
  889|      0|                if (rc < 0)
  ------------------
  |  Branch (889:21): [True: 0, False: 0]
  ------------------
  890|      0|                    return -1;
  891|      0|            }
  892|      0|            break;
  893|      0|        case SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES:
  ------------------
  |  Branch (893:9): [True: 0, False: 26]
  ------------------
  894|      0|            v = value;
  895|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (895:17): [True: 0, False: 0]
  |  Branch (895:30): [True: 0, False: 0]
  ------------------
  896|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  897|      0|                return -1;
  898|      0|            } else {
  899|      0|                rc = ssh_options_set_algo(session,
  900|      0|                                          SSH_HOSTKEYS,
  901|      0|                                          v,
  902|      0|                                          &session->opts.pubkey_accepted_types);
  903|      0|                if (rc < 0)
  ------------------
  |  Branch (903:21): [True: 0, False: 0]
  ------------------
  904|      0|                    return -1;
  905|      0|            }
  906|      0|            break;
  907|      0|        case SSH_OPTIONS_HMAC_C_S:
  ------------------
  |  Branch (907:9): [True: 0, False: 26]
  ------------------
  908|      0|            v = value;
  909|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (909:17): [True: 0, False: 0]
  |  Branch (909:30): [True: 0, False: 0]
  ------------------
  910|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  911|      0|                return -1;
  912|      0|            } else {
  913|      0|                rc = ssh_options_set_algo(session,
  914|      0|                                          SSH_MAC_C_S,
  915|      0|                                          v,
  916|      0|                                          &wanted_methods[SSH_MAC_C_S]);
  917|      0|                if (rc < 0)
  ------------------
  |  Branch (917:21): [True: 0, False: 0]
  ------------------
  918|      0|                    return -1;
  919|      0|            }
  920|      0|            break;
  921|      0|         case SSH_OPTIONS_HMAC_S_C:
  ------------------
  |  Branch (921:10): [True: 0, False: 26]
  ------------------
  922|      0|            v = value;
  923|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (923:17): [True: 0, False: 0]
  |  Branch (923:30): [True: 0, False: 0]
  ------------------
  924|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  925|      0|                return -1;
  926|      0|            } else {
  927|      0|                rc = ssh_options_set_algo(session,
  928|      0|                                          SSH_MAC_S_C,
  929|      0|                                          v,
  930|      0|                                          &wanted_methods[SSH_MAC_S_C]);
  931|      0|                if (rc < 0)
  ------------------
  |  Branch (931:21): [True: 0, False: 0]
  ------------------
  932|      0|                    return -1;
  933|      0|            }
  934|      0|            break;
  935|      0|        case SSH_OPTIONS_COMPRESSION_C_S:
  ------------------
  |  Branch (935:9): [True: 0, False: 26]
  ------------------
  936|      0|            v = value;
  937|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (937:17): [True: 0, False: 0]
  |  Branch (937:30): [True: 0, False: 0]
  ------------------
  938|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  939|      0|                return -1;
  940|      0|            } else {
  941|      0|                const char *tmp = v;
  942|      0|                if (strcasecmp(value, "yes") == 0){
  ------------------
  |  Branch (942:21): [True: 0, False: 0]
  ------------------
  943|      0|                    tmp = "zlib@openssh.com,zlib,none";
  944|      0|                } else if (strcasecmp(value, "no") == 0){
  ------------------
  |  Branch (944:28): [True: 0, False: 0]
  ------------------
  945|      0|                    tmp = "none,zlib@openssh.com,zlib";
  946|      0|                }
  947|      0|                rc = ssh_options_set_algo(session,
  948|      0|                                          SSH_COMP_C_S,
  949|      0|                                          tmp,
  950|      0|                                          &wanted_methods[SSH_COMP_C_S]);
  951|      0|                if (rc < 0)
  ------------------
  |  Branch (951:21): [True: 0, False: 0]
  ------------------
  952|      0|                    return -1;
  953|      0|            }
  954|      0|            break;
  955|      0|        case SSH_OPTIONS_COMPRESSION_S_C:
  ------------------
  |  Branch (955:9): [True: 0, False: 26]
  ------------------
  956|      0|            v = value;
  957|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (957:17): [True: 0, False: 0]
  |  Branch (957:30): [True: 0, False: 0]
  ------------------
  958|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  959|      0|                return -1;
  960|      0|            } else {
  961|      0|                const char *tmp = v;
  962|      0|                if (strcasecmp(value, "yes") == 0){
  ------------------
  |  Branch (962:21): [True: 0, False: 0]
  ------------------
  963|      0|                    tmp = "zlib@openssh.com,zlib,none";
  964|      0|                } else if (strcasecmp(value, "no") == 0){
  ------------------
  |  Branch (964:28): [True: 0, False: 0]
  ------------------
  965|      0|                    tmp = "none,zlib@openssh.com,zlib";
  966|      0|                }
  967|       |
  968|      0|                rc = ssh_options_set_algo(session,
  969|      0|                                          SSH_COMP_S_C,
  970|      0|                                          tmp,
  971|      0|                                          &wanted_methods[SSH_COMP_S_C]);
  972|      0|                if (rc < 0)
  ------------------
  |  Branch (972:21): [True: 0, False: 0]
  ------------------
  973|      0|                    return -1;
  974|      0|            }
  975|      0|            break;
  976|      0|        case SSH_OPTIONS_COMPRESSION:
  ------------------
  |  Branch (976:9): [True: 0, False: 26]
  ------------------
  977|      0|            v = value;
  978|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (978:17): [True: 0, False: 0]
  |  Branch (978:30): [True: 0, False: 0]
  ------------------
  979|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  980|      0|                return -1;
  981|      0|            }
  982|      0|            if(ssh_options_set(session,SSH_OPTIONS_COMPRESSION_C_S, v) < 0)
  ------------------
  |  Branch (982:16): [True: 0, False: 0]
  ------------------
  983|      0|                return -1;
  984|      0|            if(ssh_options_set(session,SSH_OPTIONS_COMPRESSION_S_C, v) < 0)
  ------------------
  |  Branch (984:16): [True: 0, False: 0]
  ------------------
  985|      0|                return -1;
  986|      0|            break;
  987|      0|        case SSH_OPTIONS_COMPRESSION_LEVEL:
  ------------------
  |  Branch (987:9): [True: 0, False: 26]
  ------------------
  988|      0|            if (value == NULL) {
  ------------------
  |  Branch (988:17): [True: 0, False: 0]
  ------------------
  989|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  990|      0|                return -1;
  991|      0|            } else {
  992|      0|                int *x = (int *)value;
  993|      0|                if (*x < 1 || *x > 9) {
  ------------------
  |  Branch (993:21): [True: 0, False: 0]
  |  Branch (993:31): [True: 0, False: 0]
  ------------------
  994|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  995|      0|                    return -1;
  996|      0|                }
  997|      0|                session->opts.compressionlevel = *x & 0xff;
  998|      0|            }
  999|      0|            break;
 1000|      0|        case SSH_OPTIONS_STRICTHOSTKEYCHECK:
  ------------------
  |  Branch (1000:9): [True: 0, False: 26]
  ------------------
 1001|      0|            if (value == NULL) {
  ------------------
  |  Branch (1001:17): [True: 0, False: 0]
  ------------------
 1002|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1003|      0|                return -1;
 1004|      0|            } else {
 1005|      0|                int *x = (int *) value;
 1006|       |
 1007|      0|                session->opts.StrictHostKeyChecking = (*x & 0xff) > 0 ? 1 : 0;
  ------------------
  |  Branch (1007:55): [True: 0, False: 0]
  ------------------
 1008|      0|            }
 1009|      0|            break;
 1010|      0|        case SSH_OPTIONS_PROXYCOMMAND:
  ------------------
  |  Branch (1010:9): [True: 0, False: 26]
  ------------------
 1011|      0|            v = value;
 1012|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1012:17): [True: 0, False: 0]
  |  Branch (1012:30): [True: 0, False: 0]
  ------------------
 1013|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1014|      0|                return -1;
 1015|      0|            } else {
 1016|      0|                SAFE_FREE(session->opts.ProxyCommand);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1017|       |                /* Setting the command to 'none' disables this option. */
 1018|      0|                rc = strcasecmp(v, "none");
 1019|      0|                if (rc != 0) {
  ------------------
  |  Branch (1019:21): [True: 0, False: 0]
  ------------------
 1020|      0|                    q = strdup(v);
 1021|      0|                    if (q == NULL) {
  ------------------
  |  Branch (1021:25): [True: 0, False: 0]
  ------------------
 1022|      0|                        return -1;
 1023|      0|                    }
 1024|      0|                    session->opts.ProxyCommand = q;
 1025|      0|                    session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_PROXYCOMMAND;
  ------------------
  |  |   99|      0|#define SSH_OPT_EXP_FLAG_PROXYCOMMAND 0x4
  ------------------
 1026|      0|                }
 1027|      0|            }
 1028|      0|            break;
 1029|      0|        case SSH_OPTIONS_GSSAPI_SERVER_IDENTITY:
  ------------------
  |  Branch (1029:9): [True: 0, False: 26]
  ------------------
 1030|      0|            v = value;
 1031|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1031:17): [True: 0, False: 0]
  |  Branch (1031:30): [True: 0, False: 0]
  ------------------
 1032|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1033|      0|                return -1;
 1034|      0|            } else {
 1035|      0|                SAFE_FREE(session->opts.gss_server_identity);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1036|      0|                session->opts.gss_server_identity = strdup(v);
 1037|      0|                if (session->opts.gss_server_identity == NULL) {
  ------------------
  |  Branch (1037:21): [True: 0, False: 0]
  ------------------
 1038|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1039|      0|                    return -1;
 1040|      0|                }
 1041|      0|            }
 1042|      0|            break;
 1043|      0|        case SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY:
  ------------------
  |  Branch (1043:9): [True: 0, False: 26]
  ------------------
 1044|      0|            v = value;
 1045|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1045:17): [True: 0, False: 0]
  |  Branch (1045:30): [True: 0, False: 0]
  ------------------
 1046|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1047|      0|                return -1;
 1048|      0|            } else {
 1049|      0|                SAFE_FREE(session->opts.gss_client_identity);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1050|      0|                session->opts.gss_client_identity = strdup(v);
 1051|      0|                if (session->opts.gss_client_identity == NULL) {
  ------------------
  |  Branch (1051:21): [True: 0, False: 0]
  ------------------
 1052|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1053|      0|                    return -1;
 1054|      0|                }
 1055|      0|            }
 1056|      0|            break;
 1057|      0|        case SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS:
  ------------------
  |  Branch (1057:9): [True: 0, False: 26]
  ------------------
 1058|      0|            if (value == NULL) {
  ------------------
  |  Branch (1058:17): [True: 0, False: 0]
  ------------------
 1059|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1060|      0|                return -1;
 1061|      0|            } else {
 1062|      0|                int x = *(int *)value;
 1063|       |
 1064|      0|                session->opts.gss_delegate_creds = (x & 0xff);
 1065|      0|            }
 1066|      0|            break;
 1067|      0|        case SSH_OPTIONS_PASSWORD_AUTH:
  ------------------
  |  Branch (1067:9): [True: 0, False: 26]
  ------------------
 1068|      0|        case SSH_OPTIONS_PUBKEY_AUTH:
  ------------------
  |  Branch (1068:9): [True: 0, False: 26]
  ------------------
 1069|      0|        case SSH_OPTIONS_KBDINT_AUTH:
  ------------------
  |  Branch (1069:9): [True: 0, False: 26]
  ------------------
 1070|      0|        case SSH_OPTIONS_GSSAPI_AUTH:
  ------------------
  |  Branch (1070:9): [True: 0, False: 26]
  ------------------
 1071|      0|            if (value == NULL) {
  ------------------
  |  Branch (1071:17): [True: 0, False: 0]
  ------------------
 1072|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1073|      0|                return -1;
 1074|      0|            } else {
 1075|      0|                int x = *(int *)value;
 1076|      0|                u = type == SSH_OPTIONS_PASSWORD_AUTH ?
  ------------------
  |  Branch (1076:21): [True: 0, False: 0]
  ------------------
 1077|      0|                    SSH_OPT_FLAG_PASSWORD_AUTH:
  ------------------
  |  |   91|      0|#define SSH_OPT_FLAG_PASSWORD_AUTH 0x1
  ------------------
 1078|      0|                    type == SSH_OPTIONS_PUBKEY_AUTH ?
  ------------------
  |  Branch (1078:21): [True: 0, False: 0]
  ------------------
 1079|      0|                        SSH_OPT_FLAG_PUBKEY_AUTH:
  ------------------
  |  |   92|      0|#define SSH_OPT_FLAG_PUBKEY_AUTH 0x2
  ------------------
 1080|      0|                        type == SSH_OPTIONS_KBDINT_AUTH ?
  ------------------
  |  Branch (1080:25): [True: 0, False: 0]
  ------------------
 1081|      0|                            SSH_OPT_FLAG_KBDINT_AUTH:
  ------------------
  |  |   93|      0|#define SSH_OPT_FLAG_KBDINT_AUTH 0x4
  ------------------
 1082|      0|                            SSH_OPT_FLAG_GSSAPI_AUTH;
  ------------------
  |  |   94|      0|#define SSH_OPT_FLAG_GSSAPI_AUTH 0x8
  ------------------
 1083|      0|                if (x != 0){
  ------------------
  |  Branch (1083:21): [True: 0, False: 0]
  ------------------
 1084|      0|                    session->opts.flags |= u;
 1085|      0|                } else {
 1086|      0|                    session->opts.flags &= ~u;
 1087|      0|                }
 1088|      0|            }
 1089|      0|            break;
 1090|      0|        case SSH_OPTIONS_NODELAY:
  ------------------
  |  Branch (1090:9): [True: 0, False: 26]
  ------------------
 1091|      0|            if (value == NULL) {
  ------------------
  |  Branch (1091:17): [True: 0, False: 0]
  ------------------
 1092|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1093|      0|                return -1;
 1094|      0|            } else {
 1095|      0|                int *x = (int *) value;
 1096|      0|                session->opts.nodelay = (*x & 0xff) > 0 ? 1 : 0;
  ------------------
  |  Branch (1096:41): [True: 0, False: 0]
  ------------------
 1097|      0|            }
 1098|      0|            break;
 1099|      0|        case SSH_OPTIONS_PROCESS_CONFIG:
  ------------------
  |  Branch (1099:9): [True: 0, False: 26]
  ------------------
 1100|      0|            if (value == NULL) {
  ------------------
  |  Branch (1100:17): [True: 0, False: 0]
  ------------------
 1101|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1102|      0|                return -1;
 1103|      0|            } else {
 1104|      0|                bool *x = (bool *)value;
 1105|      0|                session->opts.config_processed = !(*x);
 1106|      0|            }
 1107|      0|            break;
 1108|      0|        case SSH_OPTIONS_REKEY_DATA:
  ------------------
  |  Branch (1108:9): [True: 0, False: 26]
  ------------------
 1109|      0|            if (value == NULL) {
  ------------------
  |  Branch (1109:17): [True: 0, False: 0]
  ------------------
 1110|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1111|      0|                return -1;
 1112|      0|            } else {
 1113|      0|                uint64_t *x = (uint64_t *)value;
 1114|      0|                session->opts.rekey_data = *x;
 1115|      0|            }
 1116|      0|            break;
 1117|      0|        case SSH_OPTIONS_REKEY_TIME:
  ------------------
  |  Branch (1117:9): [True: 0, False: 26]
  ------------------
 1118|      0|            if (value == NULL) {
  ------------------
  |  Branch (1118:17): [True: 0, False: 0]
  ------------------
 1119|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1120|      0|                return -1;
 1121|      0|            } else {
 1122|      0|                uint32_t *x = (uint32_t *)value;
 1123|      0|                if ((*x * 1000) < *x) {
  ------------------
  |  Branch (1123:21): [True: 0, False: 0]
  ------------------
 1124|      0|                    ssh_set_error(session, SSH_REQUEST_DENIED,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1125|      0|                                  "The provided value (%" PRIu32 ") for rekey"
 1126|      0|                                  " time is too large", *x);
 1127|      0|                    return -1;
 1128|      0|                }
 1129|      0|                session->opts.rekey_time = (*x) * 1000;
 1130|      0|            }
 1131|      0|            break;
 1132|      0|        case SSH_OPTIONS_RSA_MIN_SIZE:
  ------------------
  |  Branch (1132:9): [True: 0, False: 26]
  ------------------
 1133|      0|            if (value == NULL) {
  ------------------
  |  Branch (1133:17): [True: 0, False: 0]
  ------------------
 1134|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1135|      0|                return -1;
 1136|      0|            } else {
 1137|      0|                int *x = (int *)value;
 1138|      0|                if (*x > 0 && *x < 768) {
  ------------------
  |  Branch (1138:21): [True: 0, False: 0]
  |  Branch (1138:31): [True: 0, False: 0]
  ------------------
 1139|      0|                    ssh_set_error(session, SSH_REQUEST_DENIED,
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1140|      0|                                  "The provided value (%u) for minimal RSA key "
 1141|      0|                                  "size is too small. Use at least 768 bits.", *x);
 1142|      0|                    return -1;
 1143|      0|                }
 1144|      0|                session->opts.rsa_min_size = *x;
 1145|      0|            }
 1146|      0|            break;
 1147|      0|        case SSH_OPTIONS_IDENTITY_AGENT:
  ------------------
  |  Branch (1147:9): [True: 0, False: 26]
  ------------------
 1148|      0|            v = value;
 1149|      0|            SAFE_FREE(session->opts.agent_socket);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1150|      0|            if (v == NULL) {
  ------------------
  |  Branch (1150:17): [True: 0, False: 0]
  ------------------
 1151|       |                /* The default value will be set by the ssh_options_apply() */
 1152|      0|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (1152:24): [True: 0, False: 0]
  ------------------
 1153|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1154|      0|                return -1;
 1155|      0|            } else {
 1156|      0|                session->opts.agent_socket = ssh_path_expand_tilde(v);
 1157|      0|                if (session->opts.agent_socket == NULL) {
  ------------------
  |  Branch (1157:21): [True: 0, False: 0]
  ------------------
 1158|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1159|      0|                    return -1;
 1160|      0|                }
 1161|      0|            }
 1162|      0|            break;
 1163|      0|        case SSH_OPTIONS_IDENTITIES_ONLY:
  ------------------
  |  Branch (1163:9): [True: 0, False: 26]
  ------------------
 1164|      0|            if (value == NULL) {
  ------------------
  |  Branch (1164:17): [True: 0, False: 0]
  ------------------
 1165|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  280|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1166|      0|                return -1;
 1167|      0|            } else {
 1168|      0|                bool *x = (bool *)value;
 1169|      0|                session->opts.identities_only = *x;
 1170|      0|            }
 1171|      0|            break;
 1172|      0|        default:
  ------------------
  |  Branch (1172:9): [True: 0, False: 26]
  ------------------
 1173|      0|            ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type);
  ------------------
  |  |  269|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1174|      0|            return -1;
 1175|      0|            break;
 1176|     26|    }
 1177|       |
 1178|     25|    return 0;
 1179|     26|}

ssh_key_free:
  194|     40|{
  195|     40|    if (key) {
  ------------------
  |  Branch (195:9): [True: 0, False: 40]
  ------------------
  196|      0|        ssh_key_clean(key);
  197|      0|        SAFE_FREE(key);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  198|      0|    }
  199|     40|}

ssh_poll_init:
   88|      2|{
   89|      2|    return;
   90|      2|}

ssh_new:
   60|     10|{
   61|     10|    ssh_session session;
   62|     10|    char *id = NULL;
   63|     10|    int rc;
   64|       |
   65|     10|    session = calloc(1, sizeof (struct ssh_session_struct));
   66|     10|    if (session == NULL) {
  ------------------
  |  Branch (66:9): [True: 0, False: 10]
  ------------------
   67|      0|        return NULL;
   68|      0|    }
   69|       |
   70|     10|    session->next_crypto = crypto_new();
   71|     10|    if (session->next_crypto == NULL) {
  ------------------
  |  Branch (71:9): [True: 0, False: 10]
  ------------------
   72|      0|        goto err;
   73|      0|    }
   74|       |
   75|     10|    session->socket = ssh_socket_new(session);
   76|     10|    if (session->socket == NULL) {
  ------------------
  |  Branch (76:9): [True: 0, False: 10]
  ------------------
   77|      0|        goto err;
   78|      0|    }
   79|       |
   80|     10|    session->out_buffer = ssh_buffer_new();
   81|     10|    if (session->out_buffer == NULL) {
  ------------------
  |  Branch (81:9): [True: 0, False: 10]
  ------------------
   82|      0|        goto err;
   83|      0|    }
   84|       |
   85|     10|    session->in_buffer = ssh_buffer_new();
   86|     10|    if (session->in_buffer == NULL) {
  ------------------
  |  Branch (86:9): [True: 0, False: 10]
  ------------------
   87|      0|        goto err;
   88|      0|    }
   89|       |
   90|     10|    session->out_queue = ssh_list_new();
   91|     10|    if (session->out_queue == NULL) {
  ------------------
  |  Branch (91:9): [True: 0, False: 10]
  ------------------
   92|      0|        goto err;
   93|      0|    }
   94|       |
   95|     10|    session->alive = 0;
   96|     10|    session->auth.supported_methods = 0;
   97|     10|    ssh_set_blocking(session, 1);
   98|     10|    session->maxchannel = FIRST_CHANNEL;
  ------------------
  |  |   43|     10|#define FIRST_CHANNEL 42 // why not ? it helps to find bugs.
  ------------------
   99|       |
  100|     10|    session->agent = ssh_agent_new(session);
  101|     10|    if (session->agent == NULL) {
  ------------------
  |  Branch (101:9): [True: 0, False: 10]
  ------------------
  102|      0|        goto err;
  103|      0|    }
  104|       |
  105|       |    /* OPTIONS */
  106|     10|    session->opts.StrictHostKeyChecking = 1;
  107|     10|    session->opts.port = 22;
  108|     10|    session->opts.fd = -1;
  109|     10|    session->opts.compressionlevel = 7;
  110|     10|    session->opts.nodelay = 0;
  111|     10|    session->opts.identities_only = false;
  112|       |
  113|     10|    session->opts.flags = SSH_OPT_FLAG_PASSWORD_AUTH |
  ------------------
  |  |   91|     10|#define SSH_OPT_FLAG_PASSWORD_AUTH 0x1
  ------------------
  114|     10|                          SSH_OPT_FLAG_PUBKEY_AUTH |
  ------------------
  |  |   92|     10|#define SSH_OPT_FLAG_PUBKEY_AUTH 0x2
  ------------------
  115|     10|                          SSH_OPT_FLAG_KBDINT_AUTH |
  ------------------
  |  |   93|     10|#define SSH_OPT_FLAG_KBDINT_AUTH 0x4
  ------------------
  116|     10|                          SSH_OPT_FLAG_GSSAPI_AUTH;
  ------------------
  |  |   94|     10|#define SSH_OPT_FLAG_GSSAPI_AUTH 0x8
  ------------------
  117|       |
  118|     10|    session->opts.exp_flags = 0;
  119|       |
  120|     10|    session->opts.identity = ssh_list_new();
  121|     10|    if (session->opts.identity == NULL) {
  ------------------
  |  Branch (121:9): [True: 0, False: 10]
  ------------------
  122|      0|        goto err;
  123|      0|    }
  124|     10|    session->opts.identity_non_exp = ssh_list_new();
  125|     10|    if (session->opts.identity_non_exp == NULL) {
  ------------------
  |  Branch (125:9): [True: 0, False: 10]
  ------------------
  126|      0|        goto err;
  127|      0|    }
  128|       |
  129|     10|    id = strdup("%d/id_ed25519");
  130|     10|    if (id == NULL) {
  ------------------
  |  Branch (130:9): [True: 0, False: 10]
  ------------------
  131|      0|        goto err;
  132|      0|    }
  133|       |
  134|     10|    rc = ssh_list_append(session->opts.identity_non_exp, id);
  135|     10|    if (rc == SSH_ERROR) {
  ------------------
  |  |  312|     10|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  |  Branch (135:9): [True: 0, False: 10]
  ------------------
  136|      0|        goto err;
  137|      0|    }
  138|       |
  139|     10|#ifdef HAVE_ECC
  140|     10|    id = strdup("%d/id_ecdsa");
  141|     10|    if (id == NULL) {
  ------------------
  |  Branch (141:9): [True: 0, False: 10]
  ------------------
  142|      0|        goto err;
  143|      0|    }
  144|     10|    rc = ssh_list_append(session->opts.identity_non_exp, id);
  145|     10|    if (rc == SSH_ERROR) {
  ------------------
  |  |  312|     10|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  |  Branch (145:9): [True: 0, False: 10]
  ------------------
  146|      0|        goto err;
  147|      0|    }
  148|     10|#endif
  149|       |
  150|     10|    id = strdup("%d/id_rsa");
  151|     10|    if (id == NULL) {
  ------------------
  |  Branch (151:9): [True: 0, False: 10]
  ------------------
  152|      0|        goto err;
  153|      0|    }
  154|     10|    rc = ssh_list_append(session->opts.identity_non_exp, id);
  155|     10|    if (rc == SSH_ERROR) {
  ------------------
  |  |  312|     10|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  |  Branch (155:9): [True: 0, False: 10]
  ------------------
  156|      0|        goto err;
  157|      0|    }
  158|       |
  159|       |    /* Explicitly initialize states */
  160|     10|    session->session_state = SSH_SESSION_STATE_NONE;
  161|     10|    session->pending_call_state = SSH_PENDING_CALL_NONE;
  162|     10|    session->packet_state = PACKET_STATE_INIT;
  163|     10|    session->dh_handshake_state = DH_STATE_INIT;
  164|     10|    session->global_req_state = SSH_CHANNEL_REQ_STATE_NONE;
  165|       |
  166|     10|    session->auth.state = SSH_AUTH_STATE_NONE;
  167|     10|    session->auth.service_state = SSH_AUTH_SERVICE_NONE;
  168|       |
  169|     10|    return session;
  170|       |
  171|      0|err:
  172|      0|    free(id);
  173|      0|    ssh_free(session);
  174|      0|    return NULL;
  175|     10|}
ssh_free:
  186|     10|{
  187|     10|  int i;
  188|     10|  struct ssh_iterator *it = NULL;
  189|     10|  struct ssh_buffer_struct *b = NULL;
  190|       |
  191|     10|  if (session == NULL) {
  ------------------
  |  Branch (191:7): [True: 0, False: 10]
  ------------------
  192|      0|    return;
  193|      0|  }
  194|       |
  195|       |  /*
  196|       |   * Delete all channels
  197|       |   *
  198|       |   * This needs the first thing we clean up cause if there is still an open
  199|       |   * channel we call ssh_channel_close() first. So we need a working socket
  200|       |   * and poll context for it.
  201|       |   */
  202|     10|  for (it = ssh_list_get_iterator(session->channels);
  203|     10|       it != NULL;
  ------------------
  |  Branch (203:8): [True: 0, False: 10]
  ------------------
  204|     10|       it = ssh_list_get_iterator(session->channels)) {
  205|      0|      ssh_channel_do_free(ssh_iterator_value(ssh_channel,it));
  ------------------
  |  |   78|      0|  ((type)((iterator)->data))
  ------------------
  206|      0|      ssh_list_remove(session->channels, it);
  207|      0|  }
  208|     10|  ssh_list_free(session->channels);
  209|     10|  session->channels = NULL;
  210|       |
  211|     10|#ifdef WITH_PCAP
  212|     10|  if (session->pcap_ctx) {
  ------------------
  |  Branch (212:7): [True: 0, False: 10]
  ------------------
  213|      0|      ssh_pcap_context_free(session->pcap_ctx);
  214|      0|      session->pcap_ctx = NULL;
  215|      0|  }
  216|     10|#endif
  217|       |
  218|     10|  ssh_socket_free(session->socket);
  219|     10|  session->socket = NULL;
  220|       |
  221|     10|  if (session->default_poll_ctx) {
  ------------------
  |  Branch (221:7): [True: 0, False: 10]
  ------------------
  222|      0|      ssh_poll_ctx_free(session->default_poll_ctx);
  223|      0|  }
  224|       |
  225|     10|  SSH_BUFFER_FREE(session->in_buffer);
  ------------------
  |  |  834|     10|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 10, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  226|     10|  SSH_BUFFER_FREE(session->out_buffer);
  ------------------
  |  |  834|     10|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 10, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  227|     10|  session->in_buffer = session->out_buffer = NULL;
  228|       |
  229|     10|  if (session->in_hashbuf != NULL) {
  ------------------
  |  Branch (229:7): [True: 0, False: 10]
  ------------------
  230|      0|      SSH_BUFFER_FREE(session->in_hashbuf);
  ------------------
  |  |  834|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 0, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|      0|  }
  232|     10|  if (session->out_hashbuf != NULL) {
  ------------------
  |  Branch (232:7): [True: 0, False: 10]
  ------------------
  233|      0|      SSH_BUFFER_FREE(session->out_hashbuf);
  ------------------
  |  |  834|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 0, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  234|      0|  }
  235|       |
  236|     10|  crypto_free(session->current_crypto);
  237|     10|  crypto_free(session->next_crypto);
  238|       |
  239|     10|#ifndef _WIN32
  240|     10|  ssh_agent_free(session->agent);
  241|     10|#endif /* _WIN32 */
  242|       |
  243|     10|  ssh_key_free(session->srv.rsa_key);
  244|     10|  session->srv.rsa_key = NULL;
  245|     10|  ssh_key_free(session->srv.ecdsa_key);
  246|     10|  session->srv.ecdsa_key = NULL;
  247|     10|  ssh_key_free(session->srv.ed25519_key);
  248|     10|  session->srv.ed25519_key = NULL;
  249|       |
  250|     10|  if (session->ssh_message_list) {
  ------------------
  |  Branch (250:7): [True: 0, False: 10]
  ------------------
  251|      0|      ssh_message msg;
  252|       |
  253|      0|      for (msg = ssh_list_pop_head(ssh_message, session->ssh_message_list);
  ------------------
  |  |   86|      0|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  254|      0|           msg != NULL;
  ------------------
  |  Branch (254:12): [True: 0, False: 0]
  ------------------
  255|      0|           msg = ssh_list_pop_head(ssh_message, session->ssh_message_list)) {
  ------------------
  |  |   86|      0|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  256|      0|          ssh_message_free(msg);
  257|      0|      }
  258|      0|      ssh_list_free(session->ssh_message_list);
  259|      0|  }
  260|       |
  261|     10|  if (session->kbdint != NULL) {
  ------------------
  |  Branch (261:7): [True: 0, False: 10]
  ------------------
  262|      0|    ssh_kbdint_free(session->kbdint);
  263|      0|  }
  264|       |
  265|     10|  if (session->packet_callbacks) {
  ------------------
  |  Branch (265:7): [True: 0, False: 10]
  ------------------
  266|      0|    ssh_list_free(session->packet_callbacks);
  267|      0|  }
  268|       |
  269|       |  /* options */
  270|     10|  if (session->opts.identity) {
  ------------------
  |  Branch (270:7): [True: 10, False: 0]
  ------------------
  271|     10|      char *id;
  272|       |
  273|     10|      for (id = ssh_list_pop_head(char *, session->opts.identity);
  ------------------
  |  |   86|     10|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  274|     10|           id != NULL;
  ------------------
  |  Branch (274:12): [True: 0, False: 10]
  ------------------
  275|     10|           id = ssh_list_pop_head(char *, session->opts.identity)) {
  ------------------
  |  |   86|      0|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  276|      0|          SAFE_FREE(id);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  277|      0|      }
  278|     10|      ssh_list_free(session->opts.identity);
  279|     10|  }
  280|       |
  281|     10|  if (session->opts.identity_non_exp) {
  ------------------
  |  Branch (281:7): [True: 10, False: 0]
  ------------------
  282|     10|      char *id;
  283|       |
  284|     10|      for (id = ssh_list_pop_head(char *, session->opts.identity_non_exp);
  ------------------
  |  |   86|     10|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  285|     45|           id != NULL;
  ------------------
  |  Branch (285:12): [True: 35, False: 10]
  ------------------
  286|     35|           id = ssh_list_pop_head(char *, session->opts.identity_non_exp)) {
  ------------------
  |  |   86|     35|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  287|     35|          SAFE_FREE(id);
  ------------------
  |  |  324|     35|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 35, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  288|     35|      }
  289|     10|      ssh_list_free(session->opts.identity_non_exp);
  290|     10|  }
  291|       |
  292|     10|    while ((b = ssh_list_pop_head(struct ssh_buffer_struct *,
  ------------------
  |  |   86|     10|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  |  Branch (292:12): [True: 0, False: 10]
  ------------------
  293|     10|                                  session->out_queue)) != NULL) {
  294|      0|        SSH_BUFFER_FREE(b);
  ------------------
  |  |  834|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 0, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  295|      0|    }
  296|     10|    ssh_list_free(session->out_queue);
  297|       |
  298|     10|#ifndef _WIN32
  299|     10|  ssh_agent_state_free (session->agent_state);
  300|     10|#endif
  301|     10|  session->agent_state = NULL;
  302|       |
  303|     10|  SAFE_FREE(session->auth.auto_state);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  304|     10|  SAFE_FREE(session->serverbanner);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  305|     10|  SAFE_FREE(session->clientbanner);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  306|     10|  SAFE_FREE(session->banner);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  307|     10|  SAFE_FREE(session->disconnect_message);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  308|     10|  SAFE_FREE(session->peer_discon_msg);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  309|       |
  310|     10|  SAFE_FREE(session->opts.agent_socket);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  311|     10|  SAFE_FREE(session->opts.bindaddr);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  312|     10|  SAFE_FREE(session->opts.custombanner);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  313|     10|  SAFE_FREE(session->opts.moduli_file);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  314|     10|  SAFE_FREE(session->opts.username);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  315|     10|  SAFE_FREE(session->opts.host);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 10, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  316|     10|  SAFE_FREE(session->opts.sshdir);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 10, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  317|     10|  SAFE_FREE(session->opts.knownhosts);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|     10|  SAFE_FREE(session->opts.global_knownhosts);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  319|     10|  SAFE_FREE(session->opts.ProxyCommand);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|     10|  SAFE_FREE(session->opts.gss_server_identity);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  321|     10|  SAFE_FREE(session->opts.gss_client_identity);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  322|     10|  SAFE_FREE(session->opts.pubkey_accepted_types);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  323|       |
  324|    110|  for (i = 0; i < SSH_KEX_METHODS; i++) {
  ------------------
  |  |   27|    110|#define SSH_KEX_METHODS 10
  ------------------
  |  Branch (324:15): [True: 100, False: 10]
  ------------------
  325|    100|      if (session->opts.wanted_methods[i]) {
  ------------------
  |  Branch (325:11): [True: 0, False: 100]
  ------------------
  326|      0|          SAFE_FREE(session->opts.wanted_methods[i]);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  327|      0|      }
  328|    100|  }
  329|       |
  330|       |  /* burn connection, it could contain sensitive data */
  331|     10|  explicit_bzero(session, sizeof(struct ssh_session_struct));
  332|     10|  SAFE_FREE(session);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 10, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  333|     10|}
ssh_set_blocking:
  492|     10|{
  493|     10|    if (session == NULL) {
  ------------------
  |  Branch (493:9): [True: 0, False: 10]
  ------------------
  494|      0|        return;
  495|      0|    }
  496|     10|    session->flags &= ~SSH_SESSION_FLAG_BLOCKING;
  ------------------
  |  |   74|     10|#define SSH_SESSION_FLAG_BLOCKING 1
  ------------------
  497|     10|    session->flags |= blocking ? SSH_SESSION_FLAG_BLOCKING : 0;
  ------------------
  |  |   74|     10|#define SSH_SESSION_FLAG_BLOCKING 1
  ------------------
  |  Branch (497:23): [True: 10, False: 0]
  ------------------
  498|     10|}

ssh_socket_init:
  118|      2|{
  119|      2|    if (sockets_initialized == 0) {
  ------------------
  |  Branch (119:9): [True: 2, False: 0]
  ------------------
  120|       |#ifdef _WIN32
  121|       |        struct WSAData wsaData;
  122|       |
  123|       |        /* Initiates use of the Winsock DLL by a process. */
  124|       |        if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) {
  125|       |            return -1;
  126|       |        }
  127|       |#endif
  128|      2|        ssh_poll_init();
  129|       |
  130|      2|        sockets_initialized = 1;
  131|      2|    }
  132|       |
  133|      2|    return 0;
  134|      2|}
ssh_socket_new:
  156|     20|{
  157|     20|    ssh_socket s;
  158|       |
  159|     20|    s = calloc(1, sizeof(struct ssh_socket_struct));
  160|     20|    if (s == NULL) {
  ------------------
  |  Branch (160:9): [True: 0, False: 20]
  ------------------
  161|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  162|      0|        return NULL;
  163|      0|    }
  164|     20|    s->fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  122|     20|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  165|     20|    s->last_errno = -1;
  166|     20|    s->fd_is_socket = 1;
  167|     20|    s->session = session;
  168|     20|    s->in_buffer = ssh_buffer_new();
  169|     20|    if (s->in_buffer == NULL) {
  ------------------
  |  Branch (169:9): [True: 0, False: 20]
  ------------------
  170|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  171|      0|        SAFE_FREE(s);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  172|      0|        return NULL;
  173|      0|    }
  174|     20|    s->out_buffer=ssh_buffer_new();
  175|     20|    if (s->out_buffer == NULL) {
  ------------------
  |  Branch (175:9): [True: 0, False: 20]
  ------------------
  176|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  276|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  177|      0|        SSH_BUFFER_FREE(s->in_buffer);
  ------------------
  |  |  834|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 0, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  178|      0|        SAFE_FREE(s);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|      0|        return NULL;
  180|      0|    }
  181|     20|    s->read_wontblock = 0;
  182|     20|    s->write_wontblock = 0;
  183|     20|    s->data_except = 0;
  184|     20|    s->poll_handle = NULL;
  185|     20|    s->state=SSH_SOCKET_NONE;
  186|     20|    return s;
  187|     20|}
ssh_socket_free:
  418|     20|{
  419|     20|    if (s == NULL) {
  ------------------
  |  Branch (419:9): [True: 0, False: 20]
  ------------------
  420|      0|        return;
  421|      0|    }
  422|     20|    ssh_socket_close(s);
  423|     20|    SSH_BUFFER_FREE(s->in_buffer);
  ------------------
  |  |  834|     20|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 20, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  424|     20|    SSH_BUFFER_FREE(s->out_buffer);
  ------------------
  |  |  834|     20|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (834:14): [True: 20, False: 0]
  |  |  |  Branch (834:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  425|     20|    SAFE_FREE(s);
  ------------------
  |  |  324|     20|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 20, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  426|     20|}
ssh_socket_close:
  469|     30|{
  470|     30|    if (ssh_socket_is_open(s)) {
  ------------------
  |  Branch (470:9): [True: 0, False: 30]
  ------------------
  471|       |#ifdef _WIN32
  472|       |        CLOSE_SOCKET(s->fd);
  473|       |        s->last_errno = WSAGetLastError();
  474|       |#else
  475|      0|        CLOSE_SOCKET(s->fd);
  ------------------
  |  |  390|      0|#define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
  |  |  ------------------
  |  |  |  |  122|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  |  |  ------------------
  |  |               #define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
  |  |  ------------------
  |  |  |  |  169|      0|#define _XCLOSESOCKET close
  |  |  ------------------
  |  |               #define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
  |  |  ------------------
  |  |  |  |  122|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  |  |  ------------------
  |  |  |  Branch (390:34): [True: 0, False: 0]
  |  |  |  Branch (390:116): [Folded - Ignored]
  |  |  ------------------
  ------------------
  476|      0|        s->last_errno = errno;
  477|      0|#endif
  478|      0|    }
  479|       |
  480|     30|    if (s->poll_handle != NULL) {
  ------------------
  |  Branch (480:9): [True: 0, False: 30]
  ------------------
  481|      0|        ssh_poll_free(s->poll_handle);
  482|      0|        s->poll_handle = NULL;
  483|      0|    }
  484|       |
  485|     30|    s->state = SSH_SOCKET_CLOSED;
  486|       |
  487|     30|#ifndef _WIN32
  488|       |    /* If the proxy command still runs try to kill it */
  489|     30|    if (s->proxy_pid != 0) {
  ------------------
  |  Branch (489:9): [True: 0, False: 30]
  ------------------
  490|      0|        int status;
  491|      0|        pid_t pid = s->proxy_pid;
  492|       |
  493|      0|        s->proxy_pid = 0;
  494|      0|        kill(pid, SIGTERM);
  495|      0|        while (waitpid(pid, &status, 0) == -1) {
  ------------------
  |  Branch (495:16): [True: 0, False: 0]
  ------------------
  496|      0|            if (errno != EINTR) {
  ------------------
  |  Branch (496:17): [True: 0, False: 0]
  ------------------
  497|      0|                char err_msg[SSH_ERRNO_MSG_MAX] = {0};
  498|      0|                SSH_LOG(SSH_LOG_TRACE, "waitpid failed: %s",
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  499|      0|                        ssh_strerror(errno, err_msg, SSH_ERRNO_MSG_MAX));
  500|      0|                return;
  501|      0|            }
  502|      0|        }
  503|      0|        if (!WIFEXITED(status)) {
  ------------------
  |  Branch (503:13): [True: 0, False: 0]
  ------------------
  504|      0|            SSH_LOG(SSH_LOG_TRACE, "Proxy command exited abnormally");
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  505|      0|            return;
  506|      0|        }
  507|      0|        SSH_LOG(SSH_LOG_TRACE, "Proxy command returned %d", WEXITSTATUS(status));
  ------------------
  |  |  251|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  508|      0|    }
  509|     30|#endif
  510|     30|}
ssh_socket_is_open:
  555|     30|{
  556|     30|    return s->fd != SSH_INVALID_SOCKET;
  ------------------
  |  |  122|     30|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  557|     30|}

ssh_threads_init:
   43|      2|{
   44|      2|    static int threads_initialized = 0;
   45|      2|    int rc;
   46|       |
   47|      2|    if (threads_initialized) {
  ------------------
  |  Branch (47:9): [True: 0, False: 2]
  ------------------
   48|      0|        return SSH_OK;
  ------------------
  |  |  311|      0|#define SSH_OK 0     /* No error */
  ------------------
   49|      0|    }
   50|       |
   51|       |    /* first initialize the user_callbacks with our default handlers if not
   52|       |     * already the case
   53|       |     */
   54|      2|    if (user_callbacks == NULL){
  ------------------
  |  Branch (54:9): [True: 2, False: 0]
  ------------------
   55|      2|        user_callbacks = ssh_threads_get_default();
   56|      2|    }
   57|       |
   58|       |    /* Then initialize the crypto libraries threading callbacks */
   59|      2|    rc = crypto_thread_init(user_callbacks);
   60|      2|    if (rc == SSH_OK) {
  ------------------
  |  |  311|      2|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (60:9): [True: 2, False: 0]
  ------------------
   61|      2|        threads_initialized = 1;
   62|      2|    }
   63|      2|    return rc;
   64|      2|}

crypto_thread_init:
   28|      2|{
   29|      2|    (void) cb;
   30|      2|    return SSH_OK;
  ------------------
  |  |  311|      2|#define SSH_OK 0     /* No error */
  ------------------
   31|      2|}

ssh_mutex_lock:
  102|     20|{
  103|     20|    int rc;
  104|       |
  105|     20|    if (mutex == NULL) {
  ------------------
  |  Branch (105:9): [True: 0, False: 20]
  ------------------
  106|      0|        exit(EINVAL);
  107|      0|    }
  108|       |
  109|     20|    rc = pthread_mutex_lock(mutex);
  110|       |
  111|     20|    if (rc) {
  ------------------
  |  Branch (111:9): [True: 0, False: 20]
  ------------------
  112|      0|        exit(rc);
  113|      0|    }
  114|     20|}
ssh_mutex_unlock:
  117|     20|{
  118|     20|    int rc;
  119|       |
  120|     20|    if (mutex == NULL) {
  ------------------
  |  Branch (120:9): [True: 0, False: 20]
  ------------------
  121|      0|        exit(EINVAL);
  122|      0|    }
  123|       |
  124|     20|    rc = pthread_mutex_unlock(mutex);
  125|       |
  126|     20|    if (rc) {
  ------------------
  |  Branch (126:9): [True: 0, False: 20]
  ------------------
  127|      0|        exit(rc);
  128|      0|    }
  129|     20|}
ssh_threads_get_default:
  132|      2|{
  133|      2|    return &ssh_threads_pthread;
  134|      2|}

ssh_cipher_clear:
  125|     20|void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
  126|       |#ifdef HAVE_LIBGCRYPT
  127|       |    unsigned int i;
  128|       |#endif
  129|       |
  130|     20|    if (cipher == NULL) {
  ------------------
  |  Branch (130:9): [True: 20, False: 0]
  ------------------
  131|     20|        return;
  132|     20|    }
  133|       |
  134|       |#ifdef HAVE_LIBGCRYPT
  135|       |    if (cipher->key) {
  136|       |        for (i = 0; i < (cipher->keylen / sizeof(gcry_cipher_hd_t)); i++) {
  137|       |            gcry_cipher_close(cipher->key[i]);
  138|       |        }
  139|       |        SAFE_FREE(cipher->key);
  140|       |    }
  141|       |#endif
  142|       |
  143|      0|    if (cipher->cleanup != NULL) {
  ------------------
  |  Branch (143:9): [True: 0, False: 0]
  ------------------
  144|      0|        cipher->cleanup(cipher);
  145|      0|    }
  146|      0|}
crypto_new:
  153|     10|struct ssh_crypto_struct *crypto_new(void) {
  154|     10|   struct ssh_crypto_struct *crypto;
  155|       |
  156|     10|  crypto = malloc(sizeof(struct ssh_crypto_struct));
  157|     10|  if (crypto == NULL) {
  ------------------
  |  Branch (157:7): [True: 0, False: 10]
  ------------------
  158|      0|    return NULL;
  159|      0|  }
  160|     10|  ZERO_STRUCTP(crypto);
  ------------------
  |  |  330|     10|#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
  |  |  ------------------
  |  |  |  Branch (330:34): [True: 10, False: 0]
  |  |  |  Branch (330:93): [Folded - Ignored]
  |  |  ------------------
  ------------------
  161|     10|  return crypto;
  162|     10|}
crypto_free:
  165|     20|{
  166|     20|    size_t i;
  167|       |
  168|     20|    if (crypto == NULL) {
  ------------------
  |  Branch (168:9): [True: 10, False: 10]
  ------------------
  169|     10|        return;
  170|     10|    }
  171|       |
  172|     10|    ssh_key_free(crypto->server_pubkey);
  173|       |
  174|     10|    ssh_dh_cleanup(crypto);
  175|     10|    bignum_safe_free(crypto->shared_secret);
  ------------------
  |  |   69|     10|#define bignum_safe_free(num) do { \
  |  |   70|     10|    if ((num) != NULL) { \
  |  |  ------------------
  |  |  |  Branch (70:9): [True: 0, False: 10]
  |  |  ------------------
  |  |   71|      0|        BN_clear_free((num)); \
  |  |   72|      0|        (num)=NULL; \
  |  |   73|      0|    } \
  |  |   74|     10|    } while(0)
  |  |  ------------------
  |  |  |  Branch (74:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  176|     10|#ifdef HAVE_ECDH
  177|     10|    SAFE_FREE(crypto->ecdh_client_pubkey);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  178|     10|    SAFE_FREE(crypto->ecdh_server_pubkey);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|     10|    if (crypto->ecdh_privkey != NULL) {
  ------------------
  |  Branch (179:9): [True: 0, False: 10]
  ------------------
  180|      0|#ifdef HAVE_OPENSSL_ECC
  181|      0|#if OPENSSL_VERSION_NUMBER < 0x30000000L
  182|      0|        EC_KEY_free(crypto->ecdh_privkey);
  183|       |#else
  184|       |        EVP_PKEY_free(crypto->ecdh_privkey);
  185|       |#endif /* OPENSSL_VERSION_NUMBER */
  186|       |#elif defined HAVE_GCRYPT_ECC
  187|       |        gcry_sexp_release(crypto->ecdh_privkey);
  188|       |#endif
  189|      0|        crypto->ecdh_privkey = NULL;
  190|      0|    }
  191|     10|#endif
  192|     10|    SAFE_FREE(crypto->dh_server_signature);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  193|     10|    if (crypto->session_id != NULL) {
  ------------------
  |  Branch (193:9): [True: 0, False: 10]
  ------------------
  194|      0|        explicit_bzero(crypto->session_id, crypto->session_id_len);
  195|      0|        SAFE_FREE(crypto->session_id);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  196|      0|    }
  197|     10|    if (crypto->secret_hash != NULL) {
  ------------------
  |  Branch (197:9): [True: 0, False: 10]
  ------------------
  198|      0|        explicit_bzero(crypto->secret_hash, crypto->digest_len);
  199|      0|        SAFE_FREE(crypto->secret_hash);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  200|      0|    }
  201|     10|#ifdef WITH_ZLIB
  202|     10|    if (crypto->compress_out_ctx &&
  ------------------
  |  Branch (202:9): [True: 0, False: 10]
  ------------------
  203|     10|        (deflateEnd(crypto->compress_out_ctx) != 0)) {
  ------------------
  |  Branch (203:9): [True: 0, False: 0]
  ------------------
  204|      0|        inflateEnd(crypto->compress_out_ctx);
  205|      0|    }
  206|     10|    SAFE_FREE(crypto->compress_out_ctx);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  207|       |
  208|     10|    if (crypto->compress_in_ctx &&
  ------------------
  |  Branch (208:9): [True: 0, False: 10]
  ------------------
  209|     10|        (deflateEnd(crypto->compress_in_ctx) != 0)) {
  ------------------
  |  Branch (209:9): [True: 0, False: 0]
  ------------------
  210|      0|        inflateEnd(crypto->compress_in_ctx);
  211|      0|    }
  212|     10|    SAFE_FREE(crypto->compress_in_ctx);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  213|     10|#endif /* WITH_ZLIB */
  214|     10|    SAFE_FREE(crypto->encryptIV);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  215|     10|    SAFE_FREE(crypto->decryptIV);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  216|     10|    SAFE_FREE(crypto->encryptMAC);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  217|     10|    SAFE_FREE(crypto->decryptMAC);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 10]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  218|     10|    if (crypto->encryptkey != NULL) {
  ------------------
  |  Branch (218:9): [True: 0, False: 10]
  ------------------
  219|      0|        explicit_bzero(crypto->encryptkey, crypto->out_cipher->keysize / 8);
  220|      0|        SAFE_FREE(crypto->encryptkey);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  221|      0|    }
  222|     10|    if (crypto->decryptkey != NULL) {
  ------------------
  |  Branch (222:9): [True: 0, False: 10]
  ------------------
  223|      0|        explicit_bzero(crypto->decryptkey, crypto->in_cipher->keysize / 8);
  224|      0|        SAFE_FREE(crypto->decryptkey);
  ------------------
  |  |  324|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  225|      0|    }
  226|       |
  227|     10|    cipher_free(crypto->in_cipher);
  228|     10|    cipher_free(crypto->out_cipher);
  229|       |
  230|    110|    for (i = 0; i < SSH_KEX_METHODS; i++) {
  ------------------
  |  |   27|    110|#define SSH_KEX_METHODS 10
  ------------------
  |  Branch (230:17): [True: 100, False: 10]
  ------------------
  231|    100|        SAFE_FREE(crypto->client_kex.methods[i]);
  ------------------
  |  |  324|    100|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 100]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  232|    100|        SAFE_FREE(crypto->server_kex.methods[i]);
  ------------------
  |  |  324|    100|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 100]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  233|    100|        SAFE_FREE(crypto->kex_methods[i]);
  ------------------
  |  |  324|    100|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 100]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  234|    100|    }
  235|       |
  236|     10|    explicit_bzero(crypto, sizeof(struct ssh_crypto_struct));
  237|       |
  238|     10|    SAFE_FREE(crypto);
  ------------------
  |  |  324|     10|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 10, False: 0]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  239|     10|}
wrapper.c:cipher_free:
  148|     20|static void cipher_free(struct ssh_cipher_struct *cipher) {
  149|     20|  ssh_cipher_clear(cipher);
  150|     20|  SAFE_FREE(cipher);
  ------------------
  |  |  324|     20|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (324:31): [True: 0, False: 20]
  |  |  |  Branch (324:71): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|     20|}

LLVMFuzzerTestOneInput:
   27|     10|{
   28|     10|    ssh_session session = NULL;
   29|     10|    char *input = NULL;
   30|       |
   31|     10|    input = (char *)malloc(size+1);
   32|     10|    if (!input) {
  ------------------
  |  Branch (32:9): [True: 0, False: 10]
  ------------------
   33|      0|        return 1;
   34|      0|    }
   35|     10|    strncpy(input, (const char *)data, size);
   36|     10|    input[size] = '\0';
   37|       |
   38|     10|    ssh_init();
   39|       |
   40|     10|    session = ssh_new();
   41|     10|    assert(session != NULL);
   42|       |
   43|       |    /* Make sure we have default options set */
   44|     10|    ssh_options_set(session, SSH_OPTIONS_SSH_DIR, NULL);
   45|     10|    ssh_options_set(session, SSH_OPTIONS_HOST, "example.com");
   46|       |
   47|     10|    ssh_config_parse_string(session, input);
   48|       |
   49|     10|    ssh_free(session);
   50|     10|    ssh_finalize();
   51|       |
   52|     10|    free(input);
   53|       |
   54|     10|    return 0;
   55|     10|}

