ssh_agent_new:
  136|    478|{
  137|    478|    ssh_agent agent = NULL;
  138|       |
  139|    478|    agent = calloc(1, sizeof(struct ssh_agent_struct));
  140|    478|    if (agent == NULL) {
  ------------------
  |  Branch (140:9): [True: 0, False: 478]
  ------------------
  141|      0|        return NULL;
  142|      0|    }
  143|       |
  144|    478|    agent->count = 0;
  145|    478|    agent->sock = ssh_socket_new(session);
  146|    478|    if (agent->sock == NULL) {
  ------------------
  |  Branch (146:9): [True: 0, False: 478]
  ------------------
  147|      0|        SAFE_FREE(agent);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  148|      0|        return NULL;
  149|      0|    }
  150|    478|    agent->channel = NULL;
  151|    478|    return agent;
  152|    478|}
ssh_agent_close:
  221|    478|{
  222|    478|    if (agent == NULL) {
  ------------------
  |  Branch (222:9): [True: 0, False: 478]
  ------------------
  223|      0|        return;
  224|      0|    }
  225|       |
  226|    478|    ssh_socket_close(agent->sock);
  227|    478|}
ssh_agent_free:
  230|    478|{
  231|    478|    if (agent) {
  ------------------
  |  Branch (231:9): [True: 478, False: 0]
  ------------------
  232|    478|        if (agent->ident) {
  ------------------
  |  Branch (232:13): [True: 0, False: 478]
  ------------------
  233|      0|            SSH_BUFFER_FREE(agent->ident);
  ------------------
  |  |  934|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 0, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  234|      0|        }
  235|    478|        if (agent->sock) {
  ------------------
  |  Branch (235:13): [True: 478, False: 0]
  ------------------
  236|    478|            ssh_agent_close(agent);
  237|    478|            ssh_socket_free(agent->sock);
  238|    478|        }
  239|       |        SAFE_FREE(agent);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 478, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  240|    478|    }
  241|    478|}

ssh_agent_state_free:
 1056|    478|{
 1057|    478|    struct ssh_agent_state_struct *state = data;
 1058|       |
 1059|    478|    if (state) {
  ------------------
  |  Branch (1059:9): [True: 0, False: 478]
  ------------------
 1060|       |        SSH_STRING_FREE_CHAR(state->comment);
  ------------------
  |  |  902|      0|    do { if ((x) != NULL) { ssh_string_free_char(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (902:14): [True: 0, False: 0]
  |  |  |  Branch (902:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1061|      0|        ssh_key_free(state->pubkey);
 1062|      0|        free(state);
 1063|      0|    }
 1064|    478|}

ssh_buffer_new:
  126|  2.86k|{
  127|  2.86k|    struct ssh_buffer_struct *buf = NULL;
  128|  2.86k|    int rc;
  129|       |
  130|  2.86k|    buf = calloc(1, sizeof(struct ssh_buffer_struct));
  131|  2.86k|    if (buf == NULL) {
  ------------------
  |  Branch (131:9): [True: 0, False: 2.86k]
  ------------------
  132|      0|        return NULL;
  133|      0|    }
  134|       |
  135|       |    /*
  136|       |     * Always preallocate 64 bytes.
  137|       |     *
  138|       |     * -1 for realloc_buffer magic.
  139|       |     */
  140|  2.86k|    rc = ssh_buffer_allocate_size(buf, 64 - 1);
  141|  2.86k|    if (rc != 0) {
  ------------------
  |  Branch (141:9): [True: 0, False: 2.86k]
  ------------------
  142|      0|        SAFE_FREE(buf);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  143|      0|        return NULL;
  144|      0|    }
  145|  2.86k|    buffer_verify(buf);
  146|       |
  147|  2.86k|    return buf;
  148|  2.86k|}
ssh_buffer_free:
  156|  2.86k|{
  157|  2.86k|    if (buffer == NULL) {
  ------------------
  |  Branch (157:9): [True: 0, False: 2.86k]
  ------------------
  158|      0|        return;
  159|      0|    }
  160|  2.86k|    buffer_verify(buffer);
  161|       |
  162|  2.86k|    if (buffer->secure && buffer->allocated > 0) {
  ------------------
  |  Branch (162:9): [True: 0, False: 2.86k]
  |  Branch (162:27): [True: 0, False: 0]
  ------------------
  163|       |        /* burn the data */
  164|      0|        ssh_burn(buffer->data, buffer->allocated);
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  165|      0|        SAFE_FREE(buffer->data);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  166|       |
  167|      0|        ssh_burn(buffer, sizeof(struct ssh_buffer_struct));
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  168|  2.86k|    } else {
  169|  2.86k|        SAFE_FREE(buffer->data);
  ------------------
  |  |  373|  2.86k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 2.86k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 2.86k]
  |  |  ------------------
  ------------------
  170|  2.86k|    }
  171|       |    SAFE_FREE(buffer);
  ------------------
  |  |  373|  2.86k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 2.86k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 2.86k]
  |  |  ------------------
  ------------------
  172|  2.86k|}
ssh_buffer_allocate_size:
  348|  2.86k|{
  349|  2.86k|    buffer_verify(buffer);
  350|       |
  351|  2.86k|    if (buffer->allocated < len) {
  ------------------
  |  Branch (351:9): [True: 2.86k, False: 0]
  ------------------
  352|  2.86k|        if (buffer->pos > 0) {
  ------------------
  |  Branch (352:13): [True: 0, False: 2.86k]
  ------------------
  353|      0|            buffer_shift(buffer);
  354|      0|        }
  355|  2.86k|        if (realloc_buffer(buffer, len) < 0) {
  ------------------
  |  Branch (355:13): [True: 0, False: 2.86k]
  ------------------
  356|      0|            return -1;
  357|      0|        }
  358|  2.86k|    }
  359|       |
  360|  2.86k|    buffer_verify(buffer);
  361|       |
  362|  2.86k|    return 0;
  363|  2.86k|}
buffer.c:realloc_buffer:
  188|  2.86k|{
  189|  2.86k|    uint32_t smallest = 1;
  190|  2.86k|    uint8_t *new = NULL;
  191|       |
  192|  2.86k|    buffer_verify(buffer);
  193|       |
  194|       |    /* Find the smallest power of two which is greater or equal to needed */
  195|  20.0k|    while(smallest <= needed) {
  ------------------
  |  Branch (195:11): [True: 17.2k, False: 2.86k]
  ------------------
  196|  17.2k|        if (smallest == 0) {
  ------------------
  |  Branch (196:13): [True: 0, False: 17.2k]
  ------------------
  197|      0|            return -1;
  198|      0|        }
  199|  17.2k|        smallest <<= 1;
  200|  17.2k|    }
  201|  2.86k|    needed = smallest;
  202|       |
  203|  2.86k|    if (needed > BUFFER_SIZE_MAX) {
  ------------------
  |  |   57|  2.86k|#define BUFFER_SIZE_MAX 0x10000000
  ------------------
  |  Branch (203:9): [True: 0, False: 2.86k]
  ------------------
  204|      0|        return -1;
  205|      0|    }
  206|       |
  207|  2.86k|    if (buffer->secure) {
  ------------------
  |  Branch (207:9): [True: 0, False: 2.86k]
  ------------------
  208|      0|        new = malloc(needed);
  209|      0|        if (new == NULL) {
  ------------------
  |  Branch (209:13): [True: 0, False: 0]
  ------------------
  210|      0|            return -1;
  211|      0|        }
  212|      0|        memcpy(new, buffer->data, buffer->used);
  213|      0|        ssh_burn(buffer->data, buffer->used);
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  214|      0|        SAFE_FREE(buffer->data);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  215|  2.86k|    } else {
  216|  2.86k|        new = realloc(buffer->data, needed);
  217|  2.86k|        if (new == NULL) {
  ------------------
  |  Branch (217:13): [True: 0, False: 2.86k]
  ------------------
  218|      0|            return -1;
  219|      0|        }
  220|  2.86k|    }
  221|  2.86k|    buffer->data = new;
  222|  2.86k|    buffer->allocated = needed;
  223|       |
  224|  2.86k|    buffer_verify(buffer);
  225|  2.86k|    return 0;
  226|  2.86k|}

_ssh_remove_legacy_log_cb:
   49|    478|{
   50|    478|    if (ssh_get_log_callback() == ssh_legacy_log_callback) {
  ------------------
  |  Branch (50:9): [True: 0, False: 478]
  ------------------
   51|      0|        _ssh_reset_log_cb();
   52|       |        ssh_set_log_userdata(NULL);
   53|      0|    }
   54|    478|}

ssh_config_get_opcode:
  219|   312k|{
  220|   312k|    int i;
  221|       |
  222|  29.3M|    for (i = 0; ssh_config_keyword_table[i].name != NULL; i++) {
  ------------------
  |  Branch (222:17): [True: 29.0M, False: 307k]
  ------------------
  223|  29.0M|        if (strcasecmp(keyword, ssh_config_keyword_table[i].name) == 0) {
  ------------------
  |  Branch (223:13): [True: 5.09k, False: 29.0M]
  ------------------
  224|  5.09k|            return ssh_config_keyword_table[i].opcode;
  225|  5.09k|        }
  226|  29.0M|    }
  227|       |
  228|   307k|    return SOC_UNKNOWN;
  229|   312k|}
ssh_config_parse_proxy_jump:
  635|     69|{
  636|     69|    char *c = NULL, *cp = NULL, *endp = NULL;
  637|     69|    char *username = NULL;
  638|     69|    char *hostname = NULL;
  639|     69|    char *port = NULL;
  640|     69|    char *next = NULL;
  641|     69|    int cmp, rv = SSH_ERROR;
  ------------------
  |  |  317|     69|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  642|     69|    struct ssh_jump_info_struct *jump_host = NULL;
  643|     69|    bool parse_entry = do_parsing;
  644|     69|    bool libssh_proxy_jump = ssh_libssh_proxy_jumps();
  645|       |
  646|     69|    if (do_parsing) {
  ------------------
  |  Branch (646:9): [True: 39, False: 30]
  ------------------
  647|     39|        SAFE_FREE(session->opts.proxy_jumps_str);
  ------------------
  |  |  373|     39|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 39]
  |  |  |  Branch (373:71): [Folded, False: 39]
  |  |  ------------------
  ------------------
  648|     39|        ssh_proxyjumps_free(session->opts.proxy_jumps);
  649|     39|    }
  650|       |    /* Special value none disables the proxy */
  651|     69|    cmp = strcasecmp(s, "none");
  652|     69|    if (cmp == 0) {
  ------------------
  |  Branch (652:9): [True: 2, False: 67]
  ------------------
  653|      2|        if (!libssh_proxy_jump && do_parsing) {
  ------------------
  |  Branch (653:13): [True: 0, False: 2]
  |  Branch (653:35): [True: 0, False: 0]
  ------------------
  654|      0|            ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, s);
  655|      0|        }
  656|      2|        return SSH_OK;
  ------------------
  |  |  316|      2|#define SSH_OK 0     /* No error */
  ------------------
  657|      2|    }
  658|       |
  659|       |    /* This is comma-separated list of [user@]host[:port] entries */
  660|     67|    c = strdup(s);
  661|     67|    if (c == NULL) {
  ------------------
  |  Branch (661:9): [True: 0, False: 67]
  ------------------
  662|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  663|      0|        return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  664|      0|    }
  665|       |
  666|     67|    if (do_parsing) {
  ------------------
  |  Branch (666:9): [True: 39, False: 28]
  ------------------
  667|       |        /* Store the whole string in session */
  668|     39|        SAFE_FREE(session->opts.proxy_jumps_str);
  ------------------
  |  |  373|     39|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 39]
  |  |  |  Branch (373:71): [Folded, False: 39]
  |  |  ------------------
  ------------------
  669|     39|        session->opts.proxy_jumps_str = strdup(s);
  670|     39|        if (session->opts.proxy_jumps_str == NULL) {
  ------------------
  |  Branch (670:13): [True: 0, False: 39]
  ------------------
  671|      0|            free(c);
  672|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  673|      0|            return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  674|      0|        }
  675|     39|    }
  676|       |
  677|     67|    cp = c;
  678|  2.18k|    do {
  679|  2.18k|        endp = strchr(cp, ',');
  680|  2.18k|        if (endp != NULL) {
  ------------------
  |  Branch (680:13): [True: 2.11k, False: 64]
  ------------------
  681|       |            /* Split out the token */
  682|  2.11k|            *endp = '\0';
  683|  2.11k|        }
  684|  2.18k|        if (parse_entry && libssh_proxy_jump) {
  ------------------
  |  Branch (684:13): [True: 2.13k, False: 50]
  |  Branch (684:28): [True: 2.13k, False: 0]
  ------------------
  685|  2.13k|            jump_host = calloc(1, sizeof(struct ssh_jump_info_struct));
  686|  2.13k|            if (jump_host == NULL) {
  ------------------
  |  Branch (686:17): [True: 0, False: 2.13k]
  ------------------
  687|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  688|      0|                rv = SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  689|      0|                goto out;
  690|      0|            }
  691|       |
  692|  2.13k|            rv = ssh_config_parse_uri(cp,
  693|  2.13k|                                      &jump_host->username,
  694|  2.13k|                                      &jump_host->hostname,
  695|  2.13k|                                      &port,
  696|  2.13k|                                      false,
  697|  2.13k|                                      false);
  698|  2.13k|            if (rv != SSH_OK) {
  ------------------
  |  |  316|  2.13k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (698:17): [True: 15, False: 2.11k]
  ------------------
  699|     15|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|     15|    _ssh_set_error_invalid(error, __func__)
  ------------------
  700|     15|                SAFE_FREE(jump_host);
  ------------------
  |  |  373|     15|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 15, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 15]
  |  |  ------------------
  ------------------
  701|     15|                goto out;
  702|     15|            }
  703|  2.11k|            if (port == NULL) {
  ------------------
  |  Branch (703:17): [True: 1.94k, False: 175]
  ------------------
  704|  1.94k|                jump_host->port = 22;
  705|  1.94k|            } else {
  706|    175|                jump_host->port = strtol(port, NULL, 10);
  707|    175|                SAFE_FREE(port);
  ------------------
  |  |  373|    175|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 175, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 175]
  |  |  ------------------
  ------------------
  708|    175|            }
  709|       |
  710|       |            /* Prepend because we will recursively proxy jump */
  711|  2.11k|            rv = ssh_list_prepend(session->opts.proxy_jumps, jump_host);
  712|  2.11k|            if (rv != SSH_OK) {
  ------------------
  |  |  316|  2.11k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (712:17): [True: 0, False: 2.11k]
  ------------------
  713|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  714|      0|                SAFE_FREE(jump_host);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  715|      0|                goto out;
  716|      0|            }
  717|  2.11k|        } else if (parse_entry) {
  ------------------
  |  Branch (717:20): [True: 0, False: 50]
  ------------------
  718|       |            /* We actually care only about the first item */
  719|      0|            rv = ssh_config_parse_uri(cp,
  720|      0|                                      &username,
  721|      0|                                      &hostname,
  722|      0|                                      &port,
  723|      0|                                      false,
  724|      0|                                      false);
  725|      0|            if (rv != SSH_OK) {
  ------------------
  |  |  316|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (725:17): [True: 0, False: 0]
  ------------------
  726|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  727|      0|                goto out;
  728|      0|            }
  729|       |            /* The rest of the list needs to be passed on */
  730|      0|            if (endp != NULL) {
  ------------------
  |  Branch (730:17): [True: 0, False: 0]
  ------------------
  731|      0|                next = strdup(endp + 1);
  732|      0|                if (next == NULL) {
  ------------------
  |  Branch (732:21): [True: 0, False: 0]
  ------------------
  733|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  734|      0|                    rv = SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  735|      0|                    goto out;
  736|      0|                }
  737|      0|            }
  738|     50|        } else {
  739|       |            /* The rest is just sanity-checked to avoid failures later */
  740|     50|            rv = ssh_config_parse_uri(cp, NULL, NULL, NULL, false, false);
  741|     50|            if (rv != SSH_OK) {
  ------------------
  |  |  316|     50|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (741:17): [True: 1, False: 49]
  ------------------
  742|      1|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      1|    _ssh_set_error_invalid(error, __func__)
  ------------------
  743|      1|                goto out;
  744|      1|            }
  745|     50|        }
  746|  2.16k|        if (!libssh_proxy_jump) {
  ------------------
  |  Branch (746:13): [True: 0, False: 2.16k]
  ------------------
  747|      0|            parse_entry = 0;
  748|      0|        }
  749|  2.16k|        if (endp != NULL) {
  ------------------
  |  Branch (749:13): [True: 2.11k, False: 51]
  ------------------
  750|  2.11k|            cp = endp + 1;
  751|  2.11k|        } else {
  752|     51|            cp = NULL; /* end */
  753|     51|        }
  754|  2.16k|    } while (cp != NULL);
  ------------------
  |  Branch (754:14): [True: 2.11k, False: 51]
  ------------------
  755|       |
  756|     51|    if (!libssh_proxy_jump && hostname != NULL && do_parsing) {
  ------------------
  |  Branch (756:9): [True: 0, False: 51]
  |  Branch (756:31): [True: 0, False: 0]
  |  Branch (756:51): [True: 0, False: 0]
  ------------------
  757|      0|        char com[512] = {0};
  758|       |
  759|      0|        rv = snprintf(com, sizeof(com), "ssh%s%s%s%s%s%s -W '[%%h]:%%p' %s",
  760|      0|                      username ? " -l " : "",
  ------------------
  |  Branch (760:23): [True: 0, False: 0]
  ------------------
  761|      0|                      username ? username : "",
  ------------------
  |  Branch (761:23): [True: 0, False: 0]
  ------------------
  762|      0|                      port ? " -p " : "",
  ------------------
  |  Branch (762:23): [True: 0, False: 0]
  ------------------
  763|      0|                      port ? port : "",
  ------------------
  |  Branch (763:23): [True: 0, False: 0]
  ------------------
  764|      0|                      next ? " -J " : "",
  ------------------
  |  Branch (764:23): [True: 0, False: 0]
  ------------------
  765|      0|                      next ? next : "",
  ------------------
  |  Branch (765:23): [True: 0, False: 0]
  ------------------
  766|      0|                      hostname);
  767|      0|        if (rv < 0 || rv >= (int)sizeof(com)) {
  ------------------
  |  Branch (767:13): [True: 0, False: 0]
  |  Branch (767:23): [True: 0, False: 0]
  ------------------
  768|      0|            SSH_LOG(SSH_LOG_TRACE, "Too long ProxyJump configuration line");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  769|      0|            rv = SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  770|      0|            goto out;
  771|      0|        }
  772|      0|        rv = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, com);
  773|      0|        if (rv != SSH_OK) {
  ------------------
  |  |  316|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (773:13): [True: 0, False: 0]
  ------------------
  774|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  775|      0|            goto out;
  776|      0|        }
  777|      0|    }
  778|       |
  779|     51|    rv = SSH_OK;
  ------------------
  |  |  316|     51|#define SSH_OK 0     /* No error */
  ------------------
  780|       |
  781|     67|out:
  782|     67|    if (rv != SSH_OK) {
  ------------------
  |  |  316|     67|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (782:9): [True: 16, False: 51]
  ------------------
  783|     16|        ssh_proxyjumps_free(session->opts.proxy_jumps);
  784|     16|    }
  785|     67|    SAFE_FREE(username);
  ------------------
  |  |  373|     67|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 67]
  |  |  |  Branch (373:71): [Folded, False: 67]
  |  |  ------------------
  ------------------
  786|     67|    SAFE_FREE(hostname);
  ------------------
  |  |  373|     67|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 67]
  |  |  |  Branch (373:71): [Folded, False: 67]
  |  |  ------------------
  ------------------
  787|     67|    SAFE_FREE(port);
  ------------------
  |  |  373|     67|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 67]
  |  |  |  Branch (373:71): [Folded, False: 67]
  |  |  ------------------
  ------------------
  788|     67|    SAFE_FREE(next);
  ------------------
  |  |  373|     67|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 67]
  |  |  |  Branch (373:71): [Folded, False: 67]
  |  |  ------------------
  ------------------
  789|       |    SAFE_FREE(c);
  ------------------
  |  |  373|     67|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 67, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 67]
  |  |  ------------------
  ------------------
  790|     67|    return rv;
  791|     51|}
ssh_config_parse_line:
 2106|   410k|{
 2107|   410k|    return ssh_config_parse_line_internal(session,
 2108|   410k|                                          line,
 2109|   410k|                                          count,
 2110|   410k|                                          parsing,
 2111|   410k|                                          depth,
 2112|   410k|                                          global,
 2113|   410k|                                          false,
 2114|       |                                          false);
 2115|   410k|}
ssh_config_parse_string:
 2206|    478|{
 2207|    478|    char line[MAX_LINE_SIZE] = {0};
 2208|    478|    const char *c = input, *line_start = input;
 2209|    478|    unsigned int line_num = 0;
 2210|    478|    size_t line_len;
 2211|    478|    int parsing, rv;
 2212|       |
 2213|    478|    SSH_LOG(SSH_LOG_DEBUG, "Reading configuration data from string:");
  ------------------
  |  |  281|    478|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2214|    478|    SSH_LOG(SSH_LOG_DEBUG, "START\n%s\nEND", input);
  ------------------
  |  |  281|    478|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2215|       |
 2216|    478|    parsing = 1;
 2217|  20.9k|    while (1) {
  ------------------
  |  Branch (2217:12): [True: 20.9k, Folded]
  ------------------
 2218|  20.9k|        line_num++;
 2219|  20.9k|        line_start = c;
 2220|  20.9k|        c = strchr(line_start, '\n');
 2221|  20.9k|        if (c == NULL) {
  ------------------
  |  Branch (2221:13): [True: 468, False: 20.4k]
  ------------------
 2222|       |            /* if there is no newline at the end of the string */
 2223|    468|            c = strchr(line_start, '\0');
 2224|    468|        }
 2225|  20.9k|        if (c == NULL) {
  ------------------
  |  Branch (2225:13): [True: 0, False: 20.9k]
  ------------------
 2226|       |            /* should not happen, would mean a string without trailing '\0' */
 2227|      0|            SSH_LOG(SSH_LOG_TRACE, "No trailing '\\0' in config string");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2228|      0|            return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2229|      0|        }
 2230|  20.9k|        line_len = c - line_start;
 2231|  20.9k|        if (line_len > MAX_LINE_SIZE - 1) {
  ------------------
  |  |   57|  20.9k|#define MAX_LINE_SIZE 1024
  ------------------
  |  Branch (2231:13): [True: 10, False: 20.8k]
  ------------------
 2232|     10|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|     10|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2233|     10|                    "Line %u too long: %zu characters",
 2234|     10|                    line_num,
 2235|     10|                    line_len);
 2236|     10|            return SSH_ERROR;
  ------------------
  |  |  317|     10|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2237|     10|        }
 2238|  20.8k|        memcpy(line, line_start, line_len);
 2239|  20.8k|        line[line_len] = '\0';
 2240|  20.8k|        SSH_LOG(SSH_LOG_DEBUG, "Line %u: %s", line_num, line);
  ------------------
  |  |  281|  20.8k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2241|  20.8k|        rv = ssh_config_parse_line(session, line, line_num, &parsing, 0, false);
 2242|  20.8k|        if (rv < 0) {
  ------------------
  |  Branch (2242:13): [True: 55, False: 20.8k]
  ------------------
 2243|     55|            return SSH_ERROR;
  ------------------
  |  |  317|     55|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2244|     55|        }
 2245|  20.8k|        if (*c == '\0') {
  ------------------
  |  Branch (2245:13): [True: 413, False: 20.4k]
  ------------------
 2246|    413|            break;
 2247|    413|        }
 2248|  20.4k|        c++;
 2249|  20.4k|    }
 2250|       |
 2251|    413|    return SSH_OK;
  ------------------
  |  |  316|    413|#define SSH_OK 0     /* No error */
  ------------------
 2252|    478|}
config.c:ssh_config_parse_line_internal:
 1144|   410k|{
 1145|   410k|  enum ssh_config_opcode_e opcode;
 1146|   410k|  const char *p = NULL, *p2 = NULL;
 1147|   410k|  char *s = NULL, *x = NULL;
 1148|   410k|  char *keyword = NULL;
 1149|   410k|  char *lowerhost = NULL;
 1150|   410k|  size_t len;
 1151|   410k|  int i, rv, cmp;
 1152|   410k|  uint8_t *seen = session->opts.options_seen;
 1153|   410k|  long l;
 1154|   410k|  int64_t ll;
 1155|       |
 1156|       |  /* Ignore empty lines */
 1157|   410k|  if (line == NULL || *line == '\0') {
  ------------------
  |  Branch (1157:7): [True: 0, False: 410k]
  |  Branch (1157:23): [True: 83.7k, False: 326k]
  ------------------
 1158|  83.7k|      if (is_cli) {
  ------------------
  |  Branch (1158:11): [True: 0, False: 83.7k]
  ------------------
 1159|      0|          return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1160|      0|      }
 1161|  83.7k|    return 0;
 1162|  83.7k|  }
 1163|       |
 1164|   326k|  x = s = strdup(line);
 1165|   326k|  if (s == NULL) {
  ------------------
  |  Branch (1165:7): [True: 0, False: 326k]
  ------------------
 1166|      0|    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1167|      0|    return -1;
 1168|      0|  }
 1169|       |
 1170|       |  /* Remove trailing spaces */
 1171|   521k|  for (len = strlen(s) - 1; len > 0; len--) {
  ------------------
  |  Branch (1171:29): [True: 492k, False: 29.0k]
  ------------------
 1172|   492k|    if (! isspace(s[len])) {
  ------------------
  |  Branch (1172:9): [True: 297k, False: 195k]
  ------------------
 1173|   297k|      break;
 1174|   297k|    }
 1175|   195k|    s[len] = '\0';
 1176|   195k|  }
 1177|       |
 1178|   326k|  keyword = ssh_config_get_token(&s);
 1179|   326k|  if (keyword == NULL || *keyword == '#' ||
  ------------------
  |  Branch (1179:7): [True: 0, False: 326k]
  |  Branch (1179:26): [True: 4.39k, False: 321k]
  ------------------
 1180|   321k|      *keyword == '\0' || *keyword == '\n') {
  ------------------
  |  Branch (1180:7): [True: 8.99k, False: 312k]
  |  Branch (1180:27): [True: 0, False: 312k]
  ------------------
 1181|  13.3k|    SAFE_FREE(x);
  ------------------
  |  |  373|  13.3k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 13.3k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 13.3k]
  |  |  ------------------
  ------------------
 1182|  13.3k|    return 0;
 1183|  13.3k|  }
 1184|       |
 1185|   312k|  opcode = ssh_config_get_opcode(keyword);
 1186|   312k|  if (is_cli && !ssh_config_is_cli_supported(opcode)) {
  ------------------
  |  Branch (1186:7): [True: 0, False: 312k]
  |  Branch (1186:17): [True: 0, False: 0]
  ------------------
 1187|      0|      ssh_set_error(
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1188|      0|          session,
 1189|      0|          SSH_FATAL,
 1190|      0|          "Option '%s' is not supported in command-line configuration",
 1191|      0|          keyword);
 1192|      0|      SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1193|      0|      return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1194|      0|  }
 1195|       |
 1196|   312k|  if (*parsing == 1 &&
  ------------------
  |  Branch (1196:7): [True: 194k, False: 117k]
  ------------------
 1197|   194k|      opcode != SOC_HOST &&
  ------------------
  |  Branch (1197:7): [True: 194k, False: 41]
  ------------------
 1198|   194k|      opcode != SOC_MATCH &&
  ------------------
  |  Branch (1198:7): [True: 194k, False: 132]
  ------------------
 1199|   194k|      opcode != SOC_INCLUDE &&
  ------------------
  |  Branch (1199:7): [True: 194k, False: 596]
  ------------------
 1200|   194k|      opcode != SOC_IDENTITY &&
  ------------------
  |  Branch (1200:7): [True: 193k, False: 570]
  ------------------
 1201|   193k|      opcode != SOC_CERTIFICATE &&
  ------------------
  |  Branch (1201:7): [True: 191k, False: 1.60k]
  ------------------
 1202|   191k|      opcode > SOC_UNSUPPORTED &&
  ------------------
  |  Branch (1202:7): [True: 590, False: 191k]
  ------------------
 1203|    590|      opcode < SOC_MAX) { /* Ignore all unknown types here */
  ------------------
  |  Branch (1203:7): [True: 590, False: 0]
  ------------------
 1204|       |      /* Skip all the options that were already applied */
 1205|    590|      if (seen[opcode] != 0) {
  ------------------
  |  Branch (1205:11): [True: 182, False: 408]
  ------------------
 1206|    182|          SAFE_FREE(x);
  ------------------
  |  |  373|    182|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 182, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 182]
  |  |  ------------------
  ------------------
 1207|    182|          return 0;
 1208|    182|      }
 1209|    408|      seen[opcode] = 1;
 1210|    408|  }
 1211|       |
 1212|   312k|  switch (opcode) {
 1213|    617|    case SOC_INCLUDE: /* recursive include of other files */
  ------------------
  |  Branch (1213:5): [True: 617, False: 312k]
  ------------------
 1214|       |
 1215|    617|      p = ssh_config_get_str_tok(&s, NULL);
 1216|    617|      if (p && *parsing) {
  ------------------
  |  Branch (1216:11): [True: 616, False: 1]
  |  Branch (1216:16): [True: 595, False: 21]
  ------------------
 1217|    595|        char *path = ssh_config_make_absolute(session, p, global);
 1218|    595|        if (path == NULL) {
  ------------------
  |  Branch (1218:13): [True: 9, False: 586]
  ------------------
 1219|      9|          SSH_LOG(SSH_LOG_WARN, "line %d: Failed to allocate memory "
  ------------------
  |  |  281|      9|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1220|      9|                  "for the include path expansion", count);
 1221|      9|          SAFE_FREE(x);
  ------------------
  |  |  373|      9|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 9, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 9]
  |  |  ------------------
  ------------------
 1222|      9|          return -1;
 1223|      9|        }
 1224|    586|#if defined(HAVE_GLOB) && defined(HAVE_GLOB_GL_FLAGS_MEMBER)
 1225|    586|        local_parse_glob(session, path, parsing, depth + 1, global);
 1226|       |#else
 1227|       |        local_parse_file(session, path, parsing, depth + 1, global);
 1228|       |#endif /* HAVE_GLOB */
 1229|    586|        free(path);
 1230|    586|      }
 1231|    608|      break;
 1232|       |
 1233|    713|    case SOC_MATCH: {
  ------------------
  |  Branch (1233:5): [True: 713, False: 311k]
  ------------------
 1234|    713|        bool negate;
 1235|    713|        int match_error = 0;
 1236|    713|        int result = 1;
 1237|    713|        size_t args = 0;
 1238|    713|        enum ssh_config_match_e opt;
 1239|    713|        struct ssh_config_token_info keyword_info;
 1240|    713|        struct ssh_config_token_info arg_info;
 1241|    713|        char *localuser = NULL;
 1242|    713|        const char *version = NULL;
 1243|       |
 1244|    713|        *parsing = 0;
 1245|  1.55k|        do {
 1246|  1.55k|            p = p2 = ssh_config_get_token_info(&s, &keyword_info);
 1247|  1.55k|            if (!keyword_info.found || p[0] == '\0') {
  ------------------
  |  Branch (1247:17): [True: 590, False: 961]
  |  Branch (1247:40): [True: 0, False: 961]
  ------------------
 1248|    590|                break;
 1249|    590|            }
 1250|    961|            args++;
 1251|    961|            SSH_LOG(SSH_LOG_DEBUG, "line %d: Processing Match keyword '%s'",
  ------------------
  |  |  281|    961|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1252|    961|                    count, p);
 1253|       |
 1254|       |            /* If the option is prefixed with ! the result should be negated */
 1255|    961|            negate = false;
 1256|    961|            if (p[0] == '!') {
  ------------------
  |  Branch (1256:17): [True: 190, False: 771]
  ------------------
 1257|    190|                negate = true;
 1258|    190|                p++;
 1259|    190|            }
 1260|       |
 1261|    961|            opt = ssh_config_get_match_opcode(p);
 1262|    961|            switch (opt) {
 1263|    108|            case MATCH_ALL:
  ------------------
  |  Branch (1263:13): [True: 108, False: 853]
  ------------------
 1264|    108|                p = ssh_config_get_str_tok(&s, NULL);
 1265|    108|                if (args <= 2 && (p == NULL || p[0] == '\0')) {
  ------------------
  |  Branch (1265:21): [True: 108, False: 0]
  |  Branch (1265:35): [True: 107, False: 1]
  |  Branch (1265:48): [True: 0, False: 1]
  ------------------
 1266|       |                    /* The first or second, but last argument. The "all" keyword
 1267|       |                     * can be prefixed with either "final" or "canonical"
 1268|       |                     * keywords which do not have any effect here. */
 1269|    107|                    if (negate == true) {
  ------------------
  |  Branch (1269:25): [True: 81, False: 26]
  ------------------
 1270|     81|                        result = 0;
 1271|     81|                    }
 1272|    107|                    break;
 1273|    107|                }
 1274|       |
 1275|      1|                ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  311|      1|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1276|      1|                              "line %d: ERROR - Match all cannot be combined with "
 1277|      1|                              "other Match attributes", count);
 1278|      1|                match_error = -1;
 1279|      1|                goto out_match;
 1280|       |
 1281|      0|            case MATCH_FINAL:
  ------------------
  |  Branch (1281:13): [True: 0, False: 961]
  ------------------
 1282|      3|            case MATCH_CANONICAL:
  ------------------
  |  Branch (1282:13): [True: 3, False: 958]
  ------------------
 1283|      3|                SSH_LOG(SSH_LOG_DEBUG,
  ------------------
  |  |  281|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1284|      3|                        "line %d: Unsupported Match keyword '%s', skipping",
 1285|      3|                        count,
 1286|      3|                        p);
 1287|       |                /* Not set any result here -- the result is dependent on the
 1288|       |                 * following matches after this keyword */
 1289|      3|                break;
 1290|       |
 1291|      1|            case MATCH_EXEC:
  ------------------
  |  Branch (1291:13): [True: 1, False: 960]
  ------------------
 1292|       |                /* Skip one argument (including in quotes) */
 1293|      1|                p = ssh_config_get_token(&s);
 1294|      1|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1294:21): [True: 0, False: 1]
  |  Branch (1294:34): [True: 0, False: 1]
  ------------------
 1295|      0|                    SSH_LOG(SSH_LOG_TRACE, "line %d: Match keyword "
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1296|      0|                            "'%s' requires argument", count, p2);
 1297|      0|                    match_error = -1;
 1298|      0|                    goto out_match;
 1299|      0|                }
 1300|      1|                if (result != 1) {
  ------------------
  |  Branch (1300:21): [True: 1, False: 0]
  ------------------
 1301|      1|                    SSH_LOG(SSH_LOG_DEBUG, "line %d: Skipped match exec "
  ------------------
  |  |  281|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1302|      1|                            "'%s' as previous conditions already failed.",
 1303|      1|                            count, p2);
 1304|      1|                    continue;
 1305|      1|                }
 1306|      0|                result &= ssh_match_exec(session, p, negate);
 1307|      0|                args++;
 1308|      0|                break;
 1309|       |
 1310|      0|            case MATCH_LOCALUSER:
  ------------------
  |  Branch (1310:13): [True: 0, False: 961]
  ------------------
 1311|       |                /* Here we match only one argument */
 1312|      0|                p = ssh_config_get_str_tok(&s, NULL);
 1313|      0|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1313:21): [True: 0, False: 0]
  |  Branch (1313:34): [True: 0, False: 0]
  ------------------
 1314|      0|                    ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1315|      0|                                  SSH_FATAL,
 1316|      0|                                  "line %d: ERROR - Match localuser keyword "
 1317|      0|                                  "requires argument",
 1318|      0|                                  count);
 1319|      0|                    match_error = -1;
 1320|      0|                    goto out_match;
 1321|      0|                }
 1322|      0|                localuser = ssh_get_local_username();
 1323|      0|                if (localuser == NULL) {
  ------------------
  |  Branch (1323:21): [True: 0, False: 0]
  ------------------
 1324|      0|                    SSH_LOG(SSH_LOG_TRACE, "line %d: Can not get local username "
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1325|      0|                            "for conditional matching.", count);
 1326|      0|                    match_error = -1;
 1327|      0|                    goto out_match;
 1328|      0|                }
 1329|      0|                result &= ssh_config_match(localuser, p, negate);
 1330|      0|                SAFE_FREE(localuser);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1331|      0|                args++;
 1332|      0|                break;
 1333|       |
 1334|      0|            case MATCH_ORIGINALHOST:
  ------------------
  |  Branch (1334:13): [True: 0, False: 961]
  ------------------
 1335|       |                /* Here we match only one argument */
 1336|      0|                p = ssh_config_get_str_tok(&s, NULL);
 1337|      0|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1337:21): [True: 0, False: 0]
  |  Branch (1337:34): [True: 0, False: 0]
  ------------------
 1338|      0|                    ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1339|      0|                                  SSH_FATAL,
 1340|      0|                                  "line %d: ERROR - Match originalhost keyword "
 1341|      0|                                  "requires argument",
 1342|      0|                                  count);
 1343|      0|                    match_error = -1;
 1344|      0|                    goto out_match;
 1345|      0|                }
 1346|      0|                result &=
 1347|      0|                    ssh_config_match(session->opts.originalhost, p, negate);
 1348|      0|                args++;
 1349|      0|                break;
 1350|       |
 1351|     53|            case MATCH_HOST:
  ------------------
  |  Branch (1351:13): [True: 53, False: 908]
  ------------------
 1352|       |                /* Here we match only one argument */
 1353|     53|                p = ssh_config_get_str_tok(&s, NULL);
 1354|     53|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1354:21): [True: 0, False: 53]
  |  Branch (1354:34): [True: 0, False: 53]
  ------------------
 1355|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1356|      0|                                  "line %d: ERROR - Match host keyword "
 1357|      0|                                  "requires argument", count);
 1358|      0|                    match_error = -1;
 1359|      0|                    goto out_match;
 1360|      0|                }
 1361|     53|                result &= ssh_config_match(session->opts.host
  ------------------
  |  Branch (1361:44): [True: 53, False: 0]
  ------------------
 1362|     53|                                               ? session->opts.host
 1363|     53|                                               : session->opts.originalhost,
 1364|     53|                                           p,
 1365|     53|                                           negate);
 1366|     53|                args++;
 1367|     53|                break;
 1368|       |
 1369|    186|            case MATCH_USER:
  ------------------
  |  Branch (1369:13): [True: 186, False: 775]
  ------------------
 1370|       |                /* Here we match only one argument */
 1371|    186|                p = ssh_config_get_str_tok(&s, NULL);
 1372|    186|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1372:21): [True: 0, False: 186]
  |  Branch (1372:34): [True: 0, False: 186]
  ------------------
 1373|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1374|      0|                                  "line %d: ERROR - Match user keyword "
 1375|      0|                                  "requires argument", count);
 1376|      0|                    match_error = -1;
 1377|      0|                    goto out_match;
 1378|      0|                }
 1379|    186|                result &= ssh_config_match(session->opts.username, p, negate);
 1380|    186|                args++;
 1381|    186|                break;
 1382|       |
 1383|     13|            case MATCH_LOCALNETWORK:
  ------------------
  |  Branch (1383:13): [True: 13, False: 948]
  ------------------
 1384|       |                /* Here we match only one argument */
 1385|     13|                p = ssh_config_get_str_tok(&s, NULL);
 1386|     13|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1386:21): [True: 0, False: 13]
  |  Branch (1386:34): [True: 0, False: 13]
  ------------------
 1387|      0|                    ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1388|      0|                                  SSH_FATAL,
 1389|      0|                                  "line %d: ERROR - Match local network keyword"
 1390|      0|                                  "requires argument",
 1391|      0|                                  count);
 1392|      0|                    match_error = -1;
 1393|      0|                    goto out_match;
 1394|      0|                }
 1395|     13|#ifdef HAVE_IFADDRS_H
 1396|     13|                rv = match_cidr_address_list(NULL, p, -1);
 1397|     13|                if (rv == -1) {
  ------------------
  |  Branch (1397:21): [True: 13, False: 0]
  ------------------
 1398|     13|                    ssh_set_error(session,
  ------------------
  |  |  311|     13|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1399|     13|                                  SSH_FATAL,
 1400|     13|                                  "line %d: ERROR - List invalid entry: %s",
 1401|     13|                                  count,
 1402|     13|                                  p);
 1403|     13|                    match_error = -1;
 1404|     13|                    goto out_match;
 1405|     13|                }
 1406|      0|                rv = ssh_match_localnetwork(p, negate);
 1407|      0|                if (rv == -1) {
  ------------------
  |  Branch (1407:21): [True: 0, False: 0]
  ------------------
 1408|      0|                    ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1409|      0|                                  SSH_FATAL,
 1410|      0|                                  "line %d: ERROR - Error while retrieving "
 1411|      0|                                  "network interface information -"
 1412|      0|                                  " List entry: %s",
 1413|      0|                                  count,
 1414|      0|                                  p);
 1415|      0|                    match_error = -1;
 1416|      0|                    goto out_match;
 1417|      0|                }
 1418|       |
 1419|      0|                result &= rv;
 1420|       |#else /* HAVE_IFADDRS_H */
 1421|       |                ssh_set_error(session,
 1422|       |                              SSH_FATAL,
 1423|       |                              "line %d: ERROR - match localnetwork "
 1424|       |                              "not supported on this platform",
 1425|       |                              count);
 1426|       |                match_error = -1;
 1427|       |                goto out_match;
 1428|       |#endif /* HAVE_IFADDRS_H */
 1429|      0|                args++;
 1430|      0|                break;
 1431|       |
 1432|      0|            case MATCH_VERSION:
  ------------------
  |  Branch (1432:13): [True: 0, False: 961]
  ------------------
 1433|       |                /* Here we match only one argument */
 1434|      0|                p = ssh_config_get_str_tok(&s, NULL);
 1435|      0|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1435:21): [True: 0, False: 0]
  |  Branch (1435:34): [True: 0, False: 0]
  ------------------
 1436|      0|                    ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1437|      0|                                  SSH_FATAL,
 1438|      0|                                  "line %d: ERROR - Match version keyword "
 1439|      0|                                  "requires argument",
 1440|      0|                                  count);
 1441|      0|                    match_error = -1;
 1442|      0|                    goto out_match;
 1443|      0|                }
 1444|      0|                version = "libssh_" SSH_STRINGIFY(LIBSSH_VERSION);
  ------------------
  |  |   71|      0|#define SSH_STRINGIFY(s) SSH_TOSTRING(s)
  |  |  ------------------
  |  |  |  |   72|      0|#define SSH_TOSTRING(s) #s
  |  |  ------------------
  ------------------
 1445|      0|                result &= ssh_config_match(version, p, negate);
 1446|      0|                args++;
 1447|      0|                break;
 1448|       |
 1449|      0|            case MATCH_TAGGED:
  ------------------
  |  Branch (1449:13): [True: 0, False: 961]
  ------------------
 1450|       |                /* Here we match exactly one argument.
 1451|       |                 * An explicit empty argument ('tagged=' or 'tagged ""') is
 1452|       |                 * allowed, but a missing argument is an error.
 1453|       |                 */
 1454|      0|                p = ssh_config_get_token_info(&s, &arg_info);
 1455|      0|                if (arg_info.invalid) {
  ------------------
  |  Branch (1455:21): [True: 0, False: 0]
  ------------------
 1456|      0|                    ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1457|      0|                                  SSH_FATAL,
 1458|      0|                                  "line %d: ERROR - Match tagged keyword "
 1459|      0|                                  "contains unterminated quotes",
 1460|      0|                                  count);
 1461|      0|                    match_error = -1;
 1462|      0|                    goto out_match;
 1463|      0|                }
 1464|       |                /* found=false means there was no argument token at all. An
 1465|       |                 * explicit empty token ("") still reports found=true.
 1466|       |                 */
 1467|      0|                if (!arg_info.found) {
  ------------------
  |  Branch (1467:21): [True: 0, False: 0]
  ------------------
 1468|      0|                    if (keyword_info.had_equal) {
  ------------------
  |  Branch (1468:25): [True: 0, False: 0]
  ------------------
 1469|      0|                        p = "";
 1470|      0|                    } else {
 1471|      0|                        ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1472|      0|                                      SSH_FATAL,
 1473|      0|                                      "line %d: ERROR - Match tagged keyword "
 1474|      0|                                      "requires argument",
 1475|      0|                                      count);
 1476|      0|                        match_error = -1;
 1477|      0|                        goto out_match;
 1478|      0|                    }
 1479|      0|                }
 1480|      0|                result &= ssh_config_match_tagged(session->opts.tag, p, negate);
 1481|       |                /* MATCH_TAGGED explicitly allows an empty pattern ('tagged='
 1482|       |                 * or 'tagged ""') to mean "match when no tag is set". That
 1483|       |                 * leaves p pointing at "", so the outer do-while loop would
 1484|       |                 * terminate early and skip any remaining predicates on the
 1485|       |                 * same Match line. Restore p to the keyword token before
 1486|       |                 * iterating.
 1487|       |                 */
 1488|      0|                p = p2;
 1489|      0|                args++;
 1490|      0|                break;
 1491|       |
 1492|    597|            case MATCH_UNKNOWN:
  ------------------
  |  Branch (1492:13): [True: 597, False: 364]
  ------------------
 1493|    597|            default:
  ------------------
  |  Branch (1493:13): [True: 0, False: 961]
  ------------------
 1494|    597|                SSH_LOG(SSH_LOG_WARN,
  ------------------
  |  |  281|    597|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1495|    597|                        "Unknown argument '%s' for Match keyword. Not matching",
 1496|    597|                        p);
 1497|    597|                result = 0;
 1498|    597|                break;
 1499|    961|            }
 1500|    961|        } while (p != NULL && p[0] != '\0');
  ------------------
  |  Branch (1500:18): [True: 840, False: 107]
  |  Branch (1500:31): [True: 838, False: 2]
  ------------------
 1501|    699|        if (args == 0) {
  ------------------
  |  Branch (1501:13): [True: 12, False: 687]
  ------------------
 1502|     12|            SSH_LOG(SSH_LOG_WARN,
  ------------------
  |  |  281|     12|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1503|     12|                    "ERROR - Match keyword requires an argument. Not matching");
 1504|     12|            result = 0;
 1505|     12|        }
 1506|    713|    out_match:
 1507|    713|        SAFE_FREE(localuser);
  ------------------
  |  |  373|    713|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 713]
  |  |  |  Branch (373:71): [Folded, False: 713]
  |  |  ------------------
  ------------------
 1508|    713|        if (match_error != 0) {
  ------------------
  |  Branch (1508:13): [True: 14, False: 699]
  ------------------
 1509|     14|            SAFE_FREE(x);
  ------------------
  |  |  373|     14|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 14, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 14]
  |  |  ------------------
  ------------------
 1510|     14|            return -1;
 1511|     14|        }
 1512|    699|        *parsing = result;
 1513|    699|        break;
 1514|    713|    }
 1515|    153|    case SOC_HOST: {
  ------------------
  |  Branch (1515:5): [True: 153, False: 312k]
  ------------------
 1516|    153|        int ok = 0, result = -1;
 1517|       |
 1518|    153|        *parsing = 0;
 1519|    153|        lowerhost = (session->opts.originalhost)
  ------------------
  |  Branch (1519:21): [True: 153, False: 0]
  ------------------
 1520|    153|                        ? ssh_lowercase(session->opts.originalhost)
 1521|    153|                        : NULL;
 1522|    153|        for (p = ssh_config_get_str_tok(&s, NULL);
 1523|    769|             p != NULL && p[0] != '\0';
  ------------------
  |  Branch (1523:14): [True: 616, False: 153]
  |  Branch (1523:27): [True: 616, False: 0]
  ------------------
 1524|    616|             p = ssh_config_get_str_tok(&s, NULL)) {
 1525|    616|             if (ok >= 0) {
  ------------------
  |  Branch (1525:18): [True: 603, False: 13]
  ------------------
 1526|    603|               ok = match_hostname(lowerhost, p, strlen(p));
 1527|    603|               if (result == -1 && ok < 0) {
  ------------------
  |  Branch (1527:20): [True: 603, False: 0]
  |  Branch (1527:36): [True: 8, False: 595]
  ------------------
 1528|      8|                   result = 0;
 1529|    595|               } else if (result == -1 && ok > 0) {
  ------------------
  |  Branch (1529:27): [True: 595, False: 0]
  |  Branch (1529:43): [True: 2, False: 593]
  ------------------
 1530|      2|                   result = 1;
 1531|      2|               }
 1532|    603|            }
 1533|    616|        }
 1534|    153|        SAFE_FREE(lowerhost);
  ------------------
  |  |  373|    153|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 153, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 153]
  |  |  ------------------
  ------------------
 1535|    153|        if (result != -1) {
  ------------------
  |  Branch (1535:13): [True: 10, False: 143]
  ------------------
 1536|     10|            *parsing = result;
 1537|     10|        }
 1538|    153|        break;
 1539|    713|    }
 1540|      1|    case SOC_TAG:
  ------------------
  |  Branch (1540:5): [True: 1, False: 312k]
  ------------------
 1541|      1|        p = ssh_config_get_str_tok(&s, NULL);
 1542|      1|        if (p == NULL) {
  ------------------
  |  Branch (1542:13): [True: 0, False: 1]
  ------------------
 1543|      0|            ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1544|      0|                          SSH_FATAL,
 1545|      0|                          "line %d: ERROR - Tag keyword requires argument",
 1546|      0|                          count);
 1547|      0|            SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1548|      0|            return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1549|      0|        }
 1550|      1|        if (*parsing) {
  ------------------
  |  Branch (1550:13): [True: 1, False: 0]
  ------------------
 1551|      1|            char *tag = NULL;
 1552|       |
 1553|      1|            tag = strdup(p);
 1554|      1|            if (tag == NULL) {
  ------------------
  |  Branch (1554:17): [True: 0, False: 1]
  ------------------
 1555|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1556|      0|                SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1557|      0|                return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1558|      0|            }
 1559|      1|            SAFE_FREE(session->opts.tag);
  ------------------
  |  |  373|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 1]
  |  |  |  Branch (373:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1560|      1|            session->opts.tag = tag;
 1561|      1|        }
 1562|      1|        break;
 1563|    148|    case SOC_HOSTNAME:
  ------------------
  |  Branch (1563:5): [True: 148, False: 312k]
  ------------------
 1564|    148|        p = ssh_config_get_str_tok(&s, NULL);
 1565|    148|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|    148|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 148]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1566|    148|        if (*parsing) {
  ------------------
  |  Branch (1566:13): [True: 122, False: 26]
  ------------------
 1567|    122|            int rc;
 1568|    122|            bool had_expansion = strchr(p, '%') != NULL;
 1569|    122|            bool needs_host = false;
 1570|    122|            bool has_unknown = false;
 1571|    122|            rc = ssh_config_scan_hostname_tokens(session,
 1572|    122|                                                 p,
 1573|    122|                                                 &needs_host,
 1574|    122|                                                 &has_unknown);
 1575|    122|            if (rc < 0) {
  ------------------
  |  Branch (1575:17): [True: 4, False: 118]
  ------------------
 1576|      4|                SAFE_FREE(x);
  ------------------
  |  |  373|      4|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 4, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 4]
  |  |  ------------------
  ------------------
 1577|      4|                return -1;
 1578|      4|            }
 1579|    118|            if (had_expansion) {
  ------------------
  |  Branch (1579:17): [True: 94, False: 24]
  ------------------
 1580|     94|                if (!has_unknown &&
  ------------------
  |  Branch (1580:21): [True: 5, False: 89]
  ------------------
 1581|      5|                    (!needs_host || session->opts.host != NULL ||
  ------------------
  |  Branch (1581:22): [True: 5, False: 0]
  |  Branch (1581:37): [True: 0, False: 0]
  ------------------
 1582|      5|                     session->opts.originalhost != NULL)) {
  ------------------
  |  Branch (1582:22): [True: 0, False: 0]
  ------------------
 1583|      5|                    char *expanded = ssh_path_expand_hostname(session, p);
 1584|      5|                    if (expanded == NULL) {
  ------------------
  |  Branch (1584:25): [True: 0, False: 5]
  ------------------
 1585|      0|                        SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1586|      0|                        return -1;
 1587|      0|                    }
 1588|      5|                    session->opts.config_hostname_only = true;
 1589|      5|                    rv = ssh_options_set(session, SSH_OPTIONS_HOST, expanded);
 1590|      5|                    session->opts.config_hostname_only = false;
 1591|      5|                    free(expanded);
 1592|      5|                    if (rv != SSH_OK) {
  ------------------
  |  |  316|      5|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1592:25): [True: 5, False: 0]
  ------------------
 1593|       |                        /* Expanded HostName values remain fatal if host
 1594|       |                         * validation rejects the resulting hostname.
 1595|       |                         */
 1596|      5|                        SAFE_FREE(x);
  ------------------
  |  |  373|      5|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 5, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 5]
  |  |  ------------------
  ------------------
 1597|      5|                        return -1;
 1598|      5|                    }
 1599|     89|                } else {
 1600|     89|                    char *hostname_pattern =
 1601|     89|                        ssh_config_lowercase_hostname_pattern(p);
 1602|     89|                    if (hostname_pattern == NULL) {
  ------------------
  |  Branch (1602:25): [True: 0, False: 89]
  ------------------
 1603|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1604|      0|                        SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1605|      0|                        return -1;
 1606|      0|                    }
 1607|     89|                    SAFE_FREE(session->opts.config_hostname);
  ------------------
  |  |  373|     89|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 89]
  |  |  |  Branch (373:71): [Folded, False: 89]
  |  |  ------------------
  ------------------
 1608|     89|                    session->opts.config_hostname = hostname_pattern;
 1609|     89|                }
 1610|     94|            } else {
 1611|     24|                char *lower = ssh_lowercase(p);
 1612|     24|                if (lower == NULL) {
  ------------------
  |  Branch (1612:21): [True: 0, False: 24]
  ------------------
 1613|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1614|      0|                    SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1615|      0|                    return -1;
 1616|      0|                }
 1617|     24|                session->opts.config_hostname_only = true;
 1618|     24|                ssh_options_set(session, SSH_OPTIONS_HOST, lower);
 1619|     24|                session->opts.config_hostname_only = false;
 1620|     24|                free(lower);
 1621|     24|            }
 1622|    118|        }
 1623|    139|        break;
 1624|    139|    case SOC_PORT:
  ------------------
  |  Branch (1624:5): [True: 25, False: 312k]
  ------------------
 1625|     25|        l = ssh_config_get_long(&s, -1);
 1626|     25|        CHECK_COND_OR_FAIL(l <= 0 || l > 65535, "Invalid argument");
  ------------------
  |  | 1116|     26|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:10): [True: 24, False: 1]
  |  |  |  Branch (1116:10): [True: 1, False: 0]
  |  |  ------------------
  |  | 1117|     25|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     25|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     25|                "line %d: %s: %s",                             \
  |  | 1119|     25|                count,                                         \
  |  | 1120|     25|                error_message,                                 \
  |  | 1121|     25|                keyword);                                      \
  |  | 1122|     25|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 25]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     25|        break;                                                 \
  |  | 1134|     25|    }
  ------------------
 1627|      0|        if (*parsing) {
  ------------------
  |  Branch (1627:13): [True: 0, False: 0]
  ------------------
 1628|      0|            i = (int)l;
 1629|      0|            ssh_options_set(session, SSH_OPTIONS_PORT, &i);
 1630|      0|        }
 1631|      0|        break;
 1632|    169|    case SOC_USERNAME:
  ------------------
  |  Branch (1632:5): [True: 169, False: 312k]
  ------------------
 1633|    169|        p = ssh_config_get_str_tok(&s, NULL);
 1634|    169|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|    169|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 2, False: 167]
  |  |  ------------------
  |  | 1117|      2|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      2|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      2|                "line %d: %s: %s",                             \
  |  | 1119|      2|                count,                                         \
  |  | 1120|      2|                error_message,                                 \
  |  | 1121|      2|                keyword);                                      \
  |  | 1122|      2|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 2]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      2|        break;                                                 \
  |  | 1134|      2|    }
  ------------------
 1635|    167|        if (*parsing) {
  ------------------
  |  Branch (1635:13): [True: 32, False: 135]
  ------------------
 1636|     32|            ssh_options_set(session, SSH_OPTIONS_USER, p);
 1637|     32|        }
 1638|    167|        break;
 1639|    573|    case SOC_IDENTITY:
  ------------------
  |  Branch (1639:5): [True: 573, False: 312k]
  ------------------
 1640|    573|      p = ssh_config_get_str_tok(&s, NULL);
 1641|    573|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|    573|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 573]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1642|    573|      if (*parsing) {
  ------------------
  |  Branch (1642:11): [True: 570, False: 3]
  ------------------
 1643|    570|          ssh_options_set(session, SSH_OPTIONS_ADD_IDENTITY, p);
 1644|    570|      }
 1645|    573|      break;
 1646|     21|    case SOC_CIPHERS:
  ------------------
  |  Branch (1646:5): [True: 21, False: 312k]
  ------------------
 1647|     21|      p = ssh_config_get_str_tok(&s, NULL);
 1648|     21|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|     21|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 5, False: 16]
  |  |  ------------------
  |  | 1117|      5|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      5|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      5|                "line %d: %s: %s",                             \
  |  | 1119|      5|                count,                                         \
  |  | 1120|      5|                error_message,                                 \
  |  | 1121|      5|                keyword);                                      \
  |  | 1122|      5|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 5]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      5|        break;                                                 \
  |  | 1134|      5|    }
  ------------------
 1649|     16|      if (*parsing) {
  ------------------
  |  Branch (1649:11): [True: 16, False: 0]
  ------------------
 1650|     16|          ssh_options_set(session, SSH_OPTIONS_CIPHERS_C_S, p);
 1651|     16|          ssh_options_set(session, SSH_OPTIONS_CIPHERS_S_C, p);
 1652|     16|      }
 1653|     16|      break;
 1654|     76|    case SOC_MACS:
  ------------------
  |  Branch (1654:5): [True: 76, False: 312k]
  ------------------
 1655|     76|      p = ssh_config_get_str_tok(&s, NULL);
 1656|     76|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|     76|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 3, False: 73]
  |  |  ------------------
  |  | 1117|      3|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      3|                "line %d: %s: %s",                             \
  |  | 1119|      3|                count,                                         \
  |  | 1120|      3|                error_message,                                 \
  |  | 1121|      3|                keyword);                                      \
  |  | 1122|      3|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 3]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      3|        break;                                                 \
  |  | 1134|      3|    }
  ------------------
 1657|     73|      if (*parsing) {
  ------------------
  |  Branch (1657:11): [True: 65, False: 8]
  ------------------
 1658|     65|          ssh_options_set(session, SSH_OPTIONS_HMAC_C_S, p);
 1659|     65|          ssh_options_set(session, SSH_OPTIONS_HMAC_S_C, p);
 1660|     65|      }
 1661|     73|      break;
 1662|      7|    case SOC_COMPRESSION:
  ------------------
  |  Branch (1662:5): [True: 7, False: 312k]
  ------------------
 1663|      7|      i = ssh_config_get_token_value(&s, compression_map, -1);
 1664|      7|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1116|      7|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 7, False: 0]
  |  |  ------------------
  |  | 1117|      7|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      7|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      7|                "line %d: %s: %s",                             \
  |  | 1119|      7|                count,                                         \
  |  | 1120|      7|                error_message,                                 \
  |  | 1121|      7|                keyword);                                      \
  |  | 1122|      7|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 7]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      7|        break;                                                 \
  |  | 1134|      7|    }
  ------------------
 1665|      0|      if (*parsing) {
  ------------------
  |  Branch (1665:11): [True: 0, False: 0]
  ------------------
 1666|      0|          if (i) {
  ------------------
  |  Branch (1666:15): [True: 0, False: 0]
  ------------------
 1667|      0|              ssh_options_set(session, SSH_OPTIONS_COMPRESSION, "yes");
 1668|      0|          } else {
 1669|      0|              ssh_options_set(session, SSH_OPTIONS_COMPRESSION, "no");
 1670|      0|          }
 1671|      0|      }
 1672|      0|      break;
 1673|      4|    case SOC_TIMEOUT:
  ------------------
  |  Branch (1673:5): [True: 4, False: 312k]
  ------------------
 1674|      4|        p = ssh_config_get_str_tok(&s, NULL);
 1675|      4|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      4|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 2, False: 2]
  |  |  ------------------
  |  | 1117|      2|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      2|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      2|                "line %d: %s: %s",                             \
  |  | 1119|      2|                count,                                         \
  |  | 1120|      2|                error_message,                                 \
  |  | 1121|      2|                keyword);                                      \
  |  | 1122|      2|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 2]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      2|        break;                                                 \
  |  | 1134|      2|    }
  ------------------
 1676|      2|        cmp = strcmp(p, "none");
 1677|      2|        if (cmp == 0) {
  ------------------
  |  Branch (1677:13): [True: 0, False: 2]
  ------------------
 1678|      0|            if (*parsing) {
  ------------------
  |  Branch (1678:17): [True: 0, False: 0]
  ------------------
 1679|      0|                session->opts.timeout = (unsigned long)SSH_TIMEOUT_INFINITE;
  ------------------
  |  |   99|      0|#define SSH_TIMEOUT_INFINITE -1
  ------------------
 1680|      0|                session->opts.timeout_usec = 0;
 1681|      0|            }
 1682|      0|            break;
 1683|      0|        }
 1684|      2|        l = ssh_config_convtime(p, -1);
 1685|      2|        CHECK_COND_OR_FAIL(l < 0, "Invalid argument");
  ------------------
  |  | 1116|      2|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 2, False: 0]
  |  |  ------------------
  |  | 1117|      2|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      2|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      2|                "line %d: %s: %s",                             \
  |  | 1119|      2|                count,                                         \
  |  | 1120|      2|                error_message,                                 \
  |  | 1121|      2|                keyword);                                      \
  |  | 1122|      2|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 2]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      2|        break;                                                 \
  |  | 1134|      2|    }
  ------------------
 1686|      0|        if (*parsing) {
  ------------------
  |  Branch (1686:13): [True: 0, False: 0]
  ------------------
 1687|      0|            ssh_options_set(session, SSH_OPTIONS_TIMEOUT, &l);
 1688|      0|        }
 1689|      0|        break;
 1690|     63|    case SOC_STRICTHOSTKEYCHECK:
  ------------------
  |  Branch (1690:5): [True: 63, False: 312k]
  ------------------
 1691|     63|      i = ssh_config_get_strict_hostkey(&s, -1);
 1692|     63|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1116|     63|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 63, False: 0]
  |  |  ------------------
  |  | 1117|     63|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     63|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     63|                "line %d: %s: %s",                             \
  |  | 1119|     63|                count,                                         \
  |  | 1120|     63|                error_message,                                 \
  |  | 1121|     63|                keyword);                                      \
  |  | 1122|     63|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 63]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     63|        break;                                                 \
  |  | 1134|     63|    }
  ------------------
 1693|      0|      if (*parsing) {
  ------------------
  |  Branch (1693:11): [True: 0, False: 0]
  ------------------
 1694|      0|          ssh_options_set(session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &i);
 1695|      0|      }
 1696|      0|      break;
 1697|      0|    case SOC_KNOWNHOSTS:
  ------------------
  |  Branch (1697:5): [True: 0, False: 312k]
  ------------------
 1698|      0|      p = ssh_config_get_str_tok(&s, NULL);
 1699|      0|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1700|      0|      if (*parsing) {
  ------------------
  |  Branch (1700:11): [True: 0, False: 0]
  ------------------
 1701|      0|          ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, p);
 1702|      0|      }
 1703|      0|      break;
 1704|      0|    case SOC_PROXYCOMMAND:
  ------------------
  |  Branch (1704:5): [True: 0, False: 312k]
  ------------------
 1705|      0|      p = ssh_config_get_cmd(&s);
 1706|      0|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1707|       |      /* We share the seen value with the ProxyJump */
 1708|      0|      if (*parsing && !seen[SOC_PROXYJUMP]) {
  ------------------
  |  Branch (1708:11): [True: 0, False: 0]
  |  Branch (1708:23): [True: 0, False: 0]
  ------------------
 1709|      0|          ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, p);
 1710|      0|      }
 1711|      0|      break;
 1712|     69|    case SOC_PROXYJUMP:
  ------------------
  |  Branch (1712:5): [True: 69, False: 312k]
  ------------------
 1713|     69|        p = ssh_config_get_str_tok(&s, NULL);
 1714|     69|        if (p == NULL) {
  ------------------
  |  Branch (1714:13): [True: 0, False: 69]
  ------------------
 1715|      0|            SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1716|      0|            return -1;
 1717|      0|        }
 1718|       |        /* We share the seen value with the ProxyCommand */
 1719|     69|        rv = ssh_config_parse_proxy_jump(session,
 1720|     69|                                         p,
 1721|     69|                                         (*parsing && !seen[SOC_PROXYCOMMAND]));
  ------------------
  |  Branch (1721:43): [True: 39, False: 30]
  |  Branch (1721:55): [True: 39, False: 0]
  ------------------
 1722|     69|        if (rv != SSH_OK) {
  ------------------
  |  |  316|     69|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1722:13): [True: 16, False: 53]
  ------------------
 1723|     16|            SAFE_FREE(x);
  ------------------
  |  |  373|     16|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 16, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 16]
  |  |  ------------------
  ------------------
 1724|     16|            return -1;
 1725|     16|        }
 1726|     53|        break;
 1727|     53|    case SOC_GSSAPISERVERIDENTITY:
  ------------------
  |  Branch (1727:5): [True: 2, False: 312k]
  ------------------
 1728|      2|      p = ssh_config_get_str_tok(&s, NULL);
 1729|      2|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      2|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 2]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1730|      2|      if (*parsing) {
  ------------------
  |  Branch (1730:11): [True: 2, False: 0]
  ------------------
 1731|      2|          ssh_options_set(session, SSH_OPTIONS_GSSAPI_SERVER_IDENTITY, p);
 1732|      2|      }
 1733|      2|      break;
 1734|      5|    case SOC_GSSAPICLIENTIDENTITY:
  ------------------
  |  Branch (1734:5): [True: 5, False: 312k]
  ------------------
 1735|      5|      p = ssh_config_get_str_tok(&s, NULL);
 1736|      5|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      5|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 5]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1737|      5|      if (*parsing) {
  ------------------
  |  Branch (1737:11): [True: 1, False: 4]
  ------------------
 1738|      1|          ssh_options_set(session, SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY, p);
 1739|      1|      }
 1740|      5|      break;
 1741|      0|    case SOC_GSSAPIDELEGATECREDENTIALS:
  ------------------
  |  Branch (1741:5): [True: 0, False: 312k]
  ------------------
 1742|      0|      i = ssh_config_get_yesno(&s, -1);
 1743|      0|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1116|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1744|      0|      if (*parsing) {
  ------------------
  |  Branch (1744:11): [True: 0, False: 0]
  ------------------
 1745|      0|          ssh_options_set(session, SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS, &i);
 1746|      0|      }
 1747|      0|      break;
 1748|     48|    case SOC_BINDADDRESS:
  ------------------
  |  Branch (1748:5): [True: 48, False: 312k]
  ------------------
 1749|     48|        p = ssh_config_get_str_tok(&s, NULL);
 1750|     48|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|     48|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 32, False: 16]
  |  |  ------------------
  |  | 1117|     32|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     32|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     32|                "line %d: %s: %s",                             \
  |  | 1119|     32|                count,                                         \
  |  | 1120|     32|                error_message,                                 \
  |  | 1121|     32|                keyword);                                      \
  |  | 1122|     32|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 32]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     32|        break;                                                 \
  |  | 1134|     32|    }
  ------------------
 1751|     16|        if (*parsing) {
  ------------------
  |  Branch (1751:13): [True: 0, False: 16]
  ------------------
 1752|      0|            ssh_options_set(session, SSH_OPTIONS_BINDADDR, p);
 1753|      0|        }
 1754|     16|        break;
 1755|      7|    case SOC_GLOBALKNOWNHOSTSFILE:
  ------------------
  |  Branch (1755:5): [True: 7, False: 312k]
  ------------------
 1756|      7|        p = ssh_config_get_str_tok(&s, NULL);
 1757|      7|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      7|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 3, False: 4]
  |  |  ------------------
  |  | 1117|      3|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      3|                "line %d: %s: %s",                             \
  |  | 1119|      3|                count,                                         \
  |  | 1120|      3|                error_message,                                 \
  |  | 1121|      3|                keyword);                                      \
  |  | 1122|      3|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 3]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      3|        break;                                                 \
  |  | 1134|      3|    }
  ------------------
 1758|      4|        if (*parsing) {
  ------------------
  |  Branch (1758:13): [True: 3, False: 1]
  ------------------
 1759|      3|            ssh_options_set(session, SSH_OPTIONS_GLOBAL_KNOWNHOSTS, p);
 1760|      3|        }
 1761|      4|        break;
 1762|     19|    case SOC_LOGLEVEL:
  ------------------
  |  Branch (1762:5): [True: 19, False: 312k]
  ------------------
 1763|     19|        p = ssh_config_get_str_tok(&s, NULL);
 1764|     19|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|     19|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 14, False: 5]
  |  |  ------------------
  |  | 1117|     14|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     14|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     14|                "line %d: %s: %s",                             \
  |  | 1119|     14|                count,                                         \
  |  | 1120|     14|                error_message,                                 \
  |  | 1121|     14|                keyword);                                      \
  |  | 1122|     14|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 14]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     14|        break;                                                 \
  |  | 1134|     14|    }
  ------------------
 1765|      5|        if (*parsing) {
  ------------------
  |  Branch (1765:13): [True: 5, False: 0]
  ------------------
 1766|      5|            int value = -1;
 1767|       |
 1768|      5|            if (strcasecmp(p, "quiet") == 0) {
  ------------------
  |  Branch (1768:17): [True: 0, False: 5]
  ------------------
 1769|      0|                value = SSH_LOG_NONE;
  ------------------
  |  |  355|      0|#define SSH_LOG_NONE 0
  ------------------
 1770|      5|            } else if (strcasecmp(p, "fatal") == 0 ||
  ------------------
  |  Branch (1770:24): [True: 0, False: 5]
  ------------------
 1771|      5|                    strcasecmp(p, "error")== 0) {
  ------------------
  |  Branch (1771:21): [True: 0, False: 5]
  ------------------
 1772|      0|                value = SSH_LOG_WARN;
  ------------------
  |  |  357|      0|#define SSH_LOG_WARN 1
  ------------------
 1773|      5|            } else if (strcasecmp(p, "verbose") == 0 ||
  ------------------
  |  Branch (1773:24): [True: 0, False: 5]
  ------------------
 1774|      5|                    strcasecmp(p, "info") == 0) {
  ------------------
  |  Branch (1774:21): [True: 0, False: 5]
  ------------------
 1775|      0|                value = SSH_LOG_INFO;
  ------------------
  |  |  359|      0|#define SSH_LOG_INFO 2
  ------------------
 1776|      5|            } else if (strcasecmp(p, "DEBUG") == 0 ||
  ------------------
  |  Branch (1776:24): [True: 0, False: 5]
  ------------------
 1777|      5|                    strcasecmp(p, "DEBUG1") == 0) {
  ------------------
  |  Branch (1777:21): [True: 0, False: 5]
  ------------------
 1778|      0|                value = SSH_LOG_DEBUG;
  ------------------
  |  |  361|      0|#define SSH_LOG_DEBUG 3
  ------------------
 1779|      5|            } else if (strcasecmp(p, "DEBUG2") == 0 ||
  ------------------
  |  Branch (1779:24): [True: 0, False: 5]
  ------------------
 1780|      5|                    strcasecmp(p, "DEBUG3") == 0) {
  ------------------
  |  Branch (1780:21): [True: 0, False: 5]
  ------------------
 1781|      0|                value = SSH_LOG_TRACE;
  ------------------
  |  |  363|      0|#define SSH_LOG_TRACE 4
  ------------------
 1782|      0|            }
 1783|      5|            CHECK_COND_OR_FAIL(value == -1, "Invalid value");
  ------------------
  |  | 1116|      5|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 5, False: 0]
  |  |  ------------------
  |  | 1117|      5|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      5|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      5|                "line %d: %s: %s",                             \
  |  | 1119|      5|                count,                                         \
  |  | 1120|      5|                error_message,                                 \
  |  | 1121|      5|                keyword);                                      \
  |  | 1122|      5|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 5]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      5|        break;                                                 \
  |  | 1134|      5|    }
  ------------------
 1784|      0|            if (value != -1) {
  ------------------
  |  Branch (1784:17): [True: 0, False: 0]
  ------------------
 1785|      0|                ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &value);
 1786|      0|            }
 1787|      0|        }
 1788|      0|        break;
 1789|     47|    case SOC_HOSTKEYALGORITHMS:
  ------------------
  |  Branch (1789:5): [True: 47, False: 312k]
  ------------------
 1790|     47|        p = ssh_config_get_str_tok(&s, NULL);
 1791|     47|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|     47|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 29, False: 18]
  |  |  ------------------
  |  | 1117|     29|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     29|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     29|                "line %d: %s: %s",                             \
  |  | 1119|     29|                count,                                         \
  |  | 1120|     29|                error_message,                                 \
  |  | 1121|     29|                keyword);                                      \
  |  | 1122|     29|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 29]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     29|        break;                                                 \
  |  | 1134|     29|    }
  ------------------
 1792|     18|        if (*parsing) {
  ------------------
  |  Branch (1792:13): [True: 18, False: 0]
  ------------------
 1793|     18|            ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, p);
 1794|     18|        }
 1795|     18|        break;
 1796|     32|    case SOC_PUBKEYACCEPTEDKEYTYPES:
  ------------------
  |  Branch (1796:5): [True: 32, False: 312k]
  ------------------
 1797|     32|        p = ssh_config_get_str_tok(&s, NULL);
 1798|     32|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|     32|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 5, False: 27]
  |  |  ------------------
  |  | 1117|      5|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      5|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      5|                "line %d: %s: %s",                             \
  |  | 1119|      5|                count,                                         \
  |  | 1120|      5|                error_message,                                 \
  |  | 1121|      5|                keyword);                                      \
  |  | 1122|      5|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 5]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      5|        break;                                                 \
  |  | 1134|      5|    }
  ------------------
 1799|     27|        if (*parsing) {
  ------------------
  |  Branch (1799:13): [True: 26, False: 1]
  ------------------
 1800|     26|            ssh_options_set(session, SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES, p);
 1801|     26|        }
 1802|     27|        break;
 1803|      9|    case SOC_KEXALGORITHMS:
  ------------------
  |  Branch (1803:5): [True: 9, False: 312k]
  ------------------
 1804|      9|        p = ssh_config_get_str_tok(&s, NULL);
 1805|      9|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      9|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 3, False: 6]
  |  |  ------------------
  |  | 1117|      3|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      3|                "line %d: %s: %s",                             \
  |  | 1119|      3|                count,                                         \
  |  | 1120|      3|                error_message,                                 \
  |  | 1121|      3|                keyword);                                      \
  |  | 1122|      3|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 3]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      3|        break;                                                 \
  |  | 1134|      3|    }
  ------------------
 1806|      6|        if (*parsing) {
  ------------------
  |  Branch (1806:13): [True: 6, False: 0]
  ------------------
 1807|      6|            ssh_options_set(session, SSH_OPTIONS_KEY_EXCHANGE, p);
 1808|      6|        }
 1809|      6|        break;
 1810|    338|    case SOC_REKEYLIMIT:
  ------------------
  |  Branch (1810:5): [True: 338, False: 312k]
  ------------------
 1811|       |        /* Parse the data limit */
 1812|    338|        p = ssh_config_get_str_tok(&s, NULL);
 1813|    338|        if (p == NULL) {
  ------------------
  |  Branch (1813:13): [True: 3, False: 335]
  ------------------
 1814|      3|            CHECK_COND_OR_FAIL(1, "Missing data limit");
  ------------------
  |  | 1116|      3|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 3, Folded]
  |  |  ------------------
  |  | 1117|      3|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      3|                "line %d: %s: %s",                             \
  |  | 1119|      3|                count,                                         \
  |  | 1120|      3|                error_message,                                 \
  |  | 1121|      3|                keyword);                                      \
  |  | 1122|      3|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 3]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      3|        break;                                                 \
  |  | 1134|      3|    }
  ------------------
 1815|      0|            break;
 1816|    335|        } else if (strcmp(p, "default") == 0) {
  ------------------
  |  Branch (1816:20): [True: 0, False: 335]
  ------------------
 1817|       |            /* Default rekey limits enforced automatically */
 1818|      0|            ll = 0;
 1819|    335|        } else {
 1820|    335|            char *endp = NULL;
 1821|    335|            ll = strtoll(p, &endp, 10);
 1822|    335|            if (p == endp || ll < 0) {
  ------------------
  |  Branch (1822:17): [True: 2, False: 333]
  |  Branch (1822:30): [True: 1, False: 332]
  ------------------
 1823|      3|                CHECK_COND_OR_FAIL(1, "Invalid data limit");
  ------------------
  |  | 1116|      3|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 3, Folded]
  |  |  ------------------
  |  | 1117|      3|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      3|                "line %d: %s: %s",                             \
  |  | 1119|      3|                count,                                         \
  |  | 1120|      3|                error_message,                                 \
  |  | 1121|      3|                keyword);                                      \
  |  | 1122|      3|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 3]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      3|        break;                                                 \
  |  | 1134|      3|    }
  ------------------
 1824|      0|                break;
 1825|      3|            }
 1826|    332|            switch (*endp) {
 1827|      0|            case 'g':
  ------------------
  |  Branch (1827:13): [True: 0, False: 332]
  ------------------
 1828|      1|            case 'G':
  ------------------
  |  Branch (1828:13): [True: 1, False: 331]
  ------------------
 1829|      1|                if (ll > LLONG_MAX / 1024) {
  ------------------
  |  Branch (1829:21): [True: 1, False: 0]
  ------------------
 1830|      1|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  281|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1831|      1|                    ll = -1;
 1832|      1|                    break;
 1833|      1|                }
 1834|      0|                ll = ll * 1024;
 1835|      0|                FALL_THROUGH;
  ------------------
  |  |  494|      0|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1836|      0|            case 'm':
  ------------------
  |  Branch (1836:13): [True: 0, False: 332]
  ------------------
 1837|      0|            case 'M':
  ------------------
  |  Branch (1837:13): [True: 0, False: 332]
  ------------------
 1838|      0|                if (ll > LLONG_MAX / 1024) {
  ------------------
  |  Branch (1838:21): [True: 0, False: 0]
  ------------------
 1839|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1840|      0|                    ll = -1;
 1841|      0|                    break;
 1842|      0|                }
 1843|      0|                ll = ll * 1024;
 1844|      0|                FALL_THROUGH;
  ------------------
  |  |  494|      0|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1845|      0|            case 'k':
  ------------------
  |  Branch (1845:13): [True: 0, False: 332]
  ------------------
 1846|      0|            case 'K':
  ------------------
  |  Branch (1846:13): [True: 0, False: 332]
  ------------------
 1847|      0|                if (ll > LLONG_MAX / 1024) {
  ------------------
  |  Branch (1847:21): [True: 0, False: 0]
  ------------------
 1848|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1849|      0|                    ll = -1;
 1850|      0|                    break;
 1851|      0|                }
 1852|      0|                ll = ll * 1024;
 1853|      0|                endp++;
 1854|      0|                FALL_THROUGH;
  ------------------
  |  |  494|      0|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1855|    317|            case '\0':
  ------------------
  |  Branch (1855:13): [True: 317, False: 15]
  ------------------
 1856|       |                /* just the number */
 1857|    317|                break;
 1858|     14|            default:
  ------------------
  |  Branch (1858:13): [True: 14, False: 318]
  ------------------
 1859|       |                /* Ignore invalid suffix and trailing garbage */
 1860|     14|                SSH_LOG(SSH_LOG_TRACE, "Ignoring invalid suffix");
  ------------------
  |  |  281|     14|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1861|     14|                break;
 1862|    332|            }
 1863|    332|        }
 1864|    332|        CHECK_COND_OR_FAIL(ll < 0, "Invalid data limit");
  ------------------
  |  | 1116|    332|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 1, False: 331]
  |  |  ------------------
  |  | 1117|      1|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      1|                "line %d: %s: %s",                             \
  |  | 1119|      1|                count,                                         \
  |  | 1120|      1|                error_message,                                 \
  |  | 1121|      1|                keyword);                                      \
  |  | 1122|      1|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 1]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      1|        break;                                                 \
  |  | 1134|      1|    }
  ------------------
 1865|    331|        CHECK_COND_OR_FAIL(ll > 0 && ll < 16, "RekeyLimit too small");
  ------------------
  |  | 1116|    448|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:10): [True: 117, False: 214]
  |  |  |  Branch (1116:10): [True: 94, False: 23]
  |  |  ------------------
  |  | 1117|     94|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     94|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     94|                "line %d: %s: %s",                             \
  |  | 1119|     94|                count,                                         \
  |  | 1120|     94|                error_message,                                 \
  |  | 1121|     94|                keyword);                                      \
  |  | 1122|     94|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 94]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     94|        break;                                                 \
  |  | 1134|     94|    }
  ------------------
 1866|    237|        if (*parsing) {
  ------------------
  |  Branch (1866:13): [True: 14, False: 223]
  ------------------
 1867|     14|            uint64_t v = (uint64_t)ll;
 1868|     14|            ssh_options_set(session, SSH_OPTIONS_REKEY_DATA, &v);
 1869|     14|        }
 1870|       |        /* Parse the time limit */
 1871|    237|        p = ssh_config_get_str_tok(&s, NULL);
 1872|    237|        if (p == NULL) {
  ------------------
  |  Branch (1872:13): [True: 2, False: 235]
  ------------------
 1873|      2|            break;
 1874|    235|        } else if (strcmp(p, "none") == 0) {
  ------------------
  |  Branch (1874:20): [True: 0, False: 235]
  ------------------
 1875|      0|            ll = 0;
 1876|    235|        } else {
 1877|    235|            char *endp = NULL;
 1878|    235|            ll = strtoll(p, &endp, 10);
 1879|    235|            if (p == endp || ll < 0) {
  ------------------
  |  Branch (1879:17): [True: 1, False: 234]
  |  Branch (1879:30): [True: 38, False: 196]
  ------------------
 1880|       |                /* No number or negative */
 1881|     39|                CHECK_COND_OR_FAIL(1, "Invalid time limit");
  ------------------
  |  | 1116|     39|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 39, Folded]
  |  |  ------------------
  |  | 1117|     39|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     39|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     39|                "line %d: %s: %s",                             \
  |  | 1119|     39|                count,                                         \
  |  | 1120|     39|                error_message,                                 \
  |  | 1121|     39|                keyword);                                      \
  |  | 1122|     39|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 39]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     39|        break;                                                 \
  |  | 1134|     39|    }
  ------------------
 1882|      0|                break;
 1883|     39|            }
 1884|    196|            switch (*endp) {
 1885|     31|            case 'w':
  ------------------
  |  Branch (1885:13): [True: 31, False: 165]
  ------------------
 1886|     31|            case 'W':
  ------------------
  |  Branch (1886:13): [True: 0, False: 196]
  ------------------
 1887|     31|                if (ll > LLONG_MAX / 7) {
  ------------------
  |  Branch (1887:21): [True: 30, False: 1]
  ------------------
 1888|     30|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  281|     30|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1889|     30|                    ll = -1;
 1890|     30|                    break;
 1891|     30|                }
 1892|      1|                ll = ll * 7;
 1893|      1|                FALL_THROUGH;
  ------------------
  |  |  494|      1|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1894|      6|            case 'd':
  ------------------
  |  Branch (1894:13): [True: 5, False: 191]
  ------------------
 1895|     16|            case 'D':
  ------------------
  |  Branch (1895:13): [True: 10, False: 186]
  ------------------
 1896|     16|                if (ll > LLONG_MAX / 24) {
  ------------------
  |  Branch (1896:21): [True: 16, False: 0]
  ------------------
 1897|     16|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  281|     16|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1898|     16|                    ll = -1;
 1899|     16|                    break;
 1900|     16|                }
 1901|      0|                ll = ll * 24;
 1902|      0|                FALL_THROUGH;
  ------------------
  |  |  494|      0|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1903|      3|            case 'h':
  ------------------
  |  Branch (1903:13): [True: 3, False: 193]
  ------------------
 1904|      3|            case 'H':
  ------------------
  |  Branch (1904:13): [True: 0, False: 196]
  ------------------
 1905|      3|                if (ll > LLONG_MAX / 60) {
  ------------------
  |  Branch (1905:21): [True: 0, False: 3]
  ------------------
 1906|      0|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1907|      0|                    ll = -1;
 1908|      0|                    break;
 1909|      0|                }
 1910|      3|                ll = ll * 60;
 1911|      3|                FALL_THROUGH;
  ------------------
  |  |  494|      3|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1912|     30|            case 'm':
  ------------------
  |  Branch (1912:13): [True: 27, False: 169]
  ------------------
 1913|     35|            case 'M':
  ------------------
  |  Branch (1913:13): [True: 5, False: 191]
  ------------------
 1914|     35|                if (ll > LLONG_MAX / 60) {
  ------------------
  |  Branch (1914:21): [True: 10, False: 25]
  ------------------
 1915|     10|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  281|     10|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1916|     10|                    ll = -1;
 1917|     10|                    break;
 1918|     10|                }
 1919|     25|                ll = ll * 60;
 1920|     25|                FALL_THROUGH;
  ------------------
  |  |  494|     25|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1921|     25|            case 's':
  ------------------
  |  Branch (1921:13): [True: 0, False: 196]
  ------------------
 1922|     55|            case 'S':
  ------------------
  |  Branch (1922:13): [True: 30, False: 166]
  ------------------
 1923|     55|                endp++;
 1924|     55|                FALL_THROUGH;
  ------------------
  |  |  494|     55|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1925|     84|            case '\0':
  ------------------
  |  Branch (1925:13): [True: 29, False: 167]
  ------------------
 1926|       |                /* just the number */
 1927|     84|                break;
 1928|     56|            default:
  ------------------
  |  Branch (1928:13): [True: 56, False: 140]
  ------------------
 1929|       |                /* Ignore invalid suffix and trailing garbage */
 1930|     56|                SSH_LOG(SSH_LOG_TRACE, "Ignoring invalid suffix");
  ------------------
  |  |  281|     56|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1931|     56|                break;
 1932|    196|            }
 1933|    196|        }
 1934|    196|        CHECK_COND_OR_FAIL(ll < 0, "Invalid time limit");
  ------------------
  |  | 1116|    196|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 56, False: 140]
  |  |  ------------------
  |  | 1117|     56|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     56|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     56|                "line %d: %s: %s",                             \
  |  | 1119|     56|                count,                                         \
  |  | 1120|     56|                error_message,                                 \
  |  | 1121|     56|                keyword);                                      \
  |  | 1122|     56|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 56]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     56|        break;                                                 \
  |  | 1134|     56|    }
  ------------------
 1935|    140|        if (ll > -1 && *parsing) {
  ------------------
  |  Branch (1935:13): [True: 140, False: 0]
  |  Branch (1935:24): [True: 4, False: 136]
  ------------------
 1936|      4|            uint32_t v = (uint32_t)ll;
 1937|      4|            ssh_options_set(session, SSH_OPTIONS_REKEY_TIME, &v);
 1938|      4|        }
 1939|    140|        break;
 1940|     19|    case SOC_GSSAPIAUTHENTICATION:
  ------------------
  |  Branch (1940:5): [True: 19, False: 312k]
  ------------------
 1941|     33|    case SOC_KBDINTERACTIVEAUTHENTICATION:
  ------------------
  |  Branch (1941:5): [True: 14, False: 312k]
  ------------------
 1942|     37|    case SOC_PASSWORDAUTHENTICATION: {
  ------------------
  |  Branch (1942:5): [True: 4, False: 312k]
  ------------------
 1943|     37|        enum ssh_options_e option = ssh_config_get_auth_option(opcode);
 1944|     37|        i = ssh_config_get_yesno(&s, -1);
 1945|       |
 1946|     37|        CHECK_COND_OR_FAIL(i < 0, "Authentication option");
  ------------------
  |  | 1116|     37|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 37, False: 0]
  |  |  ------------------
  |  | 1117|     37|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     37|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     37|                "line %d: %s: %s",                             \
  |  | 1119|     37|                count,                                         \
  |  | 1120|     37|                error_message,                                 \
  |  | 1121|     37|                keyword);                                      \
  |  | 1122|     37|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 37]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     37|        break;                                                 \
  |  | 1134|     37|    }
  ------------------
 1947|      0|        if (*parsing) {
  ------------------
  |  Branch (1947:13): [True: 0, False: 0]
  ------------------
 1948|      0|            ssh_options_set(session, option, &i);
 1949|      0|        }
 1950|      0|        break;
 1951|     37|    }
 1952|      4|    case SOC_PUBKEYAUTHENTICATION: {
  ------------------
  |  Branch (1952:5): [True: 4, False: 312k]
  ------------------
 1953|      4|        i = ssh_config_get_pubkey_auth(&s, -1);
 1954|      4|        CHECK_COND_OR_FAIL(i < 0, "Authentication option");
  ------------------
  |  | 1116|      4|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 4, False: 0]
  |  |  ------------------
  |  | 1117|      4|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      4|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      4|                "line %d: %s: %s",                             \
  |  | 1119|      4|                count,                                         \
  |  | 1120|      4|                error_message,                                 \
  |  | 1121|      4|                keyword);                                      \
  |  | 1122|      4|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 4]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      4|        break;                                                 \
  |  | 1134|      4|    }
  ------------------
 1955|      0|        if (*parsing) {
  ------------------
  |  Branch (1955:13): [True: 0, False: 0]
  ------------------
 1956|      0|            ssh_options_set(session, SSH_OPTIONS_PUBKEY_AUTH, &i);
 1957|      0|        }
 1958|      0|        break;
 1959|      4|    }
 1960|     55|    case SOC_NA:
  ------------------
  |  Branch (1960:5): [True: 55, False: 312k]
  ------------------
 1961|     55|        CHECK_COND_OR_FAIL(1, "Unapplicable option");
  ------------------
  |  | 1116|     55|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 55, Folded]
  |  |  ------------------
  |  | 1117|     55|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     55|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     55|                "line %d: %s: %s",                             \
  |  | 1119|     55|                count,                                         \
  |  | 1120|     55|                error_message,                                 \
  |  | 1121|     55|                keyword);                                      \
  |  | 1122|     55|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 55]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     55|        break;                                                 \
  |  | 1134|     55|    }
  ------------------
 1962|      0|        break;
 1963|      0|    case SOC_UNSUPPORTED:
  ------------------
  |  Branch (1963:5): [True: 0, False: 312k]
  ------------------
 1964|      0|        CHECK_COND_OR_FAIL(1, "Unsupported option");
  ------------------
  |  | 1116|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, Folded]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1965|      0|        break;
 1966|   307k|    case SOC_UNKNOWN:
  ------------------
  |  Branch (1966:5): [True: 307k, False: 4.91k]
  ------------------
 1967|   307k|        CHECK_COND_OR_FAIL(1, "Unknown option");
  ------------------
  |  | 1116|   307k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 307k, Folded]
  |  |  ------------------
  |  | 1117|   307k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|   307k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|   307k|                "line %d: %s: %s",                             \
  |  | 1119|   307k|                count,                                         \
  |  | 1120|   307k|                error_message,                                 \
  |  | 1121|   307k|                keyword);                                      \
  |  | 1122|   307k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 307k]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|   307k|        break;                                                 \
  |  | 1134|   307k|    }
  ------------------
 1968|      0|        break;
 1969|     15|    case SOC_IDENTITYAGENT:
  ------------------
  |  Branch (1969:5): [True: 15, False: 312k]
  ------------------
 1970|     15|      p = ssh_config_get_str_tok(&s, NULL);
 1971|     15|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|     15|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 14, False: 1]
  |  |  ------------------
  |  | 1117|     14|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     14|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     14|                "line %d: %s: %s",                             \
  |  | 1119|     14|                count,                                         \
  |  | 1120|     14|                error_message,                                 \
  |  | 1121|     14|                keyword);                                      \
  |  | 1122|     14|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 14]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     14|        break;                                                 \
  |  | 1134|     14|    }
  ------------------
 1972|      1|      if (*parsing) {
  ------------------
  |  Branch (1972:11): [True: 1, False: 0]
  ------------------
 1973|      1|          ssh_options_set(session, SSH_OPTIONS_IDENTITY_AGENT, p);
 1974|      1|      }
 1975|      1|      break;
 1976|     37|    case SOC_IDENTITIESONLY:
  ------------------
  |  Branch (1976:5): [True: 37, False: 312k]
  ------------------
 1977|     37|      i = ssh_config_get_yesno(&s, -1);
 1978|     37|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1116|     37|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 37, False: 0]
  |  |  ------------------
  |  | 1117|     37|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|     37|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|     37|                "line %d: %s: %s",                             \
  |  | 1119|     37|                count,                                         \
  |  | 1120|     37|                error_message,                                 \
  |  | 1121|     37|                keyword);                                      \
  |  | 1122|     37|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 37]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|     37|        break;                                                 \
  |  | 1134|     37|    }
  ------------------
 1979|      0|      if (*parsing) {
  ------------------
  |  Branch (1979:11): [True: 0, False: 0]
  ------------------
 1980|      0|          bool b = i;
 1981|      0|          ssh_options_set(session, SSH_OPTIONS_IDENTITIES_ONLY, &b);
 1982|      0|      }
 1983|      0|      break;
 1984|      0|    case SOC_BATCHMODE:
  ------------------
  |  Branch (1984:5): [True: 0, False: 312k]
  ------------------
 1985|      0|        i = ssh_config_get_yesno(&s, -1);
 1986|      0|        CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1116|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1987|      0|        if (*parsing) {
  ------------------
  |  Branch (1987:13): [True: 0, False: 0]
  ------------------
 1988|      0|            bool b = i;
 1989|      0|            ssh_options_set(session, SSH_OPTIONS_BATCH_MODE, &b);
 1990|      0|        }
 1991|      0|        break;
 1992|      0|    case SOC_CONTROLMASTER:
  ------------------
  |  Branch (1992:5): [True: 0, False: 312k]
  ------------------
 1993|      0|      p = ssh_config_get_str_tok(&s, NULL);
 1994|      0|      CHECK_COND_OR_FAIL(p == NULL, "ControlMaster");
  ------------------
  |  | 1116|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 1995|      0|      if (*parsing) {
  ------------------
  |  Branch (1995:11): [True: 0, False: 0]
  ------------------
 1996|      0|          int value = -1;
 1997|       |
 1998|      0|          if (strcasecmp(p, "auto") == 0) {
  ------------------
  |  Branch (1998:15): [True: 0, False: 0]
  ------------------
 1999|      0|              value = SSH_CONTROL_MASTER_AUTO;
 2000|      0|          } else if (strcasecmp(p, "yes") == 0) {
  ------------------
  |  Branch (2000:22): [True: 0, False: 0]
  ------------------
 2001|      0|              value = SSH_CONTROL_MASTER_YES;
 2002|      0|          } else if (strcasecmp(p, "no") == 0) {
  ------------------
  |  Branch (2002:22): [True: 0, False: 0]
  ------------------
 2003|      0|              value = SSH_CONTROL_MASTER_NO;
 2004|      0|          } else if (strcasecmp(p, "autoask") == 0) {
  ------------------
  |  Branch (2004:22): [True: 0, False: 0]
  ------------------
 2005|      0|              value = SSH_CONTROL_MASTER_AUTOASK;
 2006|      0|          } else if (strcasecmp(p, "ask") == 0) {
  ------------------
  |  Branch (2006:22): [True: 0, False: 0]
  ------------------
 2007|      0|              value = SSH_CONTROL_MASTER_ASK;
 2008|      0|          }
 2009|       |
 2010|      0|          CHECK_COND_OR_FAIL(value == -1, "Invalid argument");
  ------------------
  |  | 1116|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1117|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      0|                "line %d: %s: %s",                             \
  |  | 1119|      0|                count,                                         \
  |  | 1120|      0|                error_message,                                 \
  |  | 1121|      0|                keyword);                                      \
  |  | 1122|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      0|        break;                                                 \
  |  | 1134|      0|    }
  ------------------
 2011|      0|          if (value != -1) {
  ------------------
  |  Branch (2011:15): [True: 0, False: 0]
  ------------------
 2012|      0|              ssh_options_set(session, SSH_OPTIONS_CONTROL_MASTER, &value);
 2013|      0|          }
 2014|      0|      }
 2015|      0|      break;
 2016|      0|    case SOC_CONTROLPATH:
  ------------------
  |  Branch (2016:5): [True: 0, False: 312k]
  ------------------
 2017|      0|      p = ssh_config_get_str_tok(&s, NULL);
 2018|      0|      if (p == NULL) {
  ------------------
  |  Branch (2018:11): [True: 0, False: 0]
  ------------------
 2019|      0|        SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2020|      0|        return -1;
 2021|      0|      }
 2022|      0|      if (*parsing) {
  ------------------
  |  Branch (2022:11): [True: 0, False: 0]
  ------------------
 2023|      0|          ssh_options_set(session, SSH_OPTIONS_CONTROL_PATH, p);
 2024|      0|      }
 2025|      0|      break;
 2026|  1.60k|    case SOC_CERTIFICATE:
  ------------------
  |  Branch (2026:5): [True: 1.60k, False: 311k]
  ------------------
 2027|  1.60k|        p = ssh_config_get_str_tok(&s, NULL);
 2028|  1.60k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|  1.60k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 4, False: 1.60k]
  |  |  ------------------
  |  | 1117|      4|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      4|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      4|                "line %d: %s: %s",                             \
  |  | 1119|      4|                count,                                         \
  |  | 1120|      4|                error_message,                                 \
  |  | 1121|      4|                keyword);                                      \
  |  | 1122|      4|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 4]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      4|        break;                                                 \
  |  | 1134|      4|    }
  ------------------
 2029|  1.60k|        if (*parsing) {
  ------------------
  |  Branch (2029:13): [True: 1.60k, False: 4]
  ------------------
 2030|  1.60k|            ssh_options_set(session, SSH_OPTIONS_CERTIFICATE, p);
 2031|  1.60k|        }
 2032|  1.60k|        break;
 2033|      1|    case SOC_GSSAPIKEYEXCHANGE: {
  ------------------
  |  Branch (2033:5): [True: 1, False: 312k]
  ------------------
 2034|      1|        i = ssh_config_get_yesno(&s, -1);
 2035|      1|        CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1116|      1|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 1, False: 0]
  |  |  ------------------
  |  | 1117|      1|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      1|                "line %d: %s: %s",                             \
  |  | 1119|      1|                count,                                         \
  |  | 1120|      1|                error_message,                                 \
  |  | 1121|      1|                keyword);                                      \
  |  | 1122|      1|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 1]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      1|        break;                                                 \
  |  | 1134|      1|    }
  ------------------
 2036|      0|        if (*parsing) {
  ------------------
  |  Branch (2036:13): [True: 0, False: 0]
  ------------------
 2037|      0|            bool b = (i == 1) ? true : false;
  ------------------
  |  Branch (2037:22): [True: 0, False: 0]
  ------------------
 2038|      0|            ssh_options_set(session, SSH_OPTIONS_GSSAPI_KEY_EXCHANGE, &b);
 2039|      0|        }
 2040|      0|        break;
 2041|      1|    }
 2042|      3|    case SOC_GSSAPIKEXALGORITHMS:
  ------------------
  |  Branch (2042:5): [True: 3, False: 312k]
  ------------------
 2043|      3|        p = ssh_config_get_str_tok(&s, NULL);
 2044|      3|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1116|      3|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:9): [True: 2, False: 1]
  |  |  ------------------
  |  | 1117|      2|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      2|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      2|                "line %d: %s: %s",                             \
  |  | 1119|      2|                count,                                         \
  |  | 1120|      2|                error_message,                                 \
  |  | 1121|      2|                keyword);                                      \
  |  | 1122|      2|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 2]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      2|        break;                                                 \
  |  | 1134|      2|    }
  ------------------
 2045|      1|        if (*parsing) {
  ------------------
  |  Branch (2045:13): [True: 1, False: 0]
  ------------------
 2046|      1|            ssh_options_set(session, SSH_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS, p);
 2047|      1|        }
 2048|      1|        break;
 2049|      4|    case SOC_REQUIRED_RSA_SIZE:
  ------------------
  |  Branch (2049:5): [True: 4, False: 312k]
  ------------------
 2050|      4|        l = ssh_config_get_long(&s, -1);
 2051|      4|        CHECK_COND_OR_FAIL(l < 0 || l > INT_MAX, "Invalid argument");
  ------------------
  |  | 1116|      4|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1116:10): [True: 4, False: 0]
  |  |  |  Branch (1116:10): [True: 0, False: 0]
  |  |  ------------------
  |  | 1117|      4|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  281|      4|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1118|      4|                "line %d: %s: %s",                             \
  |  | 1119|      4|                count,                                         \
  |  | 1120|      4|                error_message,                                 \
  |  | 1121|      4|                keyword);                                      \
  |  | 1122|      4|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1122:13): [True: 0, False: 4]
  |  |  ------------------
  |  | 1123|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (311:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1124|      0|                          SSH_FATAL,                           \
  |  | 1125|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1126|      0|                                 : "%s '%s' value at line %d", \
  |  | 1127|      0|                          error_message,                       \
  |  | 1128|      0|                          keyword,                             \
  |  | 1129|      0|                          is_cli ? 0 : count);                 \
  |  | 1130|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1131|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1132|      0|        }                                                      \
  |  | 1133|      4|        break;                                                 \
  |  | 1134|      4|    }
  ------------------
 2052|      0|        if (*parsing) {
  ------------------
  |  Branch (2052:13): [True: 0, False: 0]
  ------------------
 2053|      0|            i = (int)l;
 2054|      0|            ssh_options_set(session, SSH_OPTIONS_RSA_MIN_SIZE, &i);
 2055|      0|        }
 2056|      0|        break;
 2057|      7|    case SOC_ADDRESSFAMILY:
  ------------------
  |  Branch (2057:5): [True: 7, False: 312k]
  ------------------
 2058|      7|        p = ssh_config_get_str_tok(&s, NULL);
 2059|      7|        if (p == NULL) {
  ------------------
  |  Branch (2059:13): [True: 0, False: 7]
  ------------------
 2060|      0|            SSH_LOG(SSH_LOG_WARNING,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2061|      0|                    "line %d: no argument after keyword \"addressfamily\"",
 2062|      0|                    count);
 2063|      0|            SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2064|      0|            return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2065|      0|        }
 2066|      7|        if (*parsing) {
  ------------------
  |  Branch (2066:13): [True: 7, False: 0]
  ------------------
 2067|      7|            int value = -1;
 2068|       |
 2069|      7|            if (strcasecmp(p, "any") == 0) {
  ------------------
  |  Branch (2069:17): [True: 0, False: 7]
  ------------------
 2070|      0|                value = SSH_ADDRESS_FAMILY_ANY;
 2071|      7|            } else if (strcasecmp(p, "inet") == 0) {
  ------------------
  |  Branch (2071:24): [True: 0, False: 7]
  ------------------
 2072|      0|                value = SSH_ADDRESS_FAMILY_INET;
 2073|      7|            } else if (strcasecmp(p, "inet6") == 0) {
  ------------------
  |  Branch (2073:24): [True: 0, False: 7]
  ------------------
 2074|      0|                value = SSH_ADDRESS_FAMILY_INET6;
 2075|      7|            } else {
 2076|      7|                SSH_LOG(SSH_LOG_WARNING,
  ------------------
  |  |  281|      7|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2077|      7|                        "line %d: invalid argument \"%s\"",
 2078|      7|                        count,
 2079|      7|                        p);
 2080|      7|                SAFE_FREE(x);
  ------------------
  |  |  373|      7|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 7, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 7]
  |  |  ------------------
  ------------------
 2081|      7|                return SSH_ERROR;
  ------------------
  |  |  317|      7|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2082|      7|            }
 2083|      0|            ssh_options_set(session, SSH_OPTIONS_ADDRESS_FAMILY, &value);
 2084|      0|        }
 2085|      0|        break;
 2086|      0|    default:
  ------------------
  |  Branch (2086:5): [True: 0, False: 312k]
  ------------------
 2087|      0|      ssh_set_error(session, SSH_FATAL, "ERROR - unimplemented opcode: %d",
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 2088|      0|              opcode);
 2089|      0|      SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2090|      0|      return -1;
 2091|      0|      break;
 2092|   312k|  }
 2093|       |
 2094|   312k|  SAFE_FREE(x);
  ------------------
  |  |  373|   312k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 312k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 312k]
  |  |  ------------------
  ------------------
 2095|   312k|  return 0;
 2096|   312k|}
config.c:ssh_config_make_absolute:
  797|    595|{
  798|    595|    size_t outlen = 0;
  799|    595|    char *out = NULL;
  800|    595|    int rv;
  801|       |
  802|       |    /* Looks like absolute path */
  803|    595|    if (path[0] == '/') {
  ------------------
  |  Branch (803:9): [True: 104, False: 491]
  ------------------
  804|    104|        return strdup(path);
  805|    104|    }
  806|       |
  807|       |    /* relative path */
  808|    491|    if (global) {
  ------------------
  |  Branch (808:9): [True: 0, False: 491]
  ------------------
  809|       |        /* Parsing global config */
  810|      0|        outlen = strlen(path) + strlen("/etc/ssh/") + 1;
  811|      0|        out = malloc(outlen);
  812|      0|        if (out == NULL) {
  ------------------
  |  Branch (812:13): [True: 0, False: 0]
  ------------------
  813|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  814|      0|            return NULL;
  815|      0|        }
  816|      0|        rv = snprintf(out, outlen, "/etc/ssh/%s", path);
  817|      0|        if (rv < 1) {
  ------------------
  |  Branch (817:13): [True: 0, False: 0]
  ------------------
  818|      0|            free(out);
  819|      0|            return NULL;
  820|      0|        }
  821|      0|        return out;
  822|      0|    }
  823|       |
  824|       |    /* paths starting with tilde are already absolute */
  825|    491|    if (path[0] == '~') {
  ------------------
  |  Branch (825:9): [True: 459, False: 32]
  ------------------
  826|    459|        return ssh_path_expand_tilde(path);
  827|    459|    }
  828|       |
  829|       |    /* Parsing user config relative to home directory (generally ~/.ssh) */
  830|     32|    if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (830:9): [True: 0, False: 32]
  ------------------
  831|      0|        ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  832|      0|        return NULL;
  833|      0|    }
  834|     32|    outlen = strlen(path) + strlen(session->opts.sshdir) + 1 + 1;
  835|     32|    out = malloc(outlen);
  836|     32|    if (out == NULL) {
  ------------------
  |  Branch (836:9): [True: 0, False: 32]
  ------------------
  837|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  838|      0|        return NULL;
  839|      0|    }
  840|     32|    rv = snprintf(out, outlen, "%s/%s", session->opts.sshdir, path);
  841|     32|    if (rv < 1) {
  ------------------
  |  Branch (841:9): [True: 0, False: 32]
  ------------------
  842|      0|        free(out);
  843|      0|        return NULL;
  844|      0|    }
  845|     32|    return out;
  846|     32|}
config.c:local_parse_glob:
  292|    586|{
  293|    586|    glob_t globbuf = {
  294|    586|        .gl_flags = 0,
  295|    586|    };
  296|    586|    int rt;
  297|    586|    size_t i;
  298|       |
  299|    586|    rt = glob(fileglob, GLOB_TILDE, NULL, &globbuf);
  300|    586|    if (rt == GLOB_NOMATCH) {
  ------------------
  |  Branch (300:9): [True: 518, False: 68]
  ------------------
  301|    518|        globfree(&globbuf);
  302|    518|        return;
  303|    518|    } else if (rt != 0) {
  ------------------
  |  Branch (303:16): [True: 0, False: 68]
  ------------------
  304|      0|        SSH_LOG(SSH_LOG_RARE, "Glob error: %s",
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  305|      0|                fileglob);
  306|      0|        globfree(&globbuf);
  307|      0|        return;
  308|      0|    }
  309|       |
  310|  19.9k|    for (i = 0; i < globbuf.gl_pathc; i++) {
  ------------------
  |  Branch (310:17): [True: 19.9k, False: 68]
  ------------------
  311|  19.9k|        local_parse_file(session, globbuf.gl_pathv[i], parsing, depth, global);
  312|  19.9k|    }
  313|       |
  314|     68|    globfree(&globbuf);
  315|     68|}
config.c:local_parse_file:
  251|  19.9k|{
  252|  19.9k|    FILE *f = NULL;
  253|  19.9k|    char line[MAX_LINE_SIZE] = {0};
  254|  19.9k|    unsigned int count = 0;
  255|  19.9k|    int rv;
  256|       |
  257|  19.9k|    if (depth > LIBSSH_CONF_MAX_DEPTH) {
  ------------------
  |  |  244|  19.9k|#define LIBSSH_CONF_MAX_DEPTH 16
  ------------------
  |  Branch (257:9): [True: 0, False: 19.9k]
  ------------------
  258|      0|        ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  259|      0|                      "ERROR - Too many levels of configuration includes "
  260|      0|                      "when processing file '%s'", filename);
  261|      0|        return;
  262|      0|    }
  263|       |
  264|  19.9k|    f = ssh_strict_fopen(filename, SSH_MAX_CONFIG_FILE_SIZE);
  ------------------
  |  |  528|  19.9k|#define SSH_MAX_CONFIG_FILE_SIZE 16 * 1024 * 1024
  ------------------
  265|  19.9k|    if (f == NULL) {
  ------------------
  |  Branch (265:9): [True: 19.6k, False: 289]
  ------------------
  266|  19.6k|        SSH_LOG(SSH_LOG_RARE,
  ------------------
  |  |  281|  19.6k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  267|  19.6k|                "Failed to open included configuration file %s",
  268|  19.6k|                filename);
  269|  19.6k|        return;
  270|  19.6k|    }
  271|       |
  272|    289|    SSH_LOG(SSH_LOG_PACKET, "Reading additional configuration data from %s", filename);
  ------------------
  |  |  281|    289|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  273|   389k|    while (fgets(line, sizeof(line), f)) {
  ------------------
  |  Branch (273:12): [True: 389k, False: 289]
  ------------------
  274|   389k|        count++;
  275|   389k|        rv = ssh_config_parse_line(session, line, count, parsing, depth, global);
  276|   389k|        if (rv < 0) {
  ------------------
  |  Branch (276:13): [True: 0, False: 389k]
  ------------------
  277|      0|            fclose(f);
  278|      0|            return;
  279|      0|        }
  280|   389k|    }
  281|       |
  282|    289|    fclose(f);
  283|    289|    return;
  284|    289|}
config.c:ssh_config_get_match_opcode:
  320|    961|{
  321|    961|    size_t i;
  322|       |
  323|  8.96k|    for (i = 0; ssh_config_match_keyword_table[i].name != NULL; i++) {
  ------------------
  |  Branch (323:17): [True: 8.36k, False: 597]
  ------------------
  324|  8.36k|        if (strcasecmp(keyword, ssh_config_match_keyword_table[i].name) == 0) {
  ------------------
  |  Branch (324:13): [True: 364, False: 8.00k]
  ------------------
  325|    364|            return ssh_config_match_keyword_table[i].opcode;
  326|    364|        }
  327|  8.36k|    }
  328|       |
  329|    597|    return MATCH_UNKNOWN;
  330|    961|}
config.c:ssh_config_match:
  363|    239|{
  364|    239|    int ok, result = 0;
  365|       |
  366|    239|    ok = match_pattern_list(value, pattern, strlen(pattern), 0);
  367|    239|    result = ssh_config_match_result(ok, negate);
  368|    239|    SSH_LOG(SSH_LOG_TRACE, "%s '%s' against pattern '%s'%s (ok=%d)",
  ------------------
  |  |  281|    956|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (281:34): [True: 55, False: 184]
  |  |  |  Branch (281:34): [True: 9, False: 230]
  |  |  ------------------
  ------------------
  369|    239|            result == 1 ? "Matched" : "Not matched", value, pattern,
  370|    239|            negate == true ? " (negated)" : "", ok);
  371|    239|    return result;
  372|    239|}
config.c:ssh_config_match_result:
  342|    239|{
  343|    239|    if (ok <= 0 && negate == true) {
  ------------------
  |  Branch (343:9): [True: 175, False: 64]
  |  Branch (343:20): [True: 0, False: 175]
  ------------------
  344|      0|        return 1;
  345|      0|    }
  346|    239|    if (ok > 0 && negate == false) {
  ------------------
  |  Branch (346:9): [True: 64, False: 175]
  |  Branch (346:19): [True: 55, False: 9]
  ------------------
  347|     55|        return 1;
  348|     55|    }
  349|       |
  350|    184|    return 0;
  351|    239|}
config.c:ssh_config_scan_hostname_tokens:
  546|    122|{
  547|    122|    const char *p = NULL;
  548|       |
  549|    122|    if (needs_host != NULL) {
  ------------------
  |  Branch (549:9): [True: 122, False: 0]
  ------------------
  550|    122|        *needs_host = false;
  551|    122|    }
  552|    122|    if (has_unknown != NULL) {
  ------------------
  |  Branch (552:9): [True: 122, False: 0]
  ------------------
  553|    122|        *has_unknown = false;
  554|    122|    }
  555|       |
  556|    122|    if (hostname == NULL) {
  ------------------
  |  Branch (556:9): [True: 0, False: 122]
  ------------------
  557|      0|        ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  558|      0|                      SSH_FATAL,
  559|      0|                      "Cannot scan HostName tokens from NULL input");
  560|      0|        return -1;
  561|      0|    }
  562|       |
  563|  17.0k|    for (p = hostname; *p != '\0'; p++) {
  ------------------
  |  Branch (563:24): [True: 16.9k, False: 118]
  ------------------
  564|  16.9k|        if (*p == '%') {
  ------------------
  |  Branch (564:13): [True: 4.06k, False: 12.8k]
  ------------------
  565|  4.06k|            if (p[1] == '\0') {
  ------------------
  |  Branch (565:17): [True: 4, False: 4.06k]
  ------------------
  566|      4|                ssh_set_error(session, SSH_FATAL, "Incomplete Hostname token");
  ------------------
  |  |  311|      4|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  567|      4|                return -1;
  568|      4|            }
  569|  4.06k|            switch (p[1]) {
  570|    525|            case '%':
  ------------------
  |  Branch (570:13): [True: 525, False: 3.53k]
  ------------------
  571|    525|                p++;
  572|    525|                continue;
  573|    501|            case 'h':
  ------------------
  |  Branch (573:13): [True: 501, False: 3.56k]
  ------------------
  574|    501|                if (needs_host != NULL) {
  ------------------
  |  Branch (574:21): [True: 501, False: 0]
  ------------------
  575|    501|                    *needs_host = true;
  576|    501|                }
  577|    501|                p++;
  578|    501|                continue;
  579|  3.03k|            default:
  ------------------
  |  Branch (579:13): [True: 3.03k, False: 1.02k]
  ------------------
  580|  3.03k|                if (has_unknown != NULL) {
  ------------------
  |  Branch (580:21): [True: 3.03k, False: 0]
  ------------------
  581|  3.03k|                    *has_unknown = true;
  582|  3.03k|                }
  583|  3.03k|                p++;
  584|  3.03k|                continue;
  585|  4.06k|            }
  586|  4.06k|        }
  587|  16.9k|    }
  588|       |
  589|    118|    return 0;
  590|    122|}
config.c:ssh_config_lowercase_hostname_pattern:
  593|     89|{
  594|     89|    char *pattern = NULL;
  595|     89|    char *p = NULL;
  596|     89|    bool escape = false;
  597|       |
  598|     89|    if (hostname == NULL) {
  ------------------
  |  Branch (598:9): [True: 0, False: 89]
  ------------------
  599|      0|        return NULL;
  600|      0|    }
  601|       |
  602|     89|    pattern = strdup(hostname);
  603|     89|    if (pattern == NULL) {
  ------------------
  |  Branch (603:9): [True: 0, False: 89]
  ------------------
  604|      0|        return NULL;
  605|      0|    }
  606|       |
  607|  17.6k|    for (p = pattern; *p != '\0'; p++) {
  ------------------
  |  Branch (607:23): [True: 17.5k, False: 89]
  ------------------
  608|  17.5k|        if (escape) {
  ------------------
  |  Branch (608:13): [True: 3.33k, False: 14.2k]
  ------------------
  609|  3.33k|            escape = false;
  610|  3.33k|            continue;
  611|  3.33k|        }
  612|  14.2k|        if (*p == '%') {
  ------------------
  |  Branch (612:13): [True: 3.33k, False: 10.8k]
  ------------------
  613|  3.33k|            escape = true;
  614|  3.33k|            continue;
  615|  3.33k|        }
  616|  10.8k|        *p = tolower((unsigned char)*p);
  ------------------
  |  Branch (616:14): [True: 0, False: 0]
  |  Branch (616:14): [True: 0, False: 0]
  |  Branch (616:14): [Folded, False: 10.8k]
  ------------------
  617|  10.8k|    }
  618|       |
  619|     89|    return pattern;
  620|     89|}
config.c:ssh_config_get_token_value:
 1054|     74|{
 1055|     74|    const char *p = NULL;
 1056|     74|    size_t i;
 1057|       |
 1058|     74|    p = ssh_config_get_str_tok(str, NULL);
 1059|     74|    if (p == NULL) {
  ------------------
  |  Branch (1059:9): [True: 2, False: 72]
  ------------------
 1060|      2|        return notfound;
 1061|      2|    }
 1062|       |
 1063|    539|    for (i = 0; map[i].token != NULL; i++) {
  ------------------
  |  Branch (1063:17): [True: 467, False: 72]
  ------------------
 1064|    467|        if (strcasecmp(p, map[i].token) == 0) {
  ------------------
  |  Branch (1064:13): [True: 0, False: 467]
  ------------------
 1065|      0|            return map[i].value;
 1066|      0|        }
 1067|    467|    }
 1068|       |
 1069|     72|    return notfound;
 1070|     72|}
config.c:ssh_config_convtime:
  983|      2|{
  984|      2|    char *endp = NULL;
  985|      2|    long total = 0;
  986|      2|    long value;
  987|      2|    long multiplier;
  988|       |
  989|      2|    if (p == NULL || *p == '\0') {
  ------------------
  |  Branch (989:9): [True: 0, False: 2]
  |  Branch (989:22): [True: 0, False: 2]
  ------------------
  990|      0|        return notfound;
  991|      0|    }
  992|       |
  993|      2|    while (*p != '\0') {
  ------------------
  |  Branch (993:12): [True: 2, False: 0]
  ------------------
  994|      2|        errno = 0;
  995|      2|        value = strtol(p, &endp, 10);
  996|      2|        if (p == endp || errno != 0 || value < 0) {
  ------------------
  |  Branch (996:13): [True: 1, False: 1]
  |  Branch (996:26): [True: 0, False: 1]
  |  Branch (996:40): [True: 1, False: 0]
  ------------------
  997|      2|            return notfound;
  998|      2|        }
  999|       |
 1000|      0|        switch (*endp) {
 1001|      0|        case '\0':
  ------------------
  |  Branch (1001:9): [True: 0, False: 0]
  ------------------
 1002|      0|        case 's':
  ------------------
  |  Branch (1002:9): [True: 0, False: 0]
  ------------------
 1003|      0|        case 'S':
  ------------------
  |  Branch (1003:9): [True: 0, False: 0]
  ------------------
 1004|      0|            multiplier = 1;
 1005|      0|            break;
 1006|      0|        case 'm':
  ------------------
  |  Branch (1006:9): [True: 0, False: 0]
  ------------------
 1007|      0|        case 'M':
  ------------------
  |  Branch (1007:9): [True: 0, False: 0]
  ------------------
 1008|      0|            multiplier = 60;
 1009|      0|            break;
 1010|      0|        case 'h':
  ------------------
  |  Branch (1010:9): [True: 0, False: 0]
  ------------------
 1011|      0|        case 'H':
  ------------------
  |  Branch (1011:9): [True: 0, False: 0]
  ------------------
 1012|      0|            multiplier = 60 * 60;
 1013|      0|            break;
 1014|      0|        case 'd':
  ------------------
  |  Branch (1014:9): [True: 0, False: 0]
  ------------------
 1015|      0|        case 'D':
  ------------------
  |  Branch (1015:9): [True: 0, False: 0]
  ------------------
 1016|      0|            multiplier = 24 * 60 * 60;
 1017|      0|            break;
 1018|      0|        case 'w':
  ------------------
  |  Branch (1018:9): [True: 0, False: 0]
  ------------------
 1019|      0|        case 'W':
  ------------------
  |  Branch (1019:9): [True: 0, False: 0]
  ------------------
 1020|      0|            multiplier = 7 * 24 * 60 * 60;
 1021|      0|            break;
 1022|      0|        default:
  ------------------
  |  Branch (1022:9): [True: 0, False: 0]
  ------------------
 1023|      0|            return notfound;
 1024|      0|        }
 1025|       |
 1026|       |        /*
 1027|       |         * OpenSSH accepts ConnectTimeout values only up to INT_MAX
 1028|       |         * seconds: see openssh-portable/misc.c:convtime().
 1029|       |         */
 1030|      0|        if (value > (INT_MAX - total) / multiplier) {
  ------------------
  |  Branch (1030:13): [True: 0, False: 0]
  ------------------
 1031|      0|            return notfound;
 1032|      0|        }
 1033|      0|        total += value * multiplier;
 1034|       |
 1035|      0|        if (*endp == '\0') {
  ------------------
  |  Branch (1035:13): [True: 0, False: 0]
  ------------------
 1036|      0|            p = endp;
 1037|      0|        } else {
 1038|      0|            p = endp + 1;
 1039|      0|        }
 1040|      0|    }
 1041|       |
 1042|      0|    return total;
 1043|      2|}
config.c:ssh_config_get_strict_hostkey:
 1086|     63|{
 1087|     63|    static const struct ssh_config_token_value_map strict_hostkey_map[] = {
 1088|     63|        {"yes", SSH_STRICT_HOSTKEY_YES},
 1089|     63|        {"true", SSH_STRICT_HOSTKEY_YES},
 1090|     63|        {"no", SSH_STRICT_HOSTKEY_OFF},
 1091|     63|        {"false", SSH_STRICT_HOSTKEY_OFF},
 1092|     63|        {"off", SSH_STRICT_HOSTKEY_OFF},
 1093|     63|        {"ask", SSH_STRICT_HOSTKEY_ASK},
 1094|     63|        {"accept-new", SSH_STRICT_HOSTKEY_ACCEPT_NEW},
 1095|     63|        {NULL, 0},
 1096|     63|    };
 1097|       |
 1098|     63|    return ssh_config_get_token_value(str, strict_hostkey_map, notfound);
 1099|     63|}
config.c:ssh_config_get_auth_option:
  943|     37|{
  944|     37|    struct auth_option_map {
  945|     37|        enum ssh_config_opcode_e opcode;
  946|     37|        const char *name;
  947|     37|        enum ssh_options_e option;
  948|     37|    };
  949|       |
  950|     37|    static struct auth_option_map auth_options[] = {
  951|     37|        {
  952|     37|            SOC_GSSAPIAUTHENTICATION,
  953|     37|            "GSSAPIAuthentication",
  954|     37|            SSH_OPTIONS_GSSAPI_AUTH,
  955|     37|        },
  956|     37|        {
  957|     37|            SOC_KBDINTERACTIVEAUTHENTICATION,
  958|     37|            "KbdInteractiveAuthentication",
  959|     37|            SSH_OPTIONS_KBDINT_AUTH,
  960|     37|        },
  961|     37|        {
  962|     37|            SOC_PASSWORDAUTHENTICATION,
  963|     37|            "PasswordAuthentication",
  964|     37|            SSH_OPTIONS_PASSWORD_AUTH,
  965|     37|        },
  966|     37|        {
  967|     37|            SOC_PUBKEYAUTHENTICATION,
  968|     37|            "PubkeyAuthentication",
  969|     37|            SSH_OPTIONS_PUBKEY_AUTH,
  970|     37|        },
  971|     37|        {0, NULL, 0},
  972|     37|    };
  973|       |
  974|     59|    for (struct auth_option_map *map = auth_options; map->name != NULL; map++) {
  ------------------
  |  Branch (974:54): [True: 59, False: 0]
  ------------------
  975|     59|        if (map->opcode == opcode) {
  ------------------
  |  Branch (975:13): [True: 37, False: 22]
  ------------------
  976|     37|            return map->option;
  977|     37|        }
  978|     59|    }
  979|      0|    return -1;
  980|     37|}
config.c:ssh_config_get_pubkey_auth:
 1102|      4|{
 1103|      4|    static const struct ssh_config_token_value_map pubkey_auth_map[] = {
 1104|      4|        {"yes", SSH_PUBKEY_AUTH_ALL},
 1105|      4|        {"true", SSH_PUBKEY_AUTH_ALL},
 1106|      4|        {"no", SSH_PUBKEY_AUTH_NO},
 1107|      4|        {"false", SSH_PUBKEY_AUTH_NO},
 1108|      4|        {"unbound", SSH_PUBKEY_AUTH_UNBOUND},
 1109|      4|        {"host-bound", SSH_PUBKEY_AUTH_HOST_BOUND},
 1110|      4|        {NULL, 0},
 1111|      4|    };
 1112|       |
 1113|      4|    return ssh_config_get_token_value(str, pubkey_auth_map, notfound);
 1114|      4|}

ssh_config_get_token_info:
   69|   333k|{
   70|   333k|    register char *c = NULL;
   71|       |    /* Write cursor for the normalized token. Quotes and selected escape
   72|       |     * characters are dropped while still returning a pointer into the original
   73|       |     * buffer.
   74|       |     */
   75|   333k|    char *dst = NULL;
   76|   333k|    bool had_equal = false;
   77|   333k|    bool found = false;
   78|   333k|    bool invalid = false;
   79|   333k|    char *r = NULL;
   80|       |
   81|   333k|    if (info != NULL) {
  ------------------
  |  Branch (81:9): [True: 1.55k, False: 331k]
  ------------------
   82|  1.55k|        info->found = false;
   83|  1.55k|        info->had_equal = false;
   84|  1.55k|        info->invalid = false;
   85|  1.55k|    }
   86|       |
   87|       |    /* Ignore leading spaces */
   88|   766k|    for (c = *str; *c; c++) {
  ------------------
  |  Branch (88:20): [True: 765k, False: 1.69k]
  ------------------
   89|   765k|        if (! isblank(*c)) {
  ------------------
  |  Branch (89:13): [True: 331k, False: 433k]
  ------------------
   90|   331k|            break;
   91|   331k|        }
   92|   765k|    }
   93|       |
   94|       |    /* End of string or a bare newline means there is no token here, not an
   95|       |     * explicit empty token (""). Keep found=false in both cases; the newline
   96|       |     * branch also consumes the line boundary.
   97|       |     */
   98|   333k|    if (*c == '\0') {
  ------------------
  |  Branch (98:9): [True: 1.69k, False: 331k]
  ------------------
   99|  1.69k|        r = c;
  100|  1.69k|        goto out;
  101|  1.69k|    }
  102|   331k|    if (*c == '\n') {
  ------------------
  |  Branch (102:9): [True: 7.69k, False: 323k]
  ------------------
  103|  7.69k|        r = c;
  104|  7.69k|        *c = '\0';
  105|  7.69k|        c++;
  106|  7.69k|        goto out;
  107|  7.69k|    }
  108|       |
  109|   323k|    found = true;
  110|       |
  111|       |    /* If we start with quote, return the whole quoted block */
  112|   323k|    if (*c == '\"') {
  ------------------
  |  Branch (112:9): [True: 2.12k, False: 321k]
  ------------------
  113|  2.12k|        bool closed_quote = false;
  114|       |
  115|  2.12k|        r = dst = ++c;
  116|  27.8k|        while (*c != '\0' && *c != '\n') {
  ------------------
  |  Branch (116:16): [True: 27.6k, False: 211]
  |  Branch (116:30): [True: 27.6k, False: 0]
  ------------------
  117|  27.6k|            if (*c == '\\' && c[1] == '\"') {
  ------------------
  |  Branch (117:17): [True: 941, False: 26.7k]
  |  Branch (117:31): [True: 0, False: 941]
  ------------------
  118|      0|                c++;
  119|  27.6k|            } else if (*c == '\"') {
  ------------------
  |  Branch (119:24): [True: 1.91k, False: 25.7k]
  ------------------
  120|  1.91k|                *dst = '\0';
  121|  1.91k|                c++;
  122|  1.91k|                closed_quote = true;
  123|  1.91k|                break;
  124|  1.91k|            }
  125|  25.7k|            *dst++ = *c++;
  126|  25.7k|        }
  127|  2.12k|        if (!closed_quote) {
  ------------------
  |  Branch (127:13): [True: 211, False: 1.91k]
  ------------------
  128|    211|            invalid = true;
  129|    211|            *dst = '\0';
  130|    211|            if (*c == '\n') {
  ------------------
  |  Branch (130:17): [True: 0, False: 211]
  ------------------
  131|      0|                c++;
  132|      0|            }
  133|    211|        }
  134|   321k|    } else {
  135|       |        /* Otherwise terminate on space, equal or newline */
  136|   321k|        r = dst = c;
  137|  4.05M|        for (; *c; c++) {
  ------------------
  |  Branch (137:16): [True: 3.88M, False: 167k]
  ------------------
  138|       |            /* Treat escaped whitespace outside quotes as part of the current
  139|       |             * token, e.g. "tag\ name". The backslash is dropped as the token
  140|       |             * is compacted in place through dst.
  141|       |             *
  142|       |             * Note: there is no general backslash escape; the quoted branch
  143|       |             * above only recognizes \", and this branch only recognizes
  144|       |             * \<blank>.
  145|       |             */
  146|  3.88M|            if (*c == '\\' && isblank((unsigned char)c[1])) {
  ------------------
  |  Branch (146:17): [True: 6.46k, False: 3.88M]
  |  Branch (146:31): [True: 15, False: 6.45k]
  ------------------
  147|     15|                c++;
  148|     15|                *dst++ = *c;
  149|  3.88M|            } else if (isblank((unsigned char)*c) || *c == '=' || *c == '\n') {
  ------------------
  |  Branch (149:24): [True: 149k, False: 3.73M]
  |  Branch (149:54): [True: 4.87k, False: 3.73M]
  |  Branch (149:67): [True: 0, False: 3.73M]
  ------------------
  150|   154k|                had_equal = (*c == '=');
  151|   154k|                *dst = '\0';
  152|   154k|                c++;
  153|   154k|                break;
  154|  3.73M|            } else {
  155|  3.73M|                *dst++ = *c;
  156|  3.73M|            }
  157|  3.88M|        }
  158|   321k|        if (*c == '\0') {
  ------------------
  |  Branch (158:13): [True: 167k, False: 153k]
  ------------------
  159|   167k|            *dst = '\0';
  160|   167k|        }
  161|   321k|    }
  162|       |
  163|       |    /* Skip any other remaining whitespace */
  164|   490k|    while (isblank((unsigned char)*c) || *c == '\n' ||
  ------------------
  |  Branch (164:12): [True: 158k, False: 332k]
  |  Branch (164:42): [True: 0, False: 332k]
  ------------------
  165|   332k|           (!had_equal && *c == '=')) {
  ------------------
  |  Branch (165:13): [True: 318k, False: 13.1k]
  |  Branch (165:27): [True: 8.25k, False: 310k]
  ------------------
  166|   166k|        if (*c == '=') {
  ------------------
  |  Branch (166:13): [True: 8.25k, False: 158k]
  ------------------
  167|  8.25k|            had_equal = true;
  168|  8.25k|        }
  169|   166k|        c++;
  170|   166k|    }
  171|   333k|out:
  172|   333k|    *str = c;
  173|   333k|    if (info != NULL) {
  ------------------
  |  Branch (173:9): [True: 1.55k, False: 331k]
  ------------------
  174|  1.55k|        info->found = found;
  175|  1.55k|        info->had_equal = had_equal;
  176|  1.55k|        info->invalid = invalid;
  177|  1.55k|    }
  178|   333k|    return r;
  179|   323k|}
ssh_config_get_token:
  182|   331k|{
  183|       |    return ssh_config_get_token_info(str, NULL);
  184|   331k|}
ssh_config_get_long:
  187|     29|{
  188|     29|    char *p = NULL, *endp = NULL;
  189|     29|    long i;
  190|       |
  191|     29|    p = ssh_config_get_token(str);
  192|     29|    if (p && *p) {
  ------------------
  |  Branch (192:9): [True: 29, False: 0]
  |  Branch (192:14): [True: 16, False: 13]
  ------------------
  193|     16|        i = strtol(p, &endp, 10);
  194|     16|        if (p == endp || *endp != '\0') {
  ------------------
  |  Branch (194:13): [True: 0, False: 16]
  |  Branch (194:26): [True: 15, False: 1]
  ------------------
  195|     15|            return notfound;
  196|     15|        }
  197|      1|        return i;
  198|     16|    }
  199|       |
  200|     13|    return notfound;
  201|     29|}
ssh_config_get_str_tok:
  204|  5.33k|{
  205|  5.33k|    char *p = NULL;
  206|       |
  207|  5.33k|    p = ssh_config_get_token(str);
  208|  5.33k|    if (p && *p) {
  ------------------
  |  Branch (208:9): [True: 5.33k, False: 0]
  |  Branch (208:14): [True: 4.91k, False: 416]
  ------------------
  209|  4.91k|        return p;
  210|  4.91k|    }
  211|       |
  212|    416|    return def;
  213|  5.33k|}
ssh_config_get_yesno:
  216|     75|{
  217|     75|    const char *p = NULL;
  218|       |
  219|     75|    p = ssh_config_get_str_tok(str, NULL);
  220|     75|    if (p == NULL) {
  ------------------
  |  Branch (220:9): [True: 30, False: 45]
  ------------------
  221|     30|        return notfound;
  222|     30|    }
  223|       |
  224|     45|    {
  225|     45|        int is_yes = (strcasecmp(p, "yes") == 0);
  226|     45|        int is_true = (strcasecmp(p, "true") == 0);
  227|     45|        if (is_yes || is_true) {
  ------------------
  |  Branch (227:13): [True: 0, False: 45]
  |  Branch (227:23): [True: 0, False: 45]
  ------------------
  228|      0|            return 1;
  229|     45|        } else {
  230|     45|            int is_no = (strcasecmp(p, "no") == 0);
  231|     45|            int is_false = (strcasecmp(p, "false") == 0);
  232|     45|            if (is_no || is_false) {
  ------------------
  |  Branch (232:17): [True: 0, False: 45]
  |  Branch (232:26): [True: 0, False: 45]
  ------------------
  233|      0|                return 0;
  234|      0|            }
  235|     45|        }
  236|       |
  237|     45|    }
  238|       |
  239|     45|    return notfound;
  240|     45|}
ssh_config_parse_uri:
  248|  3.17k|{
  249|  3.17k|    const char *endp = NULL;
  250|  3.17k|    long port_n;
  251|  3.17k|    int rc;
  252|       |
  253|       |    /* Sanitize inputs */
  254|  3.17k|    if (username != NULL) {
  ------------------
  |  Branch (254:9): [True: 2.63k, False: 539]
  ------------------
  255|  2.63k|        *username = NULL;
  256|  2.63k|    }
  257|  3.17k|    if (hostname != NULL) {
  ------------------
  |  Branch (257:9): [True: 3.12k, False: 50]
  ------------------
  258|  3.12k|        *hostname = NULL;
  259|  3.12k|    }
  260|  3.17k|    if (port != NULL) {
  ------------------
  |  Branch (260:9): [True: 2.13k, False: 1.04k]
  ------------------
  261|  2.13k|        *port = NULL;
  262|  2.13k|    }
  263|       |
  264|       |    /* Username part (optional) */
  265|  3.17k|    endp = strrchr(tok, '@');
  266|  3.17k|    if (endp != NULL) {
  ------------------
  |  Branch (266:9): [True: 424, False: 2.75k]
  ------------------
  267|       |        /* Zero-length username is not valid */
  268|    424|        if (tok == endp) {
  ------------------
  |  Branch (268:13): [True: 1, False: 423]
  ------------------
  269|      1|            goto error;
  270|      1|        }
  271|    423|        if (username != NULL) {
  ------------------
  |  Branch (271:13): [True: 403, False: 20]
  ------------------
  272|    403|            *username = strndup(tok, endp - tok);
  273|    403|            if (*username == NULL) {
  ------------------
  |  Branch (273:17): [True: 0, False: 403]
  ------------------
  274|      0|                goto error;
  275|      0|            }
  276|    403|            rc = ssh_check_username_syntax(*username);
  277|    403|            if (rc != SSH_OK) {
  ------------------
  |  |  316|    403|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (277:17): [True: 9, False: 394]
  ------------------
  278|      9|                goto error;
  279|      9|            }
  280|    403|        }
  281|    414|        tok = endp + 1;
  282|       |        /* If there is second @ character, this does not look like our URI */
  283|    414|        endp = strchr(tok, '@');
  284|    414|        if (endp != NULL) {
  ------------------
  |  Branch (284:13): [True: 0, False: 414]
  ------------------
  285|      0|            goto error;
  286|      0|        }
  287|    414|    }
  288|       |
  289|       |    /* Hostname */
  290|  3.16k|    if (*tok == '[') {
  ------------------
  |  Branch (290:9): [True: 10, False: 3.15k]
  ------------------
  291|       |        /* IPv6 address is enclosed with square brackets */
  292|     10|        tok++;
  293|     10|        endp = strchr(tok, ']');
  294|     10|        if (endp == NULL) {
  ------------------
  |  Branch (294:13): [True: 0, False: 10]
  ------------------
  295|      0|            goto error;
  296|      0|        }
  297|  3.15k|    } else if (!ignore_port) {
  ------------------
  |  Branch (297:16): [True: 2.16k, False: 988]
  ------------------
  298|       |        /* Hostnames or aliases expand to the last colon (if port is requested)
  299|       |         * or to the end */
  300|  2.16k|        endp = strrchr(tok, ':');
  301|  2.16k|        if (endp == NULL) {
  ------------------
  |  Branch (301:13): [True: 1.99k, False: 176]
  ------------------
  302|  1.99k|            endp = strchr(tok, '\0');
  303|  1.99k|        }
  304|  2.16k|    } else {
  305|       |        /* If no port is requested, expand to the end of line
  306|       |         * (to accommodate the IPv6 addresses) */
  307|    988|        endp = strchr(tok, '\0');
  308|    988|    }
  309|  3.16k|    if (tok == endp) {
  ------------------
  |  Branch (309:9): [True: 6, False: 3.16k]
  ------------------
  310|       |        /* Zero-length hostnames are not valid */
  311|      6|        goto error;
  312|      6|    }
  313|  3.16k|    if (hostname != NULL) {
  ------------------
  |  Branch (313:9): [True: 3.11k, False: 50]
  ------------------
  314|  3.11k|        *hostname = strndup(tok, endp - tok);
  315|  3.11k|        if (*hostname == NULL) {
  ------------------
  |  Branch (315:13): [True: 0, False: 3.11k]
  ------------------
  316|      0|            goto error;
  317|      0|        }
  318|  3.11k|        if (strict) {
  ------------------
  |  Branch (318:13): [True: 489, False: 2.62k]
  ------------------
  319|       |            /* if not an ip, check syntax */
  320|    489|            rc = ssh_is_ipaddr(*hostname);
  321|    489|            if (rc == 0) {
  ------------------
  |  Branch (321:17): [True: 488, False: 1]
  ------------------
  322|    488|                rc = ssh_check_hostname_syntax(*hostname);
  323|    488|                if (rc != SSH_OK) {
  ------------------
  |  |  316|    488|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (323:21): [True: 3, False: 485]
  ------------------
  324|      3|                    goto error;
  325|      3|                }
  326|    488|            }
  327|  2.62k|        } else {
  328|       |            /* Reject shell metacharacters to allow config aliases with
  329|       |             * non-RFC1035 chars (e.g. %, _). Modeled on OpenSSH's
  330|       |             * valid_hostname() in ssh.c. */
  331|  2.62k|            const char *c = NULL;
  332|  2.62k|            if ((*hostname)[0] == '-') {
  ------------------
  |  Branch (332:17): [True: 1, False: 2.62k]
  ------------------
  333|      1|                goto error;
  334|      1|            }
  335|  13.1k|            for (c = *hostname; *c != '\0'; c++) {
  ------------------
  |  Branch (335:33): [True: 10.5k, False: 2.60k]
  ------------------
  336|  10.5k|                const char *is_meta = strchr("'`\"$\\;&<>|(){},", *c);
  337|  10.5k|                int is_space = isspace((unsigned char)*c);
  338|  10.5k|                int is_ctrl = iscntrl((unsigned char)*c);
  339|  10.5k|                if (is_meta != NULL || is_space || is_ctrl) {
  ------------------
  |  Branch (339:21): [True: 6, False: 10.5k]
  |  Branch (339:40): [True: 0, False: 10.5k]
  |  Branch (339:52): [True: 9, False: 10.5k]
  ------------------
  340|     15|                    goto error;
  341|     15|                }
  342|  10.5k|            }
  343|  2.62k|        }
  344|  3.11k|    }
  345|       |    /* Skip also the closing bracket */
  346|  3.14k|    if (*endp == ']') {
  ------------------
  |  Branch (346:9): [True: 9, False: 3.13k]
  ------------------
  347|      9|        endp++;
  348|      9|    }
  349|       |
  350|       |    /* Port (optional) */
  351|  3.14k|    if (*endp != '\0') {
  ------------------
  |  Branch (351:9): [True: 179, False: 2.96k]
  ------------------
  352|    179|        char *port_end = NULL;
  353|       |
  354|       |        /* Verify the port is valid positive number */
  355|    179|        port_n = strtol(endp + 1, &port_end, 10);
  356|    179|        if (port_n < 1 || *port_end != '\0') {
  ------------------
  |  Branch (356:13): [True: 1, False: 178]
  |  Branch (356:27): [True: 1, False: 177]
  ------------------
  357|      2|            SSH_LOG(SSH_LOG_TRACE, "Failed to parse port number."
  ------------------
  |  |  281|      2|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  358|      2|                    " The value '%ld' is invalid or there are some"
  359|      2|                    " trailing characters: '%s'", port_n, port_end);
  360|      2|            goto error;
  361|      2|        }
  362|    177|        if (port != NULL) {
  ------------------
  |  Branch (362:13): [True: 175, False: 2]
  ------------------
  363|    175|            *port = strdup(endp + 1);
  364|    175|            if (*port == NULL) {
  ------------------
  |  Branch (364:17): [True: 0, False: 175]
  ------------------
  365|      0|                goto error;
  366|      0|            }
  367|    175|        }
  368|    177|    }
  369|       |
  370|  3.14k|    return SSH_OK;
  ------------------
  |  |  316|  3.14k|#define SSH_OK 0     /* No error */
  ------------------
  371|       |
  372|     37|error:
  373|     37|    if (username != NULL) {
  ------------------
  |  Branch (373:9): [True: 33, False: 4]
  ------------------
  374|     33|        SAFE_FREE(*username);
  ------------------
  |  |  373|     33|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 18, False: 15]
  |  |  |  Branch (373:71): [Folded, False: 33]
  |  |  ------------------
  ------------------
  375|     33|    }
  376|     37|    if (hostname != NULL) {
  ------------------
  |  Branch (376:9): [True: 36, False: 1]
  ------------------
  377|     36|        SAFE_FREE(*hostname);
  ------------------
  |  |  373|     36|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 20, False: 16]
  |  |  |  Branch (373:71): [Folded, False: 36]
  |  |  ------------------
  ------------------
  378|     36|    }
  379|     37|    if (port != NULL) {
  ------------------
  |  Branch (379:9): [True: 15, False: 22]
  ------------------
  380|     15|        SAFE_FREE(*port);
  ------------------
  |  |  373|     15|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 15]
  |  |  |  Branch (373:71): [Folded, False: 15]
  |  |  ------------------
  ------------------
  381|     15|    }
  382|     37|    return SSH_ERROR;
  ------------------
  |  |  317|     37|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  383|  3.14k|}

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

ssh_dh_cleanup:
  449|    478|{
  450|    478|    if (crypto->dh_ctx != NULL) {
  ------------------
  |  Branch (450:9): [True: 0, False: 478]
  ------------------
  451|      0|#if OPENSSL_VERSION_NUMBER < 0x30000000L
  452|      0|        DH_free(crypto->dh_ctx->keypair[0]);
  453|      0|        DH_free(crypto->dh_ctx->keypair[1]);
  454|       |#else
  455|       |        EVP_PKEY_free(crypto->dh_ctx->keypair[0]);
  456|       |        EVP_PKEY_free(crypto->dh_ctx->keypair[1]);
  457|       |#endif /* OPENSSL_VERSION_NUMBER */
  458|      0|        free(crypto->dh_ctx);
  459|       |        crypto->dh_ctx = NULL;
  460|      0|    }
  461|    478|}

_ssh_set_error:
   55|    101|{
   56|    101|    struct ssh_common_struct *err = error;
   57|    101|    va_list va;
   58|       |
   59|    101|    va_start(va, descr);
   60|    101|    vsnprintf(err->error.error_buffer, ERROR_BUFFERLEN, descr, va);
  ------------------
  |  |  219|    101|#define ERROR_BUFFERLEN 1024
  ------------------
   61|    101|    va_end(va);
   62|       |
   63|    101|    err->error.error_code = code;
   64|    101|    if (ssh_get_log_level() == SSH_LOG_TRACE) {
  ------------------
  |  |  363|    101|#define SSH_LOG_TRACE 4
  ------------------
  |  Branch (64:9): [True: 0, False: 101]
  ------------------
   65|      0|        ssh_log_function(SSH_LOG_TRACE,
  ------------------
  |  |  363|      0|#define SSH_LOG_TRACE 4
  ------------------
   66|      0|                         function,
   67|      0|                         err->error.error_buffer);
   68|      0|    }
   69|    101|}
_ssh_set_error_oom:
   81|      1|{
   82|      1|    struct error_struct *err = error;
   83|       |
   84|      1|    snprintf(err->error_buffer, sizeof(err->error_buffer),
   85|      1|            "%s: Out of memory", function);
   86|      1|    err->error_code = SSH_FATAL;
   87|      1|}
_ssh_set_error_invalid:
  100|     45|{
  101|     45|    _ssh_set_error(error, SSH_FATAL, function,
  102|     45|                   "Invalid argument in %s", function);
  103|     45|}

compress_cleanup:
  268|    478|{
  269|    478|    if (crypto->compress_out_ctx) {
  ------------------
  |  Branch (269:9): [True: 0, False: 478]
  ------------------
  270|      0|        deflateEnd(crypto->compress_out_ctx);
  271|      0|    }
  272|    478|    SAFE_FREE(crypto->compress_out_ctx);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  273|       |
  274|    478|    if (crypto->compress_in_ctx) {
  ------------------
  |  Branch (274:9): [True: 0, False: 478]
  ------------------
  275|      0|        inflateEnd(crypto->compress_in_ctx);
  276|      0|    }
  277|       |    SAFE_FREE(crypto->compress_in_ctx);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  278|    478|}

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|      2|int ssh_init(void) {
  157|      2|    return _ssh_init(0);
  158|      2|}
ssh_finalize:
  241|      2|int ssh_finalize(void) {
  242|      2|    return _ssh_finalize(0);
  243|      2|}
init.c:_ssh_init:
   62|      4|static int _ssh_init(unsigned constructor) {
   63|       |
   64|      4|    int rc = 0;
   65|       |
   66|      4|    if (!constructor) {
  ------------------
  |  Branch (66:9): [True: 2, False: 2]
  ------------------
   67|      2|        ssh_mutex_lock(&ssh_init_mutex);
   68|      2|    }
   69|       |
   70|      4|    _ssh_initialized++;
   71|       |
   72|      4|    if (_ssh_initialized > 1) {
  ------------------
  |  Branch (72:9): [True: 2, False: 2]
  ------------------
   73|      2|        rc = _ssh_init_ret;
   74|      2|        goto _ret;
   75|      2|    }
   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|      4|_ret:
   98|      4|    _ssh_init_ret = rc;
   99|       |
  100|      4|    if (!constructor) {
  ------------------
  |  Branch (100:9): [True: 2, False: 2]
  ------------------
  101|      2|        ssh_mutex_unlock(&ssh_init_mutex);
  102|      2|    }
  103|       |
  104|      4|    return rc;
  105|      2|}
init.c:_ssh_finalize:
  160|      2|static int _ssh_finalize(unsigned destructor) {
  161|       |
  162|      2|    if (!destructor) {
  ------------------
  |  Branch (162:9): [True: 2, False: 0]
  ------------------
  163|      2|        ssh_mutex_lock(&ssh_init_mutex);
  164|       |
  165|      2|        if (_ssh_initialized > 1) {
  ------------------
  |  Branch (165:13): [True: 2, False: 0]
  ------------------
  166|      2|            _ssh_initialized--;
  167|      2|            ssh_mutex_unlock(&ssh_init_mutex);
  168|      2|            return 0;
  169|      2|        }
  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|      2|}

ssh_kex_get_description:
  317|     35|{
  318|     35|    if (type >= SSH_KEX_METHODS) {
  ------------------
  |  |   27|     35|#define SSH_KEX_METHODS 10
  ------------------
  |  Branch (318:9): [True: 0, False: 35]
  ------------------
  319|      0|        return NULL;
  320|      0|    }
  321|       |
  322|     35|    return ssh_kex_descriptions[type];
  323|     35|}
ssh_keep_known_algos:
 1324|     35|{
 1325|     35|    if (algo > SSH_LANG_S_C) {
  ------------------
  |  Branch (1325:9): [True: 0, False: 35]
  ------------------
 1326|      0|        return NULL;
 1327|      0|    }
 1328|       |
 1329|     35|    return ssh_find_all_matching(supported_methods[algo], list);
 1330|     35|}
ssh_add_to_default_algos:
 1368|    105|{
 1369|    105|    char *tmp = NULL, *ret = NULL;
 1370|       |
 1371|    105|    if (algo > SSH_LANG_S_C || list == NULL || list[0] == '\0') {
  ------------------
  |  Branch (1371:9): [True: 0, False: 105]
  |  Branch (1371:32): [True: 0, False: 105]
  |  Branch (1371:48): [True: 0, False: 105]
  ------------------
 1372|      0|        return NULL;
 1373|      0|    }
 1374|       |
 1375|    105|    if (ssh_fips_mode()) {
  ------------------
  |  |  115|    105|#define ssh_fips_mode() (FIPS_mode() != 0)
  |  |  ------------------
  |  |  |  Branch (115:25): [True: 0, False: 105]
  |  |  ------------------
  ------------------
 1376|      0|        tmp = ssh_append_without_duplicates(fips_methods[algo], list);
 1377|      0|        ret = ssh_find_all_matching(fips_methods[algo], tmp);
 1378|    105|    } else {
 1379|    105|        tmp = ssh_append_without_duplicates(default_methods[algo], list);
 1380|    105|        ret = ssh_find_all_matching(supported_methods[algo], tmp);
 1381|    105|    }
 1382|       |
 1383|    105|    free(tmp);
 1384|    105|    return ret;
 1385|    105|}
ssh_remove_from_default_algos:
 1401|     21|{
 1402|     21|    if (algo > SSH_LANG_S_C) {
  ------------------
  |  Branch (1402:9): [True: 0, False: 21]
  ------------------
 1403|      0|        return NULL;
 1404|      0|    }
 1405|       |
 1406|     21|    if (list == NULL || list[0] == '\0') {
  ------------------
  |  Branch (1406:9): [True: 0, False: 21]
  |  Branch (1406:25): [True: 0, False: 21]
  ------------------
 1407|      0|        if (ssh_fips_mode()) {
  ------------------
  |  |  115|      0|#define ssh_fips_mode() (FIPS_mode() != 0)
  |  |  ------------------
  |  |  |  Branch (115:25): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1408|      0|            return strdup(fips_methods[algo]);
 1409|      0|        } else {
 1410|      0|            return strdup(default_methods[algo]);
 1411|      0|        }
 1412|      0|    }
 1413|       |
 1414|     21|    if (ssh_fips_mode()) {
  ------------------
  |  |  115|     21|#define ssh_fips_mode() (FIPS_mode() != 0)
  |  |  ------------------
  |  |  |  Branch (115:25): [True: 0, False: 21]
  |  |  ------------------
  ------------------
 1415|      0|        return ssh_remove_all_matching(fips_methods[algo], list);
 1416|     21|    } else {
 1417|     21|        return ssh_remove_all_matching(default_methods[algo], list);
 1418|     21|    }
 1419|     21|}
ssh_prefix_default_algos:
 1439|     51|{
 1440|     51|    char *ret = NULL, *tmp = NULL;
 1441|       |
 1442|     51|    if (algo > SSH_LANG_S_C || list == NULL || list[0] == '\0') {
  ------------------
  |  Branch (1442:9): [True: 0, False: 51]
  |  Branch (1442:32): [True: 0, False: 51]
  |  Branch (1442:48): [True: 0, False: 51]
  ------------------
 1443|      0|        return NULL;
 1444|      0|    }
 1445|       |
 1446|     51|    if (ssh_fips_mode()) {
  ------------------
  |  |  115|     51|#define ssh_fips_mode() (FIPS_mode() != 0)
  |  |  ------------------
  |  |  |  Branch (115:25): [True: 0, False: 51]
  |  |  ------------------
  ------------------
 1447|      0|        tmp = ssh_prefix_without_duplicates(fips_methods[algo], list);
 1448|      0|        ret = ssh_find_all_matching(fips_methods[algo], tmp);
 1449|     51|    } else {
 1450|     51|        tmp = ssh_prefix_without_duplicates(default_methods[algo], list);
 1451|     51|        ret = ssh_find_all_matching(supported_methods[algo], tmp);
 1452|     51|    }
 1453|       |
 1454|     51|    free(tmp);
 1455|     51|    return ret;
 1456|     51|}

ssh_crypto_init:
 1391|      2|{
 1392|       |#ifndef HAVE_OPENSSL_EVP_CHACHA20
 1393|       |    size_t i;
 1394|       |#endif
 1395|       |
 1396|      2|    if (libcrypto_initialized) {
  ------------------
  |  Branch (1396:9): [True: 0, False: 2]
  ------------------
 1397|      0|        return SSH_OK;
  ------------------
  |  |  316|      0|#define SSH_OK 0     /* No error */
  ------------------
 1398|      0|    }
 1399|      2|    if (OpenSSL_version_num() != OPENSSL_VERSION_NUMBER) {
  ------------------
  |  Branch (1399:9): [True: 0, False: 2]
  ------------------
 1400|      0|        SSH_LOG(SSH_LOG_DEBUG,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1401|      0|                "libssh compiled with %s "
 1402|      0|                "headers, currently running with %s.",
 1403|      0|                OPENSSL_VERSION_TEXT,
 1404|      0|                OpenSSL_version(OpenSSL_version_num()));
 1405|      0|    }
 1406|       |#ifdef CAN_DISABLE_AESNI
 1407|       |    /*
 1408|       |     * disable AES-NI when running within Valgrind, because they generate
 1409|       |     * too many "uninitialized memory access" false positives
 1410|       |     */
 1411|       |    if (RUNNING_ON_VALGRIND) {
 1412|       |        SSH_LOG(SSH_LOG_INFO, "Running within Valgrind, disabling AES-NI");
 1413|       |        /* Bit #57 denotes AES-NI instruction set extension */
 1414|       |        OPENSSL_ia32cap &= ~(1LL << 57);
 1415|       |    }
 1416|       |#endif /* CAN_DISABLE_AESNI */
 1417|       |
 1418|       |#ifndef HAVE_OPENSSL_EVP_CHACHA20
 1419|       |    for (i = 0; ssh_ciphertab[i].name != NULL; i++) {
 1420|       |        int cmp;
 1421|       |
 1422|       |        cmp = strcmp(ssh_ciphertab[i].name, "chacha20-poly1305@openssh.com");
 1423|       |        if (cmp == 0) {
 1424|       |            memcpy(&ssh_ciphertab[i],
 1425|       |                   ssh_get_chacha20poly1305_cipher(),
 1426|       |                   sizeof(struct ssh_cipher_struct));
 1427|       |            break;
 1428|       |        }
 1429|       |    }
 1430|       |#endif /* HAVE_OPENSSL_EVP_CHACHA20 */
 1431|       |
 1432|      2|    libcrypto_initialized = 1;
 1433|       |
 1434|      2|    return SSH_OK;
  ------------------
  |  |  316|      2|#define SSH_OK 0     /* No error */
  ------------------
 1435|      2|}

_ssh_log:
  168|   371k|{
  169|   371k|    va_list va;
  170|       |
  171|   371k|    if (verbosity <= ssh_get_log_level()) {
  ------------------
  |  Branch (171:9): [True: 0, False: 371k]
  ------------------
  172|      0|        va_start(va, format);
  173|      0|        ssh_vlog(verbosity, function, format, &va);
  174|       |        va_end(va);
  175|      0|    }
  176|   371k|}
ssh_get_log_level:
  252|   371k|int ssh_get_log_level(void) {
  253|   371k|  return ssh_log_level;
  254|   371k|}
ssh_get_log_callback:
  275|    478|ssh_logging_callback ssh_get_log_callback(void) {
  276|    478|  return ssh_log_cb;
  277|    478|}

match_pattern_list:
  129|    842|    size_t len, int dolower) {
  130|    842|  char sub[1024];
  131|    842|  int negated;
  132|    842|  int got_positive;
  133|    842|  size_t i, subi;
  134|       |
  135|    842|  got_positive = 0;
  136|  1.94k|  for (i = 0; i < len;) {
  ------------------
  |  Branch (136:15): [True: 1.11k, False: 834]
  ------------------
  137|       |    /* Check if the subpattern is negated. */
  138|  1.11k|    if (pattern[i] == '!') {
  ------------------
  |  Branch (138:9): [True: 13, False: 1.10k]
  ------------------
  139|     13|      negated = 1;
  140|     13|      i++;
  141|  1.10k|    } else {
  142|  1.10k|      negated = 0;
  143|  1.10k|    }
  144|       |
  145|       |    /*
  146|       |     * Extract the subpattern up to a comma or end.  Convert the
  147|       |     * subpattern to lowercase.
  148|       |     */
  149|  1.11k|    for (subi = 0;
  150|  13.6k|        i < len && subi < sizeof(sub) - 1 && pattern[i] != ',';
  ------------------
  |  Branch (150:9): [True: 12.7k, False: 832]
  |  Branch (150:20): [True: 12.7k, False: 0]
  |  Branch (150:46): [True: 12.4k, False: 281]
  ------------------
  151|  12.4k|        subi++, i++) {
  152|  12.4k|      sub[subi] = dolower && isupper(pattern[i]) ?
  ------------------
  |  Branch (152:19): [True: 10.1k, False: 2.34k]
  |  Branch (152:30): [True: 2.09k, False: 8.05k]
  ------------------
  153|  10.3k|        (char)tolower(pattern[i]) : pattern[i];
  ------------------
  |  Branch (153:15): [True: 0, False: 0]
  |  Branch (153:15): [True: 0, False: 0]
  |  Branch (153:15): [Folded, False: 2.09k]
  ------------------
  154|  12.4k|    }
  155|       |
  156|       |    /* If subpattern too long, return failure (no match). */
  157|  1.11k|    if (subi >= sizeof(sub) - 1) {
  ------------------
  |  Branch (157:9): [True: 0, False: 1.11k]
  ------------------
  158|      0|      return 0;
  159|      0|    }
  160|       |
  161|       |    /* If the subpattern was terminated by a comma, skip the comma. */
  162|  1.11k|    if (i < len && pattern[i] == ',') {
  ------------------
  |  Branch (162:9): [True: 281, False: 832]
  |  Branch (162:20): [True: 281, False: 0]
  ------------------
  163|    281|      i++;
  164|    281|    }
  165|       |
  166|       |    /* Null-terminate the subpattern. */
  167|  1.11k|    sub[subi] = '\0';
  168|       |
  169|       |    /* Try to match the subpattern against the string. */
  170|  1.11k|    if (match_pattern(string, sub)) {
  ------------------
  |  Branch (170:9): [True: 74, False: 1.03k]
  ------------------
  171|     74|      if (negated) {
  ------------------
  |  Branch (171:11): [True: 8, False: 66]
  ------------------
  172|      8|        return -1;        /* Negative */
  173|     66|      } else {
  174|     66|        got_positive = 1; /* Positive */
  175|     66|      }
  176|     74|    }
  177|  1.11k|  }
  178|       |
  179|       |  /*
  180|       |   * Return success if got a positive match.  If there was a negative
  181|       |   * match, we have already returned -1 and never get here.
  182|       |   */
  183|    834|  return got_positive;
  184|    842|}
match_hostname:
  195|    603|{
  196|    603|    return match_pattern_list(host, pattern, len, 1);
  197|    603|}
match_cidr_address_list:
  367|     13|{
  368|     13|    char *list = NULL, *cp = NULL, *a = NULL, *b = NULL, *sp = NULL;
  369|     13|    char addr_buffer[64], addr[NI_MAXHOST];
  370|     13|    struct in_addr try_addr, match_addr;
  371|     13|    struct in6_addr try_addr6, match_addr6;
  372|     13|    unsigned long mask_len;
  373|     13|    size_t addr_len, tmp_len;
  374|     13|    int rc = 0, r, ai_family;
  375|       |
  376|     13|    ZERO_STRUCT(try_addr);
  ------------------
  |  |  376|     13|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  377|     13|    ZERO_STRUCT(try_addr6);
  ------------------
  |  |  376|     13|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  378|     13|    ZERO_STRUCT(match_addr);
  ------------------
  |  |  376|     13|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  379|     13|    ZERO_STRUCT(match_addr6);
  ------------------
  |  |  376|     13|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  380|       |
  381|     13|    if (sa_family != AF_INET && sa_family != AF_INET6 && sa_family != -1) {
  ------------------
  |  Branch (381:9): [True: 13, False: 0]
  |  Branch (381:33): [True: 13, False: 0]
  |  Branch (381:58): [True: 0, False: 13]
  ------------------
  382|      0|        SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  383|      0|                "Invalid argument: sa_family %d is not valid",
  384|      0|                sa_family);
  385|      0|        return -1;
  386|      0|    }
  387|       |
  388|     13|    if (address != NULL) {
  ------------------
  |  Branch (388:9): [True: 0, False: 13]
  ------------------
  389|      0|        strlcpy(addr, address, sizeof(addr));
  390|       |
  391|       |        /* Remove interface in case of IPv6 address: addr%interface */
  392|      0|        a = strchr(addr, '%');
  393|      0|        if (a != NULL) {
  ------------------
  |  Branch (393:13): [True: 0, False: 0]
  ------------------
  394|      0|            *a = '\0';
  395|      0|        }
  396|       |
  397|       |        /*
  398|       |         * If sa_family is set to -1 and address is not NULL then
  399|       |         * the socket address family should be derived
  400|       |         */
  401|      0|        if (sa_family == -1) {
  ------------------
  |  Branch (401:13): [True: 0, False: 0]
  ------------------
  402|      0|            r = get_address_family(addr);
  403|      0|            if (r == -1) {
  ------------------
  |  Branch (403:17): [True: 0, False: 0]
  ------------------
  404|      0|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  405|      0|                        "Failed to derive address family for address "
  406|      0|                        "\"%.100s\"",
  407|      0|                        addr);
  408|      0|                return -1;
  409|      0|            }
  410|      0|            sa_family = r;
  411|      0|        }
  412|       |
  413|       |        /*
  414|       |         * Translate host address from dot notation to binary network format
  415|       |         * according to family type,
  416|       |         * i.e. IPv4 (store in in_addr) or IPv6 (store in in6_addr)
  417|       |         */
  418|      0|        if (sa_family == AF_INET) {
  ------------------
  |  Branch (418:13): [True: 0, False: 0]
  ------------------
  419|      0|            if (inet_pton(AF_INET, addr, &try_addr) == 0) {
  ------------------
  |  Branch (419:17): [True: 0, False: 0]
  ------------------
  420|      0|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  421|      0|                        "Couldn't parse IPv4 address \"%.100s\"",
  422|      0|                        addr);
  423|      0|                return -1;
  424|      0|            }
  425|      0|        } else if (sa_family == AF_INET6) {
  ------------------
  |  Branch (425:20): [True: 0, False: 0]
  ------------------
  426|      0|            if (inet_pton(AF_INET6, addr, &try_addr6) == 0) {
  ------------------
  |  Branch (426:17): [True: 0, False: 0]
  ------------------
  427|      0|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  428|      0|                        "Couldn't parse IPv6 address \"%.100s\"",
  429|      0|                        addr);
  430|      0|                return -1;
  431|      0|            }
  432|      0|        } else {
  433|      0|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  434|      0|                    "Address family %d for address \"%.100s\" "
  435|      0|                    "is not recognized",
  436|      0|                    sa_family,
  437|      0|                    addr);
  438|      0|            return -1;
  439|      0|        }
  440|      0|    }
  441|       |
  442|     13|    b = list = strdup(addrlist);
  443|     13|    if (b == NULL) {
  ------------------
  |  Branch (443:9): [True: 0, False: 13]
  ------------------
  444|      0|        return -1;
  445|      0|    }
  446|       |
  447|     13|    while ((cp = strsep(&list, ",")) != NULL) {
  ------------------
  |  Branch (447:12): [True: 13, False: 0]
  ------------------
  448|     13|        if (*cp == '\0') {
  ------------------
  |  Branch (448:13): [True: 0, False: 13]
  ------------------
  449|      0|            SSH_LOG(SSH_LOG_TRACE, "Empty entry in list \"%.100s\"", b);
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  450|      0|            rc = -1;
  451|      0|            break;
  452|      0|        }
  453|       |
  454|       |        /*
  455|       |         * Stop junk from reaching address translation. +3 for the "/prefix".
  456|       |         * INET6_ADDRSTRLEN is 46 and includes space for '\0' terminator. The
  457|       |         * maximum IPv6 address printable is the one that carries IPv4 too.
  458|       |         * E.g. ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255 is 46 chars
  459|       |         * long ('\0' included) and the maximum prefix length possible is 96.
  460|       |         * This explains why +3. All the other IPv6 addresses with maximum /127
  461|       |         * prefix length (39 + 4) are covered just by INET6_ADDRSTRLEN itself
  462|       |         */
  463|     13|        addr_len = strlen(cp);
  464|     13|        if (addr_len > INET6_ADDRSTRLEN + 3) {
  ------------------
  |  Branch (464:13): [True: 2, False: 11]
  ------------------
  465|      2|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      2|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  466|      2|                    "List entry \"%.100s\" too long: %zu > %d (MAX ALLOWED)",
  467|      2|                    cp,
  468|      2|                    addr_len,
  469|      2|                    INET6_ADDRSTRLEN + 3);
  470|      2|            rc = -1;
  471|      2|            break;
  472|      2|        }
  473|       |
  474|     11|#define VALID_CIDR_CHARS "0123456789abcdefABCDEF.:/"
  475|     11|        tmp_len = strspn(cp, VALID_CIDR_CHARS);
  ------------------
  |  |  474|     11|#define VALID_CIDR_CHARS "0123456789abcdefABCDEF.:/"
  ------------------
  476|     11|        if (tmp_len != addr_len) {
  ------------------
  |  Branch (476:13): [True: 3, False: 8]
  ------------------
  477|      3|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  478|      3|                    "List entry \"%.100s\" contains invalid characters "
  479|      3|                    "-> \"%c\" is an invalid character",
  480|      3|                    cp,
  481|      3|                    cp[tmp_len]);
  482|      3|            rc = -1;
  483|      3|            break;
  484|      3|        }
  485|      8|#undef VALID_CIDR_CHARS
  486|       |
  487|      8|        strlcpy(addr_buffer, cp, sizeof(addr_buffer));
  488|      8|        sp = strchr(addr_buffer, '/');
  489|      8|        if (sp != NULL) {
  ------------------
  |  Branch (489:13): [True: 8, False: 0]
  ------------------
  490|      8|            *sp = '\0';
  491|      8|            sp++;
  492|      8|            mask_len = strtoul(sp, &cp, 10);
  493|      8|            if (*sp < '0' || *sp > '9' || *cp != '\0') {
  ------------------
  |  Branch (493:17): [True: 0, False: 8]
  |  Branch (493:30): [True: 0, False: 8]
  |  Branch (493:43): [True: 0, False: 8]
  ------------------
  494|      0|                SSH_LOG(SSH_LOG_TRACE, "Error while parsing prefix: %s", sp);
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  495|      0|                rc = -1;
  496|      0|                break;
  497|      0|            }
  498|      8|            if (mask_len > 128) {
  ------------------
  |  Branch (498:17): [True: 8, False: 0]
  ------------------
  499|      8|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      8|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  500|      8|                        "Invalid prefix: %lu exceeds the maximum allowed "
  501|      8|                        "(>128)",
  502|      8|                        mask_len);
  503|      8|                rc = -1;
  504|      8|                break;
  505|      8|            }
  506|      8|        } else {
  507|      0|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  508|      0|                    "Missing prefix length for list entry \"%.100s\"",
  509|      0|                    addr_buffer);
  510|      0|            rc = -1;
  511|      0|            break;
  512|      0|        }
  513|       |
  514|      0|        ai_family = get_address_family(addr_buffer);
  515|      0|        if (ai_family == -1) {
  ------------------
  |  Branch (515:13): [True: 0, False: 0]
  ------------------
  516|      0|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  517|      0|                    "Couldn't get address family for \"%.100s\"",
  518|      0|                    addr_buffer);
  519|      0|            rc = -1;
  520|      0|            break;
  521|      0|        }
  522|       |
  523|      0|        if (ai_family == AF_INET) {
  ------------------
  |  Branch (523:13): [True: 0, False: 0]
  ------------------
  524|      0|            if (inet_pton(AF_INET, addr_buffer, &match_addr) == 0) {
  ------------------
  |  Branch (524:17): [True: 0, False: 0]
  ------------------
  525|      0|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  526|      0|                        "Couldn't parse IPv4 address \"%.100s\"",
  527|      0|                        addr_buffer);
  528|      0|                rc = -1;
  529|      0|                break;
  530|      0|            }
  531|      0|        } else if (ai_family == AF_INET6) {
  ------------------
  |  Branch (531:20): [True: 0, False: 0]
  ------------------
  532|      0|            if (inet_pton(AF_INET6, addr_buffer, &match_addr6) == 0) {
  ------------------
  |  Branch (532:17): [True: 0, False: 0]
  ------------------
  533|      0|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  534|      0|                        "Couldn't parse IPv6 address \"%.100s\"",
  535|      0|                        addr_buffer);
  536|      0|                rc = -1;
  537|      0|                break;
  538|      0|            }
  539|      0|        } else {
  540|      0|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  541|      0|                    "Address family %d for address \"%.100s\" "
  542|      0|                    "is not recognized",
  543|      0|                    ai_family,
  544|      0|                    addr_buffer);
  545|      0|            rc = -1;
  546|      0|            break;
  547|      0|        }
  548|       |
  549|      0|        if (masklen_valid(ai_family, mask_len) != true) {
  ------------------
  |  Branch (549:13): [True: 0, False: 0]
  ------------------
  550|      0|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  551|      0|                    "Invalid mask length %lu for list entry \"%.100s\"",
  552|      0|                    mask_len,
  553|      0|                    addr_buffer);
  554|      0|            rc = -1;
  555|      0|            break;
  556|      0|        }
  557|       |
  558|       |        /* Verify match between host address and network address*/
  559|      0|        if (((ai_family == AF_INET && sa_family == AF_INET) &&
  ------------------
  |  Branch (559:15): [True: 0, False: 0]
  |  Branch (559:39): [True: 0, False: 0]
  ------------------
  560|      0|             cidr_match_4(&try_addr, &match_addr, mask_len)) ||
  ------------------
  |  Branch (560:14): [True: 0, False: 0]
  ------------------
  561|      0|            ((ai_family == AF_INET6 && sa_family == AF_INET6) &&
  ------------------
  |  Branch (561:15): [True: 0, False: 0]
  |  Branch (561:40): [True: 0, False: 0]
  ------------------
  562|      0|             cidr_match_6(&try_addr6, &match_addr6, mask_len))) {
  ------------------
  |  Branch (562:14): [True: 0, False: 0]
  ------------------
  563|      0|            rc = 1;
  564|      0|            break;
  565|      0|        }
  566|      0|    }
  567|     13|    SAFE_FREE(b);
  ------------------
  |  |  373|     13|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 13, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 13]
  |  |  ------------------
  ------------------
  568|       |
  569|     13|    return rc;
  570|     13|}
match.c:match_pattern:
   68|  1.11k|{
   69|  1.11k|    const char *s_star = NULL; /* Position in s when last `*` was met */
   70|  1.11k|    const char *p_star = NULL; /* Position in pattern after last `*` */
   71|       |
   72|  1.11k|    if (s == NULL || pattern == NULL) {
  ------------------
  |  Branch (72:9): [True: 1, False: 1.11k]
  |  Branch (72:22): [True: 0, False: 1.11k]
  ------------------
   73|      1|        return 0;
   74|      1|    }
   75|       |
   76|  3.87k|    while (*s) {
  ------------------
  |  Branch (76:12): [True: 3.55k, False: 319]
  ------------------
   77|       |        /* Case 1: Exact match or '?' wildcard */
   78|  3.55k|        if (*pattern == *s || *pattern == '?') {
  ------------------
  |  Branch (78:13): [True: 786, False: 2.76k]
  |  Branch (78:31): [True: 200, False: 2.56k]
  ------------------
   79|    986|            s++;
   80|    986|            pattern++;
   81|    986|            continue;
   82|    986|        }
   83|       |
   84|       |        /* Case 2: '*' wildcard */
   85|  2.56k|        if (*pattern == '*') {
  ------------------
  |  Branch (85:13): [True: 306, False: 2.26k]
  ------------------
   86|       |            /* Record the position of the star and the current string position.
   87|       |             * We optimistically assume * matches 0 characters first.
   88|       |             */
   89|    306|            p_star = ++pattern;
   90|    306|            s_star = s;
   91|    306|            continue;
   92|    306|        }
   93|       |
   94|       |        /* Case 3: Mismatch */
   95|  2.26k|        if (p_star) {
  ------------------
  |  Branch (95:13): [True: 1.46k, False: 793]
  ------------------
   96|       |            /* If we have seen a star previously, backtrack.
   97|       |             * We restore the pattern to just after the star,
   98|       |             * but advance the string position (consume one more char for the
   99|       |             * star).
  100|       |             * No need to backtrack to previous stars as any match of the last
  101|       |             * star could be eaten the same way by the previous star.
  102|       |             */
  103|  1.46k|            pattern = p_star;
  104|  1.46k|            s = ++s_star;
  105|  1.46k|            continue;
  106|  1.46k|        }
  107|       |
  108|       |        /* Case 4: Mismatch and no star to backtrack to */
  109|    793|        return 0;
  110|  2.26k|    }
  111|       |
  112|       |    /* Handle trailing stars in the pattern
  113|       |     * (e.g., pattern "abc*" matching "abc") */
  114|    320|    while (*pattern == '*') {
  ------------------
  |  Branch (114:12): [True: 1, False: 319]
  ------------------
  115|      1|        pattern++;
  116|      1|    }
  117|       |
  118|       |    /* If we reached the end of the pattern, it's a match */
  119|    319|    return (*pattern == '\0');
  120|  1.11k|}

ssh_is_ipaddr_v4:
  430|    978|{
  431|    978|    int rc = -1;
  432|    978|    struct in_addr dest;
  433|       |
  434|    978|    rc = inet_pton(AF_INET, str, &dest);
  435|    978|    if (rc > 0) {
  ------------------
  |  Branch (435:9): [True: 2, False: 976]
  ------------------
  436|      2|        return 1;
  437|      2|    }
  438|       |
  439|    976|    return 0;
  440|    978|}
ssh_is_ipaddr:
  450|    978|{
  451|    978|    int rc = -1;
  452|    978|    char *s = strdup(str);
  453|       |
  454|    978|    if (s == NULL) {
  ------------------
  |  Branch (454:9): [True: 0, False: 978]
  ------------------
  455|      0|        return -1;
  456|      0|    }
  457|    978|    if (strchr(s, ':')) {
  ------------------
  |  Branch (457:9): [True: 0, False: 978]
  ------------------
  458|      0|        struct in6_addr dest6;
  459|      0|        char *network_interface = strchr(s, '%');
  460|       |
  461|       |        /* link-local (IP:v6:addr%ifname). */
  462|      0|        if (network_interface != NULL) {
  ------------------
  |  Branch (462:13): [True: 0, False: 0]
  ------------------
  463|      0|            rc = if_nametoindex(network_interface + 1);
  464|      0|            if (rc == 0) {
  ------------------
  |  Branch (464:17): [True: 0, False: 0]
  ------------------
  465|      0|                free(s);
  466|      0|                return 0;
  467|      0|            }
  468|      0|            *network_interface = '\0';
  469|      0|        }
  470|      0|        rc = inet_pton(AF_INET6, s, &dest6);
  471|      0|        if (rc > 0) {
  ------------------
  |  Branch (471:13): [True: 0, False: 0]
  ------------------
  472|      0|            free(s);
  473|      0|            return 1;
  474|      0|        }
  475|      0|    }
  476|       |
  477|    978|    free(s);
  478|    978|    return ssh_is_ipaddr_v4(str);
  479|    978|}
ssh_get_user_home_dir:
  495|    760|{
  496|    760|    char *szPath = NULL;
  497|       |
  498|       |    /* If used previously, reuse cached value */
  499|    760|    if (session != NULL && session->opts.homedir != NULL) {
  ------------------
  |  Branch (499:9): [True: 0, False: 760]
  |  Branch (499:28): [True: 0, False: 0]
  ------------------
  500|      0|        return strdup(session->opts.homedir);
  501|      0|    }
  502|       |
  503|    760|    szPath = ssh_get_user_home_dir_internal();
  504|    760|    if (szPath == NULL) {
  ------------------
  |  Branch (504:9): [True: 0, False: 760]
  ------------------
  505|      0|        return NULL;
  506|      0|    }
  507|       |
  508|    760|    if (session != NULL) {
  ------------------
  |  Branch (508:9): [True: 0, False: 760]
  ------------------
  509|       |        /* cache it:
  510|       |         * failure is not fatal -- at worst we will just not cache it */
  511|      0|        session->opts.homedir = strdup(szPath);
  512|      0|    }
  513|       |
  514|    760|    return szPath;
  515|    760|}
ssh_lowercase:
  526|    177|{
  527|    177|    char *new = NULL, *p = NULL;
  528|       |
  529|    177|    if (str == NULL) {
  ------------------
  |  Branch (529:9): [True: 0, False: 177]
  ------------------
  530|      0|        return NULL;
  531|      0|    }
  532|       |
  533|    177|    new = strdup(str);
  534|    177|    if (new == NULL) {
  ------------------
  |  Branch (534:9): [True: 0, False: 177]
  ------------------
  535|      0|        return NULL;
  536|      0|    }
  537|       |
  538|  3.08k|    for (p = new; *p; p++) {
  ------------------
  |  Branch (538:19): [True: 2.91k, False: 177]
  ------------------
  539|  2.91k|        *p = tolower(*p);
  ------------------
  |  Branch (539:14): [True: 0, False: 0]
  |  Branch (539:14): [True: 0, False: 0]
  |  Branch (539:14): [Folded, False: 2.91k]
  ------------------
  540|  2.91k|    }
  541|       |
  542|    177|    return new;
  543|    177|}
ssh_list_new:
  865|  3.34k|{
  866|  3.34k|    struct ssh_list *ret = malloc(sizeof(struct ssh_list));
  867|  3.34k|    if (ret == NULL) {
  ------------------
  |  Branch (867:9): [True: 0, False: 3.34k]
  ------------------
  868|      0|        return NULL;
  869|      0|    }
  870|  3.34k|    ret->root = ret->end = NULL;
  871|  3.34k|    return ret;
  872|  3.34k|}
ssh_list_free:
  882|  3.82k|{
  883|  3.82k|    struct ssh_iterator *ptr = NULL, *next = NULL;
  884|  3.82k|    if (!list)
  ------------------
  |  Branch (884:9): [True: 478, False: 3.34k]
  ------------------
  885|    478|        return;
  886|  3.34k|    ptr = list->root;
  887|  3.34k|    while (ptr) {
  ------------------
  |  Branch (887:12): [True: 0, False: 3.34k]
  ------------------
  888|      0|        next = ptr->next;
  889|      0|        SAFE_FREE(ptr);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  890|      0|        ptr = next;
  891|      0|    }
  892|       |    SAFE_FREE(list);
  ------------------
  |  |  373|  3.34k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 3.34k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 3.34k]
  |  |  ------------------
  ------------------
  893|  3.34k|}
ssh_list_get_iterator:
  903|    478|{
  904|    478|    if (!list)
  ------------------
  |  Branch (904:9): [True: 478, False: 0]
  ------------------
  905|    478|        return NULL;
  906|      0|    return list->root;
  907|    478|}
ssh_list_append:
  969|  3.03k|{
  970|  3.03k|  struct ssh_iterator *iterator = NULL;
  971|       |
  972|  3.03k|  if (list == NULL) {
  ------------------
  |  Branch (972:7): [True: 0, False: 3.03k]
  ------------------
  973|      0|      return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  974|      0|  }
  975|       |
  976|  3.03k|  iterator = ssh_iterator_new(data);
  977|  3.03k|  if (iterator == NULL) {
  ------------------
  |  Branch (977:7): [True: 0, False: 3.03k]
  ------------------
  978|      0|      return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  979|      0|  }
  980|       |
  981|  3.03k|  if(!list->end){
  ------------------
  |  Branch (981:6): [True: 492, False: 2.54k]
  ------------------
  982|       |    /* list is empty */
  983|    492|    list->root=list->end=iterator;
  984|  2.54k|  } else {
  985|       |    /* put it on end of list */
  986|  2.54k|    list->end->next=iterator;
  987|  2.54k|    list->end=iterator;
  988|  2.54k|  }
  989|  3.03k|  return SSH_OK;
  ------------------
  |  |  316|  3.03k|#define SSH_OK 0     /* No error */
  ------------------
  990|  3.03k|}
ssh_list_prepend:
 1001|  2.68k|{
 1002|  2.68k|  struct ssh_iterator *it = NULL;
 1003|       |
 1004|  2.68k|  if (list == NULL) {
  ------------------
  |  Branch (1004:7): [True: 0, False: 2.68k]
  ------------------
 1005|      0|      return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1006|      0|  }
 1007|       |
 1008|  2.68k|  it = ssh_iterator_new(data);
 1009|  2.68k|  if (it == NULL) {
  ------------------
  |  Branch (1009:7): [True: 0, False: 2.68k]
  ------------------
 1010|      0|    return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1011|      0|  }
 1012|       |
 1013|  2.68k|  if (list->end == NULL) {
  ------------------
  |  Branch (1013:7): [True: 36, False: 2.65k]
  ------------------
 1014|       |    /* list is empty */
 1015|     36|    list->root = list->end = it;
 1016|  2.65k|  } else {
 1017|       |    /* set as new root */
 1018|  2.65k|    it->next = list->root;
 1019|  2.65k|    list->root = it;
 1020|  2.65k|  }
 1021|       |
 1022|  2.68k|  return SSH_OK;
  ------------------
  |  |  316|  2.68k|#define SSH_OK 0     /* No error */
  ------------------
 1023|  2.68k|}
_ssh_list_pop_head:
 1073|  8.64k|{
 1074|  8.64k|  struct ssh_iterator *iterator = NULL;
 1075|  8.64k|  const void *data = NULL;
 1076|       |
 1077|  8.64k|  if (list == NULL) {
  ------------------
  |  Branch (1077:7): [True: 0, False: 8.64k]
  ------------------
 1078|      0|      return NULL;
 1079|      0|  }
 1080|       |
 1081|  8.64k|  iterator = list->root;
 1082|  8.64k|  if (iterator == NULL) {
  ------------------
  |  Branch (1082:7): [True: 2.92k, False: 5.72k]
  ------------------
 1083|  2.92k|      return NULL;
 1084|  2.92k|  }
 1085|  5.72k|  data=iterator->data;
 1086|  5.72k|  list->root=iterator->next;
 1087|  5.72k|  if(list->end==iterator)
  ------------------
  |  Branch (1087:6): [True: 528, False: 5.19k]
  ------------------
 1088|    528|    list->end=NULL;
 1089|       |  SAFE_FREE(iterator);
  ------------------
  |  |  373|  5.72k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 5.72k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 5.72k]
  |  |  ------------------
  ------------------
 1090|  5.72k|  return data;
 1091|  8.64k|}
ssh_path_expand_tilde:
 1309|    943|{
 1310|    943|    char *h = NULL, *r = NULL;
 1311|    943|    const char *p = NULL;
 1312|    943|    size_t ld;
 1313|    943|    size_t lh = 0;
 1314|       |
 1315|    943|    if (d[0] != '~') {
  ------------------
  |  Branch (1315:9): [True: 5, False: 938]
  ------------------
 1316|      5|        return strdup(d);
 1317|      5|    }
 1318|    938|    d++;
 1319|       |
 1320|       |    /* handle ~user/path */
 1321|    938|    p = strchr(d, '/');
 1322|    938|    if (p != NULL && p > d) {
  ------------------
  |  Branch (1322:9): [True: 872, False: 66]
  |  Branch (1322:22): [True: 178, False: 694]
  ------------------
 1323|       |#ifdef _WIN32
 1324|       |        return strdup(d);
 1325|       |#else
 1326|    178|        struct passwd *pw = NULL;
 1327|    178|        size_t s = p - d;
 1328|    178|        char u[128];
 1329|       |
 1330|    178|        if (s >= sizeof(u)) {
  ------------------
  |  Branch (1330:13): [True: 3, False: 175]
  ------------------
 1331|      3|            return NULL;
 1332|      3|        }
 1333|    175|        memcpy(u, d, s);
 1334|    175|        u[s] = '\0';
 1335|    175|        pw = getpwnam(u);
 1336|    175|        if (pw == NULL) {
  ------------------
  |  Branch (1336:13): [True: 7, False: 168]
  ------------------
 1337|      7|            return NULL;
 1338|      7|        }
 1339|    168|        ld = strlen(p);
 1340|    168|        h = strdup(pw->pw_dir);
 1341|    168|#endif
 1342|    760|    } else {
 1343|    760|        ld = strlen(d);
 1344|    760|        p = (char *) d;
 1345|    760|        h = ssh_get_user_home_dir(NULL);
 1346|    760|    }
 1347|    928|    if (h == NULL) {
  ------------------
  |  Branch (1347:9): [True: 0, False: 928]
  ------------------
 1348|      0|        return NULL;
 1349|      0|    }
 1350|    928|    lh = strlen(h);
 1351|       |
 1352|    928|    r = malloc(ld + lh + 1);
 1353|    928|    if (r == NULL) {
  ------------------
  |  Branch (1353:9): [True: 0, False: 928]
  ------------------
 1354|      0|        SAFE_FREE(h);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1355|      0|        return NULL;
 1356|      0|    }
 1357|       |
 1358|    928|    if (lh > 0) {
  ------------------
  |  Branch (1358:9): [True: 928, False: 0]
  ------------------
 1359|    928|        memcpy(r, h, lh);
 1360|    928|    }
 1361|    928|    SAFE_FREE(h);
  ------------------
  |  |  373|    928|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 928, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 928]
  |  |  ------------------
  ------------------
 1362|    928|    memcpy(r + lh, p, ld + 1);
 1363|       |
 1364|    928|    return r;
 1365|    928|}
ssh_path_expand_hostname:
 1717|      5|{
 1718|       |    return ssh_path_expand_internal(session, s, true);
 1719|      5|}
ssh_check_hostname_syntax:
 2547|    488|{
 2548|    488|    char *it = NULL, *s = NULL, *buf = NULL;
 2549|    488|    size_t it_len;
 2550|    488|    char c;
 2551|       |
 2552|    488|    if (hostname == NULL || strlen(hostname) == 0) {
  ------------------
  |  Branch (2552:9): [True: 0, False: 488]
  |  Branch (2552:29): [True: 0, False: 488]
  ------------------
 2553|      0|        return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2554|      0|    }
 2555|       |
 2556|       |    /* strtok_r writes into the string, keep the input clean */
 2557|    488|    s = strdup(hostname);
 2558|    488|    if (s == NULL) {
  ------------------
  |  Branch (2558:9): [True: 0, False: 488]
  ------------------
 2559|      0|        return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2560|      0|    }
 2561|       |
 2562|    488|    it = strtok_r(s, ".", &buf);
 2563|       |    /* if the token has 0 length */
 2564|    488|    if (it == NULL) {
  ------------------
  |  Branch (2564:9): [True: 0, False: 488]
  ------------------
 2565|      0|        free(s);
 2566|      0|        return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2567|      0|    }
 2568|    970|    do {
 2569|    970|        it_len = strlen(it);
 2570|    970|        if (it_len > ARPA_DOMAIN_MAX_LEN ||
  ------------------
  |  |  100|  1.94k|#define ARPA_DOMAIN_MAX_LEN 63
  ------------------
  |  Branch (2570:13): [True: 1, False: 969]
  ------------------
 2571|       |            /* the first char must be a letter, but some virtual urls start
 2572|       |             * with a number */
 2573|    970|            isalnum(it[0]) == 0 ||
  ------------------
  |  Branch (2573:13): [True: 1, False: 968]
  ------------------
 2574|    970|            isalnum(it[it_len - 1]) == 0) {
  ------------------
  |  Branch (2574:13): [True: 0, False: 968]
  ------------------
 2575|      2|            free(s);
 2576|      2|            return SSH_ERROR;
  ------------------
  |  |  317|      2|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2577|      2|        }
 2578|  5.88k|        while (*it != '\0') {
  ------------------
  |  Branch (2578:16): [True: 4.91k, False: 967]
  ------------------
 2579|  4.91k|            c = *it;
 2580|       |            /* the "." is allowed too, but tokenization removes it from the
 2581|       |             * string */
 2582|  4.91k|            if (isalnum(c) == 0 && c != '-') {
  ------------------
  |  Branch (2582:17): [True: 7, False: 4.90k]
  |  Branch (2582:36): [True: 1, False: 6]
  ------------------
 2583|      1|                free(s);
 2584|      1|                return SSH_ERROR;
  ------------------
  |  |  317|      1|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2585|      1|            }
 2586|  4.91k|            it++;
 2587|  4.91k|        }
 2588|    968|    } while ((it = strtok_r(NULL, ".", &buf)) != NULL);
  ------------------
  |  Branch (2588:14): [True: 482, False: 485]
  ------------------
 2589|       |
 2590|    485|    free(s);
 2591|       |
 2592|    485|    return SSH_OK;
  ------------------
  |  |  316|    485|#define SSH_OK 0     /* No error */
  ------------------
 2593|    488|}
ssh_check_username_syntax:
 2606|    435|{
 2607|    435|    size_t username_len;
 2608|       |
 2609|    435|    if (username == NULL || *username == '-') {
  ------------------
  |  Branch (2609:9): [True: 0, False: 435]
  |  Branch (2609:29): [True: 7, False: 428]
  ------------------
 2610|      7|        return SSH_ERROR;
  ------------------
  |  |  317|      7|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2611|      7|    }
 2612|       |
 2613|    428|    username_len = strlen(username);
 2614|    428|    if (username_len == 0 || username[username_len - 1] == '\\' ||
  ------------------
  |  Branch (2614:9): [True: 0, False: 428]
  |  Branch (2614:30): [True: 1, False: 427]
  ------------------
 2615|    427|        strpbrk(username, "'`\";&<>|(){}") != NULL) {
  ------------------
  |  Branch (2615:9): [True: 7, False: 420]
  ------------------
 2616|      8|        return SSH_ERROR;
  ------------------
  |  |  317|      8|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2617|      8|    }
 2618|  4.53k|    for (size_t i = 0; i < username_len; i++) {
  ------------------
  |  Branch (2618:24): [True: 4.11k, False: 418]
  ------------------
 2619|  4.11k|        if (isspace(username[i]) != 0 && username[i + 1] == '-') {
  ------------------
  |  Branch (2619:13): [True: 143, False: 3.97k]
  |  Branch (2619:42): [True: 2, False: 141]
  ------------------
 2620|      2|            return SSH_ERROR;
  ------------------
  |  |  317|      2|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2621|      2|        }
 2622|  4.11k|    }
 2623|       |
 2624|    418|    return SSH_OK;
  ------------------
  |  |  316|    418|#define SSH_OK 0     /* No error */
  ------------------
 2625|    420|}
ssh_proxyjumps_free:
 2637|    533|{
 2638|    533|    struct ssh_jump_info_struct *jump = NULL;
 2639|       |
 2640|    533|    for (jump =
 2641|    533|             ssh_list_pop_head(struct ssh_jump_info_struct *, proxy_jump_list);
  ------------------
  |  |  122|    533|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
 2642|  2.64k|         jump != NULL;
  ------------------
  |  Branch (2642:10): [True: 2.11k, False: 533]
  ------------------
 2643|  2.11k|         jump = ssh_list_pop_head(struct ssh_jump_info_struct *,
  ------------------
  |  |  122|  2.11k|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
 2644|  2.11k|                                  proxy_jump_list)) {
 2645|  2.11k|        SAFE_FREE(jump->hostname);
  ------------------
  |  |  373|  2.11k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 2.11k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 2.11k]
  |  |  ------------------
  ------------------
 2646|  2.11k|        SAFE_FREE(jump->username);
  ------------------
  |  |  373|  2.11k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 384, False: 1.73k]
  |  |  |  Branch (373:71): [Folded, False: 2.11k]
  |  |  ------------------
  ------------------
 2647|       |        SAFE_FREE(jump);
  ------------------
  |  |  373|  2.11k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 2.11k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 2.11k]
  |  |  ------------------
  ------------------
 2648|  2.11k|    }
 2649|    533|}
ssh_libssh_proxy_jumps:
 2662|     69|{
 2663|     69|    const char *t = getenv("OPENSSH_PROXYJUMP");
 2664|       |
 2665|     69|    return !(t != NULL && t[0] == '1');
  ------------------
  |  Branch (2665:14): [True: 0, False: 69]
  |  Branch (2665:27): [True: 0, False: 0]
  ------------------
 2666|     69|}
ssh_strict_fopen:
 2683|  19.9k|{
 2684|  19.9k|    FILE *f = NULL;
 2685|  19.9k|    struct stat sb;
 2686|  19.9k|    int r, fd;
 2687|       |
 2688|       |    /* open first to avoid TOCTOU */
 2689|  19.9k|    fd = open(filename, O_RDONLY);
 2690|  19.9k|    if (fd == -1) {
  ------------------
  |  Branch (2690:9): [True: 0, False: 19.9k]
  ------------------
 2691|      0|        SSH_LOG_STRERROR(SSH_LOG_TRACE,
  ------------------
  |  |  283|      0|    do {                                                            \
  |  |  284|      0|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  285|      0|        _ssh_log(priority,                                          \
  |  |  286|      0|                 __func__,                                          \
  |  |  287|      0|                 __VA_ARGS__,                                       \
  |  |  288|      0|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  520|      0|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  289|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (289:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2692|      0|                         errno,
 2693|      0|                         "Failed to open a file %s for reading: %s",
 2694|      0|                         filename);
 2695|      0|        return NULL;
 2696|      0|    }
 2697|       |
 2698|       |    /* Check the file is sensible for a configuration file */
 2699|  19.9k|    r = fstat(fd, &sb);
 2700|  19.9k|    if (r != 0) {
  ------------------
  |  Branch (2700:9): [True: 0, False: 19.9k]
  ------------------
 2701|      0|        SSH_LOG_STRERROR(SSH_LOG_TRACE,
  ------------------
  |  |  283|      0|    do {                                                            \
  |  |  284|      0|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  285|      0|        _ssh_log(priority,                                          \
  |  |  286|      0|                 __func__,                                          \
  |  |  287|      0|                 __VA_ARGS__,                                       \
  |  |  288|      0|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  520|      0|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  289|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (289:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2702|      0|                         errno,
 2703|      0|                         "Failed to stat %s: %s",
 2704|      0|                         filename);
 2705|      0|        close(fd);
 2706|      0|        return NULL;
 2707|      0|    }
 2708|  19.9k|    if ((sb.st_mode & S_IFMT) != S_IFREG) {
  ------------------
  |  Branch (2708:9): [True: 19.6k, False: 293]
  ------------------
 2709|  19.6k|        SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|  19.6k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2710|  19.6k|                "The file %s is not a regular file: skipping",
 2711|  19.6k|                filename);
 2712|  19.6k|        close(fd);
 2713|  19.6k|        return NULL;
 2714|  19.6k|    }
 2715|       |
 2716|    293|    if ((size_t)sb.st_size > max_file_size) {
  ------------------
  |  Branch (2716:9): [True: 4, False: 289]
  ------------------
 2717|      4|        SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  281|      4|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2718|      4|                "The file %s is too large (%jd MB > %zu MB): skipping",
 2719|      4|                filename,
 2720|      4|                (intmax_t)sb.st_size / 1024 / 1024,
 2721|      4|                max_file_size / 1024 / 1024);
 2722|      4|        close(fd);
 2723|      4|        return NULL;
 2724|      4|    }
 2725|       |
 2726|    289|    f = fdopen(fd, "r");
 2727|    289|    if (f == NULL) {
  ------------------
  |  Branch (2727:9): [True: 0, False: 289]
  ------------------
 2728|      0|        SSH_LOG_STRERROR(SSH_LOG_TRACE,
  ------------------
  |  |  283|      0|    do {                                                            \
  |  |  284|      0|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  285|      0|        _ssh_log(priority,                                          \
  |  |  286|      0|                 __func__,                                          \
  |  |  287|      0|                 __VA_ARGS__,                                       \
  |  |  288|      0|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  520|      0|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  289|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (289:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2729|      0|                         errno,
 2730|      0|                         "Failed to open a file %s for reading: %s",
 2731|      0|                         filename);
 2732|      0|        close(fd);
 2733|      0|        return NULL;
 2734|      0|    }
 2735|       |
 2736|       |    /* the flcose() will close also the underlying fd */
 2737|    289|    return f;
 2738|    289|}
strlcpy:
 2749|      8|{
 2750|      8|    size_t len = strlen(src);
 2751|       |
 2752|      8|    if (size != 0) {
  ------------------
  |  Branch (2752:9): [True: 8, False: 0]
  ------------------
 2753|      8|        size_t copy_len = (len >= size) ? size - 1 : len;
  ------------------
  |  Branch (2753:27): [True: 0, False: 8]
  ------------------
 2754|       |
 2755|      8|        memcpy(dst, src, copy_len);
 2756|      8|        dst[copy_len] = '\0';
 2757|      8|    }
 2758|       |
 2759|      8|    return len;
 2760|      8|}
strlcat:
 2765|  6.67k|{
 2766|  6.67k|    size_t dst_len;
 2767|  6.67k|    const char *p = memchr(dst, '\0', size);
 2768|  6.67k|    size_t src_len = strlen(src);
 2769|       |
 2770|  6.67k|    dst_len = (p != NULL) ? (size_t)(p - dst) : size;
  ------------------
  |  Branch (2770:15): [True: 6.67k, False: 0]
  ------------------
 2771|       |
 2772|  6.67k|    if (dst_len < size) {
  ------------------
  |  Branch (2772:9): [True: 6.67k, False: 0]
  ------------------
 2773|  6.67k|        size_t copy_len =
 2774|  6.67k|            (src_len >= size - dst_len) ? size - dst_len - 1 : src_len;
  ------------------
  |  Branch (2774:13): [True: 0, False: 6.67k]
  ------------------
 2775|  6.67k|        memcpy(dst + dst_len, src, copy_len);
 2776|  6.67k|        dst[dst_len + copy_len] = '\0';
 2777|  6.67k|    }
 2778|       |
 2779|  6.67k|    return dst_len + src_len;
 2780|  6.67k|}
ssh_normalize_loose_ip:
 2797|    489|{
 2798|    489|    struct in_addr addr;
 2799|    489|    char buf[INET_ADDRSTRLEN];
 2800|    489|    const char *p = NULL;
 2801|    489|    int rc;
 2802|    489|    int is_ip;
 2803|       |#ifdef _WIN32
 2804|       |    unsigned long ip;
 2805|       |    int is_broadcast;
 2806|       |#endif
 2807|       |
 2808|    489|    if (host == NULL || result == NULL) {
  ------------------
  |  Branch (2808:9): [True: 0, False: 489]
  |  Branch (2808:25): [True: 0, False: 489]
  ------------------
 2809|      0|        return -1;
 2810|      0|    }
 2811|       |
 2812|       |    /* We don't want to normalize stricter IP checks already handled by valid
 2813|       |     * IPv4/IPv6 */
 2814|    489|    is_ip = ssh_is_ipaddr(host);
 2815|    489|    if (is_ip) {
  ------------------
  |  Branch (2815:9): [True: 1, False: 488]
  ------------------
 2816|      1|        return 1; /* not a loose IP — already a strict address */
 2817|      1|    }
 2818|       |
 2819|       |#ifdef _WIN32
 2820|       |    ip = inet_addr(host);
 2821|       |    is_broadcast = strcmp(host, "255.255.255.255");
 2822|       |    if (ip == INADDR_NONE && is_broadcast != 0) {
 2823|       |        return 1; /* not a loose IP */
 2824|       |    }
 2825|       |    addr.S_un.S_addr = ip;
 2826|       |#else
 2827|    488|    rc = inet_aton(host, &addr);
 2828|    488|    if (rc == 0) {
  ------------------
  |  Branch (2828:9): [True: 488, False: 0]
  ------------------
 2829|    488|        return 1; /* not a loose IP */
 2830|    488|    }
 2831|      0|#endif
 2832|       |
 2833|      0|    p = inet_ntop(AF_INET, &addr, buf, sizeof(buf));
 2834|      0|    if (p == NULL) {
  ------------------
  |  Branch (2834:9): [True: 0, False: 0]
  ------------------
 2835|      0|        return -1;
 2836|      0|    }
 2837|       |
 2838|      0|    *result = strdup(p);
 2839|      0|    if (*result == NULL) {
  ------------------
  |  Branch (2839:9): [True: 0, False: 0]
  ------------------
 2840|      0|        return -1;
 2841|      0|    }
 2842|       |
 2843|      0|    return 0;
 2844|      0|}
misc.c:ssh_get_user_home_dir_internal:
  329|    760|{
  330|    760|    char *szPath = NULL;
  331|    760|    struct passwd pwd;
  332|    760|    struct passwd *pwdbuf = NULL;
  333|    760|    char buf[NSS_BUFLEN_PASSWD] = {0};
  334|    760|    int rc;
  335|       |
  336|    760|    rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
  337|    760|    if (rc != 0 || pwdbuf == NULL ) {
  ------------------
  |  Branch (337:9): [True: 0, False: 760]
  |  Branch (337:20): [True: 0, False: 760]
  ------------------
  338|      0|        szPath = getenv("HOME");
  339|      0|        if (szPath == NULL) {
  ------------------
  |  Branch (339:13): [True: 0, False: 0]
  ------------------
  340|      0|            return NULL;
  341|      0|        }
  342|      0|        snprintf(buf, sizeof(buf), "%s", szPath);
  343|      0|        return strdup(buf);
  344|      0|    }
  345|       |
  346|    760|    szPath = strdup(pwd.pw_dir);
  347|       |
  348|    760|    return szPath;
  349|    760|}
misc.c:ssh_iterator_new:
  947|  5.72k|{
  948|  5.72k|    struct ssh_iterator *iterator = malloc(sizeof(struct ssh_iterator));
  949|       |
  950|  5.72k|    if (iterator == NULL) {
  ------------------
  |  Branch (950:9): [True: 0, False: 5.72k]
  ------------------
  951|      0|        return NULL;
  952|      0|    }
  953|  5.72k|    iterator->next = NULL;
  954|  5.72k|    iterator->data = data;
  955|  5.72k|    return iterator;
  956|  5.72k|}
misc.c:ssh_path_expand_internal:
 1478|      5|{
 1479|      5|    char *buf = NULL;
 1480|      5|    char *r = NULL;
 1481|      5|    char *x = NULL;
 1482|      5|    const char *p = NULL;
 1483|      5|    size_t i, l;
 1484|       |
 1485|      5|    r = ssh_path_expand_tilde(s);
 1486|      5|    if (r == NULL) {
  ------------------
  |  Branch (1486:9): [True: 0, False: 5]
  ------------------
 1487|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1488|      0|        return NULL;
 1489|      0|    }
 1490|       |
 1491|      5|    if (strlen(r) > MAX_BUF_SIZE) {
  ------------------
  |  |  230|      5|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1491:9): [True: 0, False: 5]
  ------------------
 1492|      0|        ssh_set_error(session, SSH_FATAL, "string to expand too long");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1493|      0|        free(r);
 1494|      0|        return NULL;
 1495|      0|    }
 1496|       |
 1497|      5|    buf = malloc(MAX_BUF_SIZE);
  ------------------
  |  |  230|      5|#define MAX_BUF_SIZE 4096
  ------------------
 1498|      5|    if (buf == NULL) {
  ------------------
  |  Branch (1498:9): [True: 0, False: 5]
  ------------------
 1499|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1500|      0|        free(r);
 1501|      0|        return NULL;
 1502|      0|    }
 1503|       |
 1504|      5|    p = r;
 1505|      5|    buf[0] = '\0';
 1506|       |
 1507|    366|    for (i = 0; *p != '\0'; p++) {
  ------------------
  |  Branch (1507:17): [True: 361, False: 5]
  ------------------
 1508|    361|        if (*p != '%') {
  ------------------
  |  Branch (1508:13): [True: 352, False: 9]
  ------------------
 1509|    352|            buf[i] = hostname_lenient ? tolower((unsigned char)*p) : *p;
  ------------------
  |  Branch (1509:22): [True: 352, False: 0]
  |  Branch (1509:41): [True: 0, False: 0]
  |  Branch (1509:41): [True: 0, False: 0]
  |  Branch (1509:41): [Folded, False: 352]
  ------------------
 1510|    352|            i++;
 1511|    352|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|    352|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1511:17): [True: 0, False: 352]
  ------------------
 1512|      0|                free(buf);
 1513|      0|                free(r);
 1514|      0|                return NULL;
 1515|      0|            }
 1516|    352|            buf[i] = '\0';
 1517|    352|            continue;
 1518|    352|        }
 1519|       |
 1520|      9|        p++;
 1521|      9|        if (*p == '\0') {
  ------------------
  |  Branch (1521:13): [True: 0, False: 9]
  ------------------
 1522|       |            /* HostName expansion rejects trailing '%' to match the parse-time
 1523|       |             * scan. Keep the general expansion path unchanged, where a
 1524|       |             * trailing '%' is truncated.
 1525|       |             */
 1526|      0|            if (hostname_lenient) {
  ------------------
  |  Branch (1526:17): [True: 0, False: 0]
  ------------------
 1527|      0|                ssh_set_error(session, SSH_FATAL, "Incomplete Hostname token");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1528|      0|                free(buf);
 1529|      0|                free(r);
 1530|      0|                return NULL;
 1531|      0|            }
 1532|      0|            break;
 1533|      0|        }
 1534|       |
 1535|      9|        if (hostname_lenient && *p != '%' && *p != 'h') {
  ------------------
  |  Branch (1535:13): [True: 9, False: 0]
  |  Branch (1535:33): [True: 0, False: 9]
  |  Branch (1535:46): [True: 0, False: 0]
  ------------------
 1536|      0|            buf[i] = '%';
 1537|      0|            i++;
 1538|      0|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|      0|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1538:17): [True: 0, False: 0]
  ------------------
 1539|      0|                ssh_set_error(session, SSH_FATAL, "String too long");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1540|      0|                free(buf);
 1541|      0|                free(r);
 1542|      0|                return NULL;
 1543|      0|            }
 1544|      0|            buf[i] = *p;
 1545|      0|            i++;
 1546|      0|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|      0|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1546:17): [True: 0, False: 0]
  ------------------
 1547|      0|                ssh_set_error(session, SSH_FATAL, "String too long");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1548|      0|                free(buf);
 1549|      0|                free(r);
 1550|      0|                return NULL;
 1551|      0|            }
 1552|      0|            buf[i] = '\0';
 1553|      0|            continue;
 1554|      0|        }
 1555|       |
 1556|      9|        switch (*p) {
 1557|      9|        case '%':
  ------------------
  |  Branch (1557:9): [True: 9, False: 0]
  ------------------
 1558|      9|            buf[i] = '%';
 1559|      9|            i++;
 1560|      9|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|      9|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1560:17): [True: 0, False: 9]
  ------------------
 1561|      0|                free(buf);
 1562|      0|                free(r);
 1563|      0|                return NULL;
 1564|      0|            }
 1565|      9|            buf[i] = '\0';
 1566|      9|            continue;
 1567|      0|        case 'd':
  ------------------
  |  Branch (1567:9): [True: 0, False: 9]
  ------------------
 1568|      0|            x = ssh_get_user_home_dir(session);
 1569|      0|            if (x == NULL) {
  ------------------
  |  Branch (1569:17): [True: 0, False: 0]
  ------------------
 1570|      0|                ssh_set_error(session, SSH_FATAL, "Cannot expand homedir");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1571|      0|                free(buf);
 1572|      0|                free(r);
 1573|      0|                return NULL;
 1574|      0|            }
 1575|      0|            break;
 1576|      0|        case 'u':
  ------------------
  |  Branch (1576:9): [True: 0, False: 9]
  ------------------
 1577|      0|            x = ssh_get_local_username();
 1578|      0|            break;
 1579|      0|        case 'l':
  ------------------
  |  Branch (1579:9): [True: 0, False: 9]
  ------------------
 1580|      0|            x = ssh_get_local_hostname();
 1581|      0|            break;
 1582|      0|        case 'h':
  ------------------
  |  Branch (1582:9): [True: 0, False: 9]
  ------------------
 1583|      0|            if (session->opts.host) {
  ------------------
  |  Branch (1583:17): [True: 0, False: 0]
  ------------------
 1584|      0|                x = hostname_lenient ? ssh_lowercase(session->opts.host)
  ------------------
  |  Branch (1584:21): [True: 0, False: 0]
  ------------------
 1585|      0|                                     : strdup(session->opts.host);
 1586|      0|            } else if (session->opts.originalhost) {
  ------------------
  |  Branch (1586:24): [True: 0, False: 0]
  ------------------
 1587|      0|                x = hostname_lenient ? ssh_lowercase(session->opts.originalhost)
  ------------------
  |  Branch (1587:21): [True: 0, False: 0]
  ------------------
 1588|      0|                                     : strdup(session->opts.originalhost);
 1589|      0|            } else {
 1590|      0|                ssh_set_error(session, SSH_FATAL, "Cannot expand host");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1591|      0|                free(buf);
 1592|      0|                free(r);
 1593|      0|                return NULL;
 1594|      0|            }
 1595|      0|            break;
 1596|      0|        case 'n':
  ------------------
  |  Branch (1596:9): [True: 0, False: 9]
  ------------------
 1597|      0|            if (session->opts.originalhost) {
  ------------------
  |  Branch (1597:17): [True: 0, False: 0]
  ------------------
 1598|      0|                x = strdup(session->opts.originalhost);
 1599|      0|            } else {
 1600|      0|                ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1601|      0|                              SSH_FATAL,
 1602|      0|                              "Cannot expand original host");
 1603|      0|                free(buf);
 1604|      0|                free(r);
 1605|      0|                return NULL;
 1606|      0|            }
 1607|      0|            break;
 1608|      0|        case 'r':
  ------------------
  |  Branch (1608:9): [True: 0, False: 9]
  ------------------
 1609|      0|            if (session->opts.username) {
  ------------------
  |  Branch (1609:17): [True: 0, False: 0]
  ------------------
 1610|      0|                x = strdup(session->opts.username);
 1611|      0|            } else {
 1612|      0|                ssh_set_error(session, SSH_FATAL, "Cannot expand username");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1613|      0|                free(buf);
 1614|      0|                free(r);
 1615|      0|                return NULL;
 1616|      0|            }
 1617|      0|            break;
 1618|      0|        case 'p': {
  ------------------
  |  Branch (1618:9): [True: 0, False: 9]
  ------------------
 1619|      0|            char tmp[6];
 1620|      0|            unsigned int port;
 1621|       |
 1622|      0|            ssh_options_get_port(session, &port);
 1623|      0|            snprintf(tmp, sizeof(tmp), "%u", port);
 1624|      0|            x = strdup(tmp);
 1625|      0|            break;
 1626|      0|        }
 1627|      0|        case 'j':
  ------------------
  |  Branch (1627:9): [True: 0, False: 9]
  ------------------
 1628|      0|            if (session->opts.proxy_jumps_str != NULL) {
  ------------------
  |  Branch (1628:17): [True: 0, False: 0]
  ------------------
 1629|      0|                x = strdup(session->opts.proxy_jumps_str);
 1630|      0|            } else {
 1631|      0|                x = strdup("");
 1632|      0|            }
 1633|      0|            break;
 1634|      0|        case 'C':
  ------------------
  |  Branch (1634:9): [True: 0, False: 9]
  ------------------
 1635|      0|            x = get_connection_hash(session);
 1636|      0|            break;
 1637|      0|        default:
  ------------------
  |  Branch (1637:9): [True: 0, False: 9]
  ------------------
 1638|      0|            ssh_set_error(session, SSH_FATAL, "Wrong escape sequence detected");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1639|      0|            free(buf);
 1640|      0|            free(r);
 1641|      0|            return NULL;
 1642|      9|        }
 1643|       |
 1644|      0|        if (x == NULL) {
  ------------------
  |  Branch (1644:13): [True: 0, False: 0]
  ------------------
 1645|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1646|      0|            free(buf);
 1647|      0|            free(r);
 1648|      0|            return NULL;
 1649|      0|        }
 1650|       |
 1651|      0|        i += strlen(x);
 1652|      0|        if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|      0|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1652:13): [True: 0, False: 0]
  ------------------
 1653|      0|            ssh_set_error(session, SSH_FATAL, "String too long");
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1654|      0|            free(buf);
 1655|      0|            free(x);
 1656|      0|            free(r);
 1657|      0|            return NULL;
 1658|      0|        }
 1659|      0|        l = strlen(buf);
 1660|      0|        strlcpy(buf + l, x, MAX_BUF_SIZE - l);
  ------------------
  |  |  230|      0|#define MAX_BUF_SIZE 4096
  ------------------
 1661|      0|        buf[i] = '\0';
 1662|      0|        SAFE_FREE(x);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1663|      0|    }
 1664|       |
 1665|      5|    free(r);
 1666|       |
 1667|       |    /* strip the unused space by realloc */
 1668|      5|    x = realloc(buf, strlen(buf) + 1);
 1669|      5|    if (x == NULL) {
  ------------------
  |  Branch (1669:9): [True: 0, False: 5]
  ------------------
 1670|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1671|      0|        free(buf);
 1672|      0|    }
 1673|      5|    return x;
 1674|      5|}

ssh_options_set_algo:
  327|    212|{
  328|       |    /* When the list start with +,-,^ the filtration of unknown algorithms
  329|       |     * gets handled inside the helper functions, otherwise the list is taken
  330|       |     * as it is. */
  331|    212|    char *p = (char *)list;
  332|       |
  333|    212|    if (algo < SSH_COMP_C_S) {
  ------------------
  |  Branch (333:9): [True: 212, False: 0]
  ------------------
  334|    212|        if (list[0] == '+') {
  ------------------
  |  Branch (334:13): [True: 105, False: 107]
  ------------------
  335|    105|            p = ssh_add_to_default_algos(algo, list+1);
  336|    107|        } else if (list[0] == '-') {
  ------------------
  |  Branch (336:20): [True: 21, False: 86]
  ------------------
  337|     21|            p = ssh_remove_from_default_algos(algo, list+1);
  338|     86|        } else if (list[0] == '^') {
  ------------------
  |  Branch (338:20): [True: 51, False: 35]
  ------------------
  339|     51|            p = ssh_prefix_default_algos(algo, list+1);
  340|     51|        }
  341|    212|    }
  342|       |
  343|    212|    if (p == list) {
  ------------------
  |  Branch (343:9): [True: 35, False: 177]
  ------------------
  344|     35|        if (ssh_fips_mode()) {
  ------------------
  |  |  115|     35|#define ssh_fips_mode() (FIPS_mode() != 0)
  |  |  ------------------
  |  |  |  Branch (115:25): [True: 0, False: 35]
  |  |  ------------------
  ------------------
  345|      0|            p = ssh_keep_fips_algos(algo, list);
  346|     35|        } else {
  347|     35|            p = ssh_keep_known_algos(algo, list);
  348|     35|        }
  349|     35|    }
  350|       |
  351|    212|    if (p == NULL) {
  ------------------
  |  Branch (351:9): [True: 35, False: 177]
  ------------------
  352|     35|        ssh_set_error(session, SSH_REQUEST_DENIED,
  ------------------
  |  |  311|     35|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  353|     35|                "Setting method: no allowed algorithm for method \"%s\" (%s)",
  354|     35|                ssh_kex_get_description(algo), list);
  355|     35|        return -1;
  356|     35|    }
  357|       |
  358|    177|    SAFE_FREE(*place);
  ------------------
  |  |  373|    177|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 177]
  |  |  |  Branch (373:71): [Folded, False: 177]
  |  |  ------------------
  ------------------
  359|    177|    *place = p;
  360|       |
  361|    177|    return 0;
  362|    212|}
ssh_options_set:
  755|  3.42k|{
  756|  3.42k|    const char *v = NULL;
  757|  3.42k|    char *p = NULL, *q = NULL;
  758|  3.42k|    long int i;
  759|  3.42k|    unsigned int u;
  760|  3.42k|    int rc;
  761|  3.42k|    char **wanted_methods = session->opts.wanted_methods;
  762|  3.42k|    struct ssh_jump_callbacks_struct *j = NULL;
  763|       |
  764|  3.42k|    if (session == NULL) {
  ------------------
  |  Branch (764:9): [True: 0, False: 3.42k]
  ------------------
  765|      0|        return -1;
  766|      0|    }
  767|       |
  768|  3.42k|    switch (type) {
  769|    507|        case SSH_OPTIONS_HOST:
  ------------------
  |  Branch (769:9): [True: 507, False: 2.91k]
  ------------------
  770|    507|            v = value;
  771|    507|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (771:17): [True: 0, False: 507]
  |  Branch (771:30): [True: 0, False: 507]
  ------------------
  772|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  773|      0|                return -1;
  774|    507|            } else {
  775|    507|                char *username = NULL, *hostname = NULL;
  776|    507|                char *strict_hostname = NULL;
  777|    507|                char *normalized = NULL;
  778|       |
  779|       |                /* Non-strict parse: reject shell metacharacters */
  780|    507|                rc = ssh_config_parse_uri(value,
  781|    507|                                          &username,
  782|    507|                                          &hostname,
  783|    507|                                          NULL,
  784|    507|                                          true,
  785|    507|                                          false);
  786|    507|                if (rc != SSH_OK || hostname == NULL) {
  ------------------
  |  |  316|  1.01k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (786:21): [True: 18, False: 489]
  |  Branch (786:37): [True: 0, False: 489]
  ------------------
  787|     18|                    SAFE_FREE(username);
  ------------------
  |  |  373|     18|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 18]
  |  |  |  Branch (373:71): [Folded, False: 18]
  |  |  ------------------
  ------------------
  788|     18|                    SAFE_FREE(hostname);
  ------------------
  |  |  373|     18|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 18]
  |  |  |  Branch (373:71): [Folded, False: 18]
  |  |  ------------------
  ------------------
  789|     18|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|     18|    _ssh_set_error_invalid(error, __func__)
  ------------------
  790|     18|                    return -1;
  791|     18|                }
  792|       |
  793|       |                /* Non-strict passed: set username and originalhost */
  794|    489|                if (username != NULL) {
  ------------------
  |  Branch (794:21): [True: 1, False: 488]
  ------------------
  795|      1|                    SAFE_FREE(session->opts.username);
  ------------------
  |  |  373|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 1]
  |  |  |  Branch (373:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
  796|      1|                    session->opts.username = username;
  797|      1|                }
  798|    489|                if (!session->opts.config_hostname_only) {
  ------------------
  |  Branch (798:21): [True: 478, False: 11]
  ------------------
  799|    478|                    SAFE_FREE(session->opts.config_hostname);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  800|    478|                    SAFE_FREE(session->opts.originalhost);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  801|    478|                    session->opts.originalhost = hostname;
  802|    478|                } else {
  803|     11|                    SAFE_FREE(hostname);
  ------------------
  |  |  373|     11|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 11, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 11]
  |  |  ------------------
  ------------------
  804|     11|                }
  805|       |
  806|       |                /* Strict parse: set host only if valid hostname or IP */
  807|    489|                rc = ssh_normalize_loose_ip(value, &normalized);
  808|    489|                if (rc == -1) {
  ------------------
  |  Branch (808:21): [True: 0, False: 489]
  ------------------
  809|       |                    /* Error */
  810|      0|                    SAFE_FREE(username);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  811|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  812|      0|                    return -1;
  813|      0|                }
  814|    489|                rc = ssh_config_parse_uri(
  815|    489|                    (normalized != NULL) ? normalized : value,
  ------------------
  |  Branch (815:21): [True: 0, False: 489]
  ------------------
  816|    489|                    NULL,
  817|    489|                    &strict_hostname,
  818|    489|                    NULL,
  819|    489|                    true,
  820|    489|                    true);
  821|    489|                SAFE_FREE(normalized);
  ------------------
  |  |  373|    489|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 489]
  |  |  |  Branch (373:71): [Folded, False: 489]
  |  |  ------------------
  ------------------
  822|       |
  823|    489|                if (rc != SSH_OK || strict_hostname == NULL) {
  ------------------
  |  |  316|    978|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (823:21): [True: 3, False: 486]
  |  Branch (823:37): [True: 0, False: 486]
  ------------------
  824|      3|                    SAFE_FREE(session->opts.host);
  ------------------
  |  |  373|      3|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 3, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 3]
  |  |  ------------------
  ------------------
  825|      3|                    SAFE_FREE(strict_hostname);
  ------------------
  |  |  373|      3|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 3]
  |  |  |  Branch (373:71): [Folded, False: 3]
  |  |  ------------------
  ------------------
  826|      3|                    if (session->opts.config_hostname_only) {
  ------------------
  |  Branch (826:25): [True: 3, False: 0]
  ------------------
  827|       |                        /* Config path: Hostname must be valid */
  828|      3|                        ssh_set_error_invalid(session);
  ------------------
  |  |  322|      3|    _ssh_set_error_invalid(error, __func__)
  ------------------
  829|      3|                        return -1;
  830|      3|                    }
  831|    486|                } else {
  832|    486|                    SAFE_FREE(session->opts.host);
  ------------------
  |  |  373|    486|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 8, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 486]
  |  |  ------------------
  ------------------
  833|    486|                    session->opts.host = strict_hostname;
  834|    486|                }
  835|    489|            }
  836|    486|            break;
  837|    486|        case SSH_OPTIONS_PORT:
  ------------------
  |  Branch (837:9): [True: 0, False: 3.42k]
  ------------------
  838|      0|            if (value == NULL) {
  ------------------
  |  Branch (838:17): [True: 0, False: 0]
  ------------------
  839|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  840|      0|                return -1;
  841|      0|            } else {
  842|      0|                int *x = (int *) value;
  843|      0|                if (*x <= 0 || *x > 65535) {
  ------------------
  |  Branch (843:21): [True: 0, False: 0]
  |  Branch (843:32): [True: 0, False: 0]
  ------------------
  844|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  845|      0|                    return -1;
  846|      0|                }
  847|       |
  848|      0|                session->opts.port = *x;
  849|      0|            }
  850|      0|            break;
  851|      0|        case SSH_OPTIONS_PORT_STR:
  ------------------
  |  Branch (851:9): [True: 0, False: 3.42k]
  ------------------
  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);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  855|      0|                return -1;
  856|      0|            } else {
  857|      0|                q = strdup(v);
  858|      0|                if (q == NULL) {
  ------------------
  |  Branch (858:21): [True: 0, False: 0]
  ------------------
  859|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  860|      0|                    return -1;
  861|      0|                }
  862|      0|                i = strtol(q, &p, 10);
  863|      0|                if (q == p || *p != '\0') {
  ------------------
  |  Branch (863:21): [True: 0, False: 0]
  |  Branch (863:31): [True: 0, False: 0]
  ------------------
  864|      0|                    SSH_LOG(SSH_LOG_DEBUG, "No port number was parsed");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  865|      0|                    SAFE_FREE(q);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  866|      0|                    return -1;
  867|      0|                }
  868|      0|                SAFE_FREE(q);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  869|      0|                if (i <= 0 || i > 65535) {
  ------------------
  |  Branch (869:21): [True: 0, False: 0]
  |  Branch (869:31): [True: 0, False: 0]
  ------------------
  870|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  871|      0|                    return -1;
  872|      0|                }
  873|       |
  874|      0|                session->opts.port = i;
  875|      0|            }
  876|      0|            break;
  877|      0|        case SSH_OPTIONS_FD:
  ------------------
  |  Branch (877:9): [True: 0, False: 3.42k]
  ------------------
  878|      0|            if (value == NULL) {
  ------------------
  |  Branch (878:17): [True: 0, False: 0]
  ------------------
  879|      0|                session->opts.fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  124|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  880|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  881|      0|                return -1;
  882|      0|            } else {
  883|      0|                socket_t *x = (socket_t *) value;
  884|      0|                if (*x < 0) {
  ------------------
  |  Branch (884:21): [True: 0, False: 0]
  ------------------
  885|      0|                    session->opts.fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  124|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  886|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  887|      0|                    return -1;
  888|      0|                }
  889|       |
  890|      0|                session->opts.fd = *x & 0xffff;
  891|      0|            }
  892|      0|            break;
  893|      0|        case SSH_OPTIONS_BINDADDR:
  ------------------
  |  Branch (893:9): [True: 0, False: 3.42k]
  ------------------
  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);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  897|      0|                return -1;
  898|      0|            }
  899|       |
  900|      0|            q = strdup(v);
  901|      0|            if (q == NULL) {
  ------------------
  |  Branch (901:17): [True: 0, False: 0]
  ------------------
  902|      0|                return -1;
  903|      0|            }
  904|      0|            SAFE_FREE(session->opts.bindaddr);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  905|      0|            session->opts.bindaddr = q;
  906|      0|            break;
  907|     32|        case SSH_OPTIONS_USER:
  ------------------
  |  Branch (907:9): [True: 32, False: 3.39k]
  ------------------
  908|     32|            v = value;
  909|     32|            SAFE_FREE(session->opts.username);
  ------------------
  |  |  373|     32|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 32]
  |  |  |  Branch (373:71): [Folded, False: 32]
  |  |  ------------------
  ------------------
  910|     32|            if (v == NULL) {
  ------------------
  |  Branch (910:17): [True: 0, False: 32]
  ------------------
  911|      0|                q = ssh_get_local_username();
  912|      0|                if (q == NULL) {
  ------------------
  |  Branch (912:21): [True: 0, False: 0]
  ------------------
  913|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  914|      0|                    return -1;
  915|      0|                }
  916|      0|                session->opts.username = q;
  917|     32|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (917:24): [True: 0, False: 32]
  ------------------
  918|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  919|      0|                return -1;
  920|     32|            } else { /* username provided */
  921|     32|                session->opts.username = strdup(value);
  922|     32|                if (session->opts.username == NULL) {
  ------------------
  |  Branch (922:21): [True: 0, False: 32]
  ------------------
  923|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  924|      0|                    return -1;
  925|      0|                }
  926|     32|                rc = ssh_check_username_syntax(session->opts.username);
  927|     32|                if (rc != SSH_OK) {
  ------------------
  |  |  316|     32|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (927:21): [True: 8, False: 24]
  ------------------
  928|      8|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      8|    _ssh_set_error_invalid(error, __func__)
  ------------------
  929|      8|                    return -1;
  930|      8|                }
  931|     32|            }
  932|     24|            break;
  933|    478|        case SSH_OPTIONS_SSH_DIR:
  ------------------
  |  Branch (933:9): [True: 478, False: 2.94k]
  ------------------
  934|    478|            v = value;
  935|    478|            SAFE_FREE(session->opts.sshdir);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  936|    478|            if (v == NULL) {
  ------------------
  |  Branch (936:17): [True: 478, False: 0]
  ------------------
  937|    478|                session->opts.sshdir = ssh_path_expand_tilde("~/.ssh");
  938|    478|                if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (938:21): [True: 0, False: 478]
  ------------------
  939|      0|                    return -1;
  940|      0|                }
  941|    478|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (941:24): [True: 0, False: 0]
  ------------------
  942|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  943|      0|                return -1;
  944|      0|            } else {
  945|      0|                session->opts.sshdir = ssh_path_expand_tilde(v);
  946|      0|                if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (946:21): [True: 0, False: 0]
  ------------------
  947|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  948|      0|                    return -1;
  949|      0|                }
  950|      0|            }
  951|    478|            break;
  952|    478|        case SSH_OPTIONS_IDENTITY:
  ------------------
  |  Branch (952:9): [True: 0, False: 3.42k]
  ------------------
  953|    570|        case SSH_OPTIONS_ADD_IDENTITY:
  ------------------
  |  Branch (953:9): [True: 570, False: 2.85k]
  ------------------
  954|    570|            v = value;
  955|    570|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (955:17): [True: 0, False: 570]
  |  Branch (955:30): [True: 0, False: 570]
  ------------------
  956|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  957|      0|                return -1;
  958|      0|            }
  959|    570|            q = strdup(v);
  960|    570|            if (q == NULL) {
  ------------------
  |  Branch (960:17): [True: 0, False: 570]
  ------------------
  961|      0|                return -1;
  962|      0|            }
  963|    570|            if (session->opts.exp_flags & SSH_OPT_EXP_FLAG_IDENTITY) {
  ------------------
  |  |  118|    570|#define SSH_OPT_EXP_FLAG_IDENTITY 0x8
  ------------------
  |  Branch (963:17): [True: 0, False: 570]
  ------------------
  964|      0|                rc = ssh_list_append(session->opts.identity_non_exp, q);
  965|    570|            } else {
  966|    570|                rc = ssh_list_prepend(session->opts.identity_non_exp, q);
  967|    570|            }
  968|    570|            if (rc < 0) {
  ------------------
  |  Branch (968:17): [True: 0, False: 570]
  ------------------
  969|      0|                free(q);
  970|      0|                return -1;
  971|      0|            }
  972|    570|            break;
  973|  1.60k|        case SSH_OPTIONS_CERTIFICATE:
  ------------------
  |  Branch (973:9): [True: 1.60k, False: 1.82k]
  ------------------
  974|  1.60k|            v = value;
  975|  1.60k|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (975:17): [True: 0, False: 1.60k]
  |  Branch (975:30): [True: 0, False: 1.60k]
  ------------------
  976|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  977|      0|                return -1;
  978|      0|            }
  979|  1.60k|            q = strdup(v);
  980|  1.60k|            if (q == NULL) {
  ------------------
  |  Branch (980:17): [True: 0, False: 1.60k]
  ------------------
  981|      0|                return -1;
  982|      0|            }
  983|  1.60k|            rc = ssh_list_append(session->opts.certificate_non_exp, q);
  984|  1.60k|            if (rc < 0) {
  ------------------
  |  Branch (984:17): [True: 0, False: 1.60k]
  ------------------
  985|      0|                free(q);
  986|      0|                return -1;
  987|      0|            }
  988|  1.60k|            break;
  989|  1.60k|        case SSH_OPTIONS_KNOWNHOSTS:
  ------------------
  |  Branch (989:9): [True: 0, False: 3.42k]
  ------------------
  990|      0|            v = value;
  991|      0|            SAFE_FREE(session->opts.knownhosts);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  992|      0|            if (v == NULL) {
  ------------------
  |  Branch (992:17): [True: 0, False: 0]
  ------------------
  993|       |                /* The default value will be set by the ssh_options_apply() */
  994|      0|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (994:24): [True: 0, False: 0]
  ------------------
  995|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  996|      0|                return -1;
  997|      0|            } else {
  998|      0|                session->opts.knownhosts = strdup(v);
  999|      0|                if (session->opts.knownhosts == NULL) {
  ------------------
  |  Branch (999:21): [True: 0, False: 0]
  ------------------
 1000|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1001|      0|                    return -1;
 1002|      0|                }
 1003|      0|                session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_KNOWNHOSTS;
  ------------------
  |  |  115|      0|#define SSH_OPT_EXP_FLAG_KNOWNHOSTS 0x1
  ------------------
 1004|      0|            }
 1005|      0|            break;
 1006|      3|        case SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
  ------------------
  |  Branch (1006:9): [True: 3, False: 3.42k]
  ------------------
 1007|      3|            v = value;
 1008|      3|            SAFE_FREE(session->opts.global_knownhosts);
  ------------------
  |  |  373|      3|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 3]
  |  |  |  Branch (373:71): [Folded, False: 3]
  |  |  ------------------
  ------------------
 1009|      3|            if (v == NULL) {
  ------------------
  |  Branch (1009:17): [True: 0, False: 3]
  ------------------
 1010|      0|                session->opts.global_knownhosts =
 1011|      0|                    strdup(GLOBAL_CONF_DIR "/ssh_known_hosts");
  ------------------
  |  |   13|      0|#define GLOBAL_CONF_DIR "/etc/ssh"
  ------------------
 1012|      0|                if (session->opts.global_knownhosts == NULL) {
  ------------------
  |  Branch (1012:21): [True: 0, False: 0]
  ------------------
 1013|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1014|      0|                    return -1;
 1015|      0|                }
 1016|      3|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (1016:24): [True: 0, False: 3]
  ------------------
 1017|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1018|      0|                return -1;
 1019|      3|            } else {
 1020|      3|                session->opts.global_knownhosts = strdup(v);
 1021|      3|                if (session->opts.global_knownhosts == NULL) {
  ------------------
  |  Branch (1021:21): [True: 0, False: 3]
  ------------------
 1022|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1023|      0|                    return -1;
 1024|      0|                }
 1025|      3|                session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_GLOBAL_KNOWNHOSTS;
  ------------------
  |  |  116|      3|#define SSH_OPT_EXP_FLAG_GLOBAL_KNOWNHOSTS 0x2
  ------------------
 1026|      3|            }
 1027|      3|            break;
 1028|      3|        case SSH_OPTIONS_TIMEOUT:
  ------------------
  |  Branch (1028:9): [True: 0, False: 3.42k]
  ------------------
 1029|      0|            if (value == NULL) {
  ------------------
  |  Branch (1029:17): [True: 0, False: 0]
  ------------------
 1030|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1031|      0|                return -1;
 1032|      0|            } else {
 1033|      0|                long *x = (long *) value;
 1034|      0|                if (*x < 0) {
  ------------------
  |  Branch (1034:21): [True: 0, False: 0]
  ------------------
 1035|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1036|      0|                    return -1;
 1037|      0|                }
 1038|       |
 1039|      0|                session->opts.timeout = *x & 0xffffffffU;
 1040|      0|            }
 1041|      0|            break;
 1042|      0|        case SSH_OPTIONS_TIMEOUT_USEC:
  ------------------
  |  Branch (1042:9): [True: 0, False: 3.42k]
  ------------------
 1043|      0|            if (value == NULL) {
  ------------------
  |  Branch (1043:17): [True: 0, False: 0]
  ------------------
 1044|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1045|      0|                return -1;
 1046|      0|            } else {
 1047|      0|                long *x = (long *) value;
 1048|      0|                if (*x < 0) {
  ------------------
  |  Branch (1048:21): [True: 0, False: 0]
  ------------------
 1049|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1050|      0|                    return -1;
 1051|      0|                }
 1052|       |
 1053|      0|                session->opts.timeout_usec = *x & 0xffffffffU;
 1054|      0|            }
 1055|      0|            break;
 1056|      0|        case SSH_OPTIONS_SSH1:
  ------------------
  |  Branch (1056:9): [True: 0, False: 3.42k]
  ------------------
 1057|      0|            break;
 1058|      0|        case SSH_OPTIONS_SSH2:
  ------------------
  |  Branch (1058:9): [True: 0, False: 3.42k]
  ------------------
 1059|      0|            break;
 1060|      0|        case SSH_OPTIONS_LOG_VERBOSITY:
  ------------------
  |  Branch (1060:9): [True: 0, False: 3.42k]
  ------------------
 1061|      0|            if (value == NULL) {
  ------------------
  |  Branch (1061:17): [True: 0, False: 0]
  ------------------
 1062|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1063|      0|                return -1;
 1064|      0|            } else {
 1065|      0|                int *x = (int *) value;
 1066|      0|                if (*x < 0) {
  ------------------
  |  Branch (1066:21): [True: 0, False: 0]
  ------------------
 1067|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1068|      0|                    return -1;
 1069|      0|                }
 1070|       |
 1071|      0|                session->common.log_verbosity = *x & 0xffffU;
 1072|      0|                ssh_set_log_level(*x & 0xffffU);
 1073|      0|            }
 1074|      0|            break;
 1075|      0|        case SSH_OPTIONS_LOG_VERBOSITY_STR:
  ------------------
  |  Branch (1075:9): [True: 0, False: 3.42k]
  ------------------
 1076|      0|            v = value;
 1077|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1077:17): [True: 0, False: 0]
  |  Branch (1077:30): [True: 0, False: 0]
  ------------------
 1078|      0|                session->common.log_verbosity = 0;
 1079|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1080|      0|                return -1;
 1081|      0|            } else {
 1082|      0|                q = strdup(v);
 1083|      0|                if (q == NULL) {
  ------------------
  |  Branch (1083:21): [True: 0, False: 0]
  ------------------
 1084|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1085|      0|                    return -1;
 1086|      0|                }
 1087|      0|                i = strtol(q, &p, 10);
 1088|      0|                if (q == p) {
  ------------------
  |  Branch (1088:21): [True: 0, False: 0]
  ------------------
 1089|      0|                    SSH_LOG(SSH_LOG_DEBUG, "No log verbositiy was parsed");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1090|      0|                    SAFE_FREE(q);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1091|      0|                    return -1;
 1092|      0|                }
 1093|      0|                SAFE_FREE(q);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1094|      0|                if (i < 0) {
  ------------------
  |  Branch (1094:21): [True: 0, False: 0]
  ------------------
 1095|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1096|      0|                    return -1;
 1097|      0|                }
 1098|       |
 1099|      0|                session->common.log_verbosity = i & 0xffffU;
 1100|      0|                ssh_set_log_level(i & 0xffffU);
 1101|      0|            }
 1102|      0|            break;
 1103|     16|        case SSH_OPTIONS_CIPHERS_C_S:
  ------------------
  |  Branch (1103:9): [True: 16, False: 3.40k]
  ------------------
 1104|     16|            v = value;
 1105|     16|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1105:17): [True: 0, False: 16]
  |  Branch (1105:30): [True: 0, False: 16]
  ------------------
 1106|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1107|      0|                return -1;
 1108|     16|            } else {
 1109|     16|                rc = ssh_options_set_algo(session,
 1110|     16|                                          SSH_CRYPT_C_S,
 1111|     16|                                          v,
 1112|     16|                                          &wanted_methods[SSH_CRYPT_C_S]);
 1113|     16|                if (rc < 0)
  ------------------
  |  Branch (1113:21): [True: 2, False: 14]
  ------------------
 1114|      2|                    return -1;
 1115|     16|            }
 1116|     14|            break;
 1117|     16|        case SSH_OPTIONS_CIPHERS_S_C:
  ------------------
  |  Branch (1117:9): [True: 16, False: 3.40k]
  ------------------
 1118|     16|            v = value;
 1119|     16|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1119:17): [True: 0, False: 16]
  |  Branch (1119:30): [True: 0, False: 16]
  ------------------
 1120|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1121|      0|                return -1;
 1122|     16|            } else {
 1123|     16|                rc = ssh_options_set_algo(session,
 1124|     16|                                          SSH_CRYPT_S_C,
 1125|     16|                                          v,
 1126|     16|                                          &wanted_methods[SSH_CRYPT_S_C]);
 1127|     16|                if (rc < 0)
  ------------------
  |  Branch (1127:21): [True: 2, False: 14]
  ------------------
 1128|      2|                    return -1;
 1129|     16|            }
 1130|     14|            break;
 1131|     14|        case SSH_OPTIONS_KEY_EXCHANGE:
  ------------------
  |  Branch (1131:9): [True: 6, False: 3.41k]
  ------------------
 1132|      6|            v = value;
 1133|      6|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1133:17): [True: 0, False: 6]
  |  Branch (1133:30): [True: 0, False: 6]
  ------------------
 1134|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1135|      0|                return -1;
 1136|      6|            } else {
 1137|      6|                rc = ssh_options_set_algo(session,
 1138|      6|                                          SSH_KEX,
 1139|      6|                                          v,
 1140|      6|                                          &wanted_methods[SSH_KEX]);
 1141|      6|                if (rc < 0)
  ------------------
  |  Branch (1141:21): [True: 0, False: 6]
  ------------------
 1142|      0|                    return -1;
 1143|      6|            }
 1144|      6|            break;
 1145|     18|        case SSH_OPTIONS_HOSTKEYS:
  ------------------
  |  Branch (1145:9): [True: 18, False: 3.40k]
  ------------------
 1146|     18|            v = value;
 1147|     18|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1147:17): [True: 0, False: 18]
  |  Branch (1147:30): [True: 0, False: 18]
  ------------------
 1148|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1149|      0|                return -1;
 1150|     18|            } else {
 1151|     18|                rc = ssh_options_set_algo(session,
 1152|     18|                                          SSH_HOSTKEYS,
 1153|     18|                                          v,
 1154|     18|                                          &wanted_methods[SSH_HOSTKEYS]);
 1155|     18|                if (rc < 0)
  ------------------
  |  Branch (1155:21): [True: 4, False: 14]
  ------------------
 1156|      4|                    return -1;
 1157|     18|            }
 1158|     14|            break;
 1159|     26|        case SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES:
  ------------------
  |  Branch (1159:9): [True: 26, False: 3.39k]
  ------------------
 1160|     26|            v = value;
 1161|     26|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1161:17): [True: 0, False: 26]
  |  Branch (1161:30): [True: 0, False: 26]
  ------------------
 1162|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1163|      0|                return -1;
 1164|     26|            } else {
 1165|     26|                rc = ssh_options_set_algo(session,
 1166|     26|                                          SSH_HOSTKEYS,
 1167|     26|                                          v,
 1168|     26|                                          &session->opts.pubkey_accepted_types);
 1169|     26|                if (rc < 0)
  ------------------
  |  Branch (1169:21): [True: 3, False: 23]
  ------------------
 1170|      3|                    return -1;
 1171|     26|            }
 1172|     23|            break;
 1173|     65|        case SSH_OPTIONS_HMAC_C_S:
  ------------------
  |  Branch (1173:9): [True: 65, False: 3.36k]
  ------------------
 1174|     65|            v = value;
 1175|     65|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1175:17): [True: 0, False: 65]
  |  Branch (1175:30): [True: 0, False: 65]
  ------------------
 1176|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1177|      0|                return -1;
 1178|     65|            } else {
 1179|     65|                rc = ssh_options_set_algo(session,
 1180|     65|                                          SSH_MAC_C_S,
 1181|     65|                                          v,
 1182|     65|                                          &wanted_methods[SSH_MAC_C_S]);
 1183|     65|                if (rc < 0)
  ------------------
  |  Branch (1183:21): [True: 12, False: 53]
  ------------------
 1184|     12|                    return -1;
 1185|     65|            }
 1186|     53|            break;
 1187|     65|         case SSH_OPTIONS_HMAC_S_C:
  ------------------
  |  Branch (1187:10): [True: 65, False: 3.36k]
  ------------------
 1188|     65|            v = value;
 1189|     65|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1189:17): [True: 0, False: 65]
  |  Branch (1189:30): [True: 0, False: 65]
  ------------------
 1190|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1191|      0|                return -1;
 1192|     65|            } else {
 1193|     65|                rc = ssh_options_set_algo(session,
 1194|     65|                                          SSH_MAC_S_C,
 1195|     65|                                          v,
 1196|     65|                                          &wanted_methods[SSH_MAC_S_C]);
 1197|     65|                if (rc < 0)
  ------------------
  |  Branch (1197:21): [True: 12, False: 53]
  ------------------
 1198|     12|                    return -1;
 1199|     65|            }
 1200|     53|            break;
 1201|     53|        case SSH_OPTIONS_COMPRESSION_C_S:
  ------------------
  |  Branch (1201:9): [True: 0, False: 3.42k]
  ------------------
 1202|      0|            v = value;
 1203|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1203:17): [True: 0, False: 0]
  |  Branch (1203:30): [True: 0, False: 0]
  ------------------
 1204|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1205|      0|                return -1;
 1206|      0|            } else {
 1207|      0|                const char *tmp = v;
 1208|      0|                if (strcasecmp(value, "yes") == 0){
  ------------------
  |  Branch (1208:21): [True: 0, False: 0]
  ------------------
 1209|      0|                    tmp = "zlib@openssh.com,none";
 1210|      0|                } else if (strcasecmp(value, "no") == 0){
  ------------------
  |  Branch (1210:28): [True: 0, False: 0]
  ------------------
 1211|      0|                    tmp = "none,zlib@openssh.com";
 1212|      0|                }
 1213|      0|                rc = ssh_options_set_algo(session,
 1214|      0|                                          SSH_COMP_C_S,
 1215|      0|                                          tmp,
 1216|      0|                                          &wanted_methods[SSH_COMP_C_S]);
 1217|      0|                if (rc < 0)
  ------------------
  |  Branch (1217:21): [True: 0, False: 0]
  ------------------
 1218|      0|                    return -1;
 1219|      0|            }
 1220|      0|            break;
 1221|      0|        case SSH_OPTIONS_COMPRESSION_S_C:
  ------------------
  |  Branch (1221:9): [True: 0, False: 3.42k]
  ------------------
 1222|      0|            v = value;
 1223|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1223:17): [True: 0, False: 0]
  |  Branch (1223:30): [True: 0, False: 0]
  ------------------
 1224|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1225|      0|                return -1;
 1226|      0|            } else {
 1227|      0|                const char *tmp = v;
 1228|      0|                if (strcasecmp(value, "yes") == 0){
  ------------------
  |  Branch (1228:21): [True: 0, False: 0]
  ------------------
 1229|      0|                    tmp = "zlib@openssh.com,none";
 1230|      0|                } else if (strcasecmp(value, "no") == 0){
  ------------------
  |  Branch (1230:28): [True: 0, False: 0]
  ------------------
 1231|      0|                    tmp = "none,zlib@openssh.com";
 1232|      0|                }
 1233|       |
 1234|      0|                rc = ssh_options_set_algo(session,
 1235|      0|                                          SSH_COMP_S_C,
 1236|      0|                                          tmp,
 1237|      0|                                          &wanted_methods[SSH_COMP_S_C]);
 1238|      0|                if (rc < 0)
  ------------------
  |  Branch (1238:21): [True: 0, False: 0]
  ------------------
 1239|      0|                    return -1;
 1240|      0|            }
 1241|      0|            break;
 1242|      0|        case SSH_OPTIONS_COMPRESSION:
  ------------------
  |  Branch (1242:9): [True: 0, False: 3.42k]
  ------------------
 1243|      0|            v = value;
 1244|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1244:17): [True: 0, False: 0]
  |  Branch (1244:30): [True: 0, False: 0]
  ------------------
 1245|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1246|      0|                return -1;
 1247|      0|            }
 1248|      0|            if(ssh_options_set(session,SSH_OPTIONS_COMPRESSION_C_S, v) < 0)
  ------------------
  |  Branch (1248:16): [True: 0, False: 0]
  ------------------
 1249|      0|                return -1;
 1250|      0|            if(ssh_options_set(session,SSH_OPTIONS_COMPRESSION_S_C, v) < 0)
  ------------------
  |  Branch (1250:16): [True: 0, False: 0]
  ------------------
 1251|      0|                return -1;
 1252|      0|            break;
 1253|      0|        case SSH_OPTIONS_COMPRESSION_LEVEL:
  ------------------
  |  Branch (1253:9): [True: 0, False: 3.42k]
  ------------------
 1254|      0|            if (value == NULL) {
  ------------------
  |  Branch (1254:17): [True: 0, False: 0]
  ------------------
 1255|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1256|      0|                return -1;
 1257|      0|            } else {
 1258|      0|                int *x = (int *)value;
 1259|      0|                if (*x < 1 || *x > 9) {
  ------------------
  |  Branch (1259:21): [True: 0, False: 0]
  |  Branch (1259:31): [True: 0, False: 0]
  ------------------
 1260|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1261|      0|                    return -1;
 1262|      0|                }
 1263|      0|                session->opts.compressionlevel = *x & 0xff;
 1264|      0|            }
 1265|      0|            break;
 1266|      0|        case SSH_OPTIONS_STRICTHOSTKEYCHECK:
  ------------------
  |  Branch (1266:9): [True: 0, False: 3.42k]
  ------------------
 1267|      0|            if (value == NULL) {
  ------------------
  |  Branch (1267:17): [True: 0, False: 0]
  ------------------
 1268|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1269|      0|                return -1;
 1270|      0|            } else {
 1271|      0|                int *x = (int *) value;
 1272|      0|                int mode = *x;
 1273|       |
 1274|      0|                switch (mode) {
 1275|      0|                case SSH_STRICT_HOSTKEY_OFF:
  ------------------
  |  Branch (1275:17): [True: 0, False: 0]
  ------------------
 1276|      0|                case SSH_STRICT_HOSTKEY_YES:
  ------------------
  |  Branch (1276:17): [True: 0, False: 0]
  ------------------
 1277|      0|                case SSH_STRICT_HOSTKEY_ASK:
  ------------------
  |  Branch (1277:17): [True: 0, False: 0]
  ------------------
 1278|      0|                case SSH_STRICT_HOSTKEY_ACCEPT_NEW:
  ------------------
  |  Branch (1278:17): [True: 0, False: 0]
  ------------------
 1279|      0|                    session->opts.StrictHostKeyChecking = mode;
 1280|      0|                    break;
 1281|      0|                default:
  ------------------
  |  Branch (1281:17): [True: 0, False: 0]
  ------------------
 1282|       |                    /* Preserve the legacy low-byte "non-zero means yes"
 1283|       |                     * normalization.
 1284|       |                     */
 1285|      0|                    session->opts.StrictHostKeyChecking =
 1286|      0|                        (mode & 0xff) > 0 ? SSH_STRICT_HOSTKEY_YES
  ------------------
  |  Branch (1286:25): [True: 0, False: 0]
  ------------------
 1287|      0|                                          : SSH_STRICT_HOSTKEY_OFF;
 1288|      0|                    break;
 1289|      0|                }
 1290|      0|            }
 1291|      0|            break;
 1292|      0|        case SSH_OPTIONS_PROXYCOMMAND:
  ------------------
  |  Branch (1292:9): [True: 0, False: 3.42k]
  ------------------
 1293|      0|            v = value;
 1294|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1294:17): [True: 0, False: 0]
  |  Branch (1294:30): [True: 0, False: 0]
  ------------------
 1295|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1296|      0|                return -1;
 1297|      0|            } else {
 1298|      0|                SAFE_FREE(session->opts.ProxyCommand);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1299|       |                /* Setting the command to 'none' disables this option. */
 1300|      0|                rc = strcasecmp(v, "none");
 1301|      0|                if (rc != 0) {
  ------------------
  |  Branch (1301:21): [True: 0, False: 0]
  ------------------
 1302|      0|                    q = strdup(v);
 1303|      0|                    if (q == NULL) {
  ------------------
  |  Branch (1303:25): [True: 0, False: 0]
  ------------------
 1304|      0|                        return -1;
 1305|      0|                    }
 1306|      0|                    session->opts.ProxyCommand = q;
 1307|      0|                    session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_PROXYCOMMAND;
  ------------------
  |  |  117|      0|#define SSH_OPT_EXP_FLAG_PROXYCOMMAND 0x4
  ------------------
 1308|      0|                }
 1309|      0|            }
 1310|      0|            break;
 1311|      0|        case SSH_OPTIONS_PROXYJUMP:
  ------------------
  |  Branch (1311:9): [True: 0, False: 3.42k]
  ------------------
 1312|      0|            v = value;
 1313|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1313:17): [True: 0, False: 0]
  |  Branch (1313:30): [True: 0, False: 0]
  ------------------
 1314|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1315|      0|                return -1;
 1316|      0|            } else {
 1317|      0|                rc = ssh_config_parse_proxy_jump(session, v, true);
 1318|      0|                if (rc != SSH_OK) {
  ------------------
  |  |  316|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1318:21): [True: 0, False: 0]
  ------------------
 1319|      0|                    return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1320|      0|                }
 1321|      0|            }
 1322|      0|            break;
 1323|      0|        case SSH_OPTIONS_PROXYJUMP_CB_LIST_APPEND:
  ------------------
  |  Branch (1323:9): [True: 0, False: 3.42k]
  ------------------
 1324|      0|            j = (struct ssh_jump_callbacks_struct *)value;
 1325|      0|            if (j == NULL) {
  ------------------
  |  Branch (1325:17): [True: 0, False: 0]
  ------------------
 1326|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1327|      0|                return -1;
 1328|      0|            } else {
 1329|      0|                rc = ssh_list_prepend(session->opts.proxy_jumps_user_cb, j);
 1330|      0|                if (rc != SSH_OK) {
  ------------------
  |  |  316|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1330:21): [True: 0, False: 0]
  ------------------
 1331|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1332|      0|                    return SSH_ERROR;
  ------------------
  |  |  317|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1333|      0|                }
 1334|      0|            }
 1335|      0|            break;
 1336|      2|        case SSH_OPTIONS_GSSAPI_SERVER_IDENTITY:
  ------------------
  |  Branch (1336:9): [True: 2, False: 3.42k]
  ------------------
 1337|      2|            v = value;
 1338|      2|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1338:17): [True: 0, False: 2]
  |  Branch (1338:30): [True: 0, False: 2]
  ------------------
 1339|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1340|      0|                return -1;
 1341|      2|            } else {
 1342|      2|                SAFE_FREE(session->opts.gss_server_identity);
  ------------------
  |  |  373|      2|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 2]
  |  |  |  Branch (373:71): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1343|      2|                session->opts.gss_server_identity = strdup(v);
 1344|      2|                if (session->opts.gss_server_identity == NULL) {
  ------------------
  |  Branch (1344:21): [True: 0, False: 2]
  ------------------
 1345|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1346|      0|                    return -1;
 1347|      0|                }
 1348|      2|            }
 1349|      2|            break;
 1350|      2|        case SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY:
  ------------------
  |  Branch (1350:9): [True: 1, False: 3.42k]
  ------------------
 1351|      1|            v = value;
 1352|      1|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1352:17): [True: 0, False: 1]
  |  Branch (1352:30): [True: 0, False: 1]
  ------------------
 1353|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1354|      0|                return -1;
 1355|      1|            } else {
 1356|      1|                SAFE_FREE(session->opts.gss_client_identity);
  ------------------
  |  |  373|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 1]
  |  |  |  Branch (373:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1357|      1|                session->opts.gss_client_identity = strdup(v);
 1358|      1|                if (session->opts.gss_client_identity == NULL) {
  ------------------
  |  Branch (1358:21): [True: 0, False: 1]
  ------------------
 1359|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1360|      0|                    return -1;
 1361|      0|                }
 1362|      1|            }
 1363|      1|            break;
 1364|      1|        case SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS:
  ------------------
  |  Branch (1364:9): [True: 0, False: 3.42k]
  ------------------
 1365|      0|            if (value == NULL) {
  ------------------
  |  Branch (1365:17): [True: 0, False: 0]
  ------------------
 1366|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1367|      0|                return -1;
 1368|      0|            } else {
 1369|      0|                int x = *(int *)value;
 1370|       |
 1371|      0|                session->opts.gss_delegate_creds = (x & 0xff);
 1372|      0|            }
 1373|      0|            break;
 1374|       |#ifdef WITH_GSSAPI
 1375|       |        case SSH_OPTIONS_GSSAPI_KEY_EXCHANGE:
 1376|       |            if (value == NULL) {
 1377|       |                ssh_set_error_invalid(session);
 1378|       |                return -1;
 1379|       |            } else {
 1380|       |                bool *x = (bool *)value;
 1381|       |                session->opts.gssapi_key_exchange = *x;
 1382|       |            }
 1383|       |            break;
 1384|       |        case SSH_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS:
 1385|       |            v = value;
 1386|       |            if (v == NULL || v[0] == '\0') {
 1387|       |                ssh_set_error_invalid(session);
 1388|       |                return -1;
 1389|       |            } else {
 1390|       |                /* Check if algorithms are supported */
 1391|       |                char *ret =
 1392|       |                    ssh_find_all_matching(GSSAPI_KEY_EXCHANGE_SUPPORTED, v);
 1393|       |                if (ret == NULL) {
 1394|       |                    ssh_set_error(session,
 1395|       |                                  SSH_FATAL,
 1396|       |                                  "GSSAPI key exchange algorithms not "
 1397|       |                                  "supported or invalid");
 1398|       |                    return -1;
 1399|       |                }
 1400|       |                SAFE_FREE(session->opts.gssapi_key_exchange_algs);
 1401|       |                session->opts.gssapi_key_exchange_algs = ret;
 1402|       |            }
 1403|       |            break;
 1404|       |#endif
 1405|      0|        case SSH_OPTIONS_PASSWORD_AUTH:
  ------------------
  |  Branch (1405:9): [True: 0, False: 3.42k]
  ------------------
 1406|      0|        case SSH_OPTIONS_PUBKEY_AUTH:
  ------------------
  |  Branch (1406:9): [True: 0, False: 3.42k]
  ------------------
 1407|      0|        case SSH_OPTIONS_KBDINT_AUTH:
  ------------------
  |  Branch (1407:9): [True: 0, False: 3.42k]
  ------------------
 1408|      0|        case SSH_OPTIONS_GSSAPI_AUTH:
  ------------------
  |  Branch (1408:9): [True: 0, False: 3.42k]
  ------------------
 1409|      0|            if (value == NULL) {
  ------------------
  |  Branch (1409:17): [True: 0, False: 0]
  ------------------
 1410|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1411|      0|                return -1;
 1412|      0|            } else {
 1413|      0|                int x = *(int *)value;
 1414|      0|                u = type == SSH_OPTIONS_PASSWORD_AUTH ?
  ------------------
  |  Branch (1414:21): [True: 0, False: 0]
  ------------------
 1415|      0|                    SSH_OPT_FLAG_PASSWORD_AUTH:
  ------------------
  |  |  109|      0|#define SSH_OPT_FLAG_PASSWORD_AUTH 0x1
  ------------------
 1416|      0|                    type == SSH_OPTIONS_PUBKEY_AUTH ?
  ------------------
  |  Branch (1416:21): [True: 0, False: 0]
  ------------------
 1417|      0|                        SSH_OPT_FLAG_PUBKEY_AUTH:
  ------------------
  |  |  110|      0|#define SSH_OPT_FLAG_PUBKEY_AUTH 0x2
  ------------------
 1418|      0|                        type == SSH_OPTIONS_KBDINT_AUTH ?
  ------------------
  |  Branch (1418:25): [True: 0, False: 0]
  ------------------
 1419|      0|                            SSH_OPT_FLAG_KBDINT_AUTH:
  ------------------
  |  |  111|      0|#define SSH_OPT_FLAG_KBDINT_AUTH 0x4
  ------------------
 1420|      0|                            SSH_OPT_FLAG_GSSAPI_AUTH;
  ------------------
  |  |  112|      0|#define SSH_OPT_FLAG_GSSAPI_AUTH 0x8
  ------------------
 1421|      0|                if (x != 0) {
  ------------------
  |  Branch (1421:21): [True: 0, False: 0]
  ------------------
 1422|      0|                    session->opts.flags |= u;
 1423|      0|                } else {
 1424|      0|                    session->opts.flags &= ~u;
 1425|      0|                }
 1426|      0|                if (type == SSH_OPTIONS_PUBKEY_AUTH) {
  ------------------
  |  Branch (1426:21): [True: 0, False: 0]
  ------------------
 1427|       |                    /*
 1428|       |                     * Keep the legacy enabled/disabled auth flag semantics in
 1429|       |                     * sync above while also storing the selected
 1430|       |                     * PubkeyAuthentication mode here.
 1431|       |                     */
 1432|      0|                    switch (x) {
 1433|      0|                    case SSH_PUBKEY_AUTH_NO:
  ------------------
  |  Branch (1433:21): [True: 0, False: 0]
  ------------------
 1434|      0|                    case SSH_PUBKEY_AUTH_ALL:
  ------------------
  |  Branch (1434:21): [True: 0, False: 0]
  ------------------
 1435|      0|                    case SSH_PUBKEY_AUTH_UNBOUND:
  ------------------
  |  Branch (1435:21): [True: 0, False: 0]
  ------------------
 1436|      0|                    case SSH_PUBKEY_AUTH_HOST_BOUND:
  ------------------
  |  Branch (1436:21): [True: 0, False: 0]
  ------------------
 1437|      0|                        session->opts.pubkey_auth = x;
 1438|      0|                        break;
 1439|      0|                    default:
  ------------------
  |  Branch (1439:21): [True: 0, False: 0]
  ------------------
 1440|       |                        /* Preserve the legacy non-zero "yes" normalization
 1441|       |                         * here so callers passing -1 still land on
 1442|       |                         * SSH_PUBKEY_AUTH_ALL.
 1443|       |                         */
 1444|      0|                        session->opts.pubkey_auth = SSH_PUBKEY_AUTH_ALL;
 1445|      0|                        break;
 1446|      0|                    }
 1447|      0|                }
 1448|      0|            }
 1449|      0|            break;
 1450|      0|        case SSH_OPTIONS_NODELAY:
  ------------------
  |  Branch (1450:9): [True: 0, False: 3.42k]
  ------------------
 1451|      0|            if (value == NULL) {
  ------------------
  |  Branch (1451:17): [True: 0, False: 0]
  ------------------
 1452|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1453|      0|                return -1;
 1454|      0|            } else {
 1455|      0|                int *x = (int *) value;
 1456|      0|                session->opts.nodelay = (*x & 0xff) > 0 ? 1 : 0;
  ------------------
  |  Branch (1456:41): [True: 0, False: 0]
  ------------------
 1457|      0|            }
 1458|      0|            break;
 1459|      0|        case SSH_OPTIONS_PROCESS_CONFIG:
  ------------------
  |  Branch (1459:9): [True: 0, False: 3.42k]
  ------------------
 1460|      0|            if (value == NULL) {
  ------------------
  |  Branch (1460:17): [True: 0, False: 0]
  ------------------
 1461|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1462|      0|                return -1;
 1463|      0|            } else {
 1464|      0|                bool *x = (bool *)value;
 1465|      0|                session->opts.config_processed = !(*x);
 1466|      0|            }
 1467|      0|            break;
 1468|     14|        case SSH_OPTIONS_REKEY_DATA:
  ------------------
  |  Branch (1468:9): [True: 14, False: 3.41k]
  ------------------
 1469|     14|            if (value == NULL) {
  ------------------
  |  Branch (1469:17): [True: 0, False: 14]
  ------------------
 1470|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1471|      0|                return -1;
 1472|     14|            } else {
 1473|     14|                uint64_t *x = (uint64_t *)value;
 1474|     14|                session->opts.rekey_data = *x;
 1475|     14|            }
 1476|     14|            break;
 1477|     14|        case SSH_OPTIONS_REKEY_TIME:
  ------------------
  |  Branch (1477:9): [True: 4, False: 3.42k]
  ------------------
 1478|      4|            if (value == NULL) {
  ------------------
  |  Branch (1478:17): [True: 0, False: 4]
  ------------------
 1479|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1480|      0|                return -1;
 1481|      4|            } else {
 1482|      4|                uint32_t *x = (uint32_t *)value;
 1483|      4|                if ((*x * 1000) < *x) {
  ------------------
  |  Branch (1483:21): [True: 2, False: 2]
  ------------------
 1484|      2|                    ssh_set_error(session, SSH_REQUEST_DENIED,
  ------------------
  |  |  311|      2|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1485|      2|                                  "The provided value (%" PRIu32 ") for rekey"
 1486|      2|                                  " time is too large", *x);
 1487|      2|                    return -1;
 1488|      2|                }
 1489|      2|                session->opts.rekey_time = (*x) * 1000;
 1490|      2|            }
 1491|      2|            break;
 1492|      2|        case SSH_OPTIONS_RSA_MIN_SIZE:
  ------------------
  |  Branch (1492:9): [True: 0, False: 3.42k]
  ------------------
 1493|      0|            if (value == NULL) {
  ------------------
  |  Branch (1493:17): [True: 0, False: 0]
  ------------------
 1494|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1495|      0|                return -1;
 1496|      0|            } else {
 1497|      0|                int *x = (int *)value;
 1498|       |
 1499|      0|                if (*x < 0) {
  ------------------
  |  Branch (1499:21): [True: 0, False: 0]
  ------------------
 1500|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1501|      0|                    return -1;
 1502|      0|                }
 1503|       |
 1504|       |                /* (*x == 0) is allowed as it is used to revert to default */
 1505|       |
 1506|      0|                if (*x > 0 && *x < RSA_MIN_KEY_SIZE) {
  ------------------
  |  |   49|      0|#define RSA_MIN_KEY_SIZE      1024
  ------------------
  |  Branch (1506:21): [True: 0, False: 0]
  |  Branch (1506:31): [True: 0, False: 0]
  ------------------
 1507|      0|                    ssh_set_error(session,
  ------------------
  |  |  311|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1508|      0|                                  SSH_REQUEST_DENIED,
 1509|      0|                                  "The provided value (%d) for minimal RSA key "
 1510|      0|                                  "size is too small. Use at least %d bits.",
 1511|      0|                                  *x,
 1512|      0|                                  RSA_MIN_KEY_SIZE);
 1513|      0|                    return -1;
 1514|      0|                }
 1515|      0|                session->opts.rsa_min_size = *x;
 1516|      0|            }
 1517|      0|            break;
 1518|      1|        case SSH_OPTIONS_IDENTITY_AGENT:
  ------------------
  |  Branch (1518:9): [True: 1, False: 3.42k]
  ------------------
 1519|      1|            v = value;
 1520|      1|            SAFE_FREE(session->opts.agent_socket);
  ------------------
  |  |  373|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 1]
  |  |  |  Branch (373:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1521|      1|            if (v == NULL) {
  ------------------
  |  Branch (1521:17): [True: 0, False: 1]
  ------------------
 1522|       |                /* The default value will be set by the ssh_options_apply() */
 1523|      1|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (1523:24): [True: 0, False: 1]
  ------------------
 1524|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1525|      0|                return -1;
 1526|      1|            } else {
 1527|      1|                session->opts.agent_socket = ssh_path_expand_tilde(v);
 1528|      1|                if (session->opts.agent_socket == NULL) {
  ------------------
  |  Branch (1528:21): [True: 1, False: 0]
  ------------------
 1529|      1|                    ssh_set_error_oom(session);
  ------------------
  |  |  318|      1|    _ssh_set_error_oom(error, __func__)
  ------------------
 1530|      1|                    return -1;
 1531|      1|                }
 1532|      1|            }
 1533|      0|            break;
 1534|      0|        case SSH_OPTIONS_IDENTITIES_ONLY:
  ------------------
  |  Branch (1534:9): [True: 0, False: 3.42k]
  ------------------
 1535|      0|            if (value == NULL) {
  ------------------
  |  Branch (1535:17): [True: 0, False: 0]
  ------------------
 1536|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1537|      0|                return -1;
 1538|      0|            } else {
 1539|      0|                bool *x = (bool *)value;
 1540|      0|                session->opts.identities_only = *x;
 1541|      0|            }
 1542|      0|            break;
 1543|      0|        case SSH_OPTIONS_CONTROL_MASTER:
  ------------------
  |  Branch (1543:9): [True: 0, False: 3.42k]
  ------------------
 1544|      0|            if (value == NULL) {
  ------------------
  |  Branch (1544:17): [True: 0, False: 0]
  ------------------
 1545|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1546|      0|                return -1;
 1547|      0|            } else {
 1548|      0|                int *x = (int *) value;
 1549|      0|                if (*x < SSH_CONTROL_MASTER_NO || *x > SSH_CONTROL_MASTER_AUTOASK) {
  ------------------
  |  Branch (1549:21): [True: 0, False: 0]
  |  Branch (1549:51): [True: 0, False: 0]
  ------------------
 1550|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1551|      0|                    return -1;
 1552|      0|                }
 1553|      0|                session->opts.control_master = *x;
 1554|      0|            }
 1555|      0|            break;
 1556|      0|        case SSH_OPTIONS_CONTROL_PATH:
  ------------------
  |  Branch (1556:9): [True: 0, False: 3.42k]
  ------------------
 1557|      0|            v = value;
 1558|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1558:17): [True: 0, False: 0]
  |  Branch (1558:30): [True: 0, False: 0]
  ------------------
 1559|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1560|      0|                return -1;
 1561|      0|            } else {
 1562|      0|                SAFE_FREE(session->opts.control_path);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1563|      0|                rc = strcasecmp(v, "none");
 1564|      0|                if (rc != 0) {
  ------------------
  |  Branch (1564:21): [True: 0, False: 0]
  ------------------
 1565|      0|                    session->opts.control_path = ssh_path_expand_tilde(v);
 1566|      0|                    if (session->opts.control_path == NULL) {
  ------------------
  |  Branch (1566:25): [True: 0, False: 0]
  ------------------
 1567|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1568|      0|                        return -1;
 1569|      0|                    }
 1570|      0|                    session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_CONTROL_PATH;
  ------------------
  |  |  119|      0|#define SSH_OPT_EXP_FLAG_CONTROL_PATH 0x10
  ------------------
 1571|      0|                }
 1572|      0|            }
 1573|      0|            break;
 1574|      0|        case SSH_OPTIONS_PKI_CONTEXT:
  ------------------
  |  Branch (1574:9): [True: 0, False: 3.42k]
  ------------------
 1575|      0|            if (value == NULL) {
  ------------------
  |  Branch (1575:17): [True: 0, False: 0]
  ------------------
 1576|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1577|      0|                return -1;
 1578|      0|            }
 1579|       |
 1580|      0|            SSH_PKI_CTX_FREE(session->pki_context);
  ------------------
  |  | 1027|      0|    do {                         \
  |  | 1028|      0|        if ((x) != NULL) {       \
  |  |  ------------------
  |  |  |  Branch (1028:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1029|      0|            ssh_pki_ctx_free(x); \
  |  | 1030|      0|            x = NULL;            \
  |  | 1031|      0|        }                        \
  |  | 1032|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1032:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1581|       |
 1582|      0|            session->pki_context = ssh_pki_ctx_dup((const ssh_pki_ctx)value);
 1583|      0|            if (session->pki_context == NULL) {
  ------------------
  |  Branch (1583:17): [True: 0, False: 0]
  ------------------
 1584|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1585|      0|                return -1;
 1586|      0|            }
 1587|      0|            break;
 1588|      0|        case SSH_OPTIONS_ADDRESS_FAMILY:
  ------------------
  |  Branch (1588:9): [True: 0, False: 3.42k]
  ------------------
 1589|      0|            if (value == NULL) {
  ------------------
  |  Branch (1589:17): [True: 0, False: 0]
  ------------------
 1590|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1591|      0|                return -1;
 1592|      0|            } else {
 1593|      0|                int *x = (int *)value;
 1594|      0|                if (*x < SSH_ADDRESS_FAMILY_ANY ||
  ------------------
  |  Branch (1594:21): [True: 0, False: 0]
  ------------------
 1595|      0|                    *x > SSH_ADDRESS_FAMILY_INET6) {
  ------------------
  |  Branch (1595:21): [True: 0, False: 0]
  ------------------
 1596|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1597|      0|                    return -1;
 1598|      0|                }
 1599|      0|                session->opts.address_family = *x;
 1600|      0|            }
 1601|      0|            break;
 1602|      0|        case SSH_OPTIONS_BATCH_MODE:
  ------------------
  |  Branch (1602:9): [True: 0, False: 3.42k]
  ------------------
 1603|      0|            if (value == NULL) {
  ------------------
  |  Branch (1603:17): [True: 0, False: 0]
  ------------------
 1604|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  322|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1605|      0|                return -1;
 1606|      0|            } else {
 1607|      0|                bool *x = (bool *)value;
 1608|      0|                session->opts.batch_mode = *x;
 1609|      0|            }
 1610|      0|            break;
 1611|      1|        default:
  ------------------
  |  Branch (1611:9): [True: 1, False: 3.42k]
  ------------------
 1612|      1|            ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type);
  ------------------
  |  |  311|      1|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1613|      1|            return -1;
 1614|      0|            break;
 1615|  3.42k|    }
 1616|       |
 1617|  3.35k|    return 0;
 1618|  3.42k|}

ssh_key_free:
  261|  1.91k|{
  262|  1.91k|    if (key) {
  ------------------
  |  Branch (262:9): [True: 0, False: 1.91k]
  ------------------
  263|      0|        ssh_key_clean(key);
  264|       |        SAFE_FREE(key);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  265|      0|    }
  266|  1.91k|}

ssh_pki_ctx_new:
   49|    478|{
   50|    478|    struct ssh_pki_ctx_struct *ctx = NULL;
   51|       |
   52|    478|    ctx = calloc(1, sizeof(struct ssh_pki_ctx_struct));
   53|    478|    if (ctx == NULL) {
  ------------------
  |  Branch (53:9): [True: 0, False: 478]
  ------------------
   54|      0|        return NULL;
   55|      0|    }
   56|       |
   57|       |#ifdef WITH_FIDO2
   58|       |    /* Initialize SK fields with default, if available. */
   59|       |    ctx->sk_callbacks = ssh_sk_get_default_callbacks();
   60|       |
   61|       |    /*
   62|       |     * Both OpenSSH security key enrollment and server authentication require
   63|       |     * user presence by default, so we replicate that for consistency.
   64|       |     */
   65|       |    ctx->sk_flags = SSH_SK_USER_PRESENCE_REQD;
   66|       |
   67|       |    ctx->sk_application = strdup("ssh:");
   68|       |    if (ctx->sk_application == NULL) {
   69|       |        SSH_LOG(SSH_LOG_WARN,
   70|       |                "Failed to allocate memory for default application");
   71|       |        SAFE_FREE(ctx);
   72|       |        return NULL;
   73|       |    }
   74|       |#endif /* WITH_FIDO2 */
   75|       |
   76|    478|    return ctx;
   77|    478|}
ssh_pki_ctx_free:
   86|    478|{
   87|    478|    if (context == NULL) {
  ------------------
  |  Branch (87:9): [True: 0, False: 478]
  ------------------
   88|      0|        return;
   89|      0|    }
   90|       |
   91|       |#ifdef WITH_FIDO2
   92|       |    SAFE_FREE(context->sk_application);
   93|       |    SSH_BUFFER_FREE(context->sk_challenge_buffer);
   94|       |    SSH_BUFFER_FREE(context->sk_attestation_buffer);
   95|       |    SK_OPTIONS_FREE(context->sk_callbacks_options);
   96|       |#endif /* WITH_FIDO2 */
   97|       |
   98|    478|    SAFE_FREE(context);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 478, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
   99|    478|}

ssh_poll_init:
   91|      2|{
   92|      2|    return;
   93|      2|}

ssh_new:
   65|    478|{
   66|    478|    ssh_session session = NULL;
   67|    478|    char *id = NULL;
   68|    478|    int rc;
   69|       |
   70|    478|    session = calloc(1, sizeof (struct ssh_session_struct));
   71|    478|    if (session == NULL) {
  ------------------
  |  Branch (71:9): [True: 0, False: 478]
  ------------------
   72|      0|        return NULL;
   73|      0|    }
   74|       |
   75|    478|    session->next_crypto = crypto_new();
   76|    478|    if (session->next_crypto == NULL) {
  ------------------
  |  Branch (76:9): [True: 0, False: 478]
  ------------------
   77|      0|        goto err;
   78|      0|    }
   79|       |
   80|    478|    session->socket = ssh_socket_new(session);
   81|    478|    if (session->socket == NULL) {
  ------------------
  |  Branch (81:9): [True: 0, False: 478]
  ------------------
   82|      0|        goto err;
   83|      0|    }
   84|       |
   85|    478|    session->out_buffer = ssh_buffer_new();
   86|    478|    if (session->out_buffer == NULL) {
  ------------------
  |  Branch (86:9): [True: 0, False: 478]
  ------------------
   87|      0|        goto err;
   88|      0|    }
   89|       |
   90|    478|    session->in_buffer = ssh_buffer_new();
   91|    478|    if (session->in_buffer == NULL) {
  ------------------
  |  Branch (91:9): [True: 0, False: 478]
  ------------------
   92|      0|        goto err;
   93|      0|    }
   94|       |
   95|    478|    session->out_queue = ssh_list_new();
   96|    478|    if (session->out_queue == NULL) {
  ------------------
  |  Branch (96:9): [True: 0, False: 478]
  ------------------
   97|      0|        goto err;
   98|      0|    }
   99|       |
  100|    478|    session->alive = 0;
  101|    478|    session->auth.supported_methods = 0;
  102|    478|    ssh_set_blocking(session, 1);
  103|    478|    session->maxchannel = FIRST_CHANNEL;
  ------------------
  |  |   48|    478|#define FIRST_CHANNEL 42 // why not ? it helps to find bugs.
  ------------------
  104|    478|    session->proxy_root = true;
  105|       |
  106|    478|    session->agent = ssh_agent_new(session);
  107|    478|    if (session->agent == NULL) {
  ------------------
  |  Branch (107:9): [True: 0, False: 478]
  ------------------
  108|      0|        goto err;
  109|      0|    }
  110|       |
  111|       |    /* Initialise a default PKI context */
  112|    478|    session->pki_context = ssh_pki_ctx_new();
  113|    478|    if (session->pki_context == NULL) {
  ------------------
  |  Branch (113:9): [True: 0, False: 478]
  ------------------
  114|      0|        goto err;
  115|      0|    }
  116|       |
  117|       |    /* OPTIONS */
  118|    478|    session->opts.StrictHostKeyChecking = SSH_STRICT_HOSTKEY_ASK;
  119|    478|    session->opts.port = 22;
  120|    478|    session->opts.fd = -1;
  121|    478|    session->opts.compressionlevel = 7;
  122|    478|    session->opts.nodelay = 0;
  123|    478|    session->opts.identities_only = false;
  124|    478|    session->opts.batch_mode = false;
  125|    478|    session->opts.control_master = SSH_CONTROL_MASTER_NO;
  126|       |
  127|    478|    session->opts.flags = SSH_OPT_FLAG_PASSWORD_AUTH |
  ------------------
  |  |  109|    478|#define SSH_OPT_FLAG_PASSWORD_AUTH 0x1
  ------------------
  128|    478|                          SSH_OPT_FLAG_PUBKEY_AUTH |
  ------------------
  |  |  110|    478|#define SSH_OPT_FLAG_PUBKEY_AUTH 0x2
  ------------------
  129|    478|                          SSH_OPT_FLAG_KBDINT_AUTH |
  ------------------
  |  |  111|    478|#define SSH_OPT_FLAG_KBDINT_AUTH 0x4
  ------------------
  130|    478|                          SSH_OPT_FLAG_GSSAPI_AUTH;
  ------------------
  |  |  112|    478|#define SSH_OPT_FLAG_GSSAPI_AUTH 0x8
  ------------------
  131|    478|    session->opts.pubkey_auth = SSH_PUBKEY_AUTH_ALL;
  132|       |
  133|    478|    session->opts.exp_flags = 0;
  134|       |
  135|    478|    session->opts.identity = ssh_list_new();
  136|    478|    if (session->opts.identity == NULL) {
  ------------------
  |  Branch (136:9): [True: 0, False: 478]
  ------------------
  137|      0|        goto err;
  138|      0|    }
  139|    478|    session->opts.identity_non_exp = ssh_list_new();
  140|    478|    if (session->opts.identity_non_exp == NULL) {
  ------------------
  |  Branch (140:9): [True: 0, False: 478]
  ------------------
  141|      0|        goto err;
  142|      0|    }
  143|       |
  144|    478|    session->opts.certificate = ssh_list_new();
  145|    478|    if (session->opts.certificate == NULL) {
  ------------------
  |  Branch (145:9): [True: 0, False: 478]
  ------------------
  146|      0|        goto err;
  147|      0|    }
  148|    478|    session->opts.certificate_non_exp = ssh_list_new();
  149|    478|    if (session->opts.certificate_non_exp == NULL) {
  ------------------
  |  Branch (149:9): [True: 0, False: 478]
  ------------------
  150|      0|        goto err;
  151|      0|    }
  152|       |    /* the default certificates are loaded automatically from the default
  153|       |     * identities later */
  154|       |
  155|    478|    session->opts.proxy_jumps = ssh_list_new();
  156|    478|    if (session->opts.proxy_jumps == NULL) {
  ------------------
  |  Branch (156:9): [True: 0, False: 478]
  ------------------
  157|      0|        goto err;
  158|      0|    }
  159|       |
  160|    478|    session->opts.proxy_jumps_user_cb = ssh_list_new();
  161|    478|    if (session->opts.proxy_jumps_user_cb == NULL) {
  ------------------
  |  Branch (161:9): [True: 0, False: 478]
  ------------------
  162|      0|        goto err;
  163|      0|    }
  164|       |
  165|       |#ifdef WITH_GSSAPI
  166|       |    session->opts.gssapi_key_exchange_algs =
  167|       |        strdup(GSSAPI_KEY_EXCHANGE_SUPPORTED);
  168|       |    if (session->opts.gssapi_key_exchange_algs == NULL) {
  169|       |        goto err;
  170|       |    }
  171|       |#endif /* WITH_GSSAPI */
  172|       |
  173|    478|    id = strdup("%d/.ssh/id_ed25519");
  174|    478|    if (id == NULL) {
  ------------------
  |  Branch (174:9): [True: 0, False: 478]
  ------------------
  175|      0|        goto err;
  176|      0|    }
  177|       |
  178|    478|    rc = ssh_list_append(session->opts.identity_non_exp, id);
  179|    478|    if (rc == SSH_ERROR) {
  ------------------
  |  |  317|    478|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  |  Branch (179:9): [True: 0, False: 478]
  ------------------
  180|      0|        goto err;
  181|      0|    }
  182|       |
  183|    478|#ifdef HAVE_ECC
  184|    478|    id = strdup("%d/.ssh/id_ecdsa");
  185|    478|    if (id == NULL) {
  ------------------
  |  Branch (185:9): [True: 0, False: 478]
  ------------------
  186|      0|        goto err;
  187|      0|    }
  188|    478|    rc = ssh_list_append(session->opts.identity_non_exp, id);
  189|    478|    if (rc == SSH_ERROR) {
  ------------------
  |  |  317|    478|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  |  Branch (189:9): [True: 0, False: 478]
  ------------------
  190|      0|        goto err;
  191|      0|    }
  192|    478|#endif
  193|       |
  194|    478|    id = strdup("%d/.ssh/id_rsa");
  195|    478|    if (id == NULL) {
  ------------------
  |  Branch (195:9): [True: 0, False: 478]
  ------------------
  196|      0|        goto err;
  197|      0|    }
  198|    478|    rc = ssh_list_append(session->opts.identity_non_exp, id);
  199|    478|    if (rc == SSH_ERROR) {
  ------------------
  |  |  317|    478|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  |  Branch (199:9): [True: 0, False: 478]
  ------------------
  200|      0|        goto err;
  201|      0|    }
  202|       |
  203|       |#ifdef WITH_FIDO2
  204|       |    /* Add security key identities */
  205|       |    id = strdup("%d/.ssh/id_ed25519_sk");
  206|       |    if (id == NULL) {
  207|       |        goto err;
  208|       |    }
  209|       |    rc = ssh_list_append(session->opts.identity_non_exp, id);
  210|       |    if (rc == SSH_ERROR) {
  211|       |        goto err;
  212|       |    }
  213|       |
  214|       |#ifdef HAVE_ECC
  215|       |    id = strdup("%d/.ssh/id_ecdsa_sk");
  216|       |    if (id == NULL) {
  217|       |        goto err;
  218|       |    }
  219|       |    rc = ssh_list_append(session->opts.identity_non_exp, id);
  220|       |    if (rc == SSH_ERROR) {
  221|       |        goto err;
  222|       |    }
  223|       |#endif /* HAVE_ECC */
  224|       |#endif /* WITH_FIDO2 */
  225|       |
  226|       |    /* Explicitly initialize states */
  227|    478|    session->session_state = SSH_SESSION_STATE_NONE;
  228|    478|    session->pending_call_state = SSH_PENDING_CALL_NONE;
  229|    478|    session->packet_state = PACKET_STATE_INIT;
  230|    478|    session->dh_handshake_state = DH_STATE_INIT;
  231|    478|    session->global_req_state = SSH_CHANNEL_REQ_STATE_NONE;
  232|       |
  233|    478|    session->auth.state = SSH_AUTH_STATE_NONE;
  234|    478|    session->auth.service_state = SSH_AUTH_SERVICE_NONE;
  235|       |
  236|    478|    return session;
  237|       |
  238|      0|err:
  239|      0|    free(id);
  240|      0|    ssh_free(session);
  241|       |    return NULL;
  242|    478|}
ssh_free:
  253|    478|{
  254|    478|  int i;
  255|    478|  struct ssh_iterator *it = NULL;
  256|    478|  struct ssh_buffer_struct *b = NULL;
  257|       |
  258|    478|  if (session == NULL) {
  ------------------
  |  Branch (258:7): [True: 0, False: 478]
  ------------------
  259|      0|    return;
  260|      0|  }
  261|       |
  262|       |  /*
  263|       |   * Delete all channels
  264|       |   *
  265|       |   * This needs the first thing we clean up cause if there is still an open
  266|       |   * channel we call ssh_channel_close() first. So we need a working socket
  267|       |   * and poll context for it.
  268|       |   */
  269|    478|  for (it = ssh_list_get_iterator(session->channels);
  270|    478|       it != NULL;
  ------------------
  |  Branch (270:8): [True: 0, False: 478]
  ------------------
  271|    478|       it = ssh_list_get_iterator(session->channels)) {
  272|      0|      ssh_channel_do_free(ssh_iterator_value(ssh_channel,it));
  ------------------
  |  |  114|      0|  ((type)((iterator)->data))
  ------------------
  273|      0|      ssh_list_remove(session->channels, it);
  274|      0|  }
  275|    478|  ssh_list_free(session->channels);
  276|    478|  session->channels = NULL;
  277|       |
  278|    478|#ifdef WITH_PCAP
  279|    478|  if (session->pcap_ctx) {
  ------------------
  |  Branch (279:7): [True: 0, False: 478]
  ------------------
  280|      0|      ssh_pcap_context_free(session->pcap_ctx);
  281|      0|      session->pcap_ctx = NULL;
  282|      0|  }
  283|    478|#endif
  284|       |
  285|    478|  ssh_socket_free(session->socket);
  286|    478|  session->socket = NULL;
  287|       |
  288|    478|  if (session->default_poll_ctx) {
  ------------------
  |  Branch (288:7): [True: 0, False: 478]
  ------------------
  289|      0|      ssh_poll_ctx_free(session->default_poll_ctx);
  290|      0|  }
  291|       |
  292|    478|  SSH_BUFFER_FREE(session->in_buffer);
  ------------------
  |  |  934|    478|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 478, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 478]
  |  |  ------------------
  ------------------
  293|    478|  SSH_BUFFER_FREE(session->out_buffer);
  ------------------
  |  |  934|    478|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 478, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 478]
  |  |  ------------------
  ------------------
  294|    478|  session->in_buffer = session->out_buffer = NULL;
  295|       |
  296|    478|  if (session->in_hashbuf != NULL) {
  ------------------
  |  Branch (296:7): [True: 0, False: 478]
  ------------------
  297|      0|      SSH_BUFFER_FREE(session->in_hashbuf);
  ------------------
  |  |  934|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 0, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  298|      0|  }
  299|    478|  if (session->out_hashbuf != NULL) {
  ------------------
  |  Branch (299:7): [True: 0, False: 478]
  ------------------
  300|      0|      SSH_BUFFER_FREE(session->out_hashbuf);
  ------------------
  |  |  934|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 0, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  301|      0|  }
  302|       |
  303|    478|  crypto_free(session->current_crypto);
  304|    478|  crypto_free(session->next_crypto);
  305|       |
  306|    478|  ssh_agent_free(session->agent);
  307|       |
  308|    478|  SSH_PKI_CTX_FREE(session->pki_context);
  ------------------
  |  | 1027|    478|    do {                         \
  |  | 1028|    478|        if ((x) != NULL) {       \
  |  |  ------------------
  |  |  |  Branch (1028:13): [True: 478, False: 0]
  |  |  ------------------
  |  | 1029|    478|            ssh_pki_ctx_free(x); \
  |  | 1030|    478|            x = NULL;            \
  |  | 1031|    478|        }                        \
  |  | 1032|    478|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1032:14): [Folded, False: 478]
  |  |  ------------------
  ------------------
  309|       |
  310|    478|  ssh_key_free(session->srv.rsa_key);
  311|    478|  session->srv.rsa_key = NULL;
  312|    478|  ssh_key_free(session->srv.ecdsa_key);
  313|    478|  session->srv.ecdsa_key = NULL;
  314|    478|  ssh_key_free(session->srv.ed25519_key);
  315|    478|  session->srv.ed25519_key = NULL;
  316|       |
  317|    478|  if (session->ssh_message_list) {
  ------------------
  |  Branch (317:7): [True: 0, False: 478]
  ------------------
  318|      0|      ssh_message msg;
  319|       |
  320|      0|      for (msg = ssh_list_pop_head(ssh_message, session->ssh_message_list);
  ------------------
  |  |  122|      0|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  321|      0|           msg != NULL;
  ------------------
  |  Branch (321:12): [True: 0, False: 0]
  ------------------
  322|      0|           msg = ssh_list_pop_head(ssh_message, session->ssh_message_list)) {
  ------------------
  |  |  122|      0|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  323|      0|          ssh_message_free(msg);
  324|      0|      }
  325|      0|      ssh_list_free(session->ssh_message_list);
  326|      0|  }
  327|       |
  328|    478|  if (session->kbdint != NULL) {
  ------------------
  |  Branch (328:7): [True: 0, False: 478]
  ------------------
  329|      0|    ssh_kbdint_free(session->kbdint);
  330|      0|  }
  331|       |
  332|    478|  if (session->packet_callbacks) {
  ------------------
  |  Branch (332:7): [True: 0, False: 478]
  ------------------
  333|      0|    ssh_list_free(session->packet_callbacks);
  334|      0|  }
  335|       |
  336|       |#ifdef WITH_GSSAPI
  337|       |    ssh_gssapi_free(session);
  338|       |    SAFE_FREE(session->opts.gssapi_key_exchange_algs);
  339|       |#endif
  340|       |
  341|       |  /* options */
  342|    478|  if (session->opts.identity) {
  ------------------
  |  Branch (342:7): [True: 478, False: 0]
  ------------------
  343|    478|      char *id = NULL;
  344|       |
  345|    478|      for (id = ssh_list_pop_head(char *, session->opts.identity);
  ------------------
  |  |  122|    478|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  346|    478|           id != NULL;
  ------------------
  |  Branch (346:12): [True: 0, False: 478]
  ------------------
  347|    478|           id = ssh_list_pop_head(char *, session->opts.identity)) {
  ------------------
  |  |  122|      0|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  348|      0|          SAFE_FREE(id);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  349|      0|      }
  350|    478|      ssh_list_free(session->opts.identity);
  351|    478|  }
  352|       |
  353|    478|  if (session->opts.identity_non_exp) {
  ------------------
  |  Branch (353:7): [True: 478, False: 0]
  ------------------
  354|    478|      char *id = NULL;
  355|       |
  356|    478|      for (id = ssh_list_pop_head(char *, session->opts.identity_non_exp);
  ------------------
  |  |  122|    478|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  357|  2.48k|           id != NULL;
  ------------------
  |  Branch (357:12): [True: 2.00k, False: 478]
  ------------------
  358|  2.00k|           id = ssh_list_pop_head(char *, session->opts.identity_non_exp)) {
  ------------------
  |  |  122|  2.00k|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  359|  2.00k|          SAFE_FREE(id);
  ------------------
  |  |  373|  2.00k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 2.00k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 2.00k]
  |  |  ------------------
  ------------------
  360|  2.00k|      }
  361|    478|      ssh_list_free(session->opts.identity_non_exp);
  362|    478|  }
  363|       |
  364|    478|    if (session->opts.certificate) {
  ------------------
  |  Branch (364:9): [True: 478, False: 0]
  ------------------
  365|    478|        char *cert = NULL;
  366|       |
  367|    478|        for (cert = ssh_list_pop_head(char *, session->opts.certificate);
  ------------------
  |  |  122|    478|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  368|    478|             cert != NULL;
  ------------------
  |  Branch (368:14): [True: 0, False: 478]
  ------------------
  369|    478|             cert = ssh_list_pop_head(char *, session->opts.certificate)) {
  ------------------
  |  |  122|      0|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  370|      0|            SAFE_FREE(cert);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  371|      0|        }
  372|    478|        ssh_list_free(session->opts.certificate);
  373|    478|    }
  374|       |
  375|    478|    if (session->opts.certificate_non_exp) {
  ------------------
  |  Branch (375:9): [True: 478, False: 0]
  ------------------
  376|    478|        char *cert = NULL;
  377|       |
  378|    478|        for (cert = ssh_list_pop_head(char *, session->opts.certificate_non_exp);
  ------------------
  |  |  122|    478|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  379|  2.07k|             cert != NULL;
  ------------------
  |  Branch (379:14): [True: 1.60k, False: 478]
  ------------------
  380|  1.60k|             cert = ssh_list_pop_head(char *, session->opts.certificate_non_exp)) {
  ------------------
  |  |  122|  1.60k|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  381|  1.60k|            SAFE_FREE(cert);
  ------------------
  |  |  373|  1.60k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 1.60k, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 1.60k]
  |  |  ------------------
  ------------------
  382|  1.60k|        }
  383|    478|        ssh_list_free(session->opts.certificate_non_exp);
  384|    478|    }
  385|       |
  386|    478|    ssh_proxyjumps_free(session->opts.proxy_jumps);
  387|    478|    SSH_LIST_FREE(session->opts.proxy_jumps);
  ------------------
  |  |  125|    478|    do { if ((x) != NULL) { ssh_list_free(x); (x) = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (125:14): [True: 478, False: 0]
  |  |  |  Branch (125:69): [Folded, False: 478]
  |  |  ------------------
  ------------------
  388|    478|    SSH_LIST_FREE(session->opts.proxy_jumps_user_cb);
  ------------------
  |  |  125|    478|    do { if ((x) != NULL) { ssh_list_free(x); (x) = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (125:14): [True: 478, False: 0]
  |  |  |  Branch (125:69): [Folded, False: 478]
  |  |  ------------------
  ------------------
  389|    478|    SAFE_FREE(session->opts.proxy_jumps_str);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 39, False: 439]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  390|       |
  391|    478|    while ((b = ssh_list_pop_head(struct ssh_buffer_struct *,
  ------------------
  |  |  122|    478|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
  |  Branch (391:12): [True: 0, False: 478]
  ------------------
  392|    478|                                  session->out_queue)) != NULL) {
  393|      0|        SSH_BUFFER_FREE(b);
  ------------------
  |  |  934|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 0, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  394|      0|    }
  395|    478|    ssh_list_free(session->out_queue);
  396|       |
  397|    478|  ssh_agent_state_free(session->agent_state);
  398|    478|  session->agent_state = NULL;
  399|       |
  400|    478|  SAFE_FREE(session->auth.auto_state);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  401|    478|  SAFE_FREE(session->serverbanner);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  402|    478|  SAFE_FREE(session->clientbanner);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  403|    478|  SAFE_FREE(session->banner);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  404|    478|  SAFE_FREE(session->disconnect_message);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  405|    478|  SAFE_FREE(session->peer_discon_msg);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  406|       |
  407|    478|  SAFE_FREE(session->opts.agent_socket);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  408|    478|  SAFE_FREE(session->opts.bindaddr);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  409|    478|  SAFE_FREE(session->opts.username);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 33, False: 445]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  410|    478|  SAFE_FREE(session->opts.host);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 475, False: 3]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  411|    478|  SAFE_FREE(session->opts.originalhost);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 478, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  412|    478|  SAFE_FREE(session->opts.config_hostname);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 89, False: 389]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  413|    478|  SAFE_FREE(session->opts.tag);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 1, False: 477]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  414|    478|  SAFE_FREE(session->opts.homedir);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  415|    478|  SAFE_FREE(session->opts.sshdir);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 478, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  416|    478|  SAFE_FREE(session->opts.knownhosts);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  417|    478|  SAFE_FREE(session->opts.global_knownhosts);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 3, False: 475]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  418|    478|  SAFE_FREE(session->opts.ProxyCommand);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  419|    478|  SAFE_FREE(session->opts.gss_server_identity);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 2, False: 476]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  420|    478|  SAFE_FREE(session->opts.gss_client_identity);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 1, False: 477]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  421|    478|  SAFE_FREE(session->opts.pubkey_accepted_types);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 23, False: 455]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  422|    478|  SAFE_FREE(session->opts.control_path);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  423|       |
  424|  5.25k|  for (i = 0; i < SSH_KEX_METHODS; i++) {
  ------------------
  |  |   27|  5.25k|#define SSH_KEX_METHODS 10
  ------------------
  |  Branch (424:15): [True: 4.78k, False: 478]
  ------------------
  425|  4.78k|      if (session->opts.wanted_methods[i]) {
  ------------------
  |  Branch (425:11): [True: 154, False: 4.62k]
  ------------------
  426|    154|          SAFE_FREE(session->opts.wanted_methods[i]);
  ------------------
  |  |  373|    154|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 154, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 154]
  |  |  ------------------
  ------------------
  427|    154|      }
  428|  4.78k|  }
  429|       |
  430|    478|  SAFE_FREE(session->server_opts.custombanner);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  431|    478|  SAFE_FREE(session->server_opts.moduli_file);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  432|       |
  433|    478|  _ssh_remove_legacy_log_cb();
  434|       |
  435|       |  /* burn connection, it could contain sensitive data */
  436|    478|  ssh_burn(session, sizeof(struct ssh_session_struct));
  ------------------
  |  |  388|    478|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  437|       |  SAFE_FREE(session);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 478, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  438|    478|}
ssh_set_blocking:
  637|    478|{
  638|    478|    if (session == NULL) {
  ------------------
  |  Branch (638:9): [True: 0, False: 478]
  ------------------
  639|      0|        return;
  640|      0|    }
  641|    478|    session->flags &= ~SSH_SESSION_FLAG_BLOCKING;
  ------------------
  |  |   75|    478|#define SSH_SESSION_FLAG_BLOCKING 0x0001
  ------------------
  642|    478|    session->flags |= blocking ? SSH_SESSION_FLAG_BLOCKING : 0;
  ------------------
  |  |   75|    478|#define SSH_SESSION_FLAG_BLOCKING 0x0001
  ------------------
  |  Branch (642:23): [True: 478, False: 0]
  ------------------
  643|    478|}

ssh_socket_init:
  132|      2|{
  133|      2|    if (sockets_initialized == 0) {
  ------------------
  |  Branch (133:9): [True: 2, False: 0]
  ------------------
  134|       |#ifdef _WIN32
  135|       |        struct WSAData wsaData;
  136|       |
  137|       |        /* Initiates use of the Winsock DLL by a process. */
  138|       |        if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) {
  139|       |            return -1;
  140|       |        }
  141|       |#endif
  142|      2|        ssh_poll_init();
  143|       |
  144|      2|        sockets_initialized = 1;
  145|      2|    }
  146|       |
  147|      2|    return 0;
  148|      2|}
ssh_socket_new:
  182|    956|{
  183|    956|    ssh_socket s;
  184|       |
  185|    956|    s = calloc(1, sizeof(struct ssh_socket_struct));
  186|    956|    if (s == NULL) {
  ------------------
  |  Branch (186:9): [True: 0, False: 956]
  ------------------
  187|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  188|      0|        return NULL;
  189|      0|    }
  190|    956|    s->fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  124|    956|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  191|    956|    s->last_errno = -1;
  192|    956|    s->fd_is_socket = 1;
  193|    956|    s->session = session;
  194|    956|    s->in_buffer = ssh_buffer_new();
  195|    956|    if (s->in_buffer == NULL) {
  ------------------
  |  Branch (195:9): [True: 0, False: 956]
  ------------------
  196|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  197|      0|        SAFE_FREE(s);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  198|      0|        return NULL;
  199|      0|    }
  200|    956|    s->out_buffer=ssh_buffer_new();
  201|    956|    if (s->out_buffer == NULL) {
  ------------------
  |  Branch (201:9): [True: 0, False: 956]
  ------------------
  202|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  318|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  203|      0|        SSH_BUFFER_FREE(s->in_buffer);
  ------------------
  |  |  934|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 0, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  204|      0|        SAFE_FREE(s);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  205|      0|        return NULL;
  206|      0|    }
  207|    956|    s->read_wontblock = 0;
  208|    956|    s->write_wontblock = 0;
  209|    956|    s->data_except = 0;
  210|       |    s->poll_handle = NULL;
  211|    956|    s->state=SSH_SOCKET_NONE;
  212|    956|    return s;
  213|    956|}
ssh_socket_free:
  473|    956|{
  474|    956|    if (s == NULL) {
  ------------------
  |  Branch (474:9): [True: 0, False: 956]
  ------------------
  475|      0|        return;
  476|      0|    }
  477|    956|    ssh_socket_close(s);
  478|    956|    SSH_BUFFER_FREE(s->in_buffer);
  ------------------
  |  |  934|    956|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 956, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 956]
  |  |  ------------------
  ------------------
  479|    956|    SSH_BUFFER_FREE(s->out_buffer);
  ------------------
  |  |  934|    956|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (934:14): [True: 956, False: 0]
  |  |  |  Branch (934:69): [Folded, False: 956]
  |  |  ------------------
  ------------------
  480|       |    SAFE_FREE(s);
  ------------------
  |  |  373|    956|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 956, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 956]
  |  |  ------------------
  ------------------
  481|    956|}
ssh_socket_close:
  546|  1.43k|{
  547|  1.43k|    if (ssh_socket_is_open(s)) {
  ------------------
  |  Branch (547:9): [True: 0, False: 1.43k]
  ------------------
  548|       |#ifdef _WIN32
  549|       |        CLOSE_SOCKET(s->fd);
  550|       |        s->last_errno = WSAGetLastError();
  551|       |#else
  552|      0|        CLOSE_SOCKET(s->fd);
  ------------------
  |  |  472|      0|#define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
  |  |  ------------------
  |  |  |  |  124|      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)
  |  |  ------------------
  |  |  |  |  199|      0|#define _XCLOSESOCKET close
  |  |  ------------------
  |  |               #define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
  |  |  ------------------
  |  |  |  |  124|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  |  |  ------------------
  |  |  |  Branch (472:34): [True: 0, False: 0]
  |  |  |  Branch (472:116): [Folded, False: 0]
  |  |  ------------------
  ------------------
  553|      0|        s->last_errno = errno;
  554|      0|#endif
  555|      0|    }
  556|       |
  557|  1.43k|    if (s->poll_handle != NULL && !ssh_poll_is_locked(s->poll_handle)) {
  ------------------
  |  Branch (557:9): [True: 0, False: 1.43k]
  |  Branch (557:35): [True: 0, False: 0]
  ------------------
  558|      0|        ssh_poll_free(s->poll_handle);
  559|      0|        s->poll_handle = NULL;
  560|      0|    }
  561|       |
  562|  1.43k|    s->state = SSH_SOCKET_CLOSED;
  563|       |
  564|  1.43k|#ifndef _WIN32
  565|       |    /* If the proxy command still runs try to kill it */
  566|  1.43k|    if (s->proxy_pid != 0) {
  ------------------
  |  Branch (566:9): [True: 0, False: 1.43k]
  ------------------
  567|      0|        int status;
  568|      0|        pid_t pid = s->proxy_pid;
  569|       |
  570|      0|        s->proxy_pid = 0;
  571|      0|        kill(pid, SIGTERM);
  572|      0|        while (waitpid(pid, &status, 0) == -1) {
  ------------------
  |  Branch (572:16): [True: 0, False: 0]
  ------------------
  573|      0|            if (errno != EINTR) {
  ------------------
  |  Branch (573:17): [True: 0, False: 0]
  ------------------
  574|      0|                SSH_LOG_STRERROR(SSH_LOG_TRACE, errno, "waitpid failed: %s");
  ------------------
  |  |  283|      0|    do {                                                            \
  |  |  284|      0|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  285|      0|        _ssh_log(priority,                                          \
  |  |  286|      0|                 __func__,                                          \
  |  |  287|      0|                 __VA_ARGS__,                                       \
  |  |  288|      0|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  520|      0|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  289|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (289:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  575|      0|                return;
  576|      0|            }
  577|      0|        }
  578|      0|        if (!WIFEXITED(status)) {
  ------------------
  |  Branch (578:13): [True: 0, False: 0]
  ------------------
  579|      0|            SSH_LOG(SSH_LOG_TRACE, "Proxy command exited abnormally");
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  580|      0|            return;
  581|      0|        }
  582|      0|        SSH_LOG(SSH_LOG_TRACE, "Proxy command returned %d", WEXITSTATUS(status));
  ------------------
  |  |  281|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  583|      0|    }
  584|  1.43k|#endif
  585|  1.43k|}
ssh_socket_is_open:
  643|  1.43k|{
  644|  1.43k|    return s->fd != SSH_INVALID_SOCKET;
  ------------------
  |  |  124|  1.43k|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  645|  1.43k|}

ssh_string_burn:
  341|    478|{
  342|    478|    if (s == NULL || s->size == 0) {
  ------------------
  |  Branch (342:9): [True: 478, False: 0]
  |  Branch (342:22): [True: 0, False: 0]
  ------------------
  343|    478|        return;
  344|    478|    }
  345|       |
  346|      0|    ssh_burn(s->data, ssh_string_len(s));
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  347|      0|}
ssh_string_free:
  371|  2.39k|{
  372|       |    SAFE_FREE(s);
  ------------------
  |  |  373|  2.39k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 2.39k]
  |  |  |  Branch (373:71): [Folded, False: 2.39k]
  |  |  ------------------
  ------------------
  373|  2.39k|}

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

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

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

ssh_tokens_free:
   43|    580|{
   44|    580|    int i;
   45|    580|    if (tokens == NULL) {
  ------------------
  |  Branch (45:9): [True: 0, False: 580]
  ------------------
   46|      0|        return;
   47|      0|    }
   48|       |
   49|    580|    if (tokens->tokens != NULL) {
  ------------------
  |  Branch (49:9): [True: 580, False: 0]
  ------------------
   50|  16.9k|        for (i = 0; tokens->tokens[i] != NULL; i++) {
  ------------------
  |  Branch (50:21): [True: 16.3k, False: 580]
  ------------------
   51|  16.3k|            ssh_burn(tokens->tokens[i], strlen(tokens->tokens[i]));
  ------------------
  |  |  388|  16.3k|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
   52|  16.3k|        }
   53|    580|    }
   54|       |
   55|    580|    SAFE_FREE(tokens->buffer);
  ------------------
  |  |  373|    580|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 580, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 580]
  |  |  ------------------
  ------------------
   56|    580|    SAFE_FREE(tokens->tokens);
  ------------------
  |  |  373|    580|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 580, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 580]
  |  |  ------------------
  ------------------
   57|       |    SAFE_FREE(tokens);
  ------------------
  |  |  373|    580|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 580, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 580]
  |  |  ------------------
  ------------------
   58|    580|}
ssh_tokenize:
   74|    580|{
   75|       |
   76|    580|    struct ssh_tokens_st *tokens = NULL;
   77|    580|    size_t num_tokens = 1, i = 1;
   78|       |
   79|    580|    char *found, *c;
   80|       |
   81|    580|    if (chain == NULL) {
  ------------------
  |  Branch (81:9): [True: 0, False: 580]
  ------------------
   82|      0|        return NULL;
   83|      0|    }
   84|       |
   85|    580|    tokens = calloc(1, sizeof(struct ssh_tokens_st));
   86|    580|    if (tokens == NULL) {
  ------------------
  |  Branch (86:9): [True: 0, False: 580]
  ------------------
   87|      0|        return NULL;
   88|      0|    }
   89|       |
   90|    580|    tokens->buffer = strdup(chain);
   91|    580|    if (tokens->buffer == NULL) {
  ------------------
  |  Branch (91:9): [True: 0, False: 580]
  ------------------
   92|      0|        goto error;
   93|      0|    }
   94|       |
   95|    580|    c = tokens->buffer;
   96|  16.3k|    do {
   97|  16.3k|        found = strchr(c, separator);
   98|  16.3k|        if (found != NULL) {
  ------------------
  |  Branch (98:13): [True: 15.7k, False: 580]
  ------------------
   99|  15.7k|            c = found + 1;
  100|  15.7k|            num_tokens++;
  101|  15.7k|        }
  102|  16.3k|    } while(found != NULL);
  ------------------
  |  Branch (102:13): [True: 15.7k, False: 580]
  ------------------
  103|       |
  104|       |    /* Allocate tokens list */
  105|    580|    tokens->tokens = calloc(num_tokens + 1, sizeof(char *));
  106|    580|    if (tokens->tokens == NULL) {
  ------------------
  |  Branch (106:9): [True: 0, False: 580]
  ------------------
  107|      0|        goto error;
  108|      0|    }
  109|       |
  110|       |    /* First token starts in the beginning of the chain */
  111|    580|    tokens->tokens[0] = tokens->buffer;
  112|    580|    c = tokens->buffer;
  113|       |
  114|  16.3k|    for (i = 1; i < num_tokens; i++) {
  ------------------
  |  Branch (114:17): [True: 15.7k, False: 559]
  ------------------
  115|       |        /* Find next separator */
  116|  15.7k|        found = strchr(c, separator);
  117|  15.7k|        if (found == NULL) {
  ------------------
  |  Branch (117:13): [True: 0, False: 15.7k]
  ------------------
  118|      0|            break;
  119|      0|        }
  120|       |
  121|       |        /* Replace it with a string terminator */
  122|  15.7k|        *found = '\0';
  123|       |
  124|       |        /* The next token starts in the next byte */
  125|  15.7k|        c = found + 1;
  126|       |
  127|       |        /* If we did not reach the end of the chain yet, set the next token */
  128|  15.7k|        if (*c != '\0') {
  ------------------
  |  Branch (128:13): [True: 15.7k, False: 21]
  ------------------
  129|  15.7k|            tokens->tokens[i] = c;
  130|  15.7k|        } else {
  131|     21|            break;
  132|     21|        }
  133|  15.7k|    }
  134|       |
  135|    580|    return tokens;
  136|       |
  137|      0|error:
  138|      0|    ssh_tokens_free(tokens);
  139|       |    return NULL;
  140|    580|}
ssh_find_all_matching:
  208|    191|{
  209|    191|    struct ssh_tokens_st *a_tok = NULL, *p_tok = NULL;
  210|    191|    int i, j;
  211|    191|    char *ret = NULL;
  212|    191|    size_t max, len, pos = 0;
  213|    191|    int match;
  214|       |
  215|    191|    if ((available_list == NULL) || (preferred_list == NULL)) {
  ------------------
  |  Branch (215:9): [True: 0, False: 191]
  |  Branch (215:37): [True: 0, False: 191]
  ------------------
  216|      0|        return NULL;
  217|      0|    }
  218|       |
  219|    191|    max = MAX(strlen(available_list), strlen(preferred_list));
  ------------------
  |  |  369|    191|#define MAX(a,b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (369:19): [True: 119, False: 72]
  |  |  ------------------
  ------------------
  220|       |
  221|    191|    ret = calloc(1, max + 1);
  222|    191|    if (ret == NULL) {
  ------------------
  |  Branch (222:9): [True: 0, False: 191]
  ------------------
  223|      0|        return NULL;
  224|      0|    }
  225|       |
  226|    191|    a_tok = ssh_tokenize(available_list, ',');
  227|    191|    if (a_tok == NULL) {
  ------------------
  |  Branch (227:9): [True: 0, False: 191]
  ------------------
  228|      0|        SAFE_FREE(ret);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  229|      0|        goto out;
  230|      0|    }
  231|       |
  232|    191|    p_tok = ssh_tokenize(preferred_list, ',');
  233|    191|    if (p_tok == NULL) {
  ------------------
  |  Branch (233:9): [True: 0, False: 191]
  ------------------
  234|      0|        SAFE_FREE(ret);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  235|      0|        goto out;
  236|      0|    }
  237|       |
  238|  4.08k|    for (i = 0; p_tok->tokens[i] ; i++) {
  ------------------
  |  Branch (238:17): [True: 3.89k, False: 191]
  ------------------
  239|  42.6k|        for (j = 0; a_tok->tokens[j]; j++) {
  ------------------
  |  Branch (239:21): [True: 38.7k, False: 3.89k]
  ------------------
  240|  38.7k|            match = !strcmp(a_tok->tokens[j], p_tok->tokens[i]);
  241|  38.7k|            if (match) {
  ------------------
  |  Branch (241:17): [True: 1.07k, False: 37.6k]
  ------------------
  242|  1.07k|                if (pos != 0) {
  ------------------
  |  Branch (242:21): [True: 913, False: 158]
  ------------------
  243|    913|                    ret[pos] = ',';
  244|    913|                    pos++;
  245|    913|                }
  246|       |
  247|  1.07k|                len = strlen(a_tok->tokens[j]);
  248|  1.07k|                memcpy(&ret[pos], a_tok->tokens[j], len);
  249|  1.07k|                pos += len;
  250|  1.07k|                ret[pos] = '\0';
  251|  1.07k|            }
  252|  38.7k|        }
  253|  3.89k|    }
  254|       |
  255|    191|    if (ret[0] == '\0') {
  ------------------
  |  Branch (255:9): [True: 33, False: 158]
  ------------------
  256|     33|        SAFE_FREE(ret);
  ------------------
  |  |  373|     33|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 33, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 33]
  |  |  ------------------
  ------------------
  257|     33|    }
  258|       |
  259|    191|out:
  260|    191|    ssh_tokens_free(a_tok);
  261|    191|    ssh_tokens_free(p_tok);
  262|    191|    return ret;
  263|    191|}
ssh_remove_duplicates:
  277|    156|{
  278|    156|    struct ssh_tokens_st *tok = NULL;
  279|       |
  280|    156|    size_t i, j, num_tokens, max_len;
  281|    156|    char *ret = NULL;
  282|    156|    bool *should_copy = NULL, need_comma = false;
  283|       |
  284|    156|    if (list == NULL) {
  ------------------
  |  Branch (284:9): [True: 0, False: 156]
  ------------------
  285|      0|        return NULL;
  286|      0|    }
  287|       |
  288|       |    /* The maximum number of tokens is the size of the list */
  289|    156|    max_len = strlen(list);
  290|    156|    if (max_len == 0) {
  ------------------
  |  Branch (290:9): [True: 0, False: 156]
  ------------------
  291|      0|        return NULL;
  292|      0|    }
  293|       |
  294|       |    /* Add space for ending '\0' */
  295|    156|    max_len++;
  296|       |
  297|    156|    tok = ssh_tokenize(list, ',');
  298|    156|    if ((tok == NULL) || (tok->tokens == NULL) || (tok->tokens[0] == NULL)) {
  ------------------
  |  Branch (298:9): [True: 0, False: 156]
  |  Branch (298:26): [True: 0, False: 156]
  |  Branch (298:51): [True: 0, False: 156]
  ------------------
  299|      0|        goto out;
  300|      0|    }
  301|       |
  302|    156|    should_copy = calloc(1, max_len);
  303|    156|    if (should_copy == NULL) {
  ------------------
  |  Branch (303:9): [True: 0, False: 156]
  ------------------
  304|      0|        goto out;
  305|      0|    }
  306|       |
  307|    156|    if (strlen(tok->tokens[0]) > 0) {
  ------------------
  |  Branch (307:9): [True: 153, False: 3]
  ------------------
  308|    153|        should_copy[0] = true;
  309|    153|    }
  310|       |
  311|  9.67k|    for (i = 1; tok->tokens[i]; i++) {
  ------------------
  |  Branch (311:17): [True: 9.51k, False: 156]
  ------------------
  312|   174k|        for (j = 0; j < i; j++) {
  ------------------
  |  Branch (312:21): [True: 170k, False: 3.36k]
  ------------------
  313|   170k|            if (strcmp(tok->tokens[i], tok->tokens[j]) == 0) {
  ------------------
  |  Branch (313:17): [True: 6.14k, False: 164k]
  ------------------
  314|       |                /* Found a duplicate; do not copy */
  315|  6.14k|                should_copy[i] = false;
  316|  6.14k|                break;
  317|  6.14k|            }
  318|   170k|        }
  319|       |
  320|       |        /* No matching token before */
  321|  9.51k|        if (j == i) {
  ------------------
  |  Branch (321:13): [True: 3.36k, False: 6.14k]
  ------------------
  322|       |            /* Only copy if it is not an empty string */
  323|  3.36k|            if (strlen(tok->tokens[i]) > 0) {
  ------------------
  |  Branch (323:17): [True: 3.26k, False: 105]
  ------------------
  324|  3.26k|                should_copy[i] = true;
  325|  3.26k|            } else {
  326|    105|                should_copy[i] = false;
  327|    105|            }
  328|  3.36k|        }
  329|  9.51k|    }
  330|       |
  331|    156|    num_tokens = i;
  332|       |
  333|    156|    ret = calloc(1, max_len);
  334|    156|    if (ret == NULL) {
  ------------------
  |  Branch (334:9): [True: 0, False: 156]
  ------------------
  335|      0|        goto out;
  336|      0|    }
  337|       |
  338|  9.83k|    for (i = 0; i < num_tokens; i++) {
  ------------------
  |  Branch (338:17): [True: 9.67k, False: 156]
  ------------------
  339|  9.67k|        if (should_copy[i]) {
  ------------------
  |  Branch (339:13): [True: 3.41k, False: 6.25k]
  ------------------
  340|  3.41k|            if (need_comma) {
  ------------------
  |  Branch (340:17): [True: 3.26k, False: 156]
  ------------------
  341|  3.26k|                strlcat(ret, ",", max_len);
  342|  3.26k|            }
  343|  3.41k|            strlcat(ret, tok->tokens[i], max_len);
  344|  3.41k|            need_comma = true;
  345|  3.41k|        }
  346|  9.67k|    }
  347|       |
  348|       |    /* If no comma is needed, nothing was copied */
  349|    156|    if (!need_comma) {
  ------------------
  |  Branch (349:9): [True: 0, False: 156]
  ------------------
  350|      0|        SAFE_FREE(ret);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  351|      0|    }
  352|       |
  353|    156|out:
  354|       |    SAFE_FREE(should_copy);
  ------------------
  |  |  373|    156|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 156, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 156]
  |  |  ------------------
  ------------------
  355|    156|    ssh_tokens_free(tok);
  356|    156|    return ret;
  357|    156|}
ssh_append_without_duplicates:
  376|    105|{
  377|    105|    size_t concat_len = 0;
  378|    105|    char *ret = NULL, *concat = NULL;
  379|    105|    int rc = 0;
  380|       |
  381|    105|    if (list != NULL) {
  ------------------
  |  Branch (381:9): [True: 105, False: 0]
  ------------------
  382|    105|        concat_len = strlen(list);
  383|    105|    }
  384|       |
  385|    105|    if (appended_list != NULL) {
  ------------------
  |  Branch (385:9): [True: 105, False: 0]
  ------------------
  386|    105|        concat_len += strlen(appended_list);
  387|    105|    }
  388|       |
  389|    105|    if (concat_len == 0) {
  ------------------
  |  Branch (389:9): [True: 0, False: 105]
  ------------------
  390|      0|        return NULL;
  391|      0|    }
  392|       |
  393|       |    /* Add room for ending '\0' and for middle ',' */
  394|    105|    concat_len += 2;
  395|    105|    concat = calloc(1, concat_len);
  396|    105|    if (concat == NULL) {
  ------------------
  |  Branch (396:9): [True: 0, False: 105]
  ------------------
  397|      0|        return NULL;
  398|      0|    }
  399|       |
  400|    105|    rc = snprintf(concat, concat_len, "%s%s%s",
  401|    105|                  list == NULL ? "" : list,
  ------------------
  |  Branch (401:19): [True: 0, False: 105]
  ------------------
  402|    105|                  list == NULL ? "" : ",",
  ------------------
  |  Branch (402:19): [True: 0, False: 105]
  ------------------
  403|    105|                  appended_list == NULL ? "" : appended_list);
  ------------------
  |  Branch (403:19): [True: 0, False: 105]
  ------------------
  404|    105|    if (rc < 0) {
  ------------------
  |  Branch (404:9): [True: 0, False: 105]
  ------------------
  405|      0|        SAFE_FREE(concat);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  406|      0|        return NULL;
  407|      0|    }
  408|       |
  409|    105|    ret = ssh_remove_duplicates(concat);
  410|       |
  411|    105|    SAFE_FREE(concat);
  ------------------
  |  |  373|    105|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 105, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 105]
  |  |  ------------------
  ------------------
  412|       |
  413|    105|    return ret;
  414|    105|}
ssh_remove_all_matching:
  431|     21|{
  432|     21|    struct ssh_tokens_st *l_tok = NULL, *r_tok = NULL;
  433|     21|    int i, j, cmp;
  434|     21|    char *ret = NULL;
  435|     21|    size_t len, pos = 0;
  436|     21|    bool exclude;
  437|       |
  438|     21|    if (list == NULL) {
  ------------------
  |  Branch (438:9): [True: 0, False: 21]
  ------------------
  439|      0|        return NULL;
  440|      0|    }
  441|     21|    if (remove_list == NULL) {
  ------------------
  |  Branch (441:9): [True: 0, False: 21]
  ------------------
  442|      0|        return strdup (list);
  443|      0|    }
  444|       |
  445|     21|    l_tok = ssh_tokenize(list, ',');
  446|     21|    if (l_tok == NULL) {
  ------------------
  |  Branch (446:9): [True: 0, False: 21]
  ------------------
  447|      0|        goto out;
  448|      0|    }
  449|       |
  450|     21|    r_tok = ssh_tokenize(remove_list, ',');
  451|     21|    if (r_tok == NULL) {
  ------------------
  |  Branch (451:9): [True: 0, False: 21]
  ------------------
  452|      0|        goto out;
  453|      0|    }
  454|       |
  455|     21|    ret = calloc(1, strlen(list) + 1);
  456|     21|    if (ret == NULL) {
  ------------------
  |  Branch (456:9): [True: 0, False: 21]
  ------------------
  457|      0|        goto out;
  458|      0|    }
  459|       |
  460|    160|    for (i = 0; l_tok->tokens[i]; i++) {
  ------------------
  |  Branch (460:17): [True: 139, False: 21]
  ------------------
  461|    139|        exclude = false;
  462|  6.00k|        for (j = 0; r_tok->tokens[j]; j++) {
  ------------------
  |  Branch (462:21): [True: 5.89k, False: 116]
  ------------------
  463|  5.89k|            cmp = strcmp(l_tok->tokens[i], r_tok->tokens[j]);
  464|  5.89k|            if (cmp == 0) {
  ------------------
  |  Branch (464:17): [True: 23, False: 5.86k]
  ------------------
  465|     23|                exclude = true;
  466|     23|                break;
  467|     23|            }
  468|  5.89k|        }
  469|    139|        if (exclude == false) {
  ------------------
  |  Branch (469:13): [True: 116, False: 23]
  ------------------
  470|    116|            if (pos != 0) {
  ------------------
  |  Branch (470:17): [True: 97, False: 19]
  ------------------
  471|     97|                ret[pos] = ',';
  472|     97|                pos++;
  473|     97|            }
  474|       |
  475|    116|            len = strlen(l_tok->tokens[i]);
  476|    116|            memcpy(&ret[pos], l_tok->tokens[i], len);
  477|    116|            pos += len;
  478|    116|        }
  479|    139|    }
  480|       |
  481|     21|    if (ret[0] == '\0') {
  ------------------
  |  Branch (481:9): [True: 2, False: 19]
  ------------------
  482|      2|        SAFE_FREE(ret);
  ------------------
  |  |  373|      2|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 2, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 2]
  |  |  ------------------
  ------------------
  483|      2|    }
  484|       |
  485|     21|out:
  486|     21|    ssh_tokens_free(l_tok);
  487|     21|    ssh_tokens_free(r_tok);
  488|     21|    return ret;
  489|     21|}
ssh_prefix_without_duplicates:
  507|     51|{
  508|     51|    size_t concat_len = 0;
  509|     51|    char *ret = NULL, *concat = NULL;
  510|     51|    int rc = 0;
  511|       |
  512|     51|    if (list != NULL) {
  ------------------
  |  Branch (512:9): [True: 51, False: 0]
  ------------------
  513|     51|        concat_len = strlen(list);
  514|     51|    }
  515|       |
  516|     51|    if (prefixed_list != NULL) {
  ------------------
  |  Branch (516:9): [True: 51, False: 0]
  ------------------
  517|     51|        concat_len += strlen(prefixed_list);
  518|     51|    }
  519|       |
  520|     51|    if (concat_len == 0) {
  ------------------
  |  Branch (520:9): [True: 0, False: 51]
  ------------------
  521|      0|        return NULL;
  522|      0|    }
  523|       |
  524|       |    /* Add room for ending '\0' and for middle ',' */
  525|     51|    concat_len += 2;
  526|     51|    concat = calloc(concat_len, 1);
  527|     51|    if (concat == NULL) {
  ------------------
  |  Branch (527:9): [True: 0, False: 51]
  ------------------
  528|      0|        return NULL;
  529|      0|    }
  530|       |
  531|     51|    rc = snprintf(concat, concat_len, "%s%s%s",
  532|     51|                  prefixed_list == NULL ? "" : prefixed_list,
  ------------------
  |  Branch (532:19): [True: 0, False: 51]
  ------------------
  533|     51|                  prefixed_list == NULL ? "" : ",",
  ------------------
  |  Branch (533:19): [True: 0, False: 51]
  ------------------
  534|     51|                  list == NULL ? "" : list);
  ------------------
  |  Branch (534:19): [True: 0, False: 51]
  ------------------
  535|     51|    if (rc < 0) {
  ------------------
  |  Branch (535:9): [True: 0, False: 51]
  ------------------
  536|      0|        SAFE_FREE(concat);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  537|      0|        return NULL;
  538|      0|    }
  539|       |
  540|     51|    ret = ssh_remove_duplicates(concat);
  541|       |
  542|     51|    SAFE_FREE(concat);
  ------------------
  |  |  373|     51|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 51, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 51]
  |  |  ------------------
  ------------------
  543|       |
  544|     51|    return ret;
  545|     51|}

ssh_cipher_clear:
  124|    956|void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
  125|       |#ifdef HAVE_LIBGCRYPT
  126|       |    unsigned int i;
  127|       |#endif
  128|       |
  129|    956|    if (cipher == NULL) {
  ------------------
  |  Branch (129:9): [True: 956, False: 0]
  ------------------
  130|    956|        return;
  131|    956|    }
  132|       |
  133|       |#ifdef HAVE_LIBGCRYPT
  134|       |    if (cipher->key) {
  135|       |        for (i = 0; i < (cipher->keylen / sizeof(gcry_cipher_hd_t)); i++) {
  136|       |            gcry_cipher_close(cipher->key[i]);
  137|       |        }
  138|       |        SAFE_FREE(cipher->key);
  139|       |    }
  140|       |#endif
  141|       |
  142|      0|    if (cipher->cleanup != NULL) {
  ------------------
  |  Branch (142:9): [True: 0, False: 0]
  ------------------
  143|      0|        cipher->cleanup(cipher);
  144|      0|    }
  145|      0|}
crypto_new:
  153|    478|{
  154|    478|    struct ssh_crypto_struct *crypto = NULL;
  155|       |
  156|    478|    crypto = calloc(1, sizeof(struct ssh_crypto_struct));
  157|    478|    if (crypto == NULL) {
  ------------------
  |  Branch (157:9): [True: 0, False: 478]
  ------------------
  158|      0|        return NULL;
  159|      0|    }
  160|    478|    return crypto;
  161|    478|}
crypto_free:
  164|    956|{
  165|    956|    size_t i;
  166|       |
  167|    956|    if (crypto == NULL) {
  ------------------
  |  Branch (167:9): [True: 478, False: 478]
  ------------------
  168|    478|        return;
  169|    478|    }
  170|       |
  171|    478|    ssh_key_free(crypto->server_pubkey);
  172|       |
  173|    478|    ssh_dh_cleanup(crypto);
  174|    478|    bignum_safe_free(crypto->shared_secret);
  ------------------
  |  |   71|    478|#define bignum_safe_free(num) do { \
  |  |   72|    478|    if ((num) != NULL) { \
  |  |  ------------------
  |  |  |  Branch (72:9): [True: 0, False: 478]
  |  |  ------------------
  |  |   73|      0|        BN_clear_free((num)); \
  |  |   74|      0|        (num)=NULL; \
  |  |   75|      0|    } \
  |  |   76|    478|    } while(0)
  |  |  ------------------
  |  |  |  Branch (76:13): [Folded, False: 478]
  |  |  ------------------
  ------------------
  175|    478|#ifdef HAVE_ECDH
  176|    478|    SAFE_FREE(crypto->ecdh_client_pubkey);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  177|    478|    SAFE_FREE(crypto->ecdh_server_pubkey);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  178|    478|    if (crypto->ecdh_privkey != NULL) {
  ------------------
  |  Branch (178:9): [True: 0, False: 478]
  ------------------
  179|      0|#ifdef HAVE_OPENSSL_ECC
  180|      0|#if OPENSSL_VERSION_NUMBER < 0x30000000L
  181|      0|        EC_KEY_free(crypto->ecdh_privkey);
  182|       |#else
  183|       |        EVP_PKEY_free(crypto->ecdh_privkey);
  184|       |#endif /* OPENSSL_VERSION_NUMBER */
  185|       |#elif defined HAVE_GCRYPT_ECC
  186|       |        gcry_sexp_release(crypto->ecdh_privkey);
  187|       |#elif defined HAVE_LIBMBEDCRYPTO
  188|       |        mbedtls_ecp_keypair_free(crypto->ecdh_privkey);
  189|       |        SAFE_FREE(crypto->ecdh_privkey);
  190|       |#endif /* HAVE_LIBGCRYPT */
  191|      0|        crypto->ecdh_privkey = NULL;
  192|      0|    }
  193|    478|#endif
  194|    478|#ifdef HAVE_LIBCRYPTO
  195|    478|    EVP_PKEY_free(crypto->curve25519_privkey);
  196|       |#elif defined(HAVE_GCRYPT_CURVE25519)
  197|       |    gcry_sexp_release(crypto->curve25519_privkey);
  198|       |#endif
  199|    478|    SAFE_FREE(crypto->dh_server_signature);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  200|    478|    if (crypto->session_id != NULL) {
  ------------------
  |  Branch (200:9): [True: 0, False: 478]
  ------------------
  201|      0|        ssh_burn(crypto->session_id, crypto->session_id_len);
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  202|      0|        SAFE_FREE(crypto->session_id);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  203|      0|    }
  204|    478|    if (crypto->secret_hash != NULL) {
  ------------------
  |  Branch (204:9): [True: 0, False: 478]
  ------------------
  205|      0|        ssh_burn(crypto->secret_hash, crypto->digest_len);
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  206|      0|        SAFE_FREE(crypto->secret_hash);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  207|      0|    }
  208|    478|    compress_cleanup(crypto);
  209|    478|    SAFE_FREE(crypto->encryptIV);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  210|    478|    SAFE_FREE(crypto->decryptIV);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  211|    478|    SAFE_FREE(crypto->encryptMAC);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  212|    478|    SAFE_FREE(crypto->decryptMAC);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 478]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  213|    478|    if (crypto->encryptkey != NULL) {
  ------------------
  |  Branch (213:9): [True: 0, False: 478]
  ------------------
  214|      0|        ssh_burn(crypto->encryptkey, crypto->out_cipher->keysize / 8);
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  215|      0|        SAFE_FREE(crypto->encryptkey);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  216|      0|    }
  217|    478|    if (crypto->decryptkey != NULL) {
  ------------------
  |  Branch (217:9): [True: 0, False: 478]
  ------------------
  218|      0|        ssh_burn(crypto->decryptkey, crypto->in_cipher->keysize / 8);
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  219|      0|        SAFE_FREE(crypto->decryptkey);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  220|      0|    }
  221|       |
  222|    478|    cipher_free(crypto->in_cipher);
  223|    478|    cipher_free(crypto->out_cipher);
  224|       |
  225|  5.25k|    for (i = 0; i < SSH_KEX_METHODS; i++) {
  ------------------
  |  |   27|  5.25k|#define SSH_KEX_METHODS 10
  ------------------
  |  Branch (225:17): [True: 4.78k, False: 478]
  ------------------
  226|  4.78k|        SAFE_FREE(crypto->client_kex.methods[i]);
  ------------------
  |  |  373|  4.78k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 4.78k]
  |  |  |  Branch (373:71): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
  227|  4.78k|        SAFE_FREE(crypto->server_kex.methods[i]);
  ------------------
  |  |  373|  4.78k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 4.78k]
  |  |  |  Branch (373:71): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
  228|  4.78k|        SAFE_FREE(crypto->kex_methods[i]);
  ------------------
  |  |  373|  4.78k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 4.78k]
  |  |  |  Branch (373:71): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
  229|  4.78k|    }
  230|       |
  231|       |#ifdef HAVE_OPENSSL_MLKEM
  232|       |    EVP_PKEY_free(crypto->mlkem_privkey);
  233|       |#else
  234|    478|    if (crypto->mlkem_privkey != NULL) {
  ------------------
  |  Branch (234:9): [True: 0, False: 478]
  ------------------
  235|      0|        ssh_burn(crypto->mlkem_privkey, crypto->mlkem_privkey_len);
  ------------------
  |  |  388|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  236|      0|        SAFE_FREE(crypto->mlkem_privkey);
  ------------------
  |  |  373|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  237|      0|        crypto->mlkem_privkey_len = 0;
  238|      0|    }
  239|    478|#endif
  240|    478|    ssh_string_burn(crypto->hybrid_shared_secret);
  241|    478|    ssh_string_free(crypto->mlkem_client_pubkey);
  242|    478|    ssh_string_free(crypto->mlkem_ciphertext);
  243|    478|    ssh_string_free(crypto->hybrid_client_init);
  244|    478|    ssh_string_free(crypto->hybrid_server_reply);
  245|    478|    ssh_string_free(crypto->hybrid_shared_secret);
  246|       |
  247|    478|    ssh_burn(crypto, sizeof(struct ssh_crypto_struct));
  ------------------
  |  |  388|    478|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  248|       |
  249|       |    SAFE_FREE(crypto);
  ------------------
  |  |  373|    478|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 478, False: 0]
  |  |  |  Branch (373:71): [Folded, False: 478]
  |  |  ------------------
  ------------------
  250|    478|}
wrapper.c:cipher_free:
  147|    956|static void cipher_free(struct ssh_cipher_struct *cipher) {
  148|    956|  ssh_cipher_clear(cipher);
  149|       |  SAFE_FREE(cipher);
  ------------------
  |  |  373|    956|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (373:31): [True: 0, False: 956]
  |  |  |  Branch (373:71): [Folded, False: 956]
  |  |  ------------------
  ------------------
  150|    956|}

nalloc_init:
  114|      2|{
  115|      2|    if (nalloc_initialized) {
  ------------------
  |  Branch (115:9): [True: 0, False: 2]
  ------------------
  116|      0|        return;
  117|      0|    }
  118|      2|    nalloc_initialized = true;
  119|      2|    char *bitmask = getenv("NALLOC_FREQ");
  120|      2|    if (bitmask) {
  ------------------
  |  Branch (120:9): [True: 0, False: 2]
  ------------------
  121|      0|        int shift = atoi(bitmask);
  122|      0|        if (shift > 0 && shift < 31) {
  ------------------
  |  Branch (122:13): [True: 0, False: 0]
  |  Branch (122:26): [True: 0, False: 0]
  ------------------
  123|      0|            nalloc_bitmask = 1 << shift;
  124|      0|            nalloc_random_bitmask = false;
  125|      0|        } else if (shift == 0) {
  ------------------
  |  Branch (125:20): [True: 0, False: 0]
  ------------------
  126|      0|            nalloc_random_bitmask = false;
  127|      0|            nalloc_bitmask = 0;
  128|      0|        }
  129|      2|    } else if (prog == NULL || strstr(prog, "nalloc") == NULL) {
  ------------------
  |  Branch (129:16): [True: 0, False: 2]
  |  Branch (129:32): [True: 2, False: 0]
  ------------------
  130|      2|        nalloc_random_bitmask = false;
  131|      2|        nalloc_bitmask = 0;
  132|      2|        return;
  133|      2|    }
  134|       |
  135|      0|    char *verbose = getenv("NALLOC_VERBOSE");
  136|      0|    if (verbose) {
  ------------------
  |  Branch (136:9): [True: 0, False: 0]
  ------------------
  137|       |        nalloc_verbose = true;
  138|      0|    }
  139|      0|}
calloc:
  307|  9.71k|{
  308|  9.71k|    if (nalloc_fail(size, "calloc")) {
  ------------------
  |  Branch (308:9): [True: 0, False: 9.71k]
  ------------------
  309|      0|        errno = ENOMEM;
  310|      0|        return NULL;
  311|      0|    }
  312|  9.71k|    return nalloc_calloc(nmemb, size);
  ------------------
  |  |  259|  9.71k|#define nalloc_calloc(s, n)          __libc_calloc(s, n)
  ------------------
  313|  9.71k|}
malloc:
  316|  3.07M|{
  317|  3.07M|    if (nalloc_fail(size, "malloc")) {
  ------------------
  |  Branch (317:9): [True: 0, False: 3.07M]
  ------------------
  318|      0|        errno = ENOMEM;
  319|      0|        return NULL;
  320|      0|    }
  321|  3.07M|    return nalloc_malloc(size);
  ------------------
  |  |  258|  3.07M|#define nalloc_malloc(s)             __libc_malloc(s)
  ------------------
  322|  3.07M|}
realloc:
  325|   141k|{
  326|   141k|    if (nalloc_fail(size, "realloc")) {
  ------------------
  |  Branch (326:9): [True: 0, False: 141k]
  ------------------
  327|      0|        errno = ENOMEM;
  328|      0|        return NULL;
  329|      0|    }
  330|   141k|    return nalloc_realloc(ptr, size);
  ------------------
  |  |  260|   141k|#define nalloc_realloc(p, s)         __libc_realloc(p, s)
  ------------------
  331|   141k|}
ssh_client_config_fuzzer.c:nalloc_fail:
  194|  3.22M|{
  195|       |    // do not fail before thread init
  196|  3.22M|    if (nalloc_runs == 0) {
  ------------------
  |  Branch (196:9): [True: 3.22M, False: 0]
  ------------------
  197|  3.22M|        return false;
  198|  3.22M|    }
  199|      0|    if (__sync_fetch_and_add(&nalloc_running, 1) != 1) {
  ------------------
  |  Branch (199:9): [True: 0, False: 0]
  ------------------
  200|       |        // do not fail allocations outside of fuzzer input
  201|       |        // and do not fail inside of this function
  202|      0|        __sync_fetch_and_sub(&nalloc_running, 1);
  203|      0|        return false;
  204|      0|    }
  205|      0|    nalloc_random_update((uint8_t)size);
  206|      0|    if (size >= 0x100) {
  ------------------
  |  Branch (206:9): [True: 0, False: 0]
  ------------------
  207|      0|        nalloc_random_update((uint8_t)(size >> 8));
  208|      0|        if (size >= 0x10000) {
  ------------------
  |  Branch (208:13): [True: 0, False: 0]
  ------------------
  209|      0|            nalloc_random_update((uint8_t)(size >> 16));
  210|       |            // bigger may already fail or oom
  211|      0|        }
  212|      0|    }
  213|      0|    if (((nalloc_random_state ^ nalloc_magic) & nalloc_bitmask) == 0) {
  ------------------
  |  Branch (213:9): [True: 0, False: 0]
  ------------------
  214|      0|        if (nalloc_backtrace_exclude(size, op)) {
  ------------------
  |  Branch (214:13): [True: 0, False: 0]
  ------------------
  215|      0|            __sync_fetch_and_sub(&nalloc_running, 1);
  216|      0|            return false;
  217|      0|        }
  218|      0|        __sync_fetch_and_sub(&nalloc_running, 1);
  219|      0|        return true;
  220|      0|    }
  221|      0|    __sync_fetch_and_sub(&nalloc_running, 1);
  222|       |    return false;
  223|      0|}
ssh_client_config_fuzzer.c:nalloc_start:
  151|    478|{
  152|    478|    if (nalloc_random_bitmask) {
  ------------------
  |  Branch (152:9): [True: 0, False: 478]
  ------------------
  153|      0|        if (nalloc_random_state & 0x10) {
  ------------------
  |  Branch (153:13): [True: 0, False: 0]
  ------------------
  154|      0|            nalloc_bitmask = 0xFFFFFFFF;
  155|      0|        } else {
  156|      0|            nalloc_bitmask = 1 << (5 + (nalloc_random_state & 0xF));
  157|      0|        }
  158|    478|    } else if (nalloc_bitmask == 0) {
  ------------------
  |  Branch (158:16): [True: 478, False: 0]
  ------------------
  159|       |        // nalloc disabled
  160|    478|        return 2;
  161|    478|    }
  162|      0|    nalloc_random_state = 0;
  163|      0|    for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (163:24): [True: 0, False: 0]
  ------------------
  164|      0|        nalloc_random_update(data[i]);
  165|      0|    }
  166|      0|    if (__sync_fetch_and_add(&nalloc_running, 1)) {
  ------------------
  |  Branch (166:9): [True: 0, False: 0]
  ------------------
  167|      0|        __sync_fetch_and_sub(&nalloc_running, 1);
  168|      0|        return 0;
  169|      0|    }
  170|      0|    nalloc_runs++;
  171|      0|    return 1;
  172|      0|}
ssh_client_config_fuzzer.c:nalloc_end:
  176|    478|{
  177|    478|    __sync_fetch_and_sub(&nalloc_running, 1);
  178|    478|}

LLVMFuzzerInitialize:
   34|      2|{
   35|      2|    (void)argc;
   36|       |
   37|      2|    nalloc_init(*argv[0]);
   38|       |
   39|      2|    ssh_init();
   40|       |
   41|      2|    atexit(_fuzz_finalize);
   42|       |
   43|      2|    return 0;
   44|      2|}
LLVMFuzzerTestOneInput:
   47|    478|{
   48|    478|    ssh_session session = NULL;
   49|    478|    char *input = NULL;
   50|       |
   51|    478|    input = (char *)malloc(size+1);
   52|    478|    if (!input) {
  ------------------
  |  Branch (52:9): [True: 0, False: 478]
  ------------------
   53|      0|        return 1;
   54|      0|    }
   55|    478|    memcpy(input, data, size);
   56|    478|    input[size] = '\0';
   57|       |
   58|    478|    assert(nalloc_start(data, size) > 0);
  ------------------
  |  Branch (58:5): [True: 0, False: 478]
  |  Branch (58:5): [True: 478, False: 0]
  ------------------
   59|       |
   60|    478|    session = ssh_new();
   61|    478|    if (session == NULL) {
  ------------------
  |  Branch (61:9): [True: 0, False: 478]
  ------------------
   62|      0|        goto out;
   63|      0|    }
   64|       |
   65|       |    /* Make sure we have default options set */
   66|    478|    ssh_options_set(session, SSH_OPTIONS_SSH_DIR, NULL);
   67|    478|    ssh_options_set(session, SSH_OPTIONS_HOST, "example.com");
   68|       |
   69|    478|    ssh_config_parse_string(session, input);
   70|       |
   71|    478|    ssh_free(session);
   72|       |
   73|    478|out:
   74|    478|    free(input);
   75|       |
   76|    478|    nalloc_end();
   77|    478|    return 0;
   78|    478|}
ssh_client_config_fuzzer.c:_fuzz_finalize:
   29|      2|{
   30|      2|    ssh_finalize();
   31|      2|}

