ssh_agent_new:
  170|    573|{
  171|    573|    ssh_agent agent = NULL;
  172|       |
  173|    573|    agent = calloc(1, sizeof(struct ssh_agent_struct));
  174|    573|    if (agent == NULL) {
  ------------------
  |  Branch (174:9): [True: 0, False: 573]
  ------------------
  175|      0|        return NULL;
  176|      0|    }
  177|       |
  178|    573|    agent->count = 0;
  179|    573|    agent->sock = ssh_socket_new(session);
  180|    573|    if (agent->sock == NULL) {
  ------------------
  |  Branch (180:9): [True: 0, False: 573]
  ------------------
  181|      0|        SAFE_FREE(agent);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  182|      0|        return NULL;
  183|      0|    }
  184|    573|    agent->channel = NULL;
  185|       |#ifdef _WIN32
  186|       |    agent->pipe_handle = NULL;
  187|       |#endif
  188|    573|    return agent;
  189|    573|}
ssh_agent_close:
  258|    573|{
  259|    573|    if (agent == NULL) {
  ------------------
  |  Branch (259:9): [True: 0, False: 573]
  ------------------
  260|      0|        return;
  261|      0|    }
  262|       |
  263|       |#ifdef _WIN32
  264|       |    if (agent_pipe_is_open(agent)) {
  265|       |        CloseHandle((HANDLE)agent->pipe_handle);
  266|       |        agent->pipe_handle = NULL;
  267|       |    }
  268|       |#endif
  269|       |
  270|    573|    ssh_socket_close(agent->sock);
  271|    573|}
ssh_agent_free:
  274|    843|{
  275|    843|    if (agent) {
  ------------------
  |  Branch (275:9): [True: 573, False: 270]
  ------------------
  276|    573|        if (agent->ident) {
  ------------------
  |  Branch (276:13): [True: 0, False: 573]
  ------------------
  277|      0|            SSH_BUFFER_FREE(agent->ident);
  ------------------
  |  |  924|      0|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (924:14): [True: 0, False: 0]
  |  |  |  Branch (924:69): [Folded, False: 0]
  |  |  ------------------
  ------------------
  278|      0|        }
  279|    573|        if (agent->sock) {
  ------------------
  |  Branch (279:13): [True: 573, False: 0]
  ------------------
  280|    573|            ssh_agent_close(agent);
  281|    573|            ssh_socket_free(agent->sock);
  282|    573|        }
  283|       |        SAFE_FREE(agent);
  ------------------
  |  |  375|    573|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 573, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 573]
  |  |  ------------------
  ------------------
  284|    573|    }
  285|    843|}

ssh_agent_state_free:
 1148|    843|{
 1149|    843|    struct ssh_agent_state_struct *state = data;
 1150|       |
 1151|    843|    if (state) {
  ------------------
  |  Branch (1151:9): [True: 0, False: 843]
  ------------------
 1152|       |        SSH_STRING_FREE_CHAR(state->comment);
  ------------------
  |  |  891|      0|    do { if ((x) != NULL) { ssh_string_free_char(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (891:14): [True: 0, False: 0]
  |  |  |  Branch (891:74): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1153|      0|        ssh_key_free(state->pubkey);
 1154|      0|        free(state);
 1155|      0|    }
 1156|    843|}

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

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

ssh_config_get_opcode:
  214|   388k|{
  215|   388k|    int i;
  216|       |
  217|  28.4M|    for (i = 0; ssh_config_keyword_table[i].name != NULL; i++) {
  ------------------
  |  Branch (217:17): [True: 28.1M, False: 252k]
  ------------------
  218|  28.1M|        if (strcasecmp(keyword, ssh_config_keyword_table[i].name) == 0) {
  ------------------
  |  Branch (218:13): [True: 135k, False: 28.0M]
  ------------------
  219|   135k|            return ssh_config_keyword_table[i].opcode;
  220|   135k|        }
  221|  28.1M|    }
  222|       |
  223|   252k|    return SOC_UNKNOWN;
  224|   388k|}
ssh_config_parse_proxy_jump:
  602|  1.62k|{
  603|  1.62k|    char *c = NULL, *cp = NULL, *endp = NULL;
  604|  1.62k|    char *username = NULL;
  605|  1.62k|    char *hostname = NULL;
  606|  1.62k|    char *port = NULL;
  607|  1.62k|    char *next = NULL;
  608|  1.62k|    int cmp, rv = SSH_ERROR;
  ------------------
  |  |  316|  1.62k|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  609|  1.62k|    struct ssh_jump_info_struct *jump_host = NULL;
  610|  1.62k|    bool parse_entry = do_parsing;
  611|  1.62k|    bool libssh_proxy_jump = ssh_libssh_proxy_jumps();
  612|       |
  613|  1.62k|    if (do_parsing) {
  ------------------
  |  Branch (613:9): [True: 57, False: 1.56k]
  ------------------
  614|     57|        SAFE_FREE(session->opts.proxy_jumps_str);
  ------------------
  |  |  375|     57|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 57]
  |  |  |  Branch (375:71): [Folded, False: 57]
  |  |  ------------------
  ------------------
  615|     57|        ssh_proxyjumps_free(session->opts.proxy_jumps);
  616|     57|    }
  617|       |    /* Special value none disables the proxy */
  618|  1.62k|    cmp = strcasecmp(s, "none");
  619|  1.62k|    if (cmp == 0) {
  ------------------
  |  Branch (619:9): [True: 62, False: 1.55k]
  ------------------
  620|     62|        if (!libssh_proxy_jump && do_parsing) {
  ------------------
  |  Branch (620:13): [True: 0, False: 62]
  |  Branch (620:35): [True: 0, False: 0]
  ------------------
  621|      0|            ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, s);
  622|      0|        }
  623|     62|        return SSH_OK;
  ------------------
  |  |  315|     62|#define SSH_OK 0     /* No error */
  ------------------
  624|     62|    }
  625|       |
  626|       |    /* This is comma-separated list of [user@]host[:port] entries */
  627|  1.55k|    c = strdup(s);
  628|  1.55k|    if (c == NULL) {
  ------------------
  |  Branch (628:9): [True: 0, False: 1.55k]
  ------------------
  629|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  630|      0|        return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  631|      0|    }
  632|       |
  633|  1.55k|    if (do_parsing) {
  ------------------
  |  Branch (633:9): [True: 57, False: 1.50k]
  ------------------
  634|       |        /* Store the whole string in session */
  635|     57|        SAFE_FREE(session->opts.proxy_jumps_str);
  ------------------
  |  |  375|     57|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 57]
  |  |  |  Branch (375:71): [Folded, False: 57]
  |  |  ------------------
  ------------------
  636|     57|        session->opts.proxy_jumps_str = strdup(s);
  637|     57|        if (session->opts.proxy_jumps_str == NULL) {
  ------------------
  |  Branch (637:13): [True: 0, False: 57]
  ------------------
  638|      0|            free(c);
  639|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  640|      0|            return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  641|      0|        }
  642|     57|    }
  643|       |
  644|  1.55k|    cp = c;
  645|  4.51k|    do {
  646|  4.51k|        endp = strchr(cp, ',');
  647|  4.51k|        if (endp != NULL) {
  ------------------
  |  Branch (647:13): [True: 2.96k, False: 1.55k]
  ------------------
  648|       |            /* Split out the token */
  649|  2.96k|            *endp = '\0';
  650|  2.96k|        }
  651|  4.51k|        if (parse_entry && libssh_proxy_jump) {
  ------------------
  |  Branch (651:13): [True: 224, False: 4.29k]
  |  Branch (651:28): [True: 224, False: 0]
  ------------------
  652|    224|            jump_host = calloc(1, sizeof(struct ssh_jump_info_struct));
  653|    224|            if (jump_host == NULL) {
  ------------------
  |  Branch (653:17): [True: 0, False: 224]
  ------------------
  654|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  655|      0|                rv = SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  656|      0|                goto out;
  657|      0|            }
  658|       |
  659|    224|            rv = ssh_config_parse_uri(cp,
  660|    224|                                      &jump_host->username,
  661|    224|                                      &jump_host->hostname,
  662|    224|                                      &port,
  663|    224|                                      false,
  664|    224|                                      false);
  665|    224|            if (rv != SSH_OK) {
  ------------------
  |  |  315|    224|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (665:17): [True: 16, False: 208]
  ------------------
  666|     16|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|     16|    _ssh_set_error_invalid(error, __func__)
  ------------------
  667|     16|                goto out;
  668|     16|            }
  669|       |            /* Leave the port at 0 when it is not given, so that the jump
  670|       |             * host's own configuration can supply it later. */
  671|    208|            if (port != NULL) {
  ------------------
  |  Branch (671:17): [True: 15, False: 193]
  ------------------
  672|     15|                jump_host->port = strtol(port, NULL, 10);
  673|     15|                SAFE_FREE(port);
  ------------------
  |  |  375|     15|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 15, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 15]
  |  |  ------------------
  ------------------
  674|     15|            }
  675|       |
  676|       |            /* Allocate on first use (no longer pre-allocated in ssh_new()) */
  677|    208|            if (session->opts.proxy_jumps == NULL) {
  ------------------
  |  Branch (677:17): [True: 47, False: 161]
  ------------------
  678|     47|                session->opts.proxy_jumps = ssh_list_new();
  679|     47|                if (session->opts.proxy_jumps == NULL) {
  ------------------
  |  Branch (679:21): [True: 0, False: 47]
  ------------------
  680|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  681|      0|                    rv = SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  682|      0|                    goto out;
  683|      0|                }
  684|     47|            }
  685|       |
  686|       |            /* Prepend because we will recursively proxy jump */
  687|    208|            rv = ssh_list_prepend(session->opts.proxy_jumps, jump_host);
  688|    208|            if (rv != SSH_OK) {
  ------------------
  |  |  315|    208|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (688:17): [True: 0, False: 208]
  ------------------
  689|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  690|      0|                goto out;
  691|      0|            }
  692|       |            /* moved ownership to the ssh_list */
  693|    208|            jump_host = NULL;
  694|  4.29k|        } else if (parse_entry) {
  ------------------
  |  Branch (694:20): [True: 0, False: 4.29k]
  ------------------
  695|       |            /* We actually care only about the first item */
  696|      0|            rv = ssh_config_parse_uri(cp,
  697|      0|                                      &username,
  698|      0|                                      &hostname,
  699|      0|                                      &port,
  700|      0|                                      false,
  701|      0|                                      false);
  702|      0|            if (rv != SSH_OK) {
  ------------------
  |  |  315|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (702:17): [True: 0, False: 0]
  ------------------
  703|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  704|      0|                goto out;
  705|      0|            }
  706|       |            /* The rest of the list needs to be passed on */
  707|      0|            if (endp != NULL) {
  ------------------
  |  Branch (707:17): [True: 0, False: 0]
  ------------------
  708|      0|                next = strdup(endp + 1);
  709|      0|                if (next == NULL) {
  ------------------
  |  Branch (709:21): [True: 0, False: 0]
  ------------------
  710|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  711|      0|                    rv = SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  712|      0|                    goto out;
  713|      0|                }
  714|      0|            }
  715|  4.29k|        } else {
  716|       |            /* The rest is just sanity-checked to avoid failures later */
  717|  4.29k|            rv = ssh_config_parse_uri(cp, NULL, NULL, NULL, false, false);
  718|  4.29k|            if (rv != SSH_OK) {
  ------------------
  |  |  315|  4.29k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (718:17): [True: 6, False: 4.28k]
  ------------------
  719|      6|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      6|    _ssh_set_error_invalid(error, __func__)
  ------------------
  720|      6|                goto out;
  721|      6|            }
  722|  4.29k|        }
  723|  4.49k|        if (!libssh_proxy_jump) {
  ------------------
  |  Branch (723:13): [True: 0, False: 4.49k]
  ------------------
  724|      0|            parse_entry = 0;
  725|      0|        }
  726|  4.49k|        if (endp != NULL) {
  ------------------
  |  Branch (726:13): [True: 2.96k, False: 1.53k]
  ------------------
  727|  2.96k|            cp = endp + 1;
  728|  2.96k|        } else {
  729|  1.53k|            cp = NULL; /* end */
  730|  1.53k|        }
  731|  4.49k|    } while (cp != NULL);
  ------------------
  |  Branch (731:14): [True: 2.96k, False: 1.53k]
  ------------------
  732|       |
  733|  1.53k|    if (!libssh_proxy_jump && hostname != NULL && do_parsing) {
  ------------------
  |  Branch (733:9): [True: 0, False: 1.53k]
  |  Branch (733:31): [True: 0, False: 0]
  |  Branch (733:51): [True: 0, False: 0]
  ------------------
  734|      0|        char com[512] = {0};
  735|       |
  736|      0|        rv = snprintf(com, sizeof(com), "ssh%s%s%s%s%s%s -W '[%%h]:%%p' %s",
  737|      0|                      username ? " -l " : "",
  ------------------
  |  Branch (737:23): [True: 0, False: 0]
  ------------------
  738|      0|                      username ? username : "",
  ------------------
  |  Branch (738:23): [True: 0, False: 0]
  ------------------
  739|      0|                      port ? " -p " : "",
  ------------------
  |  Branch (739:23): [True: 0, False: 0]
  ------------------
  740|      0|                      port ? port : "",
  ------------------
  |  Branch (740:23): [True: 0, False: 0]
  ------------------
  741|      0|                      next ? " -J " : "",
  ------------------
  |  Branch (741:23): [True: 0, False: 0]
  ------------------
  742|      0|                      next ? next : "",
  ------------------
  |  Branch (742:23): [True: 0, False: 0]
  ------------------
  743|      0|                      hostname);
  744|      0|        if (rv < 0 || rv >= (int)sizeof(com)) {
  ------------------
  |  Branch (744:13): [True: 0, False: 0]
  |  Branch (744:23): [True: 0, False: 0]
  ------------------
  745|      0|            SSH_LOG(SSH_LOG_TRACE, "Too long ProxyJump configuration line");
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  746|      0|            rv = SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  747|      0|            goto out;
  748|      0|        }
  749|      0|        rv = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, com);
  750|      0|        if (rv != SSH_OK) {
  ------------------
  |  |  315|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (750:13): [True: 0, False: 0]
  ------------------
  751|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  752|      0|            goto out;
  753|      0|        }
  754|      0|    }
  755|       |
  756|  1.53k|    rv = SSH_OK;
  ------------------
  |  |  315|  1.53k|#define SSH_OK 0     /* No error */
  ------------------
  757|       |
  758|  1.55k|out:
  759|  1.55k|    if (rv != SSH_OK) {
  ------------------
  |  |  315|  1.55k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (759:9): [True: 22, False: 1.53k]
  ------------------
  760|     22|        ssh_proxyjumps_free(session->opts.proxy_jumps);
  761|     22|    }
  762|  1.55k|    ssh_jump_info_free(jump_host);
  763|  1.55k|    SAFE_FREE(username);
  ------------------
  |  |  375|  1.55k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 1.55k]
  |  |  |  Branch (375:71): [Folded, False: 1.55k]
  |  |  ------------------
  ------------------
  764|  1.55k|    SAFE_FREE(hostname);
  ------------------
  |  |  375|  1.55k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 1.55k]
  |  |  |  Branch (375:71): [Folded, False: 1.55k]
  |  |  ------------------
  ------------------
  765|  1.55k|    SAFE_FREE(port);
  ------------------
  |  |  375|  1.55k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 1.55k]
  |  |  |  Branch (375:71): [Folded, False: 1.55k]
  |  |  ------------------
  ------------------
  766|  1.55k|    SAFE_FREE(next);
  ------------------
  |  |  375|  1.55k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 1.55k]
  |  |  |  Branch (375:71): [Folded, False: 1.55k]
  |  |  ------------------
  ------------------
  767|       |    SAFE_FREE(c);
  ------------------
  |  |  375|  1.55k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 1.55k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 1.55k]
  |  |  ------------------
  ------------------
  768|  1.55k|    return rv;
  769|  1.53k|}
ssh_config_parse_line:
 2409|   507k|{
 2410|   507k|    return ssh_config_parse_line_internal(session,
 2411|   507k|                                          line,
 2412|   507k|                                          count,
 2413|   507k|                                          parsing,
 2414|   507k|                                          depth,
 2415|   507k|                                          global,
 2416|   507k|                                          false,
 2417|       |                                          false);
 2418|   507k|}
ssh_config_parse_string:
 2509|    573|{
 2510|    573|    char line[MAX_LINE_SIZE] = {0};
 2511|    573|    const char *c = input, *line_start = input;
 2512|    573|    unsigned int line_num = 0;
 2513|    573|    size_t line_len;
 2514|    573|    int parsing, rv;
 2515|       |
 2516|    573|    SSH_LOG(SSH_LOG_DEBUG, "Reading configuration data from string:");
  ------------------
  |  |  283|    573|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2517|    573|    SSH_LOG(SSH_LOG_DEBUG, "START\n%s\nEND", input);
  ------------------
  |  |  283|    573|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2518|       |
 2519|    573|    parsing = 1;
 2520|   500k|    while (1) {
  ------------------
  |  Branch (2520:12): [True: 500k, Folded]
  ------------------
 2521|   500k|        line_num++;
 2522|   500k|        line_start = c;
 2523|   500k|        c = strchr(line_start, '\n');
 2524|   500k|        if (c == NULL) {
  ------------------
  |  Branch (2524:13): [True: 559, False: 500k]
  ------------------
 2525|       |            /* if there is no newline at the end of the string */
 2526|    559|            c = strchr(line_start, '\0');
 2527|    559|        }
 2528|   500k|        if (c == NULL) {
  ------------------
  |  Branch (2528:13): [True: 0, False: 500k]
  ------------------
 2529|       |            /* should not happen, would mean a string without trailing '\0' */
 2530|      0|            SSH_LOG(SSH_LOG_TRACE, "No trailing '\\0' in config string");
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2531|      0|            return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2532|      0|        }
 2533|   500k|        line_len = c - line_start;
 2534|   500k|        if (line_len > MAX_LINE_SIZE - 1) {
  ------------------
  |  |   37|   500k|#define MAX_LINE_SIZE 1024
  ------------------
  |  Branch (2534:13): [True: 3, False: 500k]
  ------------------
 2535|      3|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2536|      3|                    "Line %u too long: %zu characters",
 2537|      3|                    line_num,
 2538|      3|                    line_len);
 2539|      3|            return SSH_ERROR;
  ------------------
  |  |  316|      3|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2540|      3|        }
 2541|   500k|        memcpy(line, line_start, line_len);
 2542|   500k|        line[line_len] = '\0';
 2543|   500k|        SSH_LOG(SSH_LOG_DEBUG, "Line %u: %s", line_num, line);
  ------------------
  |  |  283|   500k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2544|   500k|        rv = ssh_config_parse_line(session, line, line_num, &parsing, 0, false);
 2545|   500k|        if (rv < 0) {
  ------------------
  |  Branch (2545:13): [True: 39, False: 500k]
  ------------------
 2546|     39|            return SSH_ERROR;
  ------------------
  |  |  316|     39|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2547|     39|        }
 2548|   500k|        if (*c == '\0') {
  ------------------
  |  Branch (2548:13): [True: 531, False: 500k]
  ------------------
 2549|    531|            break;
 2550|    531|        }
 2551|   500k|        c++;
 2552|   500k|    }
 2553|       |
 2554|    531|    return SSH_OK;
  ------------------
  |  |  315|    531|#define SSH_OK 0     /* No error */
  ------------------
 2555|    573|}
config.c:ssh_config_parse_line_internal:
 1214|   507k|{
 1215|   507k|  enum ssh_config_opcode_e opcode;
 1216|   507k|  const char *p = NULL, *p2 = NULL;
 1217|   507k|  char *s = NULL, *x = NULL;
 1218|   507k|  char *keyword = NULL;
 1219|   507k|  char *lowerhost = NULL;
 1220|   507k|  size_t len;
 1221|   507k|  int i, rv, cmp;
 1222|   507k|  uint8_t *seen = session->opts.options_seen;
 1223|   507k|  long l;
 1224|   507k|  int64_t ll;
 1225|       |
 1226|       |  /* Ignore empty lines */
 1227|   507k|  if (line == NULL || *line == '\0') {
  ------------------
  |  Branch (1227:7): [True: 0, False: 507k]
  |  Branch (1227:23): [True: 112k, False: 395k]
  ------------------
 1228|   112k|      if (is_cli) {
  ------------------
  |  Branch (1228:11): [True: 0, False: 112k]
  ------------------
 1229|      0|          return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1230|      0|      }
 1231|   112k|    return 0;
 1232|   112k|  }
 1233|       |
 1234|   395k|  x = s = strdup(line);
 1235|   395k|  if (s == NULL) {
  ------------------
  |  Branch (1235:7): [True: 0, False: 395k]
  ------------------
 1236|      0|    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1237|      0|    return -1;
 1238|      0|  }
 1239|       |
 1240|       |  /* Remove trailing spaces */
 1241|   434k|  for (len = strlen(s) - 1; len > 0; len--) {
  ------------------
  |  Branch (1241:29): [True: 412k, False: 22.2k]
  ------------------
 1242|   412k|    if (! isspace(s[len])) {
  ------------------
  |  Branch (1242:9): [True: 373k, False: 39.0k]
  ------------------
 1243|   373k|      break;
 1244|   373k|    }
 1245|  39.0k|    s[len] = '\0';
 1246|  39.0k|  }
 1247|       |
 1248|   395k|  keyword = ssh_config_get_token(&s);
 1249|       |  /* OpenSSH treats an optional leading '=' exactly like whitespace before the keyword.
 1250|       |   * Our tokenizer returns an empty string when it hits an '=', so we should skip exactly
 1251|       |   * one empty token if there is still content on the line. */
 1252|   395k|  if (keyword != NULL && *keyword == '\0' && s != NULL && *s != '\0' && *s != '\n') {
  ------------------
  |  Branch (1252:7): [True: 395k, False: 0]
  |  Branch (1252:26): [True: 2.95k, False: 392k]
  |  Branch (1252:46): [True: 2.95k, False: 0]
  |  Branch (1252:59): [True: 462, False: 2.48k]
  |  Branch (1252:73): [True: 462, False: 0]
  ------------------
 1253|    462|      keyword = ssh_config_get_token(&s);
 1254|    462|  }
 1255|   395k|  if (keyword == NULL || *keyword == '#' ||
  ------------------
  |  Branch (1255:7): [True: 0, False: 395k]
  |  Branch (1255:26): [True: 5.00k, False: 390k]
  ------------------
 1256|   390k|      *keyword == '\0' || *keyword == '\n') {
  ------------------
  |  Branch (1256:7): [True: 2.53k, False: 388k]
  |  Branch (1256:27): [True: 0, False: 388k]
  ------------------
 1257|  7.53k|    SAFE_FREE(x);
  ------------------
  |  |  375|  7.53k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 7.53k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 7.53k]
  |  |  ------------------
  ------------------
 1258|  7.53k|    return 0;
 1259|  7.53k|  }
 1260|       |
 1261|   388k|  opcode = ssh_config_get_opcode(keyword);
 1262|   388k|  if (is_cli && !ssh_config_is_cli_supported(opcode)) {
  ------------------
  |  Branch (1262:7): [True: 0, False: 388k]
  |  Branch (1262:17): [True: 0, False: 0]
  ------------------
 1263|      0|      ssh_set_error(
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1264|      0|          session,
 1265|      0|          SSH_FATAL,
 1266|      0|          "Option '%s' is not supported in command-line configuration",
 1267|      0|          keyword);
 1268|      0|      SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1269|      0|      return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1270|      0|  }
 1271|       |
 1272|   388k|  if (*parsing == 1 &&
  ------------------
  |  Branch (1272:7): [True: 131k, False: 256k]
  ------------------
 1273|   131k|      opcode != SOC_HOST &&
  ------------------
  |  Branch (1273:7): [True: 126k, False: 5.03k]
  ------------------
 1274|   126k|      opcode != SOC_MATCH &&
  ------------------
  |  Branch (1274:7): [True: 123k, False: 2.75k]
  ------------------
 1275|   123k|      opcode != SOC_INCLUDE &&
  ------------------
  |  Branch (1275:7): [True: 121k, False: 2.28k]
  ------------------
 1276|   121k|      opcode != SOC_IDENTITY &&
  ------------------
  |  Branch (1276:7): [True: 119k, False: 1.66k]
  ------------------
 1277|   119k|      opcode != SOC_CERTIFICATE &&
  ------------------
  |  Branch (1277:7): [True: 114k, False: 5.11k]
  ------------------
 1278|   114k|      opcode != SOC_LOCAL_FORWARD &&
  ------------------
  |  Branch (1278:7): [True: 113k, False: 786]
  ------------------
 1279|   113k|      opcode != SOC_SEND_ENV &&
  ------------------
  |  Branch (1279:7): [True: 110k, False: 3.52k]
  ------------------
 1280|   110k|      opcode != SOC_REMOTE_FORWARD &&
  ------------------
  |  Branch (1280:7): [True: 109k, False: 523]
  ------------------
 1281|   109k|      opcode > SOC_UNSUPPORTED &&
  ------------------
  |  Branch (1281:7): [True: 17.4k, False: 92.3k]
  ------------------
 1282|  17.4k|      opcode < SOC_MAX) { /* Ignore all unknown types here */
  ------------------
  |  Branch (1282:7): [True: 17.4k, False: 0]
  ------------------
 1283|       |      /* Skip all the options that were already applied */
 1284|  17.4k|      if (seen[opcode] != 0) {
  ------------------
  |  Branch (1284:11): [True: 15.9k, False: 1.50k]
  ------------------
 1285|  15.9k|          SAFE_FREE(x);
  ------------------
  |  |  375|  15.9k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 15.9k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 15.9k]
  |  |  ------------------
  ------------------
 1286|  15.9k|          return 0;
 1287|  15.9k|      }
 1288|  1.50k|      seen[opcode] = 1;
 1289|  1.50k|  }
 1290|       |
 1291|   372k|  switch (opcode) {
 1292|  7.15k|    case SOC_INCLUDE: /* recursive include of other files */
  ------------------
  |  Branch (1292:5): [True: 7.15k, False: 365k]
  ------------------
 1293|  7.15k|      p = ssh_config_get_str_tok(&s, NULL);
 1294|  7.15k|      if (p && *parsing) {
  ------------------
  |  Branch (1294:11): [True: 6.33k, False: 820]
  |  Branch (1294:16): [True: 2.18k, False: 4.14k]
  ------------------
 1295|  2.18k|        char *path = ssh_config_make_absolute(session, p, global);
 1296|  2.18k|        if (path == NULL) {
  ------------------
  |  Branch (1296:13): [True: 1, False: 2.18k]
  ------------------
 1297|      1|          SSH_LOG(SSH_LOG_WARN,
  ------------------
  |  |  283|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1298|      1|                  "line %d: Failed to allocate memory for the include path expansion",
 1299|      1|                  count);
 1300|      1|          SAFE_FREE(x);
  ------------------
  |  |  375|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 1, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1301|      1|          return -1;
 1302|      1|        }
 1303|       |#if defined(HAVE_GLOB) && defined(HAVE_GLOB_GL_FLAGS_MEMBER) && \
 1304|       |    !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
 1305|       |        local_parse_glob(session, path, parsing, depth + 1, global);
 1306|       |#else
 1307|  2.18k|        local_parse_file(session, path, parsing, depth + 1, global);
 1308|  2.18k|#endif
 1309|  2.18k|        free(path);
 1310|  2.18k|      }
 1311|  7.15k|      break;
 1312|       |
 1313|  14.2k|    case SOC_MATCH: {
  ------------------
  |  Branch (1313:5): [True: 14.2k, False: 357k]
  ------------------
 1314|  14.2k|        bool negate;
 1315|  14.2k|        int match_error = 0;
 1316|  14.2k|        int result = 1;
 1317|  14.2k|        size_t args = 0;
 1318|  14.2k|        enum ssh_config_match_e opt;
 1319|  14.2k|        struct ssh_config_token_info keyword_info;
 1320|  14.2k|        struct ssh_config_token_info arg_info;
 1321|  14.2k|        char *localuser = NULL;
 1322|  14.2k|        const char *version = NULL;
 1323|       |
 1324|  14.2k|        *parsing = 0;
 1325|  63.7k|        do {
 1326|  63.7k|            p = p2 = ssh_config_get_token_info(&s, &keyword_info);
 1327|  63.7k|            if (!keyword_info.found || p[0] == '\0') {
  ------------------
  |  Branch (1327:17): [True: 13.0k, False: 50.7k]
  |  Branch (1327:40): [True: 203, False: 50.5k]
  ------------------
 1328|  13.2k|                break;
 1329|  13.2k|            }
 1330|  50.5k|            args++;
 1331|  50.5k|            SSH_LOG(SSH_LOG_DEBUG, "line %d: Processing Match keyword '%s'",
  ------------------
  |  |  283|  50.5k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1332|  50.5k|                    count, p);
 1333|       |
 1334|       |            /* If the option is prefixed with ! the result should be negated */
 1335|  50.5k|            negate = false;
 1336|  50.5k|            if (p[0] == '!') {
  ------------------
  |  Branch (1336:17): [True: 6.39k, False: 44.1k]
  ------------------
 1337|  6.39k|                negate = true;
 1338|  6.39k|                p++;
 1339|  6.39k|            }
 1340|       |
 1341|  50.5k|            opt = ssh_config_get_match_opcode(p);
 1342|  50.5k|            switch (opt) {
 1343|    877|            case MATCH_ALL:
  ------------------
  |  Branch (1343:13): [True: 877, False: 49.6k]
  ------------------
 1344|    877|                p = ssh_config_get_str_tok(&s, NULL);
 1345|    877|                if (args <= 2 && (p == NULL || p[0] == '\0')) {
  ------------------
  |  Branch (1345:21): [True: 877, False: 0]
  |  Branch (1345:35): [True: 877, False: 0]
  |  Branch (1345:48): [True: 0, False: 0]
  ------------------
 1346|       |                    /* The first or second, but last argument. The "all" keyword
 1347|       |                     * can be prefixed with either "final" or "canonical"
 1348|       |                     * keywords which do not have any effect here. */
 1349|    877|                    if (negate == true) {
  ------------------
  |  Branch (1349:25): [True: 113, False: 764]
  ------------------
 1350|    113|                        result = 0;
 1351|    113|                    }
 1352|    877|                    break;
 1353|    877|                }
 1354|       |
 1355|      0|                ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1356|      0|                              "line %d: ERROR - Match all cannot be combined with "
 1357|      0|                              "other Match attributes", count);
 1358|      0|                match_error = -1;
 1359|      0|                goto out_match;
 1360|       |
 1361|    597|            case MATCH_FINAL:
  ------------------
  |  Branch (1361:13): [True: 597, False: 49.9k]
  ------------------
 1362|  1.18k|            case MATCH_CANONICAL:
  ------------------
  |  Branch (1362:13): [True: 591, False: 49.9k]
  ------------------
 1363|  1.18k|                SSH_LOG(SSH_LOG_DEBUG,
  ------------------
  |  |  283|  1.18k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1364|  1.18k|                        "line %d: Unsupported Match keyword '%s', skipping",
 1365|  1.18k|                        count,
 1366|  1.18k|                        p);
 1367|       |                /* Not set any result here -- the result is dependent on the
 1368|       |                 * following matches after this keyword */
 1369|  1.18k|                break;
 1370|       |
 1371|    735|            case MATCH_EXEC:
  ------------------
  |  Branch (1371:13): [True: 735, False: 49.8k]
  ------------------
 1372|       |                /* Skip one argument (including in quotes) */
 1373|    735|                p = ssh_config_get_token(&s);
 1374|    735|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1374:21): [True: 0, False: 735]
  |  Branch (1374:34): [True: 1, False: 734]
  ------------------
 1375|      1|                    SSH_LOG(SSH_LOG_TRACE, "line %d: Match keyword "
  ------------------
  |  |  283|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1376|      1|                            "'%s' requires argument", count, p2);
 1377|      1|                    match_error = -1;
 1378|      1|                    goto out_match;
 1379|      1|                }
 1380|    734|                if (result != 1) {
  ------------------
  |  Branch (1380:21): [True: 279, False: 455]
  ------------------
 1381|    279|                    SSH_LOG(SSH_LOG_DEBUG, "line %d: Skipped match exec "
  ------------------
  |  |  283|    279|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1382|    279|                            "'%s' as previous conditions already failed.",
 1383|    279|                            count, p2);
 1384|    279|                    continue;
 1385|    279|                }
 1386|    455|                result &= ssh_match_exec(session, p, negate);
 1387|    455|                args++;
 1388|    455|                break;
 1389|       |
 1390|    935|            case MATCH_LOCALUSER:
  ------------------
  |  Branch (1390:13): [True: 935, False: 49.6k]
  ------------------
 1391|       |                /* Here we match only one argument */
 1392|    935|                p = ssh_config_get_str_tok(&s, NULL);
 1393|    935|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1393:21): [True: 1, False: 934]
  |  Branch (1393:34): [True: 0, False: 934]
  ------------------
 1394|      1|                    ssh_set_error(session,
  ------------------
  |  |  313|      1|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1395|      1|                                  SSH_FATAL,
 1396|      1|                                  "line %d: ERROR - Match localuser keyword "
 1397|      1|                                  "requires argument",
 1398|      1|                                  count);
 1399|      1|                    match_error = -1;
 1400|      1|                    goto out_match;
 1401|      1|                }
 1402|    934|                localuser = ssh_get_local_username();
 1403|    934|                if (localuser == NULL) {
  ------------------
  |  Branch (1403:21): [True: 0, False: 934]
  ------------------
 1404|      0|                    SSH_LOG(SSH_LOG_TRACE, "line %d: Can not get local username "
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1405|      0|                            "for conditional matching.", count);
 1406|      0|                    match_error = -1;
 1407|      0|                    goto out_match;
 1408|      0|                }
 1409|    934|                result &= ssh_config_match(localuser, p, negate);
 1410|    934|                SAFE_FREE(localuser);
  ------------------
  |  |  375|    934|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 934, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 934]
  |  |  ------------------
  ------------------
 1411|    934|                args++;
 1412|    934|                break;
 1413|       |
 1414|    725|            case MATCH_ORIGINALHOST:
  ------------------
  |  Branch (1414:13): [True: 725, False: 49.8k]
  ------------------
 1415|       |                /* Here we match only one argument */
 1416|    725|                p = ssh_config_get_str_tok(&s, NULL);
 1417|    725|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1417:21): [True: 0, False: 725]
  |  Branch (1417:34): [True: 0, False: 725]
  ------------------
 1418|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1419|      0|                                  SSH_FATAL,
 1420|      0|                                  "line %d: ERROR - Match originalhost keyword "
 1421|      0|                                  "requires argument",
 1422|      0|                                  count);
 1423|      0|                    match_error = -1;
 1424|      0|                    goto out_match;
 1425|      0|                }
 1426|    725|                result &=
 1427|    725|                    ssh_config_match(session->opts.originalhost, p, negate);
 1428|    725|                args++;
 1429|    725|                break;
 1430|       |
 1431|    937|            case MATCH_HOST:
  ------------------
  |  Branch (1431:13): [True: 937, False: 49.6k]
  ------------------
 1432|       |                /* Here we match only one argument */
 1433|    937|                p = ssh_config_get_str_tok(&s, NULL);
 1434|    937|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1434:21): [True: 0, False: 937]
  |  Branch (1434:34): [True: 0, False: 937]
  ------------------
 1435|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1436|      0|                                  "line %d: ERROR - Match host keyword "
 1437|      0|                                  "requires argument", count);
 1438|      0|                    match_error = -1;
 1439|      0|                    goto out_match;
 1440|      0|                }
 1441|    937|                result &= ssh_config_match(session->opts.host
  ------------------
  |  Branch (1441:44): [True: 937, False: 0]
  ------------------
 1442|    937|                                               ? session->opts.host
 1443|    937|                                               : session->opts.originalhost,
 1444|    937|                                           p,
 1445|    937|                                           negate);
 1446|    937|                args++;
 1447|    937|                break;
 1448|       |
 1449|    390|            case MATCH_USER:
  ------------------
  |  Branch (1449:13): [True: 390, False: 50.1k]
  ------------------
 1450|       |                /* Here we match only one argument */
 1451|    390|                p = ssh_config_get_str_tok(&s, NULL);
 1452|    390|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1452:21): [True: 0, False: 390]
  |  Branch (1452:34): [True: 0, False: 390]
  ------------------
 1453|      0|                    ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1454|      0|                                  "line %d: ERROR - Match user keyword "
 1455|      0|                                  "requires argument", count);
 1456|      0|                    match_error = -1;
 1457|      0|                    goto out_match;
 1458|      0|                }
 1459|    390|                result &= ssh_config_match(session->opts.username, p, negate);
 1460|    390|                args++;
 1461|    390|                break;
 1462|       |
 1463|      4|            case MATCH_LOCALNETWORK:
  ------------------
  |  Branch (1463:13): [True: 4, False: 50.5k]
  ------------------
 1464|       |                /* Here we match only one argument */
 1465|      4|                p = ssh_config_get_str_tok(&s, NULL);
 1466|      4|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1466:21): [True: 0, False: 4]
  |  Branch (1466:34): [True: 0, False: 4]
  ------------------
 1467|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1468|      0|                                  SSH_FATAL,
 1469|      0|                                  "line %d: ERROR - Match local network keyword"
 1470|      0|                                  "requires argument",
 1471|      0|                                  count);
 1472|      0|                    match_error = -1;
 1473|      0|                    goto out_match;
 1474|      0|                }
 1475|      4|#ifdef HAVE_IFADDRS_H
 1476|      4|                rv = match_cidr_address_list(NULL, p, -1);
 1477|      4|                if (rv == -1) {
  ------------------
  |  Branch (1477:21): [True: 4, False: 0]
  ------------------
 1478|      4|                    ssh_set_error(session,
  ------------------
  |  |  313|      4|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1479|      4|                                  SSH_FATAL,
 1480|      4|                                  "line %d: ERROR - List invalid entry: %s",
 1481|      4|                                  count,
 1482|      4|                                  p);
 1483|      4|                    match_error = -1;
 1484|      4|                    goto out_match;
 1485|      4|                }
 1486|      0|                rv = ssh_match_localnetwork(p, negate);
 1487|      0|                if (rv == -1) {
  ------------------
  |  Branch (1487:21): [True: 0, False: 0]
  ------------------
 1488|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1489|      0|                                  SSH_FATAL,
 1490|      0|                                  "line %d: ERROR - Error while retrieving "
 1491|      0|                                  "network interface information -"
 1492|      0|                                  " List entry: %s",
 1493|      0|                                  count,
 1494|      0|                                  p);
 1495|      0|                    match_error = -1;
 1496|      0|                    goto out_match;
 1497|      0|                }
 1498|       |
 1499|      0|                result &= rv;
 1500|       |#else /* HAVE_IFADDRS_H */
 1501|       |                ssh_set_error(session,
 1502|       |                              SSH_FATAL,
 1503|       |                              "line %d: ERROR - match localnetwork "
 1504|       |                              "not supported on this platform",
 1505|       |                              count);
 1506|       |                match_error = -1;
 1507|       |                goto out_match;
 1508|       |#endif /* HAVE_IFADDRS_H */
 1509|      0|                args++;
 1510|      0|                break;
 1511|       |
 1512|    294|            case MATCH_VERSION:
  ------------------
  |  Branch (1512:13): [True: 294, False: 50.2k]
  ------------------
 1513|       |                /* Here we match only one argument */
 1514|    294|                p = ssh_config_get_str_tok(&s, NULL);
 1515|    294|                if (p == NULL || p[0] == '\0') {
  ------------------
  |  Branch (1515:21): [True: 2, False: 292]
  |  Branch (1515:34): [True: 0, False: 292]
  ------------------
 1516|      2|                    ssh_set_error(session,
  ------------------
  |  |  313|      2|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1517|      2|                                  SSH_FATAL,
 1518|      2|                                  "line %d: ERROR - Match version keyword "
 1519|      2|                                  "requires argument",
 1520|      2|                                  count);
 1521|      2|                    match_error = -1;
 1522|      2|                    goto out_match;
 1523|      2|                }
 1524|    292|                version = "libssh_" SSH_STRINGIFY(LIBSSH_VERSION);
  ------------------
  |  |   71|    292|#define SSH_STRINGIFY(s) SSH_TOSTRING(s)
  |  |  ------------------
  |  |  |  |   72|    292|#define SSH_TOSTRING(s) #s
  |  |  ------------------
  ------------------
 1525|    292|                result &= ssh_config_match(version, p, negate);
 1526|    292|                args++;
 1527|    292|                break;
 1528|       |
 1529|  2.67k|            case MATCH_TAGGED:
  ------------------
  |  Branch (1529:13): [True: 2.67k, False: 47.8k]
  ------------------
 1530|       |                /* Here we match exactly one argument.
 1531|       |                 * An explicit empty argument ('tagged=' or 'tagged ""') is
 1532|       |                 * allowed, but a missing argument is an error.
 1533|       |                 */
 1534|  2.67k|                p = ssh_config_get_token_info(&s, &arg_info);
 1535|  2.67k|                if (arg_info.invalid) {
  ------------------
  |  Branch (1535:21): [True: 0, False: 2.67k]
  ------------------
 1536|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1537|      0|                                  SSH_FATAL,
 1538|      0|                                  "line %d: ERROR - Match tagged keyword "
 1539|      0|                                  "contains unterminated quotes",
 1540|      0|                                  count);
 1541|      0|                    match_error = -1;
 1542|      0|                    goto out_match;
 1543|      0|                }
 1544|       |                /* found=false means there was no argument token at all. An
 1545|       |                 * explicit empty token ("") still reports found=true.
 1546|       |                 */
 1547|  2.67k|                if (!arg_info.found) {
  ------------------
  |  Branch (1547:21): [True: 917, False: 1.75k]
  ------------------
 1548|    917|                    if (keyword_info.had_equal) {
  ------------------
  |  Branch (1548:25): [True: 916, False: 1]
  ------------------
 1549|    916|                        p = "";
 1550|    916|                    } else {
 1551|      1|                        ssh_set_error(session,
  ------------------
  |  |  313|      1|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1552|      1|                                      SSH_FATAL,
 1553|      1|                                      "line %d: ERROR - Match tagged keyword "
 1554|      1|                                      "requires argument",
 1555|      1|                                      count);
 1556|      1|                        match_error = -1;
 1557|      1|                        goto out_match;
 1558|      1|                    }
 1559|    917|                }
 1560|  2.67k|                result &= ssh_config_match_tagged(session->opts.tag, p, negate);
 1561|       |                /* MATCH_TAGGED explicitly allows an empty pattern ('tagged='
 1562|       |                 * or 'tagged ""') to mean "match when no tag is set". That
 1563|       |                 * leaves p pointing at "", so the outer do-while loop would
 1564|       |                 * terminate early and skip any remaining predicates on the
 1565|       |                 * same Match line. Restore p to the keyword token before
 1566|       |                 * iterating.
 1567|       |                 */
 1568|  2.67k|                p = p2;
 1569|  2.67k|                args++;
 1570|  2.67k|                break;
 1571|       |
 1572|  41.7k|            case MATCH_UNKNOWN:
  ------------------
  |  Branch (1572:13): [True: 41.7k, False: 8.76k]
  ------------------
 1573|  41.7k|            default:
  ------------------
  |  Branch (1573:13): [True: 0, False: 50.5k]
  ------------------
 1574|  41.7k|                SSH_LOG(SSH_LOG_WARN,
  ------------------
  |  |  283|  41.7k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1575|  41.7k|                        "Unknown argument '%s' for Match keyword. Not matching",
 1576|  41.7k|                        p);
 1577|  41.7k|                result = 0;
 1578|  41.7k|                break;
 1579|  50.5k|            }
 1580|  50.5k|        } while (p != NULL && p[0] != '\0');
  ------------------
  |  Branch (1580:18): [True: 49.6k, False: 877]
  |  Branch (1580:31): [True: 49.5k, False: 147]
  ------------------
 1581|  14.2k|        if (args == 0) {
  ------------------
  |  Branch (1581:13): [True: 691, False: 13.5k]
  ------------------
 1582|    691|            SSH_LOG(SSH_LOG_WARN,
  ------------------
  |  |  283|    691|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1583|    691|                    "ERROR - Match keyword requires an argument. Not matching");
 1584|    691|            result = 0;
 1585|    691|        }
 1586|  14.2k|    out_match:
 1587|  14.2k|        SAFE_FREE(localuser);
  ------------------
  |  |  375|  14.2k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 14.2k]
  |  |  |  Branch (375:71): [Folded, False: 14.2k]
  |  |  ------------------
  ------------------
 1588|  14.2k|        if (match_error != 0) {
  ------------------
  |  Branch (1588:13): [True: 9, False: 14.2k]
  ------------------
 1589|      9|            SAFE_FREE(x);
  ------------------
  |  |  375|      9|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 9, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 9]
  |  |  ------------------
  ------------------
 1590|      9|            return -1;
 1591|      9|        }
 1592|  14.2k|        *parsing = result;
 1593|  14.2k|        break;
 1594|  14.2k|    }
 1595|  13.7k|    case SOC_HOST: {
  ------------------
  |  Branch (1595:5): [True: 13.7k, False: 358k]
  ------------------
 1596|  13.7k|        int ok = 0, result = -1;
 1597|       |
 1598|  13.7k|        *parsing = 0;
 1599|  13.7k|        lowerhost = (session->opts.originalhost)
  ------------------
  |  Branch (1599:21): [True: 13.7k, False: 0]
  ------------------
 1600|  13.7k|                        ? ssh_lowercase(session->opts.originalhost)
 1601|  13.7k|                        : NULL;
 1602|  13.7k|        for (p = ssh_config_get_str_tok(&s, NULL);
 1603|  49.5k|             p != NULL && p[0] != '\0';
  ------------------
  |  Branch (1603:14): [True: 35.7k, False: 13.7k]
  |  Branch (1603:27): [True: 35.7k, False: 0]
  ------------------
 1604|  35.7k|             p = ssh_config_get_str_tok(&s, NULL)) {
 1605|  35.7k|             if (ok >= 0) {
  ------------------
  |  Branch (1605:18): [True: 34.1k, False: 1.60k]
  ------------------
 1606|  34.1k|               ok = match_hostname(lowerhost, p, strlen(p));
 1607|  34.1k|               if (result == -1 && ok < 0) {
  ------------------
  |  Branch (1607:20): [True: 19.3k, False: 14.8k]
  |  Branch (1607:36): [True: 1.25k, False: 18.0k]
  ------------------
 1608|  1.25k|                   result = 0;
 1609|  32.8k|               } else if (result == -1 && ok > 0) {
  ------------------
  |  Branch (1609:27): [True: 18.0k, False: 14.8k]
  |  Branch (1609:43): [True: 7.31k, False: 10.7k]
  ------------------
 1610|  7.31k|                   result = 1;
 1611|  7.31k|               }
 1612|  34.1k|            }
 1613|  35.7k|        }
 1614|  13.7k|        SAFE_FREE(lowerhost);
  ------------------
  |  |  375|  13.7k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 13.7k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 13.7k]
  |  |  ------------------
  ------------------
 1615|  13.7k|        if (result != -1) {
  ------------------
  |  Branch (1615:13): [True: 8.56k, False: 5.20k]
  ------------------
 1616|  8.56k|            *parsing = result;
 1617|  8.56k|        }
 1618|  13.7k|        break;
 1619|  14.2k|    }
 1620|  1.13k|    case SOC_TAG:
  ------------------
  |  Branch (1620:5): [True: 1.13k, False: 371k]
  ------------------
 1621|  1.13k|        p = ssh_config_get_str_tok(&s, NULL);
 1622|  1.13k|        if (p == NULL) {
  ------------------
  |  Branch (1622:13): [True: 0, False: 1.13k]
  ------------------
 1623|      0|            ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1624|      0|                          SSH_FATAL,
 1625|      0|                          "line %d: ERROR - Tag keyword requires argument",
 1626|      0|                          count);
 1627|      0|            SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1628|      0|            return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1629|      0|        }
 1630|  1.13k|        if (*parsing) {
  ------------------
  |  Branch (1630:13): [True: 28, False: 1.10k]
  ------------------
 1631|     28|            char *tag = NULL;
 1632|       |
 1633|     28|            tag = strdup(p);
 1634|     28|            if (tag == NULL) {
  ------------------
  |  Branch (1634:17): [True: 0, False: 28]
  ------------------
 1635|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1636|      0|                SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1637|      0|                return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1638|      0|            }
 1639|     28|            SAFE_FREE(session->opts.tag);
  ------------------
  |  |  375|     28|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 28]
  |  |  |  Branch (375:71): [Folded, False: 28]
  |  |  ------------------
  ------------------
 1640|     28|            session->opts.tag = tag;
 1641|     28|        }
 1642|  1.13k|        break;
 1643|  3.46k|    case SOC_HOSTNAME:
  ------------------
  |  Branch (1643:5): [True: 3.46k, False: 368k]
  ------------------
 1644|  3.46k|        p = ssh_config_get_str_tok(&s, NULL);
 1645|  3.46k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  3.46k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 1.09k, False: 2.37k]
  |  |  ------------------
  |  | 1187|  1.09k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  1.09k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  1.09k|                "line %d: %s: %s",                             \
  |  | 1189|  1.09k|                count,                                         \
  |  | 1190|  1.09k|                error_message,                                 \
  |  | 1191|  1.09k|                keyword);                                      \
  |  | 1192|  1.09k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 1.09k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  1.09k|        break;                                                 \
  |  | 1204|  1.09k|    }
  ------------------
 1646|  2.37k|        if (*parsing) {
  ------------------
  |  Branch (1646:13): [True: 61, False: 2.31k]
  ------------------
 1647|     61|            int rc;
 1648|     61|            bool had_expansion = strchr(p, '%') != NULL;
 1649|     61|            bool needs_host = false;
 1650|     61|            rc = ssh_config_scan_hostname_tokens(session,
 1651|     61|                                                 p,
 1652|     61|                                                 &needs_host);
 1653|     61|            if (rc < 0) {
  ------------------
  |  Branch (1653:17): [True: 2, False: 59]
  ------------------
 1654|      2|                SAFE_FREE(x);
  ------------------
  |  |  375|      2|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 2, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 2]
  |  |  ------------------
  ------------------
 1655|      2|                return -1;
 1656|      2|            }
 1657|     59|            if (had_expansion) {
  ------------------
  |  Branch (1657:17): [True: 23, False: 36]
  ------------------
 1658|     23|                if (!needs_host || session->opts.host != NULL ||
  ------------------
  |  Branch (1658:21): [True: 3, False: 20]
  |  Branch (1658:36): [True: 20, False: 0]
  ------------------
 1659|     23|                     session->opts.originalhost != NULL) {
  ------------------
  |  Branch (1659:22): [True: 0, False: 0]
  ------------------
 1660|     23|                    char *expanded = ssh_path_expand_hostname(session, p);
 1661|     23|                    if (expanded == NULL) {
  ------------------
  |  Branch (1661:25): [True: 0, False: 23]
  ------------------
 1662|      0|                        SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1663|      0|                        return -1;
 1664|      0|                    }
 1665|     23|                    session->opts.config_hostname_only = true;
 1666|     23|                    rv = ssh_options_set(session, SSH_OPTIONS_HOST, expanded);
 1667|     23|                    session->opts.config_hostname_only = false;
 1668|     23|                    free(expanded);
 1669|     23|                    if (rv != SSH_OK) {
  ------------------
  |  |  315|     23|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1669:25): [True: 0, False: 23]
  ------------------
 1670|       |                        /* Expanded HostName values remain fatal if host
 1671|       |                         * validation rejects the resulting hostname.
 1672|       |                         */
 1673|      0|                        SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1674|      0|                        return -1;
 1675|      0|                    }
 1676|     23|                } else {
 1677|      0|                    char *hostname_pattern = strdup(p);
 1678|      0|                    if (hostname_pattern == NULL) {
  ------------------
  |  Branch (1678:25): [True: 0, False: 0]
  ------------------
 1679|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1680|      0|                        SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1681|      0|                        return -1;
 1682|      0|                    }
 1683|      0|                    SAFE_FREE(session->opts.config_hostname);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1684|      0|                    session->opts.config_hostname = hostname_pattern;
 1685|      0|                }
 1686|     36|            } else {
 1687|     36|                session->opts.config_hostname_only = true;
 1688|     36|                ssh_options_set(session, SSH_OPTIONS_HOST, p);
 1689|     36|                session->opts.config_hostname_only = false;
 1690|     36|            }
 1691|     59|        }
 1692|  2.37k|        break;
 1693|  2.45k|    case SOC_PORT:
  ------------------
  |  Branch (1693:5): [True: 2.45k, False: 369k]
  ------------------
 1694|  2.45k|        l = ssh_config_get_long(&s, -1);
 1695|  2.45k|        CHECK_COND_OR_FAIL(l <= 0 || l > 65535, "Invalid argument");
  ------------------
  |  | 1186|  3.25k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:10): [True: 1.65k, False: 803]
  |  |  |  Branch (1186:10): [True: 403, False: 400]
  |  |  ------------------
  |  | 1187|  2.05k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  2.05k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  2.05k|                "line %d: %s: %s",                             \
  |  | 1189|  2.05k|                count,                                         \
  |  | 1190|  2.05k|                error_message,                                 \
  |  | 1191|  2.05k|                keyword);                                      \
  |  | 1192|  2.05k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 2.05k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  2.05k|        break;                                                 \
  |  | 1204|  2.05k|    }
  ------------------
 1696|    400|        if (*parsing) {
  ------------------
  |  Branch (1696:13): [True: 11, False: 389]
  ------------------
 1697|     11|            i = (int)l;
 1698|     11|            ssh_options_set(session, SSH_OPTIONS_PORT, &i);
 1699|     11|        }
 1700|    400|        break;
 1701|  1.48k|    case SOC_USERNAME:
  ------------------
  |  Branch (1701:5): [True: 1.48k, False: 370k]
  ------------------
 1702|  1.48k|        p = ssh_config_get_str_tok(&s, NULL);
 1703|  1.48k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  1.48k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 628, False: 858]
  |  |  ------------------
  |  | 1187|    628|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    628|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    628|                "line %d: %s: %s",                             \
  |  | 1189|    628|                count,                                         \
  |  | 1190|    628|                error_message,                                 \
  |  | 1191|    628|                keyword);                                      \
  |  | 1192|    628|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 628]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    628|        break;                                                 \
  |  | 1204|    628|    }
  ------------------
 1704|    858|        if (*parsing) {
  ------------------
  |  Branch (1704:13): [True: 25, False: 833]
  ------------------
 1705|     25|            ssh_options_set(session, SSH_OPTIONS_USER, p);
 1706|     25|        }
 1707|    858|        break;
 1708|  5.20k|    case SOC_IDENTITY:
  ------------------
  |  Branch (1708:5): [True: 5.20k, False: 366k]
  ------------------
 1709|  5.20k|      p = ssh_config_get_path(&s);
 1710|  5.20k|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  5.20k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 1.16k, False: 4.03k]
  |  |  ------------------
  |  | 1187|  1.16k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  1.16k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  1.16k|                "line %d: %s: %s",                             \
  |  | 1189|  1.16k|                count,                                         \
  |  | 1190|  1.16k|                error_message,                                 \
  |  | 1191|  1.16k|                keyword);                                      \
  |  | 1192|  1.16k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 1.16k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  1.16k|        break;                                                 \
  |  | 1204|  1.16k|    }
  ------------------
 1711|  4.03k|      if (*parsing) {
  ------------------
  |  Branch (1711:11): [True: 1.32k, False: 2.71k]
  ------------------
 1712|       |          /* OpenSSH does not use default identities if any explicit IdentityFile
 1713|       |           * is provided in the configuration. Because libssh pre-populates its
 1714|       |           * defaults early, we must clear them the first time we encounter an
 1715|       |           * IdentityFile. We use seen[SOC_IDENTITY] as a flag to ensure we only
 1716|       |           * clear the list once. */
 1717|  1.32k|          if (!seen[SOC_IDENTITY]) {
  ------------------
  |  Branch (1717:15): [True: 96, False: 1.23k]
  ------------------
 1718|     96|              struct ssh_iterator *it = NULL;
 1719|     96|              seen[SOC_IDENTITY] = 1;
 1720|    384|              while ((it = ssh_list_get_iterator(session->opts.identity_non_exp)) != NULL) {
  ------------------
  |  Branch (1720:22): [True: 288, False: 96]
  ------------------
 1721|    288|                  char *id = ssh_iterator_value(char *, it);
  ------------------
  |  |  122|    288|  ((type)((iterator)->data))
  ------------------
 1722|    288|                  ssh_list_remove(session->opts.identity_non_exp, it);
 1723|    288|                  free(id);
 1724|    288|              }
 1725|     96|          }
 1726|  1.32k|          ssh_options_set(session, SSH_OPTIONS_ADD_IDENTITY, p);
 1727|  1.32k|      }
 1728|  4.03k|      break;
 1729|    830|    case SOC_CIPHERS:
  ------------------
  |  Branch (1729:5): [True: 830, False: 371k]
  ------------------
 1730|    830|      p = ssh_config_get_str_tok(&s, NULL);
 1731|    830|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    830|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 125, False: 705]
  |  |  ------------------
  |  | 1187|    125|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    125|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    125|                "line %d: %s: %s",                             \
  |  | 1189|    125|                count,                                         \
  |  | 1190|    125|                error_message,                                 \
  |  | 1191|    125|                keyword);                                      \
  |  | 1192|    125|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 125]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    125|        break;                                                 \
  |  | 1204|    125|    }
  ------------------
 1732|    705|      if (*parsing) {
  ------------------
  |  Branch (1732:11): [True: 28, False: 677]
  ------------------
 1733|     28|          int sc_rv;
 1734|       |
 1735|     28|          rv = ssh_options_set(session, SSH_OPTIONS_CIPHERS_C_S, p);
 1736|     28|          if (ssh_config_algo_failed(session, rv, is_cli, count, keyword)) {
  ------------------
  |  Branch (1736:15): [True: 0, False: 28]
  ------------------
 1737|      0|              SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1738|      0|              return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1739|      0|          }
 1740|       |
 1741|     28|          sc_rv = ssh_options_set(session, SSH_OPTIONS_CIPHERS_S_C, p);
 1742|     28|          if (ssh_config_algo_failed(session, sc_rv, is_cli, count, keyword)) {
  ------------------
  |  Branch (1742:15): [True: 0, False: 28]
  ------------------
 1743|      0|              SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1744|      0|              return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1745|      0|          }
 1746|       |
 1747|       |          /* Report only when neither direction accepts the list. */
 1748|     28|          if (rv != SSH_OK && sc_rv != SSH_OK) {
  ------------------
  |  |  315|     56|#define SSH_OK 0     /* No error */
  ------------------
                        if (rv != SSH_OK && sc_rv != SSH_OK) {
  ------------------
  |  |  315|      3|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1748:15): [True: 3, False: 25]
  |  Branch (1748:31): [True: 3, False: 0]
  ------------------
 1749|      3|              ssh_config_log_unusable_algo(count, is_cli, keyword, p);
 1750|      3|          }
 1751|     28|      }
 1752|    705|      break;
 1753|  3.45k|    case SOC_MACS:
  ------------------
  |  Branch (1753:5): [True: 3.45k, False: 368k]
  ------------------
 1754|  3.45k|      p = ssh_config_get_str_tok(&s, NULL);
 1755|  3.45k|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  3.45k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 349, False: 3.10k]
  |  |  ------------------
  |  | 1187|    349|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    349|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    349|                "line %d: %s: %s",                             \
  |  | 1189|    349|                count,                                         \
  |  | 1190|    349|                error_message,                                 \
  |  | 1191|    349|                keyword);                                      \
  |  | 1192|    349|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 349]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    349|        break;                                                 \
  |  | 1204|    349|    }
  ------------------
 1756|  3.10k|      if (*parsing) {
  ------------------
  |  Branch (1756:11): [True: 126, False: 2.97k]
  ------------------
 1757|    126|          int sc_rv;
 1758|       |
 1759|    126|          rv = ssh_options_set(session, SSH_OPTIONS_HMAC_C_S, p);
 1760|    126|          if (ssh_config_algo_failed(session, rv, is_cli, count, keyword)) {
  ------------------
  |  Branch (1760:15): [True: 0, False: 126]
  ------------------
 1761|      0|              SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1762|      0|              return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1763|      0|          }
 1764|       |
 1765|    126|          sc_rv = ssh_options_set(session, SSH_OPTIONS_HMAC_S_C, p);
 1766|    126|          if (ssh_config_algo_failed(session, sc_rv, is_cli, count, keyword)) {
  ------------------
  |  Branch (1766:15): [True: 0, False: 126]
  ------------------
 1767|      0|              SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1768|      0|              return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1769|      0|          }
 1770|       |
 1771|       |          /* Report only when neither direction accepts the list. */
 1772|    126|          if (rv != SSH_OK && sc_rv != SSH_OK) {
  ------------------
  |  |  315|    252|#define SSH_OK 0     /* No error */
  ------------------
                        if (rv != SSH_OK && sc_rv != SSH_OK) {
  ------------------
  |  |  315|     31|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1772:15): [True: 31, False: 95]
  |  Branch (1772:31): [True: 31, False: 0]
  ------------------
 1773|     31|              ssh_config_log_unusable_algo(count, is_cli, keyword, p);
 1774|     31|          }
 1775|    126|      }
 1776|  3.10k|      break;
 1777|  3.10k|    case SOC_COMPRESSION:
  ------------------
  |  Branch (1777:5): [True: 1.10k, False: 371k]
  ------------------
 1778|  1.10k|      i = ssh_config_get_token_value(&s, compression_map, -1);
 1779|  1.10k|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|  1.10k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 467, False: 637]
  |  |  ------------------
  |  | 1187|    467|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    467|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    467|                "line %d: %s: %s",                             \
  |  | 1189|    467|                count,                                         \
  |  | 1190|    467|                error_message,                                 \
  |  | 1191|    467|                keyword);                                      \
  |  | 1192|    467|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 467]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    467|        break;                                                 \
  |  | 1204|    467|    }
  ------------------
 1780|    637|      if (*parsing) {
  ------------------
  |  Branch (1780:11): [True: 21, False: 616]
  ------------------
 1781|     21|          if (i) {
  ------------------
  |  Branch (1781:15): [True: 0, False: 21]
  ------------------
 1782|      0|              ssh_options_set(session, SSH_OPTIONS_COMPRESSION, "yes");
 1783|     21|          } else {
 1784|     21|              ssh_options_set(session, SSH_OPTIONS_COMPRESSION, "no");
 1785|     21|          }
 1786|     21|      }
 1787|    637|      break;
 1788|  3.94k|    case SOC_TIMEOUT:
  ------------------
  |  Branch (1788:5): [True: 3.94k, False: 368k]
  ------------------
 1789|  3.94k|        p = ssh_config_get_str_tok(&s, NULL);
 1790|  3.94k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  3.94k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 35, False: 3.91k]
  |  |  ------------------
  |  | 1187|     35|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     35|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     35|                "line %d: %s: %s",                             \
  |  | 1189|     35|                count,                                         \
  |  | 1190|     35|                error_message,                                 \
  |  | 1191|     35|                keyword);                                      \
  |  | 1192|     35|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 35]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     35|        break;                                                 \
  |  | 1204|     35|    }
  ------------------
 1791|  3.91k|        cmp = strcmp(p, "none");
 1792|  3.91k|        if (cmp == 0) {
  ------------------
  |  Branch (1792:13): [True: 214, False: 3.69k]
  ------------------
 1793|    214|            if (*parsing) {
  ------------------
  |  Branch (1793:17): [True: 6, False: 208]
  ------------------
 1794|      6|                session->opts.timeout = (unsigned long)SSH_TIMEOUT_INFINITE;
  ------------------
  |  |   99|      6|#define SSH_TIMEOUT_INFINITE -1
  ------------------
 1795|      6|                session->opts.timeout_usec = 0;
 1796|      6|            }
 1797|    214|            break;
 1798|    214|        }
 1799|  3.69k|        l = ssh_config_convtime(p, -1);
 1800|  3.69k|        CHECK_COND_OR_FAIL(l < 0, "Invalid argument");
  ------------------
  |  | 1186|  3.69k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 3.19k, False: 502]
  |  |  ------------------
  |  | 1187|  3.19k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  3.19k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  3.19k|                "line %d: %s: %s",                             \
  |  | 1189|  3.19k|                count,                                         \
  |  | 1190|  3.19k|                error_message,                                 \
  |  | 1191|  3.19k|                keyword);                                      \
  |  | 1192|  3.19k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 3.19k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  3.19k|        break;                                                 \
  |  | 1204|  3.19k|    }
  ------------------
 1801|    502|        if (*parsing) {
  ------------------
  |  Branch (1801:13): [True: 9, False: 493]
  ------------------
 1802|      9|            ssh_options_set(session, SSH_OPTIONS_TIMEOUT, &l);
 1803|      9|        }
 1804|    502|        break;
 1805|  1.13k|    case SOC_STRICTHOSTKEYCHECK:
  ------------------
  |  Branch (1805:5): [True: 1.13k, False: 371k]
  ------------------
 1806|  1.13k|      i = ssh_config_get_strict_hostkey(&s, -1);
 1807|  1.13k|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|  1.13k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 654, False: 478]
  |  |  ------------------
  |  | 1187|    654|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    654|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    654|                "line %d: %s: %s",                             \
  |  | 1189|    654|                count,                                         \
  |  | 1190|    654|                error_message,                                 \
  |  | 1191|    654|                keyword);                                      \
  |  | 1192|    654|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 654]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    654|        break;                                                 \
  |  | 1204|    654|    }
  ------------------
 1808|    478|      if (*parsing) {
  ------------------
  |  Branch (1808:11): [True: 13, False: 465]
  ------------------
 1809|     13|          ssh_options_set(session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &i);
 1810|     13|      }
 1811|    478|      break;
 1812|     88|    case SOC_KNOWNHOSTS:
  ------------------
  |  Branch (1812:5): [True: 88, False: 372k]
  ------------------
 1813|     88|      p = ssh_config_get_path(&s);
 1814|     88|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|     88|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 52, False: 36]
  |  |  ------------------
  |  | 1187|     52|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     52|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     52|                "line %d: %s: %s",                             \
  |  | 1189|     52|                count,                                         \
  |  | 1190|     52|                error_message,                                 \
  |  | 1191|     52|                keyword);                                      \
  |  | 1192|     52|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 52]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     52|        break;                                                 \
  |  | 1204|     52|    }
  ------------------
 1815|     36|      if (*parsing) {
  ------------------
  |  Branch (1815:11): [True: 0, False: 36]
  ------------------
 1816|      0|          ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, p);
 1817|      0|      }
 1818|     36|      break;
 1819|    861|    case SOC_PROXYCOMMAND:
  ------------------
  |  Branch (1819:5): [True: 861, False: 371k]
  ------------------
 1820|    861|      p = ssh_config_get_cmd(&s);
 1821|    861|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    861|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 0, False: 861]
  |  |  ------------------
  |  | 1187|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|      0|                "line %d: %s: %s",                             \
  |  | 1189|      0|                count,                                         \
  |  | 1190|      0|                error_message,                                 \
  |  | 1191|      0|                keyword);                                      \
  |  | 1192|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|      0|        break;                                                 \
  |  | 1204|      0|    }
  ------------------
 1822|       |      /* We share the seen value with the ProxyJump */
 1823|    861|      if (*parsing && !seen[SOC_PROXYJUMP]) {
  ------------------
  |  Branch (1823:11): [True: 48, False: 813]
  |  Branch (1823:23): [True: 38, False: 10]
  ------------------
 1824|     38|          ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, p);
 1825|     38|      }
 1826|    861|      break;
 1827|  1.62k|    case SOC_PROXYJUMP:
  ------------------
  |  Branch (1827:5): [True: 1.62k, False: 370k]
  ------------------
 1828|  1.62k|        p = ssh_config_get_str_tok(&s, NULL);
 1829|  1.62k|        if (p == NULL) {
  ------------------
  |  Branch (1829:13): [True: 1, False: 1.62k]
  ------------------
 1830|      1|            SAFE_FREE(x);
  ------------------
  |  |  375|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 1, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 1831|      1|            return -1;
 1832|      1|        }
 1833|       |        /* We share the seen value with the ProxyCommand */
 1834|  1.62k|        rv = ssh_config_parse_proxy_jump(session,
 1835|  1.62k|                                         p,
 1836|  1.62k|                                         (*parsing && !seen[SOC_PROXYCOMMAND]));
  ------------------
  |  Branch (1836:43): [True: 78, False: 1.54k]
  |  Branch (1836:55): [True: 57, False: 21]
  ------------------
 1837|  1.62k|        if (rv != SSH_OK) {
  ------------------
  |  |  315|  1.62k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1837:13): [True: 22, False: 1.59k]
  ------------------
 1838|     22|            SAFE_FREE(x);
  ------------------
  |  |  375|     22|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 22, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 22]
  |  |  ------------------
  ------------------
 1839|     22|            return -1;
 1840|     22|        }
 1841|  1.59k|        break;
 1842|  1.59k|    case SOC_GSSAPISERVERIDENTITY:
  ------------------
  |  Branch (1842:5): [True: 210, False: 371k]
  ------------------
 1843|    210|      p = ssh_config_get_str_tok(&s, NULL);
 1844|    210|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    210|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 70, False: 140]
  |  |  ------------------
  |  | 1187|     70|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     70|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     70|                "line %d: %s: %s",                             \
  |  | 1189|     70|                count,                                         \
  |  | 1190|     70|                error_message,                                 \
  |  | 1191|     70|                keyword);                                      \
  |  | 1192|     70|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 70]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     70|        break;                                                 \
  |  | 1204|     70|    }
  ------------------
 1845|    140|      if (*parsing) {
  ------------------
  |  Branch (1845:11): [True: 9, False: 131]
  ------------------
 1846|      9|          ssh_options_set(session, SSH_OPTIONS_GSSAPI_SERVER_IDENTITY, p);
 1847|      9|      }
 1848|    140|      break;
 1849|    406|    case SOC_GSSAPICLIENTIDENTITY:
  ------------------
  |  Branch (1849:5): [True: 406, False: 371k]
  ------------------
 1850|    406|      p = ssh_config_get_str_tok(&s, NULL);
 1851|    406|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    406|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 51, False: 355]
  |  |  ------------------
  |  | 1187|     51|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     51|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     51|                "line %d: %s: %s",                             \
  |  | 1189|     51|                count,                                         \
  |  | 1190|     51|                error_message,                                 \
  |  | 1191|     51|                keyword);                                      \
  |  | 1192|     51|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 51]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     51|        break;                                                 \
  |  | 1204|     51|    }
  ------------------
 1852|    355|      if (*parsing) {
  ------------------
  |  Branch (1852:11): [True: 8, False: 347]
  ------------------
 1853|      8|          ssh_options_set(session, SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY, p);
 1854|      8|      }
 1855|    355|      break;
 1856|  1.24k|    case SOC_GSSAPIDELEGATECREDENTIALS:
  ------------------
  |  Branch (1856:5): [True: 1.24k, False: 370k]
  ------------------
 1857|  1.24k|      i = ssh_config_get_yesno(&s, -1);
 1858|  1.24k|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|  1.24k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 990, False: 253]
  |  |  ------------------
  |  | 1187|    990|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    990|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    990|                "line %d: %s: %s",                             \
  |  | 1189|    990|                count,                                         \
  |  | 1190|    990|                error_message,                                 \
  |  | 1191|    990|                keyword);                                      \
  |  | 1192|    990|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 990]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    990|        break;                                                 \
  |  | 1204|    990|    }
  ------------------
 1859|    253|      if (*parsing) {
  ------------------
  |  Branch (1859:11): [True: 9, False: 244]
  ------------------
 1860|      9|          ssh_options_set(session, SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS, &i);
 1861|      9|      }
 1862|    253|      break;
 1863|  1.90k|    case SOC_BINDADDRESS:
  ------------------
  |  Branch (1863:5): [True: 1.90k, False: 370k]
  ------------------
 1864|  1.90k|        p = ssh_config_get_str_tok(&s, NULL);
 1865|  1.90k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  1.90k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 115, False: 1.78k]
  |  |  ------------------
  |  | 1187|    115|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    115|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    115|                "line %d: %s: %s",                             \
  |  | 1189|    115|                count,                                         \
  |  | 1190|    115|                error_message,                                 \
  |  | 1191|    115|                keyword);                                      \
  |  | 1192|    115|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 115]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    115|        break;                                                 \
  |  | 1204|    115|    }
  ------------------
 1866|  1.78k|        if (*parsing) {
  ------------------
  |  Branch (1866:13): [True: 20, False: 1.76k]
  ------------------
 1867|     20|            ssh_options_set(session, SSH_OPTIONS_BINDADDR, p);
 1868|     20|        }
 1869|  1.78k|        break;
 1870|    153|    case SOC_GLOBALKNOWNHOSTSFILE:
  ------------------
  |  Branch (1870:5): [True: 153, False: 372k]
  ------------------
 1871|    153|        p = ssh_config_get_path(&s);
 1872|    153|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    153|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 20, False: 133]
  |  |  ------------------
  |  | 1187|     20|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     20|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     20|                "line %d: %s: %s",                             \
  |  | 1189|     20|                count,                                         \
  |  | 1190|     20|                error_message,                                 \
  |  | 1191|     20|                keyword);                                      \
  |  | 1192|     20|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 20]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     20|        break;                                                 \
  |  | 1204|     20|    }
  ------------------
 1873|    133|        if (*parsing) {
  ------------------
  |  Branch (1873:13): [True: 6, False: 127]
  ------------------
 1874|      6|            ssh_options_set(session, SSH_OPTIONS_GLOBAL_KNOWNHOSTS, p);
 1875|      6|        }
 1876|    133|        break;
 1877|    902|    case SOC_LOGLEVEL:
  ------------------
  |  Branch (1877:5): [True: 902, False: 371k]
  ------------------
 1878|    902|        p = ssh_config_get_str_tok(&s, NULL);
 1879|    902|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    902|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 327, False: 575]
  |  |  ------------------
  |  | 1187|    327|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    327|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    327|                "line %d: %s: %s",                             \
  |  | 1189|    327|                count,                                         \
  |  | 1190|    327|                error_message,                                 \
  |  | 1191|    327|                keyword);                                      \
  |  | 1192|    327|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 327]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    327|        break;                                                 \
  |  | 1204|    327|    }
  ------------------
 1880|    575|        if (*parsing) {
  ------------------
  |  Branch (1880:13): [True: 59, False: 516]
  ------------------
 1881|     59|            int value = -1;
 1882|       |
 1883|     59|            if (strcasecmp(p, "quiet") == 0) {
  ------------------
  |  Branch (1883:17): [True: 0, False: 59]
  ------------------
 1884|      0|                value = SSH_LOG_NONE;
  ------------------
  |  |  354|      0|#define SSH_LOG_NONE 0
  ------------------
 1885|     59|            } else if (strcasecmp(p, "fatal") == 0 ||
  ------------------
  |  Branch (1885:24): [True: 0, False: 59]
  ------------------
 1886|     59|                    strcasecmp(p, "error")== 0) {
  ------------------
  |  Branch (1886:21): [True: 0, False: 59]
  ------------------
 1887|      0|                value = SSH_LOG_WARN;
  ------------------
  |  |  356|      0|#define SSH_LOG_WARN 1
  ------------------
 1888|     59|            } else if (strcasecmp(p, "verbose") == 0 ||
  ------------------
  |  Branch (1888:24): [True: 0, False: 59]
  ------------------
 1889|     59|                    strcasecmp(p, "info") == 0) {
  ------------------
  |  Branch (1889:21): [True: 1, False: 58]
  ------------------
 1890|      1|                value = SSH_LOG_INFO;
  ------------------
  |  |  358|      1|#define SSH_LOG_INFO 2
  ------------------
 1891|     58|            } else if (strcasecmp(p, "DEBUG") == 0 ||
  ------------------
  |  Branch (1891:24): [True: 0, False: 58]
  ------------------
 1892|     58|                    strcasecmp(p, "DEBUG1") == 0) {
  ------------------
  |  Branch (1892:21): [True: 1, False: 57]
  ------------------
 1893|      1|                value = SSH_LOG_DEBUG;
  ------------------
  |  |  360|      1|#define SSH_LOG_DEBUG 3
  ------------------
 1894|     57|            } else if (strcasecmp(p, "DEBUG2") == 0 ||
  ------------------
  |  Branch (1894:24): [True: 0, False: 57]
  ------------------
 1895|     57|                    strcasecmp(p, "DEBUG3") == 0) {
  ------------------
  |  Branch (1895:21): [True: 0, False: 57]
  ------------------
 1896|      0|                value = SSH_LOG_TRACE;
  ------------------
  |  |  362|      0|#define SSH_LOG_TRACE 4
  ------------------
 1897|      0|            }
 1898|     59|            CHECK_COND_OR_FAIL(value == -1, "Invalid value");
  ------------------
  |  | 1186|     59|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 57, False: 2]
  |  |  ------------------
  |  | 1187|     57|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     57|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     57|                "line %d: %s: %s",                             \
  |  | 1189|     57|                count,                                         \
  |  | 1190|     57|                error_message,                                 \
  |  | 1191|     57|                keyword);                                      \
  |  | 1192|     57|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 57]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     57|        break;                                                 \
  |  | 1204|     57|    }
  ------------------
 1899|      2|            if (value != -1) {
  ------------------
  |  Branch (1899:17): [True: 2, False: 0]
  ------------------
 1900|      2|                ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &value);
 1901|      2|            }
 1902|      2|        }
 1903|    518|        break;
 1904|    518|    case SOC_HOSTKEYALGORITHMS:
  ------------------
  |  Branch (1904:5): [True: 406, False: 371k]
  ------------------
 1905|    406|        p = ssh_config_get_str_tok(&s, NULL);
 1906|    406|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    406|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 35, False: 371]
  |  |  ------------------
  |  | 1187|     35|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     35|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     35|                "line %d: %s: %s",                             \
  |  | 1189|     35|                count,                                         \
  |  | 1190|     35|                error_message,                                 \
  |  | 1191|     35|                keyword);                                      \
  |  | 1192|     35|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 35]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     35|        break;                                                 \
  |  | 1204|     35|    }
  ------------------
 1907|    371|        if (*parsing) {
  ------------------
  |  Branch (1907:13): [True: 15, False: 356]
  ------------------
 1908|     15|            rv = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, p);
 1909|     15|            if (ssh_config_algo_failed(session, rv, is_cli, count, keyword)) {
  ------------------
  |  Branch (1909:17): [True: 0, False: 15]
  ------------------
 1910|      0|                SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1911|      0|                return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1912|      0|            }
 1913|     15|            if (rv != SSH_OK) {
  ------------------
  |  |  315|     15|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1913:17): [True: 8, False: 7]
  ------------------
 1914|      8|                ssh_config_log_unusable_algo(count, is_cli, keyword, p);
 1915|      8|            }
 1916|     15|        }
 1917|    371|        break;
 1918|    831|    case SOC_PUBKEYACCEPTEDKEYTYPES:
  ------------------
  |  Branch (1918:5): [True: 831, False: 371k]
  ------------------
 1919|    831|        p = ssh_config_get_str_tok(&s, NULL);
 1920|    831|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    831|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 200, False: 631]
  |  |  ------------------
  |  | 1187|    200|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    200|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    200|                "line %d: %s: %s",                             \
  |  | 1189|    200|                count,                                         \
  |  | 1190|    200|                error_message,                                 \
  |  | 1191|    200|                keyword);                                      \
  |  | 1192|    200|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 200]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    200|        break;                                                 \
  |  | 1204|    200|    }
  ------------------
 1921|    631|        if (*parsing) {
  ------------------
  |  Branch (1921:13): [True: 48, False: 583]
  ------------------
 1922|     48|            rv = ssh_options_set(session,
 1923|     48|                                 SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES,
 1924|     48|                                 p);
 1925|     48|            if (ssh_config_algo_failed(session, rv, is_cli, count, keyword)) {
  ------------------
  |  Branch (1925:17): [True: 0, False: 48]
  ------------------
 1926|      0|                SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1927|      0|                return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1928|      0|            }
 1929|     48|            if (rv != SSH_OK) {
  ------------------
  |  |  315|     48|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1929:17): [True: 4, False: 44]
  ------------------
 1930|      4|                ssh_config_log_unusable_algo(count, is_cli, keyword, p);
 1931|      4|            }
 1932|     48|        }
 1933|    631|        break;
 1934|    847|    case SOC_KEXALGORITHMS:
  ------------------
  |  Branch (1934:5): [True: 847, False: 371k]
  ------------------
 1935|    847|        p = ssh_config_get_str_tok(&s, NULL);
 1936|    847|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    847|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 73, False: 774]
  |  |  ------------------
  |  | 1187|     73|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     73|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     73|                "line %d: %s: %s",                             \
  |  | 1189|     73|                count,                                         \
  |  | 1190|     73|                error_message,                                 \
  |  | 1191|     73|                keyword);                                      \
  |  | 1192|     73|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 73]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     73|        break;                                                 \
  |  | 1204|     73|    }
  ------------------
 1937|    774|        if (*parsing) {
  ------------------
  |  Branch (1937:13): [True: 32, False: 742]
  ------------------
 1938|     32|            rv = ssh_options_set(session, SSH_OPTIONS_KEY_EXCHANGE, p);
 1939|     32|            if (ssh_config_algo_failed(session, rv, is_cli, count, keyword)) {
  ------------------
  |  Branch (1939:17): [True: 0, False: 32]
  ------------------
 1940|      0|                SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1941|      0|                return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1942|      0|            }
 1943|     32|            if (rv != SSH_OK) {
  ------------------
  |  |  315|     32|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1943:17): [True: 14, False: 18]
  ------------------
 1944|     14|                ssh_config_log_unusable_algo(count, is_cli, keyword, p);
 1945|     14|            }
 1946|     32|        }
 1947|    774|        break;
 1948|  18.1k|    case SOC_REKEYLIMIT:
  ------------------
  |  Branch (1948:5): [True: 18.1k, False: 354k]
  ------------------
 1949|       |        /* Parse the data limit */
 1950|  18.1k|        p = ssh_config_get_str_tok(&s, NULL);
 1951|  18.1k|        if (p == NULL) {
  ------------------
  |  Branch (1951:13): [True: 477, False: 17.6k]
  ------------------
 1952|    477|            CHECK_COND_OR_FAIL(1, "Missing data limit");
  ------------------
  |  | 1186|    477|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 477, Folded]
  |  |  ------------------
  |  | 1187|    477|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    477|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    477|                "line %d: %s: %s",                             \
  |  | 1189|    477|                count,                                         \
  |  | 1190|    477|                error_message,                                 \
  |  | 1191|    477|                keyword);                                      \
  |  | 1192|    477|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 477]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    477|        break;                                                 \
  |  | 1204|    477|    }
  ------------------
 1953|      0|            break;
 1954|  17.6k|        } else if (strcmp(p, "default") == 0) {
  ------------------
  |  Branch (1954:20): [True: 605, False: 17.0k]
  ------------------
 1955|       |            /* Default rekey limits enforced automatically */
 1956|    605|            ll = 0;
 1957|  17.0k|        } else {
 1958|  17.0k|            char *endp = NULL;
 1959|  17.0k|            double divisor;
 1960|  17.0k|            double val;
 1961|       |
 1962|       |            /* We parse decimals manually instead of using strtod() to match
 1963|       |             * OpenSSH's strict behavior. This avoids locale issues (such as
 1964|       |             * expecting commas instead of dots) and prevents the accidental
 1965|       |             * parsing of exponential or scientific notation.
 1966|       |             */
 1967|  17.0k|            ll = strtoll(p, &endp, 10);
 1968|  17.0k|            if (p == endp || ll < 0) {
  ------------------
  |  Branch (1968:17): [True: 2.46k, False: 14.5k]
  |  Branch (1968:30): [True: 352, False: 14.2k]
  ------------------
 1969|  2.81k|                CHECK_COND_OR_FAIL(1, "Invalid data limit");
  ------------------
  |  | 1186|  2.81k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 2.81k, Folded]
  |  |  ------------------
  |  | 1187|  2.81k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  2.81k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  2.81k|                "line %d: %s: %s",                             \
  |  | 1189|  2.81k|                count,                                         \
  |  | 1190|  2.81k|                error_message,                                 \
  |  | 1191|  2.81k|                keyword);                                      \
  |  | 1192|  2.81k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 2.81k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  2.81k|        break;                                                 \
  |  | 1204|  2.81k|    }
  ------------------
 1970|      0|                break;
 1971|  2.81k|            }
 1972|       |
 1973|  14.2k|            val = (double)ll;
 1974|  14.2k|            if (*endp == '.') {
  ------------------
  |  Branch (1974:17): [True: 489, False: 13.7k]
  ------------------
 1975|    489|                endp++;
 1976|    489|                divisor = 10.0;
 1977|  4.37k|                while (isdigit((unsigned char)*endp)) {
  ------------------
  |  Branch (1977:24): [True: 4.37k, False: 489]
  ------------------
 1978|  4.37k|                    val += (*endp - '0') / divisor;
 1979|  4.37k|                    divisor *= 10.0;
 1980|  4.37k|                    endp++;
 1981|  4.37k|                }
 1982|    489|            }
 1983|  14.2k|            switch (*endp) {
 1984|     21|            case 'e':
  ------------------
  |  Branch (1984:13): [True: 21, False: 14.1k]
  ------------------
 1985|    590|            case 'E':
  ------------------
  |  Branch (1985:13): [True: 569, False: 13.6k]
  ------------------
 1986|    590|                val *= 1024.0;
 1987|    590|                FALL_THROUGH;
  ------------------
  |  |  496|    590|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1988|    938|            case 'p':
  ------------------
  |  Branch (1988:13): [True: 348, False: 13.8k]
  ------------------
 1989|  1.20k|            case 'P':
  ------------------
  |  Branch (1989:13): [True: 262, False: 13.9k]
  ------------------
 1990|  1.20k|                val *= 1024.0;
 1991|  1.20k|                FALL_THROUGH;
  ------------------
  |  |  496|  1.20k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1992|  2.04k|            case 't':
  ------------------
  |  Branch (1992:13): [True: 841, False: 13.3k]
  ------------------
 1993|  2.43k|            case 'T':
  ------------------
  |  Branch (1993:13): [True: 389, False: 13.8k]
  ------------------
 1994|  2.43k|                val *= 1024.0;
 1995|  2.43k|                FALL_THROUGH;
  ------------------
  |  |  496|  2.43k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 1996|  2.45k|            case 'g':
  ------------------
  |  Branch (1996:13): [True: 26, False: 14.1k]
  ------------------
 1997|  2.61k|            case 'G':
  ------------------
  |  Branch (1997:13): [True: 158, False: 14.0k]
  ------------------
 1998|  2.61k|                val *= 1024.0;
 1999|  2.61k|                FALL_THROUGH;
  ------------------
  |  |  496|  2.61k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2000|  3.09k|            case 'm':
  ------------------
  |  Branch (2000:13): [True: 485, False: 13.7k]
  ------------------
 2001|  4.73k|            case 'M':
  ------------------
  |  Branch (2001:13): [True: 1.63k, False: 12.5k]
  ------------------
 2002|  4.73k|                val *= 1024.0;
 2003|  4.73k|                FALL_THROUGH;
  ------------------
  |  |  496|  4.73k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2004|  4.82k|            case 'k':
  ------------------
  |  Branch (2004:13): [True: 89, False: 14.1k]
  ------------------
 2005|  4.84k|            case 'K':
  ------------------
  |  Branch (2005:13): [True: 23, False: 14.1k]
  ------------------
 2006|  4.84k|                val *= 1024.0;
 2007|  4.84k|                endp++;
 2008|  4.84k|                FALL_THROUGH;
  ------------------
  |  |  496|  4.84k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2009|  8.36k|            case '\0':
  ------------------
  |  Branch (2009:13): [True: 3.51k, False: 10.6k]
  ------------------
 2010|       |                /* just the number */
 2011|  8.36k|                break;
 2012|  5.85k|            default:
  ------------------
  |  Branch (2012:13): [True: 5.85k, False: 8.36k]
  ------------------
 2013|       |                /* Ignore invalid suffix and trailing garbage */
 2014|  5.85k|                SSH_LOG(SSH_LOG_TRACE, "Ignoring invalid suffix");
  ------------------
  |  |  283|  5.85k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2015|  5.85k|                break;
 2016|  14.2k|            }
 2017|  14.2k|            if (val > (double)LLONG_MAX) {
  ------------------
  |  Branch (2017:17): [True: 1.18k, False: 13.0k]
  ------------------
 2018|  1.18k|                SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  283|  1.18k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2019|  1.18k|                ll = -1;
 2020|  13.0k|            } else {
 2021|  13.0k|                ll = (long long)val;
 2022|  13.0k|            }
 2023|  14.2k|        }
 2024|  14.8k|        CHECK_COND_OR_FAIL(ll < 0, "Invalid data limit");
  ------------------
  |  | 1186|  14.8k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 1.20k, False: 13.6k]
  |  |  ------------------
  |  | 1187|  1.20k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  1.20k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  1.20k|                "line %d: %s: %s",                             \
  |  | 1189|  1.20k|                count,                                         \
  |  | 1190|  1.20k|                error_message,                                 \
  |  | 1191|  1.20k|                keyword);                                      \
  |  | 1192|  1.20k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 1.20k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  1.20k|        break;                                                 \
  |  | 1204|  1.20k|    }
  ------------------
 2025|  13.6k|        CHECK_COND_OR_FAIL(ll > 0 && ll < 16, "RekeyLimit too small");
  ------------------
  |  | 1186|  23.7k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:10): [True: 10.1k, False: 3.48k]
  |  |  |  Branch (1186:10): [True: 477, False: 9.64k]
  |  |  ------------------
  |  | 1187|    477|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    477|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    477|                "line %d: %s: %s",                             \
  |  | 1189|    477|                count,                                         \
  |  | 1190|    477|                error_message,                                 \
  |  | 1191|    477|                keyword);                                      \
  |  | 1192|    477|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 477]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    477|        break;                                                 \
  |  | 1204|    477|    }
  ------------------
 2026|  13.1k|        if (*parsing) {
  ------------------
  |  Branch (2026:13): [True: 125, False: 13.0k]
  ------------------
 2027|    125|            uint64_t v = (uint64_t)ll;
 2028|    125|            ssh_options_set(session, SSH_OPTIONS_REKEY_DATA, &v);
 2029|    125|        }
 2030|       |        /* Parse the time limit */
 2031|  13.1k|        p = ssh_config_get_str_tok(&s, NULL);
 2032|  13.1k|        if (p == NULL) {
  ------------------
  |  Branch (2032:13): [True: 4.21k, False: 8.91k]
  ------------------
 2033|  4.21k|            break;
 2034|  8.91k|        } else if (strcmp(p, "none") == 0) {
  ------------------
  |  Branch (2034:20): [True: 92, False: 8.82k]
  ------------------
 2035|     92|            ll = 0;
 2036|  8.82k|        } else {
 2037|  8.82k|            char *endp = NULL;
 2038|  8.82k|            ll = strtoll(p, &endp, 10);
 2039|  8.82k|            if (p == endp || ll < 0) {
  ------------------
  |  Branch (2039:17): [True: 1.39k, False: 7.43k]
  |  Branch (2039:30): [True: 382, False: 7.05k]
  ------------------
 2040|       |                /* No number or negative */
 2041|  1.77k|                CHECK_COND_OR_FAIL(1, "Invalid time limit");
  ------------------
  |  | 1186|  1.77k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 1.77k, Folded]
  |  |  ------------------
  |  | 1187|  1.77k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  1.77k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  1.77k|                "line %d: %s: %s",                             \
  |  | 1189|  1.77k|                count,                                         \
  |  | 1190|  1.77k|                error_message,                                 \
  |  | 1191|  1.77k|                keyword);                                      \
  |  | 1192|  1.77k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 1.77k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  1.77k|        break;                                                 \
  |  | 1204|  1.77k|    }
  ------------------
 2042|      0|                break;
 2043|  1.77k|            }
 2044|  7.05k|            switch (*endp) {
 2045|     75|            case 'w':
  ------------------
  |  Branch (2045:13): [True: 75, False: 6.97k]
  ------------------
 2046|    439|            case 'W':
  ------------------
  |  Branch (2046:13): [True: 364, False: 6.68k]
  ------------------
 2047|    439|                if (ll > LLONG_MAX / 7) {
  ------------------
  |  Branch (2047:21): [True: 298, False: 141]
  ------------------
 2048|    298|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  283|    298|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2049|    298|                    ll = -1;
 2050|    298|                    break;
 2051|    298|                }
 2052|    141|                ll = ll * 7;
 2053|    141|                FALL_THROUGH;
  ------------------
  |  |  496|    141|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2054|    486|            case 'd':
  ------------------
  |  Branch (2054:13): [True: 345, False: 6.70k]
  ------------------
 2055|    643|            case 'D':
  ------------------
  |  Branch (2055:13): [True: 157, False: 6.89k]
  ------------------
 2056|    643|                if (ll > LLONG_MAX / 24) {
  ------------------
  |  Branch (2056:21): [True: 48, False: 595]
  ------------------
 2057|     48|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  283|     48|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2058|     48|                    ll = -1;
 2059|     48|                    break;
 2060|     48|                }
 2061|    595|                ll = ll * 24;
 2062|    595|                FALL_THROUGH;
  ------------------
  |  |  496|    595|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2063|    894|            case 'h':
  ------------------
  |  Branch (2063:13): [True: 299, False: 6.75k]
  ------------------
 2064|  1.54k|            case 'H':
  ------------------
  |  Branch (2064:13): [True: 648, False: 6.40k]
  ------------------
 2065|  1.54k|                if (ll > LLONG_MAX / 60) {
  ------------------
  |  Branch (2065:21): [True: 109, False: 1.43k]
  ------------------
 2066|    109|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  283|    109|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2067|    109|                    ll = -1;
 2068|    109|                    break;
 2069|    109|                }
 2070|  1.43k|                ll = ll * 60;
 2071|  1.43k|                FALL_THROUGH;
  ------------------
  |  |  496|  1.43k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2072|  1.54k|            case 'm':
  ------------------
  |  Branch (2072:13): [True: 115, False: 6.93k]
  ------------------
 2073|  1.78k|            case 'M':
  ------------------
  |  Branch (2073:13): [True: 238, False: 6.81k]
  ------------------
 2074|  1.78k|                if (ll > LLONG_MAX / 60) {
  ------------------
  |  Branch (2074:21): [True: 501, False: 1.28k]
  ------------------
 2075|    501|                    SSH_LOG(SSH_LOG_TRACE, "Possible overflow of rekey limit");
  ------------------
  |  |  283|    501|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2076|    501|                    ll = -1;
 2077|    501|                    break;
 2078|    501|                }
 2079|  1.28k|                ll = ll * 60;
 2080|  1.28k|                FALL_THROUGH;
  ------------------
  |  |  496|  1.28k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2081|  1.58k|            case 's':
  ------------------
  |  Branch (2081:13): [True: 298, False: 6.75k]
  ------------------
 2082|  1.65k|            case 'S':
  ------------------
  |  Branch (2082:13): [True: 71, False: 6.98k]
  ------------------
 2083|  1.65k|                endp++;
 2084|  1.65k|                FALL_THROUGH;
  ------------------
  |  |  496|  1.65k|#  define FALL_THROUGH __attribute__ ((fallthrough))
  ------------------
 2085|  1.95k|            case '\0':
  ------------------
  |  Branch (2085:13): [True: 297, False: 6.75k]
  ------------------
 2086|       |                /* just the number */
 2087|  1.95k|                break;
 2088|  4.14k|            default:
  ------------------
  |  Branch (2088:13): [True: 4.14k, False: 2.90k]
  ------------------
 2089|       |                /* Ignore invalid suffix and trailing garbage */
 2090|  4.14k|                SSH_LOG(SSH_LOG_TRACE, "Ignoring invalid suffix");
  ------------------
  |  |  283|  4.14k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2091|  4.14k|                break;
 2092|  7.05k|            }
 2093|  7.05k|        }
 2094|  7.14k|        CHECK_COND_OR_FAIL(ll < 0, "Invalid time limit");
  ------------------
  |  | 1186|  7.14k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 956, False: 6.18k]
  |  |  ------------------
  |  | 1187|    956|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    956|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    956|                "line %d: %s: %s",                             \
  |  | 1189|    956|                count,                                         \
  |  | 1190|    956|                error_message,                                 \
  |  | 1191|    956|                keyword);                                      \
  |  | 1192|    956|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 956]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    956|        break;                                                 \
  |  | 1204|    956|    }
  ------------------
 2095|  6.18k|        if (ll > -1 && *parsing) {
  ------------------
  |  Branch (2095:13): [True: 6.18k, False: 0]
  |  Branch (2095:24): [True: 77, False: 6.11k]
  ------------------
 2096|     77|            uint32_t v = (uint32_t)ll;
 2097|     77|            ssh_options_set(session, SSH_OPTIONS_REKEY_TIME, &v);
 2098|     77|        }
 2099|  6.18k|        break;
 2100|    114|    case SOC_GSSAPIAUTHENTICATION:
  ------------------
  |  Branch (2100:5): [True: 114, False: 372k]
  ------------------
 2101|    158|    case SOC_KBDINTERACTIVEAUTHENTICATION:
  ------------------
  |  Branch (2101:5): [True: 44, False: 372k]
  ------------------
 2102|    341|    case SOC_PASSWORDAUTHENTICATION: {
  ------------------
  |  Branch (2102:5): [True: 183, False: 371k]
  ------------------
 2103|    341|        enum ssh_options_e option = ssh_config_get_auth_option(opcode);
 2104|    341|        i = ssh_config_get_yesno(&s, -1);
 2105|       |
 2106|    341|        CHECK_COND_OR_FAIL(i < 0, "Authentication option");
  ------------------
  |  | 1186|    341|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 203, False: 138]
  |  |  ------------------
  |  | 1187|    203|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    203|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    203|                "line %d: %s: %s",                             \
  |  | 1189|    203|                count,                                         \
  |  | 1190|    203|                error_message,                                 \
  |  | 1191|    203|                keyword);                                      \
  |  | 1192|    203|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 203]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    203|        break;                                                 \
  |  | 1204|    203|    }
  ------------------
 2107|    138|        if (*parsing) {
  ------------------
  |  Branch (2107:13): [True: 3, False: 135]
  ------------------
 2108|      3|            ssh_options_set(session, option, &i);
 2109|      3|        }
 2110|    138|        break;
 2111|    341|    }
 2112|    674|    case SOC_PUBKEYAUTHENTICATION: {
  ------------------
  |  Branch (2112:5): [True: 674, False: 371k]
  ------------------
 2113|    674|        i = ssh_config_get_pubkey_auth(&s, -1);
 2114|    674|        CHECK_COND_OR_FAIL(i < 0, "Authentication option");
  ------------------
  |  | 1186|    674|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 621, False: 53]
  |  |  ------------------
  |  | 1187|    621|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    621|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    621|                "line %d: %s: %s",                             \
  |  | 1189|    621|                count,                                         \
  |  | 1190|    621|                error_message,                                 \
  |  | 1191|    621|                keyword);                                      \
  |  | 1192|    621|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 621]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    621|        break;                                                 \
  |  | 1204|    621|    }
  ------------------
 2115|     53|        if (*parsing) {
  ------------------
  |  Branch (2115:13): [True: 2, False: 51]
  ------------------
 2116|      2|            ssh_options_set(session, SSH_OPTIONS_PUBKEY_AUTH, &i);
 2117|      2|        }
 2118|     53|        break;
 2119|    674|    }
 2120|    871|    case SOC_NA:
  ------------------
  |  Branch (2120:5): [True: 871, False: 371k]
  ------------------
 2121|    871|        CHECK_COND_OR_FAIL(1, "Unapplicable option");
  ------------------
  |  | 1186|    871|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 871, Folded]
  |  |  ------------------
  |  | 1187|    871|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    871|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    871|                "line %d: %s: %s",                             \
  |  | 1189|    871|                count,                                         \
  |  | 1190|    871|                error_message,                                 \
  |  | 1191|    871|                keyword);                                      \
  |  | 1192|    871|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 871]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    871|        break;                                                 \
  |  | 1204|    871|    }
  ------------------
 2122|      0|        break;
 2123|     50|    case SOC_UNSUPPORTED:
  ------------------
  |  Branch (2123:5): [True: 50, False: 372k]
  ------------------
 2124|     50|        CHECK_COND_OR_FAIL(1, "Unsupported option");
  ------------------
  |  | 1186|     50|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 50, Folded]
  |  |  ------------------
  |  | 1187|     50|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     50|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     50|                "line %d: %s: %s",                             \
  |  | 1189|     50|                count,                                         \
  |  | 1190|     50|                error_message,                                 \
  |  | 1191|     50|                keyword);                                      \
  |  | 1192|     50|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 50]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     50|        break;                                                 \
  |  | 1204|     50|    }
  ------------------
 2125|      0|        break;
 2126|   252k|    case SOC_UNKNOWN:
  ------------------
  |  Branch (2126:5): [True: 252k, False: 119k]
  ------------------
 2127|   252k|        CHECK_COND_OR_FAIL(1, "Unknown option");
  ------------------
  |  | 1186|   252k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 252k, Folded]
  |  |  ------------------
  |  | 1187|   252k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|   252k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|   252k|                "line %d: %s: %s",                             \
  |  | 1189|   252k|                count,                                         \
  |  | 1190|   252k|                error_message,                                 \
  |  | 1191|   252k|                keyword);                                      \
  |  | 1192|   252k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 252k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|   252k|        break;                                                 \
  |  | 1204|   252k|    }
  ------------------
 2128|      0|        break;
 2129|     86|    case SOC_IDENTITYAGENT:
  ------------------
  |  Branch (2129:5): [True: 86, False: 372k]
  ------------------
 2130|     86|      p = ssh_config_get_path(&s);
 2131|     86|      CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|     86|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 48, False: 38]
  |  |  ------------------
  |  | 1187|     48|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     48|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     48|                "line %d: %s: %s",                             \
  |  | 1189|     48|                count,                                         \
  |  | 1190|     48|                error_message,                                 \
  |  | 1191|     48|                keyword);                                      \
  |  | 1192|     48|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 48]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     48|        break;                                                 \
  |  | 1204|     48|    }
  ------------------
 2132|     38|      if (*parsing) {
  ------------------
  |  Branch (2132:11): [True: 16, False: 22]
  ------------------
 2133|     16|          ssh_options_set(session, SSH_OPTIONS_IDENTITY_AGENT, p);
 2134|     16|      }
 2135|     38|      break;
 2136|    421|    case SOC_IDENTITIESONLY:
  ------------------
  |  Branch (2136:5): [True: 421, False: 371k]
  ------------------
 2137|    421|      i = ssh_config_get_yesno(&s, -1);
 2138|    421|      CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|    421|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 328, False: 93]
  |  |  ------------------
  |  | 1187|    328|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    328|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    328|                "line %d: %s: %s",                             \
  |  | 1189|    328|                count,                                         \
  |  | 1190|    328|                error_message,                                 \
  |  | 1191|    328|                keyword);                                      \
  |  | 1192|    328|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 328]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    328|        break;                                                 \
  |  | 1204|    328|    }
  ------------------
 2139|     93|      if (*parsing) {
  ------------------
  |  Branch (2139:11): [True: 5, False: 88]
  ------------------
 2140|      5|          bool b = i;
 2141|      5|          ssh_options_set(session, SSH_OPTIONS_IDENTITIES_ONLY, &b);
 2142|      5|      }
 2143|     93|      break;
 2144|    492|    case SOC_BATCHMODE:
  ------------------
  |  Branch (2144:5): [True: 492, False: 371k]
  ------------------
 2145|    492|        i = ssh_config_get_yesno(&s, -1);
 2146|    492|        CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|    492|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 416, False: 76]
  |  |  ------------------
  |  | 1187|    416|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    416|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    416|                "line %d: %s: %s",                             \
  |  | 1189|    416|                count,                                         \
  |  | 1190|    416|                error_message,                                 \
  |  | 1191|    416|                keyword);                                      \
  |  | 1192|    416|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 416]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    416|        break;                                                 \
  |  | 1204|    416|    }
  ------------------
 2147|     76|        if (*parsing) {
  ------------------
  |  Branch (2147:13): [True: 4, False: 72]
  ------------------
 2148|      4|            bool b = i;
 2149|      4|            ssh_options_set(session, SSH_OPTIONS_BATCH_MODE, &b);
 2150|      4|        }
 2151|     76|        break;
 2152|    700|    case SOC_SERVERALIVEINTERVAL:
  ------------------
  |  Branch (2152:5): [True: 700, False: 371k]
  ------------------
 2153|    700|        l = ssh_config_get_long(&s, -1);
 2154|    700|        CHECK_COND_OR_FAIL(l < 0 || l > INT_MAX, "Invalid argument");
  ------------------
  |  | 1186|  1.29k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:10): [True: 105, False: 595]
  |  |  |  Branch (1186:10): [True: 103, False: 492]
  |  |  ------------------
  |  | 1187|    208|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    208|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    208|                "line %d: %s: %s",                             \
  |  | 1189|    208|                count,                                         \
  |  | 1190|    208|                error_message,                                 \
  |  | 1191|    208|                keyword);                                      \
  |  | 1192|    208|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 208]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    208|        break;                                                 \
  |  | 1204|    208|    }
  ------------------
 2155|    492|        if (*parsing) {
  ------------------
  |  Branch (2155:13): [True: 13, False: 479]
  ------------------
 2156|     13|            i = (int)l;
 2157|     13|            ssh_options_set(session, SSH_OPTIONS_SERVER_ALIVE_INTERVAL, &i);
 2158|     13|        }
 2159|    492|        break;
 2160|    356|    case SOC_SERVERALIVECOUNTMAX:
  ------------------
  |  Branch (2160:5): [True: 356, False: 371k]
  ------------------
 2161|    356|        l = ssh_config_get_long(&s, -1);
 2162|    356|        CHECK_COND_OR_FAIL(l < 0 || l > INT_MAX, "Invalid argument");
  ------------------
  |  | 1186|    630|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:10): [True: 82, False: 274]
  |  |  |  Branch (1186:10): [True: 218, False: 56]
  |  |  ------------------
  |  | 1187|    300|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    300|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    300|                "line %d: %s: %s",                             \
  |  | 1189|    300|                count,                                         \
  |  | 1190|    300|                error_message,                                 \
  |  | 1191|    300|                keyword);                                      \
  |  | 1192|    300|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 300]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    300|        break;                                                 \
  |  | 1204|    300|    }
  ------------------
 2163|     56|        if (*parsing) {
  ------------------
  |  Branch (2163:13): [True: 1, False: 55]
  ------------------
 2164|      1|            i = (int)l;
 2165|      1|            ssh_options_set(session, SSH_OPTIONS_SERVER_ALIVE_COUNT_MAX, &i);
 2166|      1|        }
 2167|     56|        break;
 2168|    458|    case SOC_PREFERRED_AUTHENTICATIONS:
  ------------------
  |  Branch (2168:5): [True: 458, False: 371k]
  ------------------
 2169|    458|        p = ssh_config_get_str_tok(&s, NULL);
 2170|    458|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    458|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 276, False: 182]
  |  |  ------------------
  |  | 1187|    276|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    276|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    276|                "line %d: %s: %s",                             \
  |  | 1189|    276|                count,                                         \
  |  | 1190|    276|                error_message,                                 \
  |  | 1191|    276|                keyword);                                      \
  |  | 1192|    276|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 276]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    276|        break;                                                 \
  |  | 1204|    276|    }
  ------------------
 2171|    182|        if (*parsing) {
  ------------------
  |  Branch (2171:13): [True: 1, False: 181]
  ------------------
 2172|      1|            ssh_options_set(session, SSH_OPTIONS_PREFERRED_AUTHENTICATIONS, p);
 2173|      1|        }
 2174|    182|        break;
 2175|  1.16k|    case SOC_NUMBER_OF_PASSWORD_PROMPTS:
  ------------------
  |  Branch (2175:5): [True: 1.16k, False: 371k]
  ------------------
 2176|  1.16k|        l = ssh_config_get_long(&s, -1);
 2177|  1.16k|        CHECK_COND_OR_FAIL(l <= 0 || l > INT_MAX, "Invalid argument");
  ------------------
  |  | 1186|  1.51k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:10): [True: 807, False: 354]
  |  |  |  Branch (1186:10): [True: 172, False: 182]
  |  |  ------------------
  |  | 1187|    979|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    979|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    979|                "line %d: %s: %s",                             \
  |  | 1189|    979|                count,                                         \
  |  | 1190|    979|                error_message,                                 \
  |  | 1191|    979|                keyword);                                      \
  |  | 1192|    979|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 979]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    979|        break;                                                 \
  |  | 1204|    979|    }
  ------------------
 2178|    182|        if (*parsing) {
  ------------------
  |  Branch (2178:13): [True: 6, False: 176]
  ------------------
 2179|      6|            i = (int)l;
 2180|      6|            ssh_options_set(session, SSH_OPTIONS_NUMBER_OF_PASSWORD_PROMPTS, &i);
 2181|      6|        }
 2182|    182|        break;
 2183|    313|    case SOC_REQUEST_TTY: {
  ------------------
  |  Branch (2183:5): [True: 313, False: 371k]
  ------------------
 2184|    313|        static const struct ssh_config_token_value_map request_tty_map[] = {
 2185|    313|            {"no", SSH_REQUEST_TTY_NO},
 2186|    313|            {"yes", SSH_REQUEST_TTY_YES},
 2187|    313|            {"auto", SSH_REQUEST_TTY_AUTO},
 2188|    313|            {"force", SSH_REQUEST_TTY_FORCE},
 2189|    313|            {NULL, 0},
 2190|    313|        };
 2191|    313|        i = ssh_config_get_token_value(&s, request_tty_map, -1);
 2192|    313|        CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|    313|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 249, False: 64]
  |  |  ------------------
  |  | 1187|    249|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    249|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    249|                "line %d: %s: %s",                             \
  |  | 1189|    249|                count,                                         \
  |  | 1190|    249|                error_message,                                 \
  |  | 1191|    249|                keyword);                                      \
  |  | 1192|    249|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 249]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    249|        break;                                                 \
  |  | 1204|    249|    }
  ------------------
 2193|     64|        if (*parsing) {
  ------------------
  |  Branch (2193:13): [True: 6, False: 58]
  ------------------
 2194|      6|            ssh_options_set(session, SSH_OPTIONS_REQUEST_TTY, &i);
 2195|      6|        }
 2196|     64|        break;
 2197|    313|    }
 2198|    371|    case SOC_ESCAPE_CHAR:
  ------------------
  |  Branch (2198:5): [True: 371, False: 371k]
  ------------------
 2199|    371|        p = ssh_config_get_str_tok(&s, NULL);
 2200|    371|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    371|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 179, False: 192]
  |  |  ------------------
  |  | 1187|    179|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    179|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    179|                "line %d: %s: %s",                             \
  |  | 1189|    179|                count,                                         \
  |  | 1190|    179|                error_message,                                 \
  |  | 1191|    179|                keyword);                                      \
  |  | 1192|    179|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 179]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    179|        break;                                                 \
  |  | 1204|    179|    }
  ------------------
 2201|    192|        if (*parsing) {
  ------------------
  |  Branch (2201:13): [True: 14, False: 178]
  ------------------
 2202|     14|            int value = 0;
 2203|       |
 2204|     14|            if (strcasecmp(p, "none") == 0) {
  ------------------
  |  Branch (2204:17): [True: 0, False: 14]
  ------------------
 2205|      0|                value = -1;
 2206|     14|            } else if (p[0] == '^' &&
  ------------------
  |  Branch (2206:24): [True: 0, False: 14]
  ------------------
 2207|      0|                       (unsigned char)p[1] >= 64 && (unsigned char)p[1] < 128 &&
  ------------------
  |  Branch (2207:24): [True: 0, False: 0]
  |  Branch (2207:53): [True: 0, False: 0]
  ------------------
 2208|      0|                       p[2] == '\0') {
  ------------------
  |  Branch (2208:24): [True: 0, False: 0]
  ------------------
 2209|       |                /* Control character notation like ^C for Ctrl-C */
 2210|      0|                value = (unsigned char)p[1] & 31;
 2211|     14|            } else if (p[0] != '\0' && p[1] == '\0') {
  ------------------
  |  Branch (2211:24): [True: 14, False: 0]
  |  Branch (2211:40): [True: 3, False: 11]
  ------------------
 2212|      3|                value = (unsigned char)p[0];
 2213|     11|            } else {
 2214|     11|                CHECK_COND_OR_FAIL(1, "Invalid argument");
  ------------------
  |  | 1186|     11|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 11, Folded]
  |  |  ------------------
  |  | 1187|     11|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     11|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     11|                "line %d: %s: %s",                             \
  |  | 1189|     11|                count,                                         \
  |  | 1190|     11|                error_message,                                 \
  |  | 1191|     11|                keyword);                                      \
  |  | 1192|     11|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 11]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     11|        break;                                                 \
  |  | 1204|     11|    }
  ------------------
 2215|      0|                break;
 2216|     11|            }
 2217|       |
 2218|      3|            ssh_options_set(session, SSH_OPTIONS_ESCAPE_CHAR, &value);
 2219|      3|        }
 2220|    181|        break;
 2221|  2.69k|    case SOC_LOCAL_FORWARD:
  ------------------
  |  Branch (2221:5): [True: 2.69k, False: 369k]
  ------------------
 2222|  2.69k|        p = ssh_config_get_str_tok(&s, NULL);
 2223|  2.69k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  2.69k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 50, False: 2.64k]
  |  |  ------------------
  |  | 1187|     50|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     50|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     50|                "line %d: %s: %s",                             \
  |  | 1189|     50|                count,                                         \
  |  | 1190|     50|                error_message,                                 \
  |  | 1191|     50|                keyword);                                      \
  |  | 1192|     50|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 50]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     50|        break;                                                 \
  |  | 1204|     50|    }
  ------------------
 2224|  2.64k|        p2 = ssh_config_get_str_tok(&s, NULL);
 2225|  2.64k|        CHECK_COND_OR_FAIL(p2 == NULL, "Missing remote destination");
  ------------------
  |  | 1186|  2.64k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 1.19k, False: 1.44k]
  |  |  ------------------
  |  | 1187|  1.19k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  1.19k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  1.19k|                "line %d: %s: %s",                             \
  |  | 1189|  1.19k|                count,                                         \
  |  | 1190|  1.19k|                error_message,                                 \
  |  | 1191|  1.19k|                keyword);                                      \
  |  | 1192|  1.19k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 1.19k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  1.19k|        break;                                                 \
  |  | 1204|  1.19k|    }
  ------------------
 2226|  1.44k|        if (*parsing) {
  ------------------
  |  Branch (2226:13): [True: 322, False: 1.12k]
  ------------------
 2227|    322|            char buf[MAX_LINE_SIZE] = {0};
 2228|       |
 2229|    322|            len = snprintf(buf, sizeof(buf), "%s %s", p, p2);
 2230|    322|            CHECK_COND_OR_FAIL(len >= (int)sizeof(buf), "Forwarding specification too long");
  ------------------
  |  | 1186|    322|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 0, False: 322]
  |  |  ------------------
  |  | 1187|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|      0|                "line %d: %s: %s",                             \
  |  | 1189|      0|                count,                                         \
  |  | 1190|      0|                error_message,                                 \
  |  | 1191|      0|                keyword);                                      \
  |  | 1192|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|      0|        break;                                                 \
  |  | 1204|      0|    }
  ------------------
 2231|    322|            ssh_options_set(session, SSH_OPTIONS_LOCAL_FORWARD, buf);
 2232|    322|        }
 2233|  1.44k|        break;
 2234|  2.23k|    case SOC_REMOTE_FORWARD:
  ------------------
  |  Branch (2234:5): [True: 2.23k, False: 369k]
  ------------------
 2235|  2.23k|        p = ssh_config_get_str_tok(&s, NULL);
 2236|  2.23k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  2.23k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 322, False: 1.91k]
  |  |  ------------------
  |  | 1187|    322|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    322|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    322|                "line %d: %s: %s",                             \
  |  | 1189|    322|                count,                                         \
  |  | 1190|    322|                error_message,                                 \
  |  | 1191|    322|                keyword);                                      \
  |  | 1192|    322|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 322]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    322|        break;                                                 \
  |  | 1204|    322|    }
  ------------------
 2237|  1.91k|        p2 = ssh_config_get_str_tok(&s, NULL);
 2238|  1.91k|        CHECK_COND_OR_FAIL(p2 == NULL, "Missing remote destination");
  ------------------
  |  | 1186|  1.91k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 520, False: 1.39k]
  |  |  ------------------
  |  | 1187|    520|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    520|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    520|                "line %d: %s: %s",                             \
  |  | 1189|    520|                count,                                         \
  |  | 1190|    520|                error_message,                                 \
  |  | 1191|    520|                keyword);                                      \
  |  | 1192|    520|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 520]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    520|        break;                                                 \
  |  | 1204|    520|    }
  ------------------
 2239|  1.39k|        if (*parsing) {
  ------------------
  |  Branch (2239:13): [True: 155, False: 1.23k]
  ------------------
 2240|    155|            char buf[MAX_LINE_SIZE] = {0};
 2241|       |
 2242|    155|            len = snprintf(buf, sizeof(buf), "%s %s", p, p2);
 2243|    155|            CHECK_COND_OR_FAIL(len >= (int)sizeof(buf), "Forwarding specification too long");
  ------------------
  |  | 1186|    155|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 0, False: 155]
  |  |  ------------------
  |  | 1187|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|      0|                "line %d: %s: %s",                             \
  |  | 1189|      0|                count,                                         \
  |  | 1190|      0|                error_message,                                 \
  |  | 1191|      0|                keyword);                                      \
  |  | 1192|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|      0|        break;                                                 \
  |  | 1204|      0|    }
  ------------------
 2244|    155|            ssh_options_set(session, SSH_OPTIONS_REMOTE_FORWARD, buf);
 2245|    155|        }
 2246|  1.39k|        break;
 2247|  1.39k|    case SOC_EXIT_ON_FORWARD_FAILURE:
  ------------------
  |  Branch (2247:5): [True: 317, False: 371k]
  ------------------
 2248|    317|        i = ssh_config_get_yesno(&s, -1);
 2249|    317|        CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|    317|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 142, False: 175]
  |  |  ------------------
  |  | 1187|    142|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    142|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    142|                "line %d: %s: %s",                             \
  |  | 1189|    142|                count,                                         \
  |  | 1190|    142|                error_message,                                 \
  |  | 1191|    142|                keyword);                                      \
  |  | 1192|    142|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 142]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    142|        break;                                                 \
  |  | 1204|    142|    }
  ------------------
 2250|    175|        if (*parsing) {
  ------------------
  |  Branch (2250:13): [True: 3, False: 172]
  ------------------
 2251|      3|            bool b = (i == 1) ? true : false;
  ------------------
  |  Branch (2251:22): [True: 0, False: 3]
  ------------------
 2252|      3|            ssh_options_set(session, SSH_OPTIONS_EXIT_ON_FORWARD_FAILURE, &b);
 2253|      3|        }
 2254|    175|        break;
 2255|    896|    case SOC_FORWARD_AGENT:
  ------------------
  |  Branch (2255:5): [True: 896, False: 371k]
  ------------------
 2256|    896|        p = ssh_config_get_str_tok(&s, NULL);
 2257|    896|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    896|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 543, False: 353]
  |  |  ------------------
  |  | 1187|    543|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    543|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    543|                "line %d: %s: %s",                             \
  |  | 1189|    543|                count,                                         \
  |  | 1190|    543|                error_message,                                 \
  |  | 1191|    543|                keyword);                                      \
  |  | 1192|    543|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 543]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    543|        break;                                                 \
  |  | 1204|    543|    }
  ------------------
 2258|    353|        if (*parsing) {
  ------------------
  |  Branch (2258:13): [True: 20, False: 333]
  ------------------
 2259|       |            /* Accept a boolean, an explicit socket path, or a $VAR reference.
 2260|       |             * A non-boolean value enables forwarding and sets the socket path.
 2261|       |             * The value may be a literal path or an environment variable name
 2262|       |             * (starting with '$'); a $VAR reference is kept verbatim here and
 2263|       |             * is expanded only after login, at session time. */
 2264|     20|            if (strcasecmp(p, "yes") == 0 || strcasecmp(p, "true") == 0) {
  ------------------
  |  Branch (2264:17): [True: 0, False: 20]
  |  Branch (2264:46): [True: 0, False: 20]
  ------------------
 2265|      0|                bool b = true;
 2266|      0|                ssh_options_set(session, SSH_OPTIONS_FORWARD_AGENT, &b);
 2267|     20|            } else if (strcasecmp(p, "no") == 0 || strcasecmp(p, "false") == 0) {
  ------------------
  |  Branch (2267:24): [True: 0, False: 20]
  |  Branch (2267:52): [True: 0, False: 20]
  ------------------
 2268|      0|                bool b = false;
 2269|      0|                ssh_options_set(session, SSH_OPTIONS_FORWARD_AGENT, &b);
 2270|     20|            } else {
 2271|     20|                bool b = true;
 2272|     20|                ssh_options_set(session, SSH_OPTIONS_FORWARD_AGENT, &b);
 2273|     20|                ssh_options_set(session, SSH_OPTIONS_FORWARD_AGENT_SOCK_PATH, p);
 2274|     20|            }
 2275|     20|        }
 2276|    353|        break;
 2277|    350|    case SOC_GATEWAY_PORTS:
  ------------------
  |  Branch (2277:5): [True: 350, False: 371k]
  ------------------
 2278|    350|        i = ssh_config_get_yesno(&s, -1);
 2279|    350|        CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|    350|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 291, False: 59]
  |  |  ------------------
  |  | 1187|    291|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    291|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    291|                "line %d: %s: %s",                             \
  |  | 1189|    291|                count,                                         \
  |  | 1190|    291|                error_message,                                 \
  |  | 1191|    291|                keyword);                                      \
  |  | 1192|    291|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 291]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    291|        break;                                                 \
  |  | 1204|    291|    }
  ------------------
 2280|     59|        if (*parsing) {
  ------------------
  |  Branch (2280:13): [True: 2, False: 57]
  ------------------
 2281|      2|            bool b = (i == 1) ? true : false;
  ------------------
  |  Branch (2281:22): [True: 0, False: 2]
  ------------------
 2282|      2|            ssh_options_set(session, SSH_OPTIONS_GATEWAY_PORTS, &b);
 2283|      2|        }
 2284|     59|        break;
 2285|  7.42k|    case SOC_SEND_ENV:
  ------------------
  |  Branch (2285:5): [True: 7.42k, False: 364k]
  ------------------
 2286|  7.42k|        p = ssh_config_get_str_tok(&s, NULL);
 2287|  7.42k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  7.42k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 34, False: 7.39k]
  |  |  ------------------
  |  | 1187|     34|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     34|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     34|                "line %d: %s: %s",                             \
  |  | 1189|     34|                count,                                         \
  |  | 1190|     34|                error_message,                                 \
  |  | 1191|     34|                keyword);                                      \
  |  | 1192|     34|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 34]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     34|        break;                                                 \
  |  | 1204|     34|    }
  ------------------
 2288|  7.39k|        if (*parsing) {
  ------------------
  |  Branch (2288:13): [True: 3.51k, False: 3.87k]
  ------------------
 2289|  17.2k|            while (p != NULL && p[0] != '\0') {
  ------------------
  |  Branch (2289:20): [True: 13.7k, False: 3.51k]
  |  Branch (2289:33): [True: 13.7k, False: 0]
  ------------------
 2290|  13.7k|                ssh_options_set(session, SSH_OPTIONS_SEND_ENV, p);
 2291|  13.7k|                p = ssh_config_get_str_tok(&s, NULL);
 2292|  13.7k|            }
 2293|  3.51k|        }
 2294|  7.39k|        break;
 2295|      0|    case SOC_CONTROLMASTER:
  ------------------
  |  Branch (2295:5): [True: 0, False: 372k]
  ------------------
 2296|      0|      p = ssh_config_get_str_tok(&s, NULL);
 2297|      0|      CHECK_COND_OR_FAIL(p == NULL, "ControlMaster");
  ------------------
  |  | 1186|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1187|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|      0|                "line %d: %s: %s",                             \
  |  | 1189|      0|                count,                                         \
  |  | 1190|      0|                error_message,                                 \
  |  | 1191|      0|                keyword);                                      \
  |  | 1192|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|      0|        break;                                                 \
  |  | 1204|      0|    }
  ------------------
 2298|      0|      if (*parsing) {
  ------------------
  |  Branch (2298:11): [True: 0, False: 0]
  ------------------
 2299|      0|          int value = -1;
 2300|       |
 2301|      0|          if (strcasecmp(p, "auto") == 0) {
  ------------------
  |  Branch (2301:15): [True: 0, False: 0]
  ------------------
 2302|      0|              value = SSH_CONTROL_MASTER_AUTO;
 2303|      0|          } else if (strcasecmp(p, "yes") == 0) {
  ------------------
  |  Branch (2303:22): [True: 0, False: 0]
  ------------------
 2304|      0|              value = SSH_CONTROL_MASTER_YES;
 2305|      0|          } else if (strcasecmp(p, "no") == 0) {
  ------------------
  |  Branch (2305:22): [True: 0, False: 0]
  ------------------
 2306|      0|              value = SSH_CONTROL_MASTER_NO;
 2307|      0|          } else if (strcasecmp(p, "autoask") == 0) {
  ------------------
  |  Branch (2307:22): [True: 0, False: 0]
  ------------------
 2308|      0|              value = SSH_CONTROL_MASTER_AUTOASK;
 2309|      0|          } else if (strcasecmp(p, "ask") == 0) {
  ------------------
  |  Branch (2309:22): [True: 0, False: 0]
  ------------------
 2310|      0|              value = SSH_CONTROL_MASTER_ASK;
 2311|      0|          }
 2312|       |
 2313|      0|          CHECK_COND_OR_FAIL(value == -1, "Invalid argument");
  ------------------
  |  | 1186|      0|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 0, False: 0]
  |  |  ------------------
  |  | 1187|      0|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|      0|                "line %d: %s: %s",                             \
  |  | 1189|      0|                count,                                         \
  |  | 1190|      0|                error_message,                                 \
  |  | 1191|      0|                keyword);                                      \
  |  | 1192|      0|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|      0|        break;                                                 \
  |  | 1204|      0|    }
  ------------------
 2314|      0|          if (value != -1) {
  ------------------
  |  Branch (2314:15): [True: 0, False: 0]
  ------------------
 2315|      0|              ssh_options_set(session, SSH_OPTIONS_CONTROL_MASTER, &value);
 2316|      0|          }
 2317|      0|      }
 2318|      0|      break;
 2319|      0|    case SOC_CONTROLPATH:
  ------------------
  |  Branch (2319:5): [True: 0, False: 372k]
  ------------------
 2320|      0|      p = ssh_config_get_str_tok(&s, NULL);
 2321|      0|      if (p == NULL) {
  ------------------
  |  Branch (2321:11): [True: 0, False: 0]
  ------------------
 2322|      0|        SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2323|      0|        return -1;
 2324|      0|      }
 2325|      0|      if (*parsing) {
  ------------------
  |  Branch (2325:11): [True: 0, False: 0]
  ------------------
 2326|      0|          ssh_options_set(session, SSH_OPTIONS_CONTROL_PATH, p);
 2327|      0|      }
 2328|      0|      break;
 2329|  7.49k|    case SOC_CERTIFICATE:
  ------------------
  |  Branch (2329:5): [True: 7.49k, False: 364k]
  ------------------
 2330|  7.49k|        p = ssh_config_get_path(&s);
 2331|  7.49k|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|  7.49k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 3.49k, False: 4.00k]
  |  |  ------------------
  |  | 1187|  3.49k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  3.49k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  3.49k|                "line %d: %s: %s",                             \
  |  | 1189|  3.49k|                count,                                         \
  |  | 1190|  3.49k|                error_message,                                 \
  |  | 1191|  3.49k|                keyword);                                      \
  |  | 1192|  3.49k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 3.49k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  3.49k|        break;                                                 \
  |  | 1204|  3.49k|    }
  ------------------
 2332|  4.00k|        if (*parsing) {
  ------------------
  |  Branch (2332:13): [True: 3.04k, False: 967]
  ------------------
 2333|  3.04k|            ssh_options_set(session, SSH_OPTIONS_CERTIFICATE, p);
 2334|  3.04k|        }
 2335|  4.00k|        break;
 2336|  2.09k|    case SOC_GSSAPIKEYEXCHANGE: {
  ------------------
  |  Branch (2336:5): [True: 2.09k, False: 370k]
  ------------------
 2337|  2.09k|        i = ssh_config_get_yesno(&s, -1);
 2338|  2.09k|        CHECK_COND_OR_FAIL(i < 0, "Invalid argument");
  ------------------
  |  | 1186|  2.09k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 987, False: 1.10k]
  |  |  ------------------
  |  | 1187|    987|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|    987|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|    987|                "line %d: %s: %s",                             \
  |  | 1189|    987|                count,                                         \
  |  | 1190|    987|                error_message,                                 \
  |  | 1191|    987|                keyword);                                      \
  |  | 1192|    987|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 987]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|    987|        break;                                                 \
  |  | 1204|    987|    }
  ------------------
 2339|  1.10k|        if (*parsing) {
  ------------------
  |  Branch (2339:13): [True: 28, False: 1.07k]
  ------------------
 2340|     28|            bool b = (i == 1) ? true : false;
  ------------------
  |  Branch (2340:22): [True: 28, False: 0]
  ------------------
 2341|     28|            ssh_options_set(session, SSH_OPTIONS_GSSAPI_KEY_EXCHANGE, &b);
 2342|     28|        }
 2343|  1.10k|        break;
 2344|  2.09k|    }
 2345|    687|    case SOC_GSSAPIKEXALGORITHMS:
  ------------------
  |  Branch (2345:5): [True: 687, False: 371k]
  ------------------
 2346|    687|        p = ssh_config_get_str_tok(&s, NULL);
 2347|    687|        CHECK_COND_OR_FAIL(p == NULL, "Missing argument");
  ------------------
  |  | 1186|    687|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:9): [True: 61, False: 626]
  |  |  ------------------
  |  | 1187|     61|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|     61|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|     61|                "line %d: %s: %s",                             \
  |  | 1189|     61|                count,                                         \
  |  | 1190|     61|                error_message,                                 \
  |  | 1191|     61|                keyword);                                      \
  |  | 1192|     61|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 61]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|     61|        break;                                                 \
  |  | 1204|     61|    }
  ------------------
 2348|    626|        if (*parsing) {
  ------------------
  |  Branch (2348:13): [True: 11, False: 615]
  ------------------
 2349|     11|            ssh_options_set(session, SSH_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS, p);
 2350|     11|        }
 2351|    626|        break;
 2352|  2.02k|    case SOC_REQUIRED_RSA_SIZE:
  ------------------
  |  Branch (2352:5): [True: 2.02k, False: 370k]
  ------------------
 2353|  2.02k|        l = ssh_config_get_long(&s, -1);
 2354|  2.02k|        CHECK_COND_OR_FAIL(l < 0 || l > INT_MAX, "Invalid argument");
  ------------------
  |  | 1186|  3.09k|    if ((cond)) {                                              \
  |  |  ------------------
  |  |  |  Branch (1186:10): [True: 956, False: 1.06k]
  |  |  |  Branch (1186:10): [True: 57, False: 1.01k]
  |  |  ------------------
  |  | 1187|  1.01k|        SSH_LOG(SSH_LOG_DEBUG,                                 \
  |  |  ------------------
  |  |  |  |  283|  1.01k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  | 1188|  1.01k|                "line %d: %s: %s",                             \
  |  | 1189|  1.01k|                count,                                         \
  |  | 1190|  1.01k|                error_message,                                 \
  |  | 1191|  1.01k|                keyword);                                      \
  |  | 1192|  1.01k|        if (fail_on_unknown) {                                 \
  |  |  ------------------
  |  |  |  Branch (1192:13): [True: 0, False: 1.01k]
  |  |  ------------------
  |  | 1193|      0|            ssh_set_error(session,                             \
  |  |  ------------------
  |  |  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  |  Branch (313:43): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1194|      0|                          SSH_FATAL,                           \
  |  | 1195|      0|                          is_cli ? "%s '%s' value on CLI"      \
  |  | 1196|      0|                                 : "%s '%s' value at line %d", \
  |  | 1197|      0|                          error_message,                       \
  |  | 1198|      0|                          keyword,                             \
  |  | 1199|      0|                          is_cli ? 0 : count);                 \
  |  | 1200|      0|            SAFE_FREE(x);                                      \
  |  |  ------------------
  |  |  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1201|      0|            return SSH_ERROR;                                  \
  |  |  ------------------
  |  |  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  |  |  ------------------
  |  | 1202|      0|        }                                                      \
  |  | 1203|  1.01k|        break;                                                 \
  |  | 1204|  1.01k|    }
  ------------------
 2355|  1.01k|        if (*parsing) {
  ------------------
  |  Branch (2355:13): [True: 12, False: 1.00k]
  ------------------
 2356|     12|            i = (int)l;
 2357|     12|            ssh_options_set(session, SSH_OPTIONS_RSA_MIN_SIZE, &i);
 2358|     12|        }
 2359|  1.01k|        break;
 2360|     83|    case SOC_ADDRESSFAMILY:
  ------------------
  |  Branch (2360:5): [True: 83, False: 372k]
  ------------------
 2361|     83|        p = ssh_config_get_str_tok(&s, NULL);
 2362|     83|        if (p == NULL) {
  ------------------
  |  Branch (2362:13): [True: 1, False: 82]
  ------------------
 2363|      1|            SSH_LOG(SSH_LOG_WARNING,
  ------------------
  |  |  283|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2364|      1|                    "line %d: no argument after keyword \"addressfamily\"",
 2365|      1|                    count);
 2366|      1|            SAFE_FREE(x);
  ------------------
  |  |  375|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 1, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2367|      1|            return SSH_ERROR;
  ------------------
  |  |  316|      1|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2368|      1|        }
 2369|     82|        if (*parsing) {
  ------------------
  |  Branch (2369:13): [True: 4, False: 78]
  ------------------
 2370|      4|            int value = -1;
 2371|       |
 2372|      4|            if (strcasecmp(p, "any") == 0) {
  ------------------
  |  Branch (2372:17): [True: 0, False: 4]
  ------------------
 2373|      0|                value = SSH_ADDRESS_FAMILY_ANY;
 2374|      4|            } else if (strcasecmp(p, "inet") == 0) {
  ------------------
  |  Branch (2374:24): [True: 0, False: 4]
  ------------------
 2375|      0|                value = SSH_ADDRESS_FAMILY_INET;
 2376|      4|            } else if (strcasecmp(p, "inet6") == 0) {
  ------------------
  |  Branch (2376:24): [True: 1, False: 3]
  ------------------
 2377|      1|                value = SSH_ADDRESS_FAMILY_INET6;
 2378|      3|            } else {
 2379|      3|                SSH_LOG(SSH_LOG_WARNING,
  ------------------
  |  |  283|      3|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2380|      3|                        "line %d: invalid argument \"%s\"",
 2381|      3|                        count,
 2382|      3|                        p);
 2383|      3|                SAFE_FREE(x);
  ------------------
  |  |  375|      3|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 3, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 3]
  |  |  ------------------
  ------------------
 2384|      3|                return SSH_ERROR;
  ------------------
  |  |  316|      3|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2385|      3|            }
 2386|      1|            ssh_options_set(session, SSH_OPTIONS_ADDRESS_FAMILY, &value);
 2387|      1|        }
 2388|     79|        break;
 2389|     79|    default:
  ------------------
  |  Branch (2389:5): [True: 0, False: 372k]
  ------------------
 2390|      0|      ssh_set_error(session, SSH_FATAL, "ERROR - unimplemented opcode: %d",
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 2391|      0|              opcode);
 2392|      0|      SAFE_FREE(x);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2393|      0|      return -1;
 2394|      0|      break;
 2395|   372k|  }
 2396|       |
 2397|   372k|  SAFE_FREE(x);
  ------------------
  |  |  375|   372k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 372k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 372k]
  |  |  ------------------
  ------------------
 2398|   372k|  return 0;
 2399|   372k|}
config.c:ssh_config_make_absolute:
  775|  2.18k|{
  776|  2.18k|    size_t outlen = 0;
  777|  2.18k|    char *out = NULL;
  778|  2.18k|    int rv;
  779|       |
  780|       |    /* Looks like absolute path */
  781|  2.18k|    if (path[0] == '/') {
  ------------------
  |  Branch (781:9): [True: 237, False: 1.94k]
  ------------------
  782|    237|        return strdup(path);
  783|    237|    }
  784|       |
  785|       |    /* relative path */
  786|  1.94k|    if (global) {
  ------------------
  |  Branch (786:9): [True: 0, False: 1.94k]
  ------------------
  787|       |        /* Parsing global config */
  788|      0|        outlen = strlen(path) + strlen("/etc/ssh/") + 1;
  789|      0|        out = malloc(outlen);
  790|      0|        if (out == NULL) {
  ------------------
  |  Branch (790:13): [True: 0, False: 0]
  ------------------
  791|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  792|      0|            return NULL;
  793|      0|        }
  794|      0|        rv = snprintf(out, outlen, "/etc/ssh/%s", path);
  795|      0|        if (rv < 1) {
  ------------------
  |  Branch (795:13): [True: 0, False: 0]
  ------------------
  796|      0|            free(out);
  797|      0|            return NULL;
  798|      0|        }
  799|      0|        return out;
  800|      0|    }
  801|       |
  802|       |    /* paths starting with tilde are already absolute */
  803|  1.94k|    if (path[0] == '~') {
  ------------------
  |  Branch (803:9): [True: 1.52k, False: 427]
  ------------------
  804|  1.52k|        return ssh_path_expand_tilde(path);
  805|  1.52k|    }
  806|       |
  807|       |    /* Parsing user config relative to home directory (generally ~/.ssh) */
  808|    427|    if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (808:9): [True: 0, False: 427]
  ------------------
  809|      0|        ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
  810|      0|        return NULL;
  811|      0|    }
  812|    427|    outlen = strlen(path) + strlen(session->opts.sshdir) + 1 + 1;
  813|    427|    out = malloc(outlen);
  814|    427|    if (out == NULL) {
  ------------------
  |  Branch (814:9): [True: 0, False: 427]
  ------------------
  815|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  816|      0|        return NULL;
  817|      0|    }
  818|    427|    rv = snprintf(out, outlen, "%s/%s", session->opts.sshdir, path);
  819|    427|    if (rv < 1) {
  ------------------
  |  Branch (819:9): [True: 0, False: 427]
  ------------------
  820|      0|        free(out);
  821|      0|        return NULL;
  822|      0|    }
  823|    427|    return out;
  824|    427|}
config.c:local_parse_file:
  246|  2.18k|{
  247|  2.18k|    FILE *f = NULL;
  248|  2.18k|    char line[MAX_LINE_SIZE] = {0};
  249|  2.18k|    unsigned int count = 0;
  250|       |    /* A Host or Match block in the included file ends with the file, as in
  251|       |     * OpenSSH, so the file gets its own copy of the parsing state. */
  252|  2.18k|    int file_parsing = *parsing;
  253|  2.18k|    int rv;
  254|       |
  255|  2.18k|    if (depth > LIBSSH_CONF_MAX_DEPTH) {
  ------------------
  |  |  239|  2.18k|#define LIBSSH_CONF_MAX_DEPTH 16
  ------------------
  |  Branch (255:9): [True: 0, False: 2.18k]
  ------------------
  256|      0|        ssh_set_error(session, SSH_FATAL,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  257|      0|                      "ERROR - Too many levels of configuration includes "
  258|      0|                      "when processing file '%s'", filename);
  259|      0|        return;
  260|      0|    }
  261|       |
  262|  2.18k|    f = ssh_strict_fopen(filename, SSH_MAX_CONFIG_FILE_SIZE);
  ------------------
  |  |  530|  2.18k|#define SSH_MAX_CONFIG_FILE_SIZE 16 * 1024 * 1024
  ------------------
  263|  2.18k|    if (f == NULL) {
  ------------------
  |  Branch (263:9): [True: 2.08k, False: 100]
  ------------------
  264|  2.08k|        SSH_LOG(SSH_LOG_RARE,
  ------------------
  |  |  283|  2.08k|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  265|  2.08k|                "Failed to open included configuration file %s",
  266|  2.08k|                filename);
  267|  2.08k|        return;
  268|  2.08k|    }
  269|       |
  270|    100|    SSH_LOG(SSH_LOG_PACKET, "Reading additional configuration data from %s", filename);
  ------------------
  |  |  283|    100|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  271|  7.00k|    while (fgets(line, sizeof(line), f)) {
  ------------------
  |  Branch (271:12): [True: 6.90k, False: 100]
  ------------------
  272|  6.90k|        count++;
  273|  6.90k|        rv = ssh_config_parse_line(session,
  274|  6.90k|                                   line,
  275|  6.90k|                                   count,
  276|  6.90k|                                   &file_parsing,
  277|  6.90k|                                   depth,
  278|  6.90k|                                   global);
  279|  6.90k|        if (rv < 0) {
  ------------------
  |  Branch (279:13): [True: 0, False: 6.90k]
  ------------------
  280|      0|            fclose(f);
  281|      0|            return;
  282|      0|        }
  283|  6.90k|    }
  284|       |
  285|    100|    fclose(f);
  286|    100|    return;
  287|    100|}
config.c:ssh_config_get_match_opcode:
  325|  50.5k|{
  326|  50.5k|    size_t i;
  327|       |
  328|   559k|    for (i = 0; ssh_config_match_keyword_table[i].name != NULL; i++) {
  ------------------
  |  Branch (328:17): [True: 518k, False: 41.7k]
  ------------------
  329|   518k|        if (strcasecmp(keyword, ssh_config_match_keyword_table[i].name) == 0) {
  ------------------
  |  Branch (329:13): [True: 8.76k, False: 509k]
  ------------------
  330|  8.76k|            return ssh_config_match_keyword_table[i].opcode;
  331|  8.76k|        }
  332|   518k|    }
  333|       |
  334|  41.7k|    return MATCH_UNKNOWN;
  335|  50.5k|}
config.c:ssh_match_exec:
  530|    455|{
  531|    455|    (void)session;
  532|    455|    (void)command;
  533|    455|    (void)negate;
  534|       |
  535|    455|    SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|    455|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  536|    455|            "Unsupported 'exec' command on Windows '%s'",
  537|    455|            command);
  538|    455|    return 0;
  539|    455|}
config.c:ssh_config_match:
  368|  3.27k|{
  369|  3.27k|    int ok, result = 0;
  370|       |
  371|  3.27k|    ok = match_pattern_list(value, pattern, strlen(pattern), 0);
  372|  3.27k|    result = ssh_config_match_result(ok, negate);
  373|  3.27k|    SSH_LOG(SSH_LOG_TRACE, "%s '%s' against pattern '%s'%s (ok=%d)",
  ------------------
  |  |  283|  13.1k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (283:34): [True: 1.05k, False: 2.22k]
  |  |  |  Branch (283:34): [True: 842, False: 2.43k]
  |  |  ------------------
  ------------------
  374|  3.27k|            result == 1 ? "Matched" : "Not matched", value, pattern,
  375|  3.27k|            negate == true ? " (negated)" : "", ok);
  376|  3.27k|    return result;
  377|  3.27k|}
config.c:ssh_config_match_result:
  347|  5.95k|{
  348|  5.95k|    if (ok <= 0 && negate == true) {
  ------------------
  |  Branch (348:9): [True: 4.72k, False: 1.23k]
  |  Branch (348:20): [True: 2.30k, False: 2.41k]
  ------------------
  349|  2.30k|        return 1;
  350|  2.30k|    }
  351|  3.64k|    if (ok > 0 && negate == false) {
  ------------------
  |  Branch (351:9): [True: 1.23k, False: 2.41k]
  |  Branch (351:19): [True: 434, False: 798]
  ------------------
  352|    434|        return 1;
  353|    434|    }
  354|       |
  355|  3.21k|    return 0;
  356|  3.64k|}
config.c:ssh_config_match_tagged:
  390|  2.67k|{
  391|  2.67k|    const char *tag = value != NULL ? value : "";
  ------------------
  |  Branch (391:23): [True: 828, False: 1.84k]
  ------------------
  392|  2.67k|    int ok, result = 0;
  393|  2.67k|    size_t pattern_len;
  394|       |
  395|  2.67k|    if (tag[0] == '\0') {
  ------------------
  |  Branch (395:9): [True: 1.84k, False: 828]
  ------------------
  396|       |        /* Match tagged treats an explicit empty pattern as "match unset tag".
  397|       |         * The generic match_pattern_list() should still treat empty patterns
  398|       |         * as no match for other predicates.
  399|       |         */
  400|  1.84k|        ok = (pattern[0] == '\0');
  401|  1.84k|    } else {
  402|    828|        pattern_len = strlen(pattern);
  403|    828|        ok = match_pattern_list(tag, pattern, pattern_len, 0) > 0;
  404|    828|    }
  405|       |
  406|  2.67k|    result = ssh_config_match_result(ok, negate);
  407|  2.67k|    SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|  10.7k|    _ssh_log(priority, __func__, __VA_ARGS__)
  |  |  ------------------
  |  |  |  Branch (283:34): [True: 1.68k, False: 986]
  |  |  |  Branch (283:34): [True: 2.26k, False: 411]
  |  |  ------------------
  ------------------
  408|  2.67k|            "%s tag '%s' against pattern '%s'%s (ok=%d)",
  409|  2.67k|            result == 1 ? "Matched" : "Not matched",
  410|  2.67k|            tag,
  411|  2.67k|            pattern,
  412|  2.67k|            negate == true ? " (negated)" : "",
  413|  2.67k|            ok);
  414|  2.67k|    return result;
  415|  2.67k|}
config.c:ssh_config_scan_hostname_tokens:
  549|     61|{
  550|     61|    const char *p = NULL;
  551|       |
  552|     61|    if (needs_host != NULL) {
  ------------------
  |  Branch (552:9): [True: 61, False: 0]
  ------------------
  553|     61|        *needs_host = false;
  554|     61|    }
  555|       |
  556|     61|    if (hostname == NULL) {
  ------------------
  |  Branch (556:9): [True: 0, False: 61]
  ------------------
  557|      0|        ssh_set_error(session,
  ------------------
  |  |  313|      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|  2.90k|    for (p = hostname; *p != '\0'; p++) {
  ------------------
  |  Branch (563:24): [True: 2.84k, False: 59]
  ------------------
  564|  2.84k|        if (*p == '%') {
  ------------------
  |  Branch (564:13): [True: 562, False: 2.28k]
  ------------------
  565|    562|            if (p[1] == '\0') {
  ------------------
  |  Branch (565:17): [True: 1, False: 561]
  ------------------
  566|      1|                ssh_set_error(session, SSH_FATAL, "Incomplete Hostname token");
  ------------------
  |  |  313|      1|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  567|      1|                return -1;
  568|      1|            }
  569|    561|            switch (p[1]) {
  570|    134|            case '%':
  ------------------
  |  Branch (570:13): [True: 134, False: 427]
  ------------------
  571|    134|                p++;
  572|    134|                continue;
  573|    426|            case 'h':
  ------------------
  |  Branch (573:13): [True: 426, False: 135]
  ------------------
  574|    426|                if (needs_host != NULL) {
  ------------------
  |  Branch (574:21): [True: 426, False: 0]
  ------------------
  575|    426|                    *needs_host = true;
  576|    426|                }
  577|    426|                p++;
  578|    426|                continue;
  579|      1|            default:
  ------------------
  |  Branch (579:13): [True: 1, False: 560]
  ------------------
  580|      1|                ssh_set_error(session, SSH_FATAL, "unknown key %%%c", p[1]);
  ------------------
  |  |  313|      1|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  581|      1|                return -1;
  582|    561|            }
  583|    561|        }
  584|  2.84k|    }
  585|       |
  586|     59|    return 0;
  587|     61|}
config.c:ssh_config_algo_failed:
 1149|    403|{
 1150|    403|    char prefix[32] = "";
 1151|    403|    char safe[SSH_CONFIG_LOG_VALUE_MAX];
 1152|    403|    const char *error = NULL;
 1153|       |
 1154|    403|    if (rv == SSH_OK) {
  ------------------
  |  |  315|    403|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1154:9): [True: 309, False: 94]
  ------------------
 1155|    309|        return false;
 1156|    309|    }
 1157|       |
 1158|     94|    if (ssh_get_error_code(session) == SSH_REQUEST_DENIED) {
  ------------------
  |  Branch (1158:9): [True: 94, False: 0]
  ------------------
 1159|       |        /*
 1160|       |         * Unusable list: tolerated and ignored by the caller, so do not
 1161|       |         * leave the setter's error on the session.
 1162|       |         */
 1163|     94|        ssh_reset_error(session);
 1164|     94|        return false;
 1165|     94|    }
 1166|       |
 1167|       |    /*
 1168|       |     * Any error other than SSH_REQUEST_DENIED is a real failure, not an
 1169|       |     * unusable list. This includes OOM: ssh_options_set_algo() reports
 1170|       |     * ENOMEM as SSH_FATAL, so the config parse fails instead of
 1171|       |     * continuing.
 1172|       |     */
 1173|      0|    error = ssh_get_error(session);
 1174|       |
 1175|      0|    if (!is_cli) {
  ------------------
  |  Branch (1175:9): [True: 0, False: 0]
  ------------------
 1176|      0|        snprintf(prefix, sizeof(prefix), "line %u: ", count);
 1177|      0|    }
 1178|       |
 1179|      0|    ssh_config_sanitize_log_value(error, safe, sizeof(safe));
 1180|      0|    SSH_LOG(SSH_LOG_WARN, "%s%s: %s", prefix, keyword, safe);
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1181|       |
 1182|       |    return true;
 1183|     94|}
config.c:ssh_config_sanitize_log_value:
 1102|     60|{
 1103|     60|    size_t i;
 1104|       |
 1105|     60|    strlcpy(buf, value, buflen);
 1106|       |
 1107|  1.67k|    for (i = 0; buf[i] != '\0'; i++) {
  ------------------
  |  Branch (1107:17): [True: 1.61k, False: 60]
  ------------------
 1108|  1.61k|        unsigned char c = (unsigned char)buf[i];
 1109|       |
 1110|  1.61k|        if (c < 0x20 || c > 0x7E) {
  ------------------
  |  Branch (1110:13): [True: 117, False: 1.50k]
  |  Branch (1110:25): [True: 554, False: 946]
  ------------------
 1111|    671|            buf[i] = '?';
 1112|    671|        }
 1113|  1.61k|    }
 1114|     60|}
config.c:ssh_config_log_unusable_algo:
 1121|     60|{
 1122|     60|    char prefix[32] = "";
 1123|     60|    char safe[SSH_CONFIG_LOG_VALUE_MAX];
 1124|       |
 1125|       |    /* The command line has no line number. */
 1126|     60|    if (!is_cli) {
  ------------------
  |  Branch (1126:9): [True: 60, False: 0]
  ------------------
 1127|     60|        snprintf(prefix, sizeof(prefix), "line %u: ", count);
 1128|     60|    }
 1129|       |
 1130|     60|    ssh_config_sanitize_log_value(value, safe, sizeof(safe));
 1131|       |
 1132|     60|    SSH_LOG(SSH_LOG_INFO,
  ------------------
  |  |  283|     60|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1133|     60|            "%s%s: no supported algorithm in '%s'; ignoring this setting",
 1134|     60|            prefix,
 1135|     60|            keyword,
 1136|     60|            safe);
 1137|     60|}
config.c:ssh_config_get_token_value:
 1032|  3.22k|{
 1033|  3.22k|    const char *p = NULL;
 1034|  3.22k|    size_t i;
 1035|       |
 1036|  3.22k|    p = ssh_config_get_str_tok(str, NULL);
 1037|  3.22k|    if (p == NULL) {
  ------------------
  |  Branch (1037:9): [True: 589, False: 2.63k]
  ------------------
 1038|    589|        return notfound;
 1039|    589|    }
 1040|       |
 1041|  10.5k|    for (i = 0; map[i].token != NULL; i++) {
  ------------------
  |  Branch (1041:17): [True: 9.18k, False: 1.40k]
  ------------------
 1042|  9.18k|        if (strcasecmp(p, map[i].token) == 0) {
  ------------------
  |  Branch (1042:13): [True: 1.23k, False: 7.95k]
  ------------------
 1043|  1.23k|            return map[i].value;
 1044|  1.23k|        }
 1045|  9.18k|    }
 1046|       |
 1047|  1.40k|    return notfound;
 1048|  2.63k|}
config.c:ssh_config_convtime:
  961|  3.69k|{
  962|  3.69k|    char *endp = NULL;
  963|  3.69k|    long total = 0;
  964|  3.69k|    long value;
  965|  3.69k|    long multiplier;
  966|       |
  967|  3.69k|    if (p == NULL || *p == '\0') {
  ------------------
  |  Branch (967:9): [True: 0, False: 3.69k]
  |  Branch (967:22): [True: 0, False: 3.69k]
  ------------------
  968|      0|        return notfound;
  969|      0|    }
  970|       |
  971|  14.6k|    while (*p != '\0') {
  ------------------
  |  Branch (971:12): [True: 14.1k, False: 502]
  ------------------
  972|  14.1k|        errno = 0;
  973|  14.1k|        value = strtol(p, &endp, 10);
  974|  14.1k|        if (p == endp || errno != 0 || value < 0) {
  ------------------
  |  Branch (974:13): [True: 1.07k, False: 13.0k]
  |  Branch (974:26): [True: 83, False: 12.9k]
  |  Branch (974:40): [True: 236, False: 12.7k]
  ------------------
  975|  1.39k|            return notfound;
  976|  1.39k|        }
  977|       |
  978|  12.7k|        switch (*endp) {
  979|    248|        case '\0':
  ------------------
  |  Branch (979:9): [True: 248, False: 12.5k]
  ------------------
  980|  4.22k|        case 's':
  ------------------
  |  Branch (980:9): [True: 3.97k, False: 8.77k]
  ------------------
  981|  4.41k|        case 'S':
  ------------------
  |  Branch (981:9): [True: 192, False: 12.5k]
  ------------------
  982|  4.41k|            multiplier = 1;
  983|  4.41k|            break;
  984|     50|        case 'm':
  ------------------
  |  Branch (984:9): [True: 50, False: 12.6k]
  ------------------
  985|  2.50k|        case 'M':
  ------------------
  |  Branch (985:9): [True: 2.45k, False: 10.2k]
  ------------------
  986|  2.50k|            multiplier = 60;
  987|  2.50k|            break;
  988|    116|        case 'h':
  ------------------
  |  Branch (988:9): [True: 116, False: 12.6k]
  ------------------
  989|  1.17k|        case 'H':
  ------------------
  |  Branch (989:9): [True: 1.06k, False: 11.6k]
  ------------------
  990|  1.17k|            multiplier = 60 * 60;
  991|  1.17k|            break;
  992|     55|        case 'd':
  ------------------
  |  Branch (992:9): [True: 55, False: 12.6k]
  ------------------
  993|    518|        case 'D':
  ------------------
  |  Branch (993:9): [True: 463, False: 12.2k]
  ------------------
  994|    518|            multiplier = 24 * 60 * 60;
  995|    518|            break;
  996|  2.21k|        case 'w':
  ------------------
  |  Branch (996:9): [True: 2.21k, False: 10.5k]
  ------------------
  997|  2.87k|        case 'W':
  ------------------
  |  Branch (997:9): [True: 664, False: 12.0k]
  ------------------
  998|  2.87k|            multiplier = 7 * 24 * 60 * 60;
  999|  2.87k|            break;
 1000|  1.24k|        default:
  ------------------
  |  Branch (1000:9): [True: 1.24k, False: 11.5k]
  ------------------
 1001|  1.24k|            return notfound;
 1002|  12.7k|        }
 1003|       |
 1004|       |        /*
 1005|       |         * OpenSSH accepts ConnectTimeout values only up to INT_MAX
 1006|       |         * seconds: see openssh-portable/misc.c:convtime().
 1007|       |         */
 1008|  11.5k|        if (value > (INT_MAX - total) / multiplier) {
  ------------------
  |  Branch (1008:13): [True: 549, False: 10.9k]
  ------------------
 1009|    549|            return notfound;
 1010|    549|        }
 1011|  10.9k|        total += value * multiplier;
 1012|       |
 1013|  10.9k|        if (*endp == '\0') {
  ------------------
  |  Branch (1013:13): [True: 248, False: 10.7k]
  ------------------
 1014|    248|            p = endp;
 1015|  10.7k|        } else {
 1016|  10.7k|            p = endp + 1;
 1017|  10.7k|        }
 1018|  10.9k|    }
 1019|       |
 1020|    502|    return total;
 1021|  3.69k|}
config.c:ssh_config_get_strict_hostkey:
 1064|  1.13k|{
 1065|  1.13k|    static const struct ssh_config_token_value_map strict_hostkey_map[] = {
 1066|  1.13k|        {"yes", SSH_STRICT_HOSTKEY_YES},
 1067|  1.13k|        {"true", SSH_STRICT_HOSTKEY_YES},
 1068|  1.13k|        {"no", SSH_STRICT_HOSTKEY_OFF},
 1069|  1.13k|        {"false", SSH_STRICT_HOSTKEY_OFF},
 1070|  1.13k|        {"off", SSH_STRICT_HOSTKEY_OFF},
 1071|  1.13k|        {"ask", SSH_STRICT_HOSTKEY_ASK},
 1072|  1.13k|        {"accept-new", SSH_STRICT_HOSTKEY_ACCEPT_NEW},
 1073|  1.13k|        {NULL, 0},
 1074|  1.13k|    };
 1075|       |
 1076|  1.13k|    return ssh_config_get_token_value(str, strict_hostkey_map, notfound);
 1077|  1.13k|}
config.c:ssh_config_get_auth_option:
  921|    341|{
  922|    341|    struct auth_option_map {
  923|    341|        enum ssh_config_opcode_e opcode;
  924|    341|        const char *name;
  925|    341|        enum ssh_options_e option;
  926|    341|    };
  927|       |
  928|    341|    static struct auth_option_map auth_options[] = {
  929|    341|        {
  930|    341|            SOC_GSSAPIAUTHENTICATION,
  931|    341|            "GSSAPIAuthentication",
  932|    341|            SSH_OPTIONS_GSSAPI_AUTH,
  933|    341|        },
  934|    341|        {
  935|    341|            SOC_KBDINTERACTIVEAUTHENTICATION,
  936|    341|            "KbdInteractiveAuthentication",
  937|    341|            SSH_OPTIONS_KBDINT_AUTH,
  938|    341|        },
  939|    341|        {
  940|    341|            SOC_PASSWORDAUTHENTICATION,
  941|    341|            "PasswordAuthentication",
  942|    341|            SSH_OPTIONS_PASSWORD_AUTH,
  943|    341|        },
  944|    341|        {
  945|    341|            SOC_PUBKEYAUTHENTICATION,
  946|    341|            "PubkeyAuthentication",
  947|    341|            SSH_OPTIONS_PUBKEY_AUTH,
  948|    341|        },
  949|    341|        {0, NULL, 0},
  950|    341|    };
  951|       |
  952|    751|    for (struct auth_option_map *map = auth_options; map->name != NULL; map++) {
  ------------------
  |  Branch (952:54): [True: 751, False: 0]
  ------------------
  953|    751|        if (map->opcode == opcode) {
  ------------------
  |  Branch (953:13): [True: 341, False: 410]
  ------------------
  954|    341|            return map->option;
  955|    341|        }
  956|    751|    }
  957|      0|    return -1;
  958|    341|}
config.c:ssh_config_get_pubkey_auth:
 1080|    674|{
 1081|    674|    static const struct ssh_config_token_value_map pubkey_auth_map[] = {
 1082|    674|        {"yes", SSH_PUBKEY_AUTH_ALL},
 1083|    674|        {"true", SSH_PUBKEY_AUTH_ALL},
 1084|    674|        {"no", SSH_PUBKEY_AUTH_NO},
 1085|    674|        {"false", SSH_PUBKEY_AUTH_NO},
 1086|    674|        {"unbound", SSH_PUBKEY_AUTH_UNBOUND},
 1087|    674|        {"host-bound", SSH_PUBKEY_AUTH_HOST_BOUND},
 1088|    674|        {NULL, 0},
 1089|    674|    };
 1090|       |
 1091|    674|    return ssh_config_get_token_value(str, pubkey_auth_map, notfound);
 1092|    674|}

ssh_config_get_cmd:
   41|    861|{
   42|    861|    register char *c = NULL;
   43|    861|    char *r = NULL;
   44|       |
   45|       |    /* Ignore leading spaces */
   46|    861|    for (c = *str; *c; c++) {
  ------------------
  |  Branch (46:20): [True: 508, False: 353]
  ------------------
   47|    508|        if (!isspace((unsigned char)*c)) {
  ------------------
  |  Branch (47:13): [True: 508, False: 0]
  ------------------
   48|    508|            break;
   49|    508|        }
   50|    508|    }
   51|       |
   52|  11.7k|    for (r = c; *c; c++) {
  ------------------
  |  Branch (52:17): [True: 10.9k, False: 861]
  ------------------
   53|  10.9k|        if (*c == '\n') {
  ------------------
  |  Branch (53:13): [True: 0, False: 10.9k]
  ------------------
   54|      0|            *c = '\0';
   55|      0|            goto out;
   56|      0|        }
   57|  10.9k|    }
   58|       |
   59|    861|out:
   60|    861|    *str = c + 1;
   61|       |
   62|    861|    return r;
   63|    861|}
ssh_config_get_token_info:
   69|   625k|{
   70|   625k|    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|   625k|    char *dst = NULL;
   76|   625k|    bool had_equal = false;
   77|   625k|    bool found = false;
   78|   625k|    bool invalid = false;
   79|   625k|    char *r = NULL;
   80|   625k|    char inquote = '\0';
   81|       |
   82|   625k|    if (info != NULL) {
  ------------------
  |  Branch (82:9): [True: 66.4k, False: 558k]
  ------------------
   83|  66.4k|        info->found = false;
   84|  66.4k|        info->had_equal = false;
   85|  66.4k|        info->invalid = false;
   86|  66.4k|    }
   87|       |
   88|       |    /* Ignore leading spaces */
   89|   786k|    for (c = *str; *c; c++) {
  ------------------
  |  Branch (89:20): [True: 737k, False: 49.3k]
  ------------------
   90|   737k|        if (!isspace((unsigned char)*c)) {
  ------------------
  |  Branch (90:13): [True: 575k, False: 161k]
  ------------------
   91|   575k|            break;
   92|   575k|        }
   93|   737k|    }
   94|       |
   95|       |    /* End of string or a bare newline means there is no token here, not an
   96|       |     * explicit empty token (""). Keep found=false in both cases; the newline
   97|       |     * branch also consumes the line boundary.
   98|       |     */
   99|   625k|    if (*c == '\0') {
  ------------------
  |  Branch (99:9): [True: 49.3k, False: 575k]
  ------------------
  100|  49.3k|        r = c;
  101|  49.3k|        goto out;
  102|  49.3k|    }
  103|   575k|    if (*c == '\n') {
  ------------------
  |  Branch (103:9): [True: 0, False: 575k]
  ------------------
  104|      0|        r = c;
  105|      0|        *c = '\0';
  106|      0|        c++;
  107|      0|        goto out;
  108|      0|    }
  109|       |
  110|   575k|    found = true;
  111|       |
  112|       |    /* Terminate on space, equal or newline.
  113|       |     * Embedded quotes are stripped and used to protect spaces from being
  114|       |     * seen as delimiters.
  115|       |     */
  116|   575k|    r = dst = c;
  117|  7.50M|    for (; *c; c++) {
  ------------------
  |  Branch (117:12): [True: 7.27M, False: 230k]
  ------------------
  118|       |        /* Process backslash escapes matching OpenSSH's argv_split():
  119|       |         * \\, \', \", and \<blank> are recognized. The backslash is
  120|       |         * dropped and the escaped character is kept. Unrecognized
  121|       |         * escapes preserve the backslash literally.
  122|       |         */
  123|  7.27M|        if (*c == '\\' &&
  ------------------
  |  Branch (123:13): [True: 25.8k, False: 7.24M]
  ------------------
  124|  25.8k|            (c[1] == '\\' || c[1] == '\'' || c[1] == '\"' ||
  ------------------
  |  Branch (124:14): [True: 9.52k, False: 16.3k]
  |  Branch (124:30): [True: 2.51k, False: 13.8k]
  |  Branch (124:46): [True: 2.22k, False: 11.6k]
  ------------------
  125|  25.8k|             isspace((unsigned char)c[1]))) {
  ------------------
  |  Branch (125:14): [True: 3.80k, False: 7.82k]
  ------------------
  126|  18.0k|            c++;
  127|  18.0k|            *dst++ = *c;
  128|  7.25M|        } else if (*c == '\n' || (!inquote && (isspace((unsigned char)*c) || *c == '='))) {
  ------------------
  |  Branch (128:20): [True: 0, False: 7.25M]
  |  Branch (128:35): [True: 6.89M, False: 361k]
  |  Branch (128:48): [True: 296k, False: 6.59M]
  |  Branch (128:78): [True: 49.0k, False: 6.54M]
  ------------------
  129|   345k|            had_equal = (*c == '=');
  130|   345k|            *dst = '\0';
  131|   345k|            c++;
  132|   345k|            break;
  133|  6.90M|        } else if (inquote) {
  ------------------
  |  Branch (133:20): [True: 361k, False: 6.54M]
  ------------------
  134|   361k|            if (*c == inquote) {
  ------------------
  |  Branch (134:17): [True: 8.25k, False: 353k]
  ------------------
  135|  8.25k|                inquote = '\0';
  136|   353k|            } else {
  137|   353k|                *dst++ = *c;
  138|   353k|            }
  139|  6.54M|        } else if (*c == '\'' || *c == '\"') {
  ------------------
  |  Branch (139:20): [True: 9.90k, False: 6.53M]
  |  Branch (139:34): [True: 16.4k, False: 6.52M]
  ------------------
  140|  26.3k|            inquote = *c;
  141|  6.52M|        } else {
  142|  6.52M|            *dst++ = *c;
  143|  6.52M|        }
  144|  7.27M|    }
  145|   575k|    if (inquote) {
  ------------------
  |  Branch (145:9): [True: 18.1k, False: 557k]
  ------------------
  146|  18.1k|        invalid = true;
  147|  18.1k|    }
  148|   575k|    if (*c == '\0') {
  ------------------
  |  Branch (148:9): [True: 233k, False: 342k]
  ------------------
  149|   233k|        *dst = '\0';
  150|   233k|    }
  151|       |
  152|       |    /* Skip any other remaining whitespace */
  153|   695k|    while (isspace((unsigned char)*c) || *c == '\n' ||
  ------------------
  |  Branch (153:12): [True: 116k, False: 579k]
  |  Branch (153:42): [True: 0, False: 579k]
  ------------------
  154|   579k|           (!had_equal && *c == '=')) {
  ------------------
  |  Branch (154:13): [True: 526k, False: 52.8k]
  |  Branch (154:27): [True: 3.76k, False: 523k]
  ------------------
  155|   119k|        if (*c == '=') {
  ------------------
  |  Branch (155:13): [True: 3.76k, False: 116k]
  ------------------
  156|  3.76k|            had_equal = true;
  157|  3.76k|        }
  158|   119k|        c++;
  159|   119k|    }
  160|   625k|out:
  161|   625k|    *str = c;
  162|   625k|    if (info != NULL) {
  ------------------
  |  Branch (162:9): [True: 66.4k, False: 558k]
  ------------------
  163|  66.4k|        info->found = found;
  164|  66.4k|        info->had_equal = had_equal;
  165|  66.4k|        info->invalid = invalid;
  166|  66.4k|    }
  167|   625k|    return r;
  168|   575k|}
ssh_config_get_token:
  171|   558k|{
  172|       |    return ssh_config_get_token_info(str, NULL);
  173|   558k|}
ssh_config_get_long:
  176|  6.69k|{
  177|  6.69k|    char *p = NULL, *endp = NULL;
  178|  6.69k|    long i;
  179|       |
  180|  6.69k|    p = ssh_config_get_token(str);
  181|  6.69k|    if (p && *p) {
  ------------------
  |  Branch (181:9): [True: 6.69k, False: 0]
  |  Branch (181:14): [True: 6.07k, False: 618]
  ------------------
  182|  6.07k|        i = strtol(p, &endp, 10);
  183|  6.07k|        if (p == endp || *endp != '\0') {
  ------------------
  |  Branch (183:13): [True: 674, False: 5.40k]
  |  Branch (183:26): [True: 1.41k, False: 3.98k]
  ------------------
  184|  2.08k|            return notfound;
  185|  2.08k|        }
  186|  3.98k|        return i;
  187|  6.07k|    }
  188|       |
  189|    618|    return notfound;
  190|  6.69k|}
ssh_config_get_str_tok:
  193|   155k|{
  194|   155k|    char *p = NULL;
  195|       |
  196|   155k|    p = ssh_config_get_token(str);
  197|   155k|    if (p && *p) {
  ------------------
  |  Branch (197:9): [True: 155k, False: 0]
  |  Branch (197:14): [True: 122k, False: 32.6k]
  ------------------
  198|   122k|        return p;
  199|   122k|    }
  200|       |
  201|  32.6k|    return def;
  202|   155k|}
ssh_config_get_yesno:
  205|  5.25k|{
  206|  5.25k|    const char *p = NULL;
  207|       |
  208|  5.25k|    p = ssh_config_get_str_tok(str, NULL);
  209|  5.25k|    if (p == NULL) {
  ------------------
  |  Branch (209:9): [True: 2.06k, False: 3.19k]
  ------------------
  210|  2.06k|        return notfound;
  211|  2.06k|    }
  212|       |
  213|  3.19k|    {
  214|  3.19k|        int is_yes = (strcasecmp(p, "yes") == 0);
  215|  3.19k|        int is_true = (strcasecmp(p, "true") == 0);
  216|  3.19k|        if (is_yes || is_true) {
  ------------------
  |  Branch (216:13): [True: 377, False: 2.81k]
  |  Branch (216:23): [True: 1.10k, False: 1.71k]
  ------------------
  217|  1.48k|            return 1;
  218|  1.71k|        } else {
  219|  1.71k|            int is_no = (strcasecmp(p, "no") == 0);
  220|  1.71k|            int is_false = (strcasecmp(p, "false") == 0);
  221|  1.71k|            if (is_no || is_false) {
  ------------------
  |  Branch (221:17): [True: 137, False: 1.57k]
  |  Branch (221:26): [True: 280, False: 1.29k]
  ------------------
  222|    417|                return 0;
  223|    417|            }
  224|  1.71k|        }
  225|       |
  226|  3.19k|    }
  227|       |
  228|  1.29k|    return notfound;
  229|  3.19k|}
ssh_config_parse_uri:
  237|  5.66k|{
  238|  5.66k|    const char *endp = NULL;
  239|  5.66k|    long port_n;
  240|  5.66k|    int rc;
  241|       |
  242|       |    /* Sanitize inputs */
  243|  5.66k|    if (username != NULL) {
  ------------------
  |  Branch (243:9): [True: 797, False: 4.86k]
  ------------------
  244|    797|        *username = NULL;
  245|    797|    }
  246|  5.66k|    if (hostname != NULL) {
  ------------------
  |  Branch (246:9): [True: 1.37k, False: 4.29k]
  ------------------
  247|  1.37k|        *hostname = NULL;
  248|  1.37k|    }
  249|  5.66k|    if (port != NULL) {
  ------------------
  |  Branch (249:9): [True: 224, False: 5.44k]
  ------------------
  250|    224|        *port = NULL;
  251|    224|    }
  252|       |
  253|       |    /* Username part (optional) */
  254|  5.66k|    endp = strrchr(tok, '@');
  255|  5.66k|    if (endp != NULL) {
  ------------------
  |  Branch (255:9): [True: 817, False: 4.84k]
  ------------------
  256|       |        /* Zero-length username is not valid */
  257|    817|        if (tok == endp) {
  ------------------
  |  Branch (257:13): [True: 1, False: 816]
  ------------------
  258|      1|            goto error;
  259|      1|        }
  260|    816|        if (username != NULL) {
  ------------------
  |  Branch (260:13): [True: 81, False: 735]
  ------------------
  261|     81|            *username = strndup(tok, endp - tok);
  262|     81|            if (*username == NULL) {
  ------------------
  |  Branch (262:17): [True: 0, False: 81]
  ------------------
  263|      0|                goto error;
  264|      0|            }
  265|     81|            rc = ssh_check_username_syntax(*username);
  266|     81|            if (rc != SSH_OK) {
  ------------------
  |  |  315|     81|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (266:17): [True: 2, False: 79]
  ------------------
  267|      2|                goto error;
  268|      2|            }
  269|     81|        }
  270|    814|        tok = endp + 1;
  271|       |        /* If there is second @ character, this does not look like our URI */
  272|    814|        endp = strchr(tok, '@');
  273|    814|        if (endp != NULL) {
  ------------------
  |  Branch (273:13): [True: 0, False: 814]
  ------------------
  274|      0|            goto error;
  275|      0|        }
  276|    814|    }
  277|       |
  278|       |    /* Hostname */
  279|  5.66k|    if (*tok == '[') {
  ------------------
  |  Branch (279:9): [True: 336, False: 5.32k]
  ------------------
  280|       |        /* IPv6 address is enclosed with square brackets */
  281|    336|        tok++;
  282|    336|        endp = strchr(tok, ']');
  283|    336|        if (endp == NULL) {
  ------------------
  |  Branch (283:13): [True: 1, False: 335]
  ------------------
  284|      1|            goto error;
  285|      1|        }
  286|  5.32k|    } else if (!ignore_port) {
  ------------------
  |  Branch (286:16): [True: 4.18k, False: 1.14k]
  ------------------
  287|       |        /* Hostnames or aliases expand to the last colon (if port is requested)
  288|       |         * or to the end */
  289|  4.18k|        endp = strrchr(tok, ':');
  290|  4.18k|        if (endp == NULL) {
  ------------------
  |  Branch (290:13): [True: 3.48k, False: 695]
  ------------------
  291|  3.48k|            endp = strchr(tok, '\0');
  292|  3.48k|        }
  293|  4.18k|    } else {
  294|       |        /* If no port is requested, expand to the end of line
  295|       |         * (to accommodate the IPv6 addresses) */
  296|  1.14k|        endp = strchr(tok, '\0');
  297|  1.14k|    }
  298|  5.66k|    if (tok == endp) {
  ------------------
  |  Branch (298:9): [True: 1, False: 5.66k]
  ------------------
  299|       |        /* Zero-length hostnames are not valid */
  300|      1|        goto error;
  301|      1|    }
  302|  5.66k|    if (hostname != NULL) {
  ------------------
  |  Branch (302:9): [True: 1.36k, False: 4.29k]
  ------------------
  303|  1.36k|        *hostname = strndup(tok, endp - tok);
  304|  1.36k|        if (*hostname == NULL) {
  ------------------
  |  Branch (304:13): [True: 0, False: 1.36k]
  ------------------
  305|      0|            goto error;
  306|      0|        }
  307|  1.36k|        if (strict) {
  ------------------
  |  Branch (307:13): [True: 573, False: 793]
  ------------------
  308|       |            /* if not an ip, check syntax */
  309|    573|            rc = ssh_is_ipaddr(*hostname);
  310|    573|            if (rc == 0) {
  ------------------
  |  Branch (310:17): [True: 573, False: 0]
  ------------------
  311|    573|                rc = ssh_check_hostname_syntax(*hostname);
  312|    573|                if (rc != SSH_OK) {
  ------------------
  |  |  315|    573|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (312:21): [True: 0, False: 573]
  ------------------
  313|      0|                    goto error;
  314|      0|                }
  315|    573|            }
  316|    793|        } else {
  317|       |            /* Reject shell metacharacters to allow config aliases with
  318|       |             * non-RFC1035 chars (e.g. %, _). Modeled on OpenSSH's
  319|       |             * valid_hostname() in ssh.c. */
  320|    793|            const char *c = NULL;
  321|    793|            if ((*hostname)[0] == '-') {
  ------------------
  |  Branch (321:17): [True: 0, False: 793]
  ------------------
  322|      0|                goto error;
  323|      0|            }
  324|  8.78k|            for (c = *hostname; *c != '\0'; c++) {
  ------------------
  |  Branch (324:33): [True: 7.99k, False: 789]
  ------------------
  325|  7.99k|                const char *is_meta = strchr(SSH_DANGEROUS_SHELL_CHARS, *c);
  ------------------
  |  |  260|  7.99k|#define SSH_DANGEROUS_SHELL_CHARS "'`\";&<>|(){}$\\,"
  ------------------
  326|  7.99k|                int is_space = isspace((unsigned char)*c);
  327|  7.99k|                int is_ctrl = iscntrl((unsigned char)*c);
  328|  7.99k|                if (is_meta != NULL || is_space || is_ctrl) {
  ------------------
  |  Branch (328:21): [True: 1, False: 7.99k]
  |  Branch (328:40): [True: 0, False: 7.99k]
  |  Branch (328:52): [True: 3, False: 7.98k]
  ------------------
  329|      4|                    goto error;
  330|      4|                }
  331|  7.99k|            }
  332|    793|        }
  333|  1.36k|    }
  334|       |    /* Skip also the closing bracket */
  335|  5.65k|    if (*endp == ']') {
  ------------------
  |  Branch (335:9): [True: 335, False: 5.32k]
  ------------------
  336|    335|        endp++;
  337|    335|    }
  338|       |
  339|       |    /* Port (optional) */
  340|  5.65k|    if (*endp != '\0') {
  ------------------
  |  Branch (340:9): [True: 696, False: 4.96k]
  ------------------
  341|    696|        char *port_end = NULL;
  342|       |
  343|       |        /* Verify the port is valid positive number */
  344|    696|        port_n = strtol(endp + 1, &port_end, 10);
  345|    696|        if (port_n < 1 || *port_end != '\0') {
  ------------------
  |  Branch (345:13): [True: 9, False: 687]
  |  Branch (345:27): [True: 4, False: 683]
  ------------------
  346|     13|            SSH_LOG(SSH_LOG_TRACE, "Failed to parse port number."
  ------------------
  |  |  283|     13|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  347|     13|                    " The value '%ld' is invalid or there are some"
  348|     13|                    " trailing characters: '%s'", port_n, port_end);
  349|     13|            goto error;
  350|     13|        }
  351|    683|        if (port != NULL) {
  ------------------
  |  Branch (351:13): [True: 15, False: 668]
  ------------------
  352|     15|            *port = strdup(endp + 1);
  353|     15|            if (*port == NULL) {
  ------------------
  |  Branch (353:17): [True: 0, False: 15]
  ------------------
  354|      0|                goto error;
  355|      0|            }
  356|     15|        }
  357|    683|    }
  358|       |
  359|  5.64k|    return SSH_OK;
  ------------------
  |  |  315|  5.64k|#define SSH_OK 0     /* No error */
  ------------------
  360|       |
  361|     22|error:
  362|     22|    if (username != NULL) {
  ------------------
  |  Branch (362:9): [True: 16, False: 6]
  ------------------
  363|     16|        SAFE_FREE(*username);
  ------------------
  |  |  375|     16|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 3, False: 13]
  |  |  |  Branch (375:71): [Folded, False: 16]
  |  |  ------------------
  ------------------
  364|     16|    }
  365|     22|    if (hostname != NULL) {
  ------------------
  |  Branch (365:9): [True: 16, False: 6]
  ------------------
  366|     16|        SAFE_FREE(*hostname);
  ------------------
  |  |  375|     16|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 12, False: 4]
  |  |  |  Branch (375:71): [Folded, False: 16]
  |  |  ------------------
  ------------------
  367|     16|    }
  368|     22|    if (port != NULL) {
  ------------------
  |  Branch (368:9): [True: 16, False: 6]
  ------------------
  369|     16|        SAFE_FREE(*port);
  ------------------
  |  |  375|     16|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 16]
  |  |  |  Branch (375:71): [Folded, False: 16]
  |  |  ------------------
  ------------------
  370|     16|    }
  371|     22|    return SSH_ERROR;
  ------------------
  |  |  316|     22|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  372|  5.65k|}
ssh_config_get_path:
  388|  13.0k|{
  389|  13.0k|    char *c = *str;
  390|  13.0k|    char *r = NULL;
  391|  13.0k|    char *out = NULL;
  392|  13.0k|    char delimiter;
  393|  13.0k|    bool in_double_quote = false;
  394|  13.0k|    bool in_single_quote = false;
  395|       |
  396|       |    /* Skip leading spaces */
  397|  13.0k|    while (isblank((unsigned char)*c)) {
  ------------------
  |  Branch (397:12): [True: 0, False: 13.0k]
  ------------------
  398|      0|        c++;
  399|      0|    }
  400|       |
  401|  13.0k|    if (*c == '\0' || *c == '\n' || *c == '#') {
  ------------------
  |  Branch (401:9): [True: 1.82k, False: 11.2k]
  |  Branch (401:23): [True: 0, False: 11.2k]
  |  Branch (401:37): [True: 159, False: 11.0k]
  ------------------
  402|  1.98k|        *str = c;
  403|  1.98k|        return NULL;
  404|  1.98k|    }
  405|       |
  406|  11.0k|    r = out = c;
  407|       |
  408|   403k|    for (; *c != '\0' && *c != '\n'; c++) {
  ------------------
  |  Branch (408:12): [True: 396k, False: 6.82k]
  |  Branch (408:26): [True: 396k, False: 0]
  ------------------
  409|   396k|        bool in_quotes = in_single_quote || in_double_quote;
  ------------------
  |  Branch (409:26): [True: 62.6k, False: 333k]
  |  Branch (409:45): [True: 102k, False: 230k]
  ------------------
  410|       |
  411|   396k|        if (*c == '\\') {
  ------------------
  |  Branch (411:13): [True: 12.2k, False: 384k]
  ------------------
  412|       |            /* If we encounter an escape character, check if it's escaping something meaningful */
  413|  12.2k|            if (c[1] == '\'' || c[1] == '\"' || c[1] == '\\' ||
  ------------------
  |  Branch (413:17): [True: 3.15k, False: 9.09k]
  |  Branch (413:33): [True: 1.59k, False: 7.49k]
  |  Branch (413:49): [True: 586, False: 6.91k]
  ------------------
  414|  6.91k|                (!in_quotes && isblank((unsigned char)c[1]))) {
  ------------------
  |  Branch (414:18): [True: 4.63k, False: 2.27k]
  |  Branch (414:32): [True: 920, False: 3.71k]
  ------------------
  415|  6.25k|                c++; /* Skip the escape character */
  416|  6.25k|            }
  417|   384k|        } else if ((in_single_quote && *c == '\'') || (in_double_quote && *c == '\"')) {
  ------------------
  |  Branch (417:21): [True: 59.2k, False: 324k]
  |  Branch (417:40): [True: 1.17k, False: 58.0k]
  |  Branch (417:56): [True: 100k, False: 282k]
  |  Branch (417:75): [True: 7.25k, False: 93.4k]
  ------------------
  418|       |            /* Closing quote */
  419|  8.42k|            in_single_quote = false;
  420|  8.42k|            in_double_quote = false;
  421|  8.42k|            continue;
  422|   375k|        } else if (!in_quotes) {
  ------------------
  |  Branch (422:20): [True: 224k, False: 151k]
  ------------------
  423|       |            /* We are outside of quotes - handle opening quotes and token boundaries */
  424|   224k|            if (isblank((unsigned char)*c)) {
  ------------------
  |  Branch (424:17): [True: 4.21k, False: 219k]
  ------------------
  425|  4.21k|                break; /* Space means we've reached the end of the token */
  426|   219k|            } else if (*c == '\'' || *c == '\"') {
  ------------------
  |  Branch (426:24): [True: 2.39k, False: 217k]
  |  Branch (426:38): [True: 8.82k, False: 208k]
  ------------------
  427|  11.2k|                if (*c == '\'') {
  ------------------
  |  Branch (427:21): [True: 2.39k, False: 8.82k]
  ------------------
  428|  2.39k|                    in_single_quote = true;
  429|  8.82k|                } else {
  430|  8.82k|                    in_double_quote = true;
  431|  8.82k|                }
  432|  11.2k|                continue; /* Skip the opening quote character itself */
  433|  11.2k|            }
  434|   224k|        }
  435|       |
  436|       |        /* Everything else (regular characters, and literal characters inside quotes) 
  437|       |         * gets appended to the token */
  438|   372k|        *out++ = *c;
  439|   372k|    }
  440|       |
  441|       |    /* Return NULL on unclosed quotes */
  442|  11.0k|    if (in_double_quote || in_single_quote) {
  ------------------
  |  Branch (442:9): [True: 1.57k, False: 9.46k]
  |  Branch (442:28): [True: 1.21k, False: 8.25k]
  ------------------
  443|  2.79k|        return NULL;
  444|  2.79k|    }
  445|       |
  446|  8.25k|    delimiter = *c;
  447|  8.25k|    *out = '\0';
  448|       |
  449|       |    /* Move past the delimiter for the next time this is called */
  450|  8.25k|    if (delimiter != '\0' && delimiter != '\n' && delimiter != '#') {
  ------------------
  |  Branch (450:9): [True: 4.21k, False: 4.03k]
  |  Branch (450:30): [True: 4.21k, False: 0]
  |  Branch (450:51): [True: 4.21k, False: 0]
  ------------------
  451|  4.21k|        c++;
  452|  4.21k|    }
  453|       |
  454|       |    /* Skip any trailing whitespace as well */
  455|  8.25k|    while (isblank((unsigned char)*c)) {
  ------------------
  |  Branch (455:12): [True: 351, False: 8.25k]
  ------------------
  456|    351|        c++;
  457|    351|    }
  458|       |
  459|  8.25k|    *str = c;
  460|  8.25k|    return r;
  461|  11.0k|}

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;
  ------------------
  |  |  315|      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;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  273|      2|}

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

_ssh_set_error:
   55|    907|{
   56|    907|    struct ssh_common_struct *err = error;
   57|    907|    va_list va;
   58|       |
   59|    907|    va_start(va, descr);
   60|    907|    vsnprintf(err->error.error_buffer, ERROR_BUFFERLEN, descr, va);
  ------------------
  |  |  219|    907|#define ERROR_BUFFERLEN 1024
  ------------------
   61|    907|    va_end(va);
   62|       |
   63|    907|    err->error.error_code = code;
   64|    907|    if (ssh_get_log_level() == SSH_LOG_TRACE) {
  ------------------
  |  |  362|    907|#define SSH_LOG_TRACE 4
  ------------------
  |  Branch (64:9): [True: 0, False: 907]
  ------------------
   65|      0|        ssh_log_function(SSH_LOG_TRACE,
  ------------------
  |  |  362|      0|#define SSH_LOG_TRACE 4
  ------------------
   66|      0|                         function,
   67|      0|                         err->error.error_buffer);
   68|      0|    }
   69|    907|}
_ssh_set_error_oom:
   81|    152|{
   82|    152|    struct error_struct *err = error;
   83|       |
   84|    152|    snprintf(err->error_buffer, sizeof(err->error_buffer),
   85|    152|            "%s: Out of memory", function);
   86|    152|    err->error_code = SSH_FATAL;
   87|    152|}
_ssh_set_error_invalid:
  100|    733|{
  101|    733|    _ssh_set_error(error, SSH_FATAL, function,
  102|    733|                   "Invalid argument in %s", function);
  103|    733|}
ssh_reset_error:
  113|     94|{
  114|     94|    struct ssh_common_struct *err = error;
  115|       |
  116|     94|    ZERO_STRUCT(err->error.error_buffer);
  ------------------
  |  |  378|     94|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  117|     94|    err->error.error_code = 0;
  118|     94|}
ssh_get_error_code:
  147|     94|int ssh_get_error_code(void *error) {
  148|     94|  struct error_struct *err = error;
  149|       |
  150|     94|  return err->error_code;
  151|     94|}

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

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|     94|{
  318|     94|    if (type >= SSH_KEX_METHODS) {
  ------------------
  |  |   27|     94|#define SSH_KEX_METHODS 10
  ------------------
  |  Branch (318:9): [True: 0, False: 94]
  ------------------
  319|      0|        return NULL;
  320|      0|    }
  321|       |
  322|     94|    return ssh_kex_descriptions[type];
  323|     94|}
ssh_keep_known_algos:
 1324|    128|{
 1325|    128|    if (algo > SSH_LANG_S_C) {
  ------------------
  |  Branch (1325:9): [True: 0, False: 128]
  ------------------
 1326|      0|        return NULL;
 1327|      0|    }
 1328|       |
 1329|    128|    return ssh_find_all_matching(supported_methods[algo], list);
 1330|    128|}
ssh_add_to_default_algos:
 1368|    215|{
 1369|    215|    char *tmp = NULL, *ret = NULL;
 1370|       |
 1371|    215|    if (algo > SSH_LANG_S_C || list == NULL || list[0] == '\0') {
  ------------------
  |  Branch (1371:9): [True: 0, False: 215]
  |  Branch (1371:32): [True: 0, False: 215]
  |  Branch (1371:48): [True: 8, False: 207]
  ------------------
 1372|      8|        return NULL;
 1373|      8|    }
 1374|       |
 1375|    207|    if (ssh_fips_mode()) {
  ------------------
  |  |  117|    207|#define ssh_fips_mode() EVP_default_properties_is_fips_enabled(NULL)
  |  |  ------------------
  |  |  |  Branch (117:25): [True: 0, False: 207]
  |  |  ------------------
  ------------------
 1376|      0|        tmp = ssh_append_without_duplicates(fips_methods[algo], list);
 1377|      0|        ret = ssh_find_all_matching(fips_methods[algo], tmp);
 1378|    207|    } else {
 1379|    207|        tmp = ssh_append_without_duplicates(default_methods[algo], list);
 1380|    207|        ret = ssh_find_all_matching(supported_methods[algo], tmp);
 1381|    207|    }
 1382|       |
 1383|    207|    free(tmp);
 1384|    207|    return ret;
 1385|    215|}
ssh_remove_from_default_algos:
 1401|     55|{
 1402|     55|    if (algo > SSH_LANG_S_C) {
  ------------------
  |  Branch (1402:9): [True: 0, False: 55]
  ------------------
 1403|      0|        return NULL;
 1404|      0|    }
 1405|       |
 1406|     55|    if (list == NULL || list[0] == '\0') {
  ------------------
  |  Branch (1406:9): [True: 0, False: 55]
  |  Branch (1406:25): [True: 0, False: 55]
  ------------------
 1407|      0|        if (ssh_fips_mode()) {
  ------------------
  |  |  117|      0|#define ssh_fips_mode() EVP_default_properties_is_fips_enabled(NULL)
  |  |  ------------------
  |  |  |  Branch (117: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|     55|    if (ssh_fips_mode()) {
  ------------------
  |  |  117|     55|#define ssh_fips_mode() EVP_default_properties_is_fips_enabled(NULL)
  |  |  ------------------
  |  |  |  Branch (117:25): [True: 0, False: 55]
  |  |  ------------------
  ------------------
 1415|      0|        return ssh_remove_all_matching(fips_methods[algo], list);
 1416|     55|    } else {
 1417|     55|        return ssh_remove_all_matching(default_methods[algo], list);
 1418|     55|    }
 1419|     55|}
ssh_prefix_default_algos:
 1439|     47|{
 1440|     47|    char *ret = NULL, *tmp = NULL;
 1441|       |
 1442|     47|    if (algo > SSH_LANG_S_C || list == NULL || list[0] == '\0') {
  ------------------
  |  Branch (1442:9): [True: 0, False: 47]
  |  Branch (1442:32): [True: 0, False: 47]
  |  Branch (1442:48): [True: 0, False: 47]
  ------------------
 1443|      0|        return NULL;
 1444|      0|    }
 1445|       |
 1446|     47|    if (ssh_fips_mode()) {
  ------------------
  |  |  117|     47|#define ssh_fips_mode() EVP_default_properties_is_fips_enabled(NULL)
  |  |  ------------------
  |  |  |  Branch (117:25): [True: 0, False: 47]
  |  |  ------------------
  ------------------
 1447|      0|        tmp = ssh_prefix_without_duplicates(fips_methods[algo], list);
 1448|      0|        ret = ssh_find_all_matching(fips_methods[algo], tmp);
 1449|     47|    } else {
 1450|     47|        tmp = ssh_prefix_without_duplicates(default_methods[algo], list);
 1451|     47|        ret = ssh_find_all_matching(supported_methods[algo], tmp);
 1452|     47|    }
 1453|       |
 1454|     47|    free(tmp);
 1455|     47|    return ret;
 1456|     47|}

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

ssh_log_function:
  125|   882k|{
  126|   882k|    ssh_logging_callback log_fn = ssh_get_log_callback();
  127|       |
  128|   882k|    if (log_fn) {
  ------------------
  |  Branch (128:9): [True: 0, False: 882k]
  ------------------
  129|      0|        ssh_log_custom(log_fn, verbosity, function, buffer);
  130|      0|        return;
  131|      0|    }
  132|       |
  133|   882k|    ssh_log_stderr(verbosity, function, buffer);
  134|   882k|}
ssh_vlog:
  149|   882k|{
  150|   882k|    char buffer[LOG_SIZE];
  151|       |
  152|   882k|    vsnprintf(buffer, sizeof(buffer), format, *va);
  153|   882k|    ssh_log_function(verbosity, function, buffer);
  154|   882k|}
_ssh_log:
  168|   904k|{
  169|   904k|    va_list va;
  170|       |
  171|   904k|    if (verbosity <= ssh_get_log_level()) {
  ------------------
  |  Branch (171:9): [True: 882k, False: 21.9k]
  ------------------
  172|   882k|        va_start(va, format);
  173|   882k|        ssh_vlog(verbosity, function, format, &va);
  174|       |        va_end(va);
  175|   882k|    }
  176|   904k|}
ssh_set_log_level:
  237|      2|int ssh_set_log_level(int level) {
  238|      2|  if (level < 0) {
  ------------------
  |  Branch (238:7): [True: 0, False: 2]
  ------------------
  239|      0|    return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  240|      0|  }
  241|       |
  242|      2|  ssh_log_level = level;
  243|       |
  244|      2|  return SSH_OK;
  ------------------
  |  |  315|      2|#define SSH_OK 0     /* No error */
  ------------------
  245|      2|}
ssh_get_log_level:
  252|   905k|int ssh_get_log_level(void) {
  253|   905k|  return ssh_log_level;
  254|   905k|}
ssh_get_log_callback:
  275|   883k|ssh_logging_callback ssh_get_log_callback(void) {
  276|   883k|  return ssh_log_cb;
  277|   883k|}
log.c:ssh_log_stderr:
   87|   882k|{
   88|   882k|    char date[128] = {0};
   89|   882k|    int rc;
   90|       |
   91|   882k|    rc = current_timestring(1, date, sizeof(date));
   92|   882k|    if (rc == 0) {
  ------------------
  |  Branch (92:9): [True: 882k, False: 0]
  ------------------
   93|   882k|        fprintf(stderr, "[%s, %d] %s:", date, verbosity, function);
   94|   882k|    } else {
   95|      0|        fprintf(stderr, "[%d] %s", verbosity, function);
   96|      0|    }
   97|       |
   98|       |    fprintf(stderr, "  %s\n", buffer);
   99|   882k|}
log.c:current_timestring:
   59|   882k|{
   60|   882k|    char tbuf[64];
   61|   882k|    struct timeval tv;
   62|   882k|    struct tm tm, *tm_ptr = NULL;
   63|   882k|    time_t t;
   64|       |
   65|   882k|    gettimeofday(&tv, NULL);
   66|   882k|    t = (time_t) tv.tv_sec;
   67|       |
   68|   882k|    tm_ptr = localtime_r(&t, &tm);
   69|   882k|    if (tm_ptr == NULL) {
  ------------------
  |  Branch (69:9): [True: 0, False: 882k]
  ------------------
   70|      0|        return -1;
   71|      0|    }
   72|       |
   73|   882k|    if (hires) {
  ------------------
  |  Branch (73:9): [True: 882k, False: 0]
  ------------------
   74|   882k|        strftime(tbuf, sizeof(tbuf), "%Y/%m/%d %H:%M:%S", &tm);
   75|   882k|        snprintf(buf, len, "%s.%06ld", tbuf, (long)tv.tv_usec);
   76|   882k|    } else {
   77|      0|        strftime(tbuf, sizeof(tbuf), "%Y/%m/%d %H:%M:%S", &tm);
   78|      0|        snprintf(buf, len, "%s", tbuf);
   79|      0|    }
   80|       |
   81|   882k|    return 0;
   82|   882k|}

match_pattern_list:
  129|  38.2k|    size_t len, int dolower) {
  130|  38.2k|  char sub[1024];
  131|  38.2k|  int negated;
  132|  38.2k|  int got_positive;
  133|  38.2k|  size_t i, subi;
  134|       |
  135|  38.2k|  got_positive = 0;
  136|  93.5k|  for (i = 0; i < len;) {
  ------------------
  |  Branch (136:15): [True: 58.3k, False: 35.2k]
  ------------------
  137|       |    /* Check if the subpattern is negated. */
  138|  58.3k|    if (pattern[i] == '!') {
  ------------------
  |  Branch (138:9): [True: 8.34k, False: 49.9k]
  ------------------
  139|  8.34k|      negated = 1;
  140|  8.34k|      i++;
  141|  49.9k|    } else {
  142|  49.9k|      negated = 0;
  143|  49.9k|    }
  144|       |
  145|       |    /*
  146|       |     * Extract the subpattern up to a comma or end.  Convert the
  147|       |     * subpattern to lowercase.
  148|       |     */
  149|  58.3k|    for (subi = 0;
  150|   396k|        i < len && subi < sizeof(sub) - 1 && pattern[i] != ',';
  ------------------
  |  Branch (150:9): [True: 359k, False: 37.3k]
  |  Branch (150:20): [True: 359k, False: 0]
  |  Branch (150:46): [True: 338k, False: 20.9k]
  ------------------
  151|   338k|        subi++, i++) {
  152|   338k|      sub[subi] = dolower && isupper(pattern[i]) ?
  ------------------
  |  Branch (152:19): [True: 287k, False: 51.4k]
  |  Branch (152:30): [True: 15.6k, False: 271k]
  ------------------
  153|   322k|        (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: 15.6k]
  ------------------
  154|   338k|    }
  155|       |
  156|       |    /* If subpattern too long, return failure (no match). */
  157|  58.3k|    if (subi >= sizeof(sub) - 1) {
  ------------------
  |  Branch (157:9): [True: 0, False: 58.3k]
  ------------------
  158|      0|      return 0;
  159|      0|    }
  160|       |
  161|       |    /* If the subpattern was terminated by a comma, skip the comma. */
  162|  58.3k|    if (i < len && pattern[i] == ',') {
  ------------------
  |  Branch (162:9): [True: 20.9k, False: 37.3k]
  |  Branch (162:20): [True: 20.9k, False: 0]
  ------------------
  163|  20.9k|      i++;
  164|  20.9k|    }
  165|       |
  166|       |    /* Null-terminate the subpattern. */
  167|  58.3k|    sub[subi] = '\0';
  168|       |
  169|       |    /* Try to match the subpattern against the string. */
  170|  58.3k|    if (match_pattern(string, sub)) {
  ------------------
  |  Branch (170:9): [True: 11.0k, False: 47.2k]
  ------------------
  171|  11.0k|      if (negated) {
  ------------------
  |  Branch (171:11): [True: 2.99k, False: 8.02k]
  ------------------
  172|  2.99k|        return -1;        /* Negative */
  173|  8.02k|      } else {
  174|  8.02k|        got_positive = 1; /* Positive */
  175|  8.02k|      }
  176|  11.0k|    }
  177|  58.3k|  }
  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|  35.2k|  return got_positive;
  184|  38.2k|}
match_hostname:
  195|  34.1k|{
  196|  34.1k|    return match_pattern_list(host, pattern, len, 1);
  197|  34.1k|}
match_cidr_address_list:
  367|      4|{
  368|      4|    char *list = NULL, *cp = NULL, *a = NULL, *b = NULL, *sp = NULL;
  369|      4|    char addr_buffer[64], addr[NI_MAXHOST];
  370|      4|    struct in_addr try_addr, match_addr;
  371|      4|    struct in6_addr try_addr6, match_addr6;
  372|      4|    unsigned long mask_len;
  373|      4|    size_t addr_len, tmp_len;
  374|      4|    int rc = 0, r, ai_family;
  375|       |
  376|      4|    ZERO_STRUCT(try_addr);
  ------------------
  |  |  378|      4|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  377|      4|    ZERO_STRUCT(try_addr6);
  ------------------
  |  |  378|      4|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  378|      4|    ZERO_STRUCT(match_addr);
  ------------------
  |  |  378|      4|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  379|      4|    ZERO_STRUCT(match_addr6);
  ------------------
  |  |  378|      4|#define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
  ------------------
  380|       |
  381|      4|    if (sa_family != AF_INET && sa_family != AF_INET6 && sa_family != -1) {
  ------------------
  |  Branch (381:9): [True: 4, False: 0]
  |  Branch (381:33): [True: 4, False: 0]
  |  Branch (381:58): [True: 0, False: 4]
  ------------------
  382|      0|        SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|      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|      4|    if (address != NULL) {
  ------------------
  |  Branch (388:9): [True: 0, False: 4]
  ------------------
  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,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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|      4|    b = list = strdup(addrlist);
  443|      4|    if (b == NULL) {
  ------------------
  |  Branch (443:9): [True: 0, False: 4]
  ------------------
  444|      0|        return -1;
  445|      0|    }
  446|       |
  447|      4|    while ((cp = strsep(&list, ",")) != NULL) {
  ------------------
  |  Branch (447:12): [True: 4, False: 0]
  ------------------
  448|      4|        if (*cp == '\0') {
  ------------------
  |  Branch (448:13): [True: 0, False: 4]
  ------------------
  449|      0|            SSH_LOG(SSH_LOG_TRACE, "Empty entry in list \"%.100s\"", b);
  ------------------
  |  |  283|      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|      4|        addr_len = strlen(cp);
  464|      4|        if (addr_len > INET6_ADDRSTRLEN + 3) {
  ------------------
  |  Branch (464:13): [True: 1, False: 3]
  ------------------
  465|      1|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  466|      1|                    "List entry \"%.100s\" too long: %zu > %d (MAX ALLOWED)",
  467|      1|                    cp,
  468|      1|                    addr_len,
  469|      1|                    INET6_ADDRSTRLEN + 3);
  470|      1|            rc = -1;
  471|      1|            break;
  472|      1|        }
  473|       |
  474|      3|#define VALID_CIDR_CHARS "0123456789abcdefABCDEF.:/"
  475|      3|        tmp_len = strspn(cp, VALID_CIDR_CHARS);
  ------------------
  |  |  474|      3|#define VALID_CIDR_CHARS "0123456789abcdefABCDEF.:/"
  ------------------
  476|      3|        if (tmp_len != addr_len) {
  ------------------
  |  Branch (476:13): [True: 1, False: 2]
  ------------------
  477|      1|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  478|      1|                    "List entry \"%.100s\" contains invalid characters "
  479|      1|                    "-> \"%c\" is an invalid character",
  480|      1|                    cp,
  481|      1|                    cp[tmp_len]);
  482|      1|            rc = -1;
  483|      1|            break;
  484|      1|        }
  485|      2|#undef VALID_CIDR_CHARS
  486|       |
  487|      2|        strlcpy(addr_buffer, cp, sizeof(addr_buffer));
  488|      2|        sp = strchr(addr_buffer, '/');
  489|      2|        if (sp != NULL) {
  ------------------
  |  Branch (489:13): [True: 2, False: 0]
  ------------------
  490|      2|            *sp = '\0';
  491|      2|            sp++;
  492|      2|            mask_len = strtoul(sp, &cp, 10);
  493|      2|            if (*sp < '0' || *sp > '9' || *cp != '\0') {
  ------------------
  |  Branch (493:17): [True: 0, False: 2]
  |  Branch (493:30): [True: 0, False: 2]
  |  Branch (493:43): [True: 1, False: 1]
  ------------------
  494|      1|                SSH_LOG(SSH_LOG_TRACE, "Error while parsing prefix: %s", sp);
  ------------------
  |  |  283|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  495|      1|                rc = -1;
  496|      1|                break;
  497|      1|            }
  498|      1|            if (mask_len > 128) {
  ------------------
  |  Branch (498:17): [True: 1, False: 0]
  ------------------
  499|      1|                SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|      1|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  500|      1|                        "Invalid prefix: %lu exceeds the maximum allowed "
  501|      1|                        "(>128)",
  502|      1|                        mask_len);
  503|      1|                rc = -1;
  504|      1|                break;
  505|      1|            }
  506|      1|        } else {
  507|      0|            SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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,
  ------------------
  |  |  283|      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|      4|    SAFE_FREE(b);
  ------------------
  |  |  375|      4|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 4, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 4]
  |  |  ------------------
  ------------------
  568|       |
  569|      4|    return rc;
  570|      4|}
match.c:match_pattern:
   68|  58.3k|{
   69|  58.3k|    const char *s_star = NULL; /* Position in s when last `*` was met */
   70|  58.3k|    const char *p_star = NULL; /* Position in pattern after last `*` */
   71|       |
   72|  58.3k|    if (s == NULL || pattern == NULL) {
  ------------------
  |  Branch (72:9): [True: 363, False: 57.9k]
  |  Branch (72:22): [True: 0, False: 57.9k]
  ------------------
   73|    363|        return 0;
   74|    363|    }
   75|       |
   76|   262k|    while (*s) {
  ------------------
  |  Branch (76:12): [True: 246k, False: 15.9k]
  ------------------
   77|       |        /* Case 1: Exact match or '?' wildcard */
   78|   246k|        if (*pattern == *s || *pattern == '?') {
  ------------------
  |  Branch (78:13): [True: 4.44k, False: 242k]
  |  Branch (78:31): [True: 933, False: 241k]
  ------------------
   79|  5.37k|            s++;
   80|  5.37k|            pattern++;
   81|  5.37k|            continue;
   82|  5.37k|        }
   83|       |
   84|       |        /* Case 2: '*' wildcard */
   85|   241k|        if (*pattern == '*') {
  ------------------
  |  Branch (85:13): [True: 26.8k, False: 214k]
  ------------------
   86|       |            /* Record the position of the star and the current string position.
   87|       |             * We optimistically assume * matches 0 characters first.
   88|       |             */
   89|  26.8k|            p_star = ++pattern;
   90|  26.8k|            s_star = s;
   91|  26.8k|            continue;
   92|  26.8k|        }
   93|       |
   94|       |        /* Case 3: Mismatch */
   95|   214k|        if (p_star) {
  ------------------
  |  Branch (95:13): [True: 172k, False: 41.9k]
  ------------------
   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|   172k|            pattern = p_star;
  104|   172k|            s = ++s_star;
  105|   172k|            continue;
  106|   172k|        }
  107|       |
  108|       |        /* Case 4: Mismatch and no star to backtrack to */
  109|  41.9k|        return 0;
  110|   214k|    }
  111|       |
  112|       |    /* Handle trailing stars in the pattern
  113|       |     * (e.g., pattern "abc*" matching "abc") */
  114|  16.4k|    while (*pattern == '*') {
  ------------------
  |  Branch (114:12): [True: 443, False: 15.9k]
  ------------------
  115|    443|        pattern++;
  116|    443|    }
  117|       |
  118|       |    /* If we reached the end of the pattern, it's a match */
  119|  15.9k|    return (*pattern == '\0');
  120|  57.9k|}

ssh_get_local_username:
  392|    934|{
  393|    934|    struct passwd pwd;
  394|    934|    struct passwd *pwdbuf = NULL;
  395|    934|    char buf[NSS_BUFLEN_PASSWD];
  396|    934|    char *name = NULL;
  397|    934|    int rc;
  398|       |
  399|    934|    rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
  400|    934|    if (rc != 0 || pwdbuf == NULL) {
  ------------------
  |  Branch (400:9): [True: 0, False: 934]
  |  Branch (400:20): [True: 0, False: 934]
  ------------------
  401|      0|        return NULL;
  402|      0|    }
  403|       |
  404|    934|    name = strdup(pwd.pw_name);
  405|    934|    rc = ssh_check_username_syntax(name);
  406|       |
  407|    934|    if (rc != SSH_OK) {
  ------------------
  |  |  315|    934|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (407:9): [True: 0, False: 934]
  ------------------
  408|      0|        free(name);
  409|      0|        return NULL;
  410|      0|    }
  411|       |
  412|    934|    return name;
  413|    934|}
ssh_is_ipaddr_v4:
  423|  1.14k|{
  424|  1.14k|    int rc = -1;
  425|  1.14k|    struct in_addr dest;
  426|       |
  427|  1.14k|    rc = inet_pton(AF_INET, str, &dest);
  428|  1.14k|    if (rc > 0) {
  ------------------
  |  Branch (428:9): [True: 0, False: 1.14k]
  ------------------
  429|      0|        return 1;
  430|      0|    }
  431|       |
  432|  1.14k|    return 0;
  433|  1.14k|}
ssh_is_ipaddr:
  443|  1.14k|{
  444|  1.14k|    int rc = -1;
  445|  1.14k|    char *s = strdup(str);
  446|       |
  447|  1.14k|    if (s == NULL) {
  ------------------
  |  Branch (447:9): [True: 0, False: 1.14k]
  ------------------
  448|      0|        return -1;
  449|      0|    }
  450|  1.14k|    if (strchr(s, ':')) {
  ------------------
  |  Branch (450:9): [True: 0, False: 1.14k]
  ------------------
  451|      0|        struct in6_addr dest6;
  452|      0|        char *network_interface = strchr(s, '%');
  453|       |
  454|       |        /* link-local (IP:v6:addr%ifname). */
  455|      0|        if (network_interface != NULL) {
  ------------------
  |  Branch (455:13): [True: 0, False: 0]
  ------------------
  456|      0|            rc = if_nametoindex(network_interface + 1);
  457|      0|            if (rc == 0) {
  ------------------
  |  Branch (457:17): [True: 0, False: 0]
  ------------------
  458|      0|                free(s);
  459|      0|                return 0;
  460|      0|            }
  461|      0|            *network_interface = '\0';
  462|      0|        }
  463|      0|        rc = inet_pton(AF_INET6, s, &dest6);
  464|      0|        if (rc > 0) {
  ------------------
  |  Branch (464:13): [True: 0, False: 0]
  ------------------
  465|      0|            free(s);
  466|      0|            return 1;
  467|      0|        }
  468|      0|    }
  469|       |
  470|  1.14k|    free(s);
  471|  1.14k|    return ssh_is_ipaddr_v4(str);
  472|  1.14k|}
ssh_get_user_home_dir:
  488|  1.91k|{
  489|  1.91k|    char *szPath = NULL;
  490|       |
  491|       |    /* If used previously, reuse cached value */
  492|  1.91k|    if (session != NULL && session->opts.homedir != NULL) {
  ------------------
  |  Branch (492:9): [True: 0, False: 1.91k]
  |  Branch (492:28): [True: 0, False: 0]
  ------------------
  493|      0|        return strdup(session->opts.homedir);
  494|      0|    }
  495|       |
  496|  1.91k|    szPath = ssh_get_user_home_dir_internal();
  497|  1.91k|    if (szPath == NULL) {
  ------------------
  |  Branch (497:9): [True: 0, False: 1.91k]
  ------------------
  498|      0|        return NULL;
  499|      0|    }
  500|       |
  501|  1.91k|    if (session != NULL) {
  ------------------
  |  Branch (501:9): [True: 0, False: 1.91k]
  ------------------
  502|       |        /* cache it:
  503|       |         * failure is not fatal -- at worst we will just not cache it */
  504|      0|        session->opts.homedir = strdup(szPath);
  505|      0|    }
  506|       |
  507|  1.91k|    return szPath;
  508|  1.91k|}
ssh_lowercase:
  519|  13.7k|{
  520|  13.7k|    char *new = NULL, *p = NULL;
  521|       |
  522|  13.7k|    if (str == NULL) {
  ------------------
  |  Branch (522:9): [True: 0, False: 13.7k]
  ------------------
  523|      0|        return NULL;
  524|      0|    }
  525|       |
  526|  13.7k|    new = strdup(str);
  527|  13.7k|    if (new == NULL) {
  ------------------
  |  Branch (527:9): [True: 0, False: 13.7k]
  ------------------
  528|      0|        return NULL;
  529|      0|    }
  530|       |
  531|   165k|    for (p = new; *p; p++) {
  ------------------
  |  Branch (531:19): [True: 151k, False: 13.7k]
  ------------------
  532|   151k|        *p = tolower(*p);
  ------------------
  |  Branch (532:14): [True: 0, False: 0]
  |  Branch (532:14): [True: 0, False: 0]
  |  Branch (532:14): [Folded, False: 151k]
  ------------------
  533|   151k|    }
  534|       |
  535|  13.7k|    return new;
  536|  13.7k|}
ssh_list_new:
  858|  1.49k|{
  859|  1.49k|    struct ssh_list *ret = malloc(sizeof(struct ssh_list));
  860|  1.49k|    if (ret == NULL) {
  ------------------
  |  Branch (860:9): [True: 0, False: 1.49k]
  ------------------
  861|      0|        return NULL;
  862|      0|    }
  863|  1.49k|    ret->root = ret->end = NULL;
  864|  1.49k|    return ret;
  865|  1.49k|}
ssh_list_free:
  875|  2.60k|{
  876|  2.60k|    struct ssh_iterator *ptr = NULL, *next = NULL;
  877|  2.60k|    if (!list)
  ------------------
  |  Branch (877:9): [True: 1.11k, False: 1.49k]
  ------------------
  878|  1.11k|        return;
  879|  1.49k|    ptr = list->root;
  880|  1.49k|    while (ptr) {
  ------------------
  |  Branch (880:12): [True: 0, False: 1.49k]
  ------------------
  881|      0|        next = ptr->next;
  882|      0|        SAFE_FREE(ptr);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  883|      0|        ptr = next;
  884|      0|    }
  885|       |    SAFE_FREE(list);
  ------------------
  |  |  375|  1.49k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 1.49k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 1.49k]
  |  |  ------------------
  ------------------
  886|  1.49k|}
ssh_list_get_iterator:
  896|  9.66k|{
  897|  9.66k|    if (!list)
  ------------------
  |  Branch (897:9): [True: 894, False: 8.76k]
  ------------------
  898|    894|        return NULL;
  899|  8.76k|    return list->root;
  900|  9.66k|}
ssh_list_append:
  962|  11.5k|{
  963|  11.5k|  struct ssh_iterator *iterator = NULL;
  964|       |
  965|  11.5k|  if (list == NULL) {
  ------------------
  |  Branch (965:7): [True: 0, False: 11.5k]
  ------------------
  966|      0|      return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  967|      0|  }
  968|       |
  969|  11.5k|  iterator = ssh_iterator_new(data);
  970|  11.5k|  if (iterator == NULL) {
  ------------------
  |  Branch (970:7): [True: 0, False: 11.5k]
  ------------------
  971|      0|      return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  972|      0|  }
  973|       |
  974|  11.5k|  if(!list->end){
  ------------------
  |  Branch (974:6): [True: 2.67k, False: 8.86k]
  ------------------
  975|       |    /* list is empty */
  976|  2.67k|    list->root=list->end=iterator;
  977|  8.86k|  } else {
  978|       |    /* put it on end of list */
  979|  8.86k|    list->end->next=iterator;
  980|  8.86k|    list->end=iterator;
  981|  8.86k|  }
  982|  11.5k|  return SSH_OK;
  ------------------
  |  |  315|  11.5k|#define SSH_OK 0     /* No error */
  ------------------
  983|  11.5k|}
ssh_list_prepend:
  994|    434|{
  995|    434|  struct ssh_iterator *it = NULL;
  996|       |
  997|    434|  if (list == NULL) {
  ------------------
  |  Branch (997:7): [True: 0, False: 434]
  ------------------
  998|      0|      return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
  999|      0|  }
 1000|       |
 1001|    434|  it = ssh_iterator_new(data);
 1002|    434|  if (it == NULL) {
  ------------------
  |  Branch (1002:7): [True: 0, False: 434]
  ------------------
 1003|      0|    return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1004|      0|  }
 1005|       |
 1006|    434|  if (list->end == NULL) {
  ------------------
  |  Branch (1006:7): [True: 140, False: 294]
  ------------------
 1007|       |    /* list is empty */
 1008|    140|    list->root = list->end = it;
 1009|    294|  } else {
 1010|       |    /* set as new root */
 1011|    294|    it->next = list->root;
 1012|    294|    list->root = it;
 1013|    294|  }
 1014|       |
 1015|    434|  return SSH_OK;
  ------------------
  |  |  315|    434|#define SSH_OK 0     /* No error */
  ------------------
 1016|    434|}
ssh_list_remove:
 1025|  5.92k|{
 1026|  5.92k|    struct ssh_iterator *ptr = NULL, *prev = NULL;
 1027|       |
 1028|  5.92k|    if (list == NULL) {
  ------------------
  |  Branch (1028:9): [True: 0, False: 5.92k]
  ------------------
 1029|      0|        return;
 1030|      0|    }
 1031|       |
 1032|  5.92k|    prev = NULL;
 1033|  5.92k|    ptr = list->root;
 1034|   205k|    while (ptr && ptr != iterator) {
  ------------------
  |  Branch (1034:12): [True: 205k, False: 0]
  |  Branch (1034:19): [True: 199k, False: 5.92k]
  ------------------
 1035|   199k|        prev = ptr;
 1036|   199k|        ptr = ptr->next;
 1037|   199k|    }
 1038|  5.92k|    if (!ptr) {
  ------------------
  |  Branch (1038:9): [True: 0, False: 5.92k]
  ------------------
 1039|       |        /* we did not find the element */
 1040|      0|        return;
 1041|      0|    }
 1042|       |    /* unlink it */
 1043|  5.92k|    if (prev)
  ------------------
  |  Branch (1043:9): [True: 1.99k, False: 3.93k]
  ------------------
 1044|  1.99k|        prev->next = ptr->next;
 1045|       |    /* if iterator was the head */
 1046|  5.92k|    if (list->root == iterator)
  ------------------
  |  Branch (1046:9): [True: 3.93k, False: 1.99k]
  ------------------
 1047|  3.93k|        list->root = iterator->next;
 1048|       |    /* if iterator was the tail */
 1049|  5.92k|    if (list->end == iterator)
  ------------------
  |  Branch (1049:9): [True: 2.86k, False: 3.06k]
  ------------------
 1050|  2.86k|        list->end = prev;
 1051|       |    SAFE_FREE(iterator);
  ------------------
  |  |  375|  5.92k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 5.92k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 5.92k]
  |  |  ------------------
  ------------------
 1052|  5.92k|}
_ssh_list_pop_head:
 1066|  8.68k|{
 1067|  8.68k|  struct ssh_iterator *iterator = NULL;
 1068|  8.68k|  const void *data = NULL;
 1069|       |
 1070|  8.68k|  if (list == NULL) {
  ------------------
  |  Branch (1070:7): [True: 1.13k, False: 7.54k]
  ------------------
 1071|  1.13k|      return NULL;
 1072|  1.13k|  }
 1073|       |
 1074|  7.54k|  iterator = list->root;
 1075|  7.54k|  if (iterator == NULL) {
  ------------------
  |  Branch (1075:7): [True: 1.50k, False: 6.04k]
  ------------------
 1076|  1.50k|      return NULL;
 1077|  1.50k|  }
 1078|  6.04k|  data=iterator->data;
 1079|  6.04k|  list->root=iterator->next;
 1080|  6.04k|  if(list->end==iterator)
  ------------------
  |  Branch (1080:6): [True: 898, False: 5.14k]
  ------------------
 1081|    898|    list->end=NULL;
 1082|       |  SAFE_FREE(iterator);
  ------------------
  |  |  375|  6.04k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 6.04k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 6.04k]
  |  |  ------------------
  ------------------
 1083|  6.04k|  return data;
 1084|  7.54k|}
ssh_path_expand_tilde:
 1302|  2.11k|{
 1303|  2.11k|    char *h = NULL, *r = NULL;
 1304|  2.11k|    const char *p = NULL;
 1305|  2.11k|    size_t ld;
 1306|  2.11k|    size_t lh = 0;
 1307|  2.11k|    int add_slash = 0;
 1308|       |
 1309|  2.11k|    if (d[0] != '~') {
  ------------------
  |  Branch (1309:9): [True: 7, False: 2.11k]
  ------------------
 1310|      7|        return strdup(d);
 1311|      7|    }
 1312|  2.11k|    d++;
 1313|       |
 1314|       |    /* handle ~user/path */
 1315|  2.11k|    p = strchr(d, '/');
 1316|  2.11k|    if (p != NULL && p > d) {
  ------------------
  |  Branch (1316:9): [True: 1.25k, False: 852]
  |  Branch (1316:22): [True: 196, False: 1.06k]
  ------------------
 1317|       |#ifdef _WIN32
 1318|       |        return strdup(d);
 1319|       |#else
 1320|    196|        struct passwd *pw = NULL;
 1321|    196|        size_t s = p - d;
 1322|    196|        char u[128];
 1323|       |
 1324|    196|        if (s >= sizeof(u)) {
  ------------------
  |  Branch (1324:13): [True: 0, False: 196]
  ------------------
 1325|      0|            return NULL;
 1326|      0|        }
 1327|    196|        memcpy(u, d, s);
 1328|    196|        u[s] = '\0';
 1329|    196|        pw = getpwnam(u);
 1330|    196|        if (pw == NULL) {
  ------------------
  |  Branch (1330:13): [True: 17, False: 179]
  ------------------
 1331|     17|            return NULL;
 1332|     17|        }
 1333|    179|        h = strdup(pw->pw_dir);
 1334|    179|#endif
 1335|  1.91k|    } else {
 1336|  1.91k|        p = (char *) d;
 1337|  1.91k|        h = ssh_get_user_home_dir(NULL);
 1338|  1.91k|    }
 1339|       |
 1340|  2.09k|    if (h == NULL) {
  ------------------
  |  Branch (1340:9): [True: 0, False: 2.09k]
  ------------------
 1341|      0|        return NULL;
 1342|      0|    }
 1343|  2.09k|    lh = strlen(h);
 1344|       |
 1345|       |    /* Strip all leading slashes from the suffix path */
 1346|  3.33k|    while (*p == '/') {
  ------------------
  |  Branch (1346:12): [True: 1.24k, False: 2.09k]
  ------------------
 1347|  1.24k|        p++;
 1348|  1.24k|    }
 1349|  2.09k|    ld = strlen(p);
 1350|       |
 1351|       |    /* Does the home directory path end with a slash? */
 1352|  2.09k|    add_slash = (lh > 0 && h[lh - 1] == '/') ? 0 : 1;
  ------------------
  |  Branch (1352:18): [True: 2.09k, False: 0]
  |  Branch (1352:28): [True: 0, False: 2.09k]
  ------------------
 1353|       |
 1354|  2.09k|    r = malloc(lh + add_slash + ld + 1);
 1355|  2.09k|    if (r == NULL) {
  ------------------
  |  Branch (1355:9): [True: 0, False: 2.09k]
  ------------------
 1356|      0|        SAFE_FREE(h);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1357|      0|        return NULL;
 1358|      0|    }
 1359|       |
 1360|  2.09k|    if (lh > 0) {
  ------------------
  |  Branch (1360:9): [True: 2.09k, False: 0]
  ------------------
 1361|  2.09k|        memcpy(r, h, lh);
 1362|  2.09k|    }
 1363|  2.09k|    SAFE_FREE(h);
  ------------------
  |  |  375|  2.09k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 2.09k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 2.09k]
  |  |  ------------------
  ------------------
 1364|       |
 1365|  2.09k|    if (add_slash) {
  ------------------
  |  Branch (1365:9): [True: 2.09k, False: 0]
  ------------------
 1366|  2.09k|        r[lh] = '/';
 1367|  2.09k|    }
 1368|  2.09k|    memcpy(r + lh + add_slash, p, ld + 1);
 1369|       |
 1370|  2.09k|    return r;
 1371|  2.09k|}
ssh_path_expand_hostname:
 1731|     23|{
 1732|     23|    return ssh_path_expand_internal(session, s, true, false);
 1733|     23|}
ssh_strerror:
 2428|  1.94k|{
 2429|       |#if ((defined(__linux__) && defined(__GLIBC__)) || defined(__CYGWIN__)) && defined(_GNU_SOURCE)
 2430|       |    /* GNU extension on Linux */
 2431|       |    return strerror_r(err_num, buf, buflen);
 2432|       |#else
 2433|  1.94k|    int rv;
 2434|       |
 2435|       |#if defined(_WIN32)
 2436|       |    rv = strerror_s(buf, buflen, err_num);
 2437|       |#else
 2438|       |    /* POSIX version available for example on FreeBSD or in musl libc */
 2439|  1.94k|    rv = strerror_r(err_num, buf, buflen);
 2440|  1.94k|#endif /* _WIN32 */
 2441|       |
 2442|       |    /* make sure the buffer is initialized and terminated with NULL */
 2443|  1.94k|    if (-rv == ERANGE) {
  ------------------
  |  Branch (2443:9): [True: 0, False: 1.94k]
  ------------------
 2444|      0|        buf[0] = '\0';
 2445|      0|    }
 2446|  1.94k|    return buf;
 2447|  1.94k|#endif /* ((defined(__linux__) && defined(__GLIBC__)) || defined(__CYGWIN__)) && defined(_GNU_SOURCE) */
 2448|  1.94k|}
ssh_check_hostname_syntax:
 2579|    573|{
 2580|    573|    char *it = NULL, *s = NULL, *buf = NULL;
 2581|    573|    size_t it_len;
 2582|    573|    char c;
 2583|       |
 2584|    573|    if (hostname == NULL || strlen(hostname) == 0) {
  ------------------
  |  Branch (2584:9): [True: 0, False: 573]
  |  Branch (2584:29): [True: 0, False: 573]
  ------------------
 2585|      0|        return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2586|      0|    }
 2587|       |
 2588|       |    /* strtok_r writes into the string, keep the input clean */
 2589|    573|    s = strdup(hostname);
 2590|    573|    if (s == NULL) {
  ------------------
  |  Branch (2590:9): [True: 0, False: 573]
  ------------------
 2591|      0|        return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2592|      0|    }
 2593|       |
 2594|    573|    it = strtok_r(s, ".", &buf);
 2595|       |    /* if the token has 0 length */
 2596|    573|    if (it == NULL) {
  ------------------
  |  Branch (2596:9): [True: 0, False: 573]
  ------------------
 2597|      0|        free(s);
 2598|      0|        return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2599|      0|    }
 2600|  1.14k|    do {
 2601|  1.14k|        it_len = strlen(it);
 2602|  1.14k|        if (it_len > ARPA_DOMAIN_MAX_LEN ||
  ------------------
  |  |  100|  2.29k|#define ARPA_DOMAIN_MAX_LEN 63
  ------------------
  |  Branch (2602:13): [True: 0, False: 1.14k]
  ------------------
 2603|       |            /* the first char must be a letter, but some virtual urls start
 2604|       |             * with a number */
 2605|  1.14k|            isalnum(it[0]) == 0 ||
  ------------------
  |  Branch (2605:13): [True: 0, False: 1.14k]
  ------------------
 2606|  1.14k|            isalnum(it[it_len - 1]) == 0) {
  ------------------
  |  Branch (2606:13): [True: 0, False: 1.14k]
  ------------------
 2607|      0|            free(s);
 2608|      0|            return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2609|      0|        }
 2610|  6.87k|        while (*it != '\0') {
  ------------------
  |  Branch (2610:16): [True: 5.73k, False: 1.14k]
  ------------------
 2611|  5.73k|            c = *it;
 2612|       |            /* the "." is allowed too, but tokenization removes it from the
 2613|       |             * string */
 2614|  5.73k|            if (isalnum(c) == 0 && c != '-') {
  ------------------
  |  Branch (2614:17): [True: 0, False: 5.73k]
  |  Branch (2614:36): [True: 0, False: 0]
  ------------------
 2615|      0|                free(s);
 2616|      0|                return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2617|      0|            }
 2618|  5.73k|            it++;
 2619|  5.73k|        }
 2620|  1.14k|    } while ((it = strtok_r(NULL, ".", &buf)) != NULL);
  ------------------
  |  Branch (2620:14): [True: 573, False: 573]
  ------------------
 2621|       |
 2622|    573|    free(s);
 2623|       |
 2624|    573|    return SSH_OK;
  ------------------
  |  |  315|    573|#define SSH_OK 0     /* No error */
  ------------------
 2625|    573|}
ssh_check_username_syntax:
 2638|  1.04k|{
 2639|  1.04k|    size_t username_len;
 2640|       |
 2641|  1.04k|    if (username == NULL || *username == '-') {
  ------------------
  |  Branch (2641:9): [True: 0, False: 1.04k]
  |  Branch (2641:29): [True: 0, False: 1.04k]
  ------------------
 2642|      0|        return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2643|      0|    }
 2644|       |
 2645|  1.04k|    username_len = strlen(username);
 2646|  1.04k|    if (username_len == 0 || username[username_len - 1] == '\\' ||
  ------------------
  |  Branch (2646:9): [True: 0, False: 1.04k]
  |  Branch (2646:30): [True: 0, False: 1.04k]
  ------------------
 2647|  1.04k|        strpbrk(username, SSH_DANGEROUS_SHELL_CHARS) != NULL) {
  ------------------
  |  |  260|  1.04k|#define SSH_DANGEROUS_SHELL_CHARS "'`\";&<>|(){}$\\,"
  ------------------
  |  Branch (2647:9): [True: 5, False: 1.03k]
  ------------------
 2648|      5|        return SSH_ERROR;
  ------------------
  |  |  316|      5|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2649|      5|    }
 2650|  5.50k|    for (size_t i = 0; i < username_len; i++) {
  ------------------
  |  Branch (2650:24): [True: 4.47k, False: 1.02k]
  ------------------
 2651|  4.47k|        unsigned char c = (unsigned char)username[i];
 2652|  4.47k|        if (iscntrl(c) != 0 || (isspace(c) != 0 && username[i + 1] == '-')) {
  ------------------
  |  Branch (2652:13): [True: 7, False: 4.46k]
  |  Branch (2652:33): [True: 19, False: 4.44k]
  |  Branch (2652:52): [True: 0, False: 19]
  ------------------
 2653|      7|            return SSH_ERROR;
  ------------------
  |  |  316|      7|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 2654|      7|        }
 2655|  4.47k|    }
 2656|       |
 2657|  1.02k|    return SSH_OK;
  ------------------
  |  |  315|  1.02k|#define SSH_OK 0     /* No error */
  ------------------
 2658|  1.03k|}
ssh_jump_info_free:
 2665|  1.76k|{
 2666|  1.76k|    if (jump == NULL) {
  ------------------
  |  Branch (2666:9): [True: 1.54k, False: 224]
  ------------------
 2667|  1.54k|        return;
 2668|  1.54k|    }
 2669|       |
 2670|    224|    SAFE_FREE(jump->hostname);
  ------------------
  |  |  375|    224|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 208, False: 16]
  |  |  |  Branch (375:71): [Folded, False: 224]
  |  |  ------------------
  ------------------
 2671|    224|    SAFE_FREE(jump->username);
  ------------------
  |  |  375|    224|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 78, False: 146]
  |  |  |  Branch (375:71): [Folded, False: 224]
  |  |  ------------------
  ------------------
 2672|       |    SAFE_FREE(jump);
  ------------------
  |  |  375|    224|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 224, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 224]
  |  |  ------------------
  ------------------
 2673|    224|}
ssh_proxyjumps_free:
 2685|    922|{
 2686|    922|    struct ssh_jump_info_struct *jump = NULL;
 2687|       |
 2688|    922|    for (jump =
 2689|    922|             ssh_list_pop_head(struct ssh_jump_info_struct *, proxy_jump_list);
  ------------------
  |  |  130|    922|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
 2690|  1.13k|         jump != NULL;
  ------------------
  |  Branch (2690:10): [True: 208, False: 922]
  ------------------
 2691|    922|         jump = ssh_list_pop_head(struct ssh_jump_info_struct *,
  ------------------
  |  |  130|    208|  ((type)_ssh_list_pop_head(ssh_list))
  ------------------
 2692|    922|                                  proxy_jump_list)) {
 2693|    208|        ssh_jump_info_free(jump);
 2694|    208|    }
 2695|    922|}
ssh_libssh_proxy_jumps:
 2708|  1.62k|{
 2709|  1.62k|    const char *t = getenv("OPENSSH_PROXYJUMP");
 2710|       |
 2711|  1.62k|    return !(t != NULL && t[0] == '1');
  ------------------
  |  Branch (2711:14): [True: 0, False: 1.62k]
  |  Branch (2711:27): [True: 0, False: 0]
  ------------------
 2712|  1.62k|}
ssh_strict_fopen:
 2729|  2.18k|{
 2730|  2.18k|    FILE *f = NULL;
 2731|  2.18k|    struct stat sb;
 2732|  2.18k|    int r, fd;
 2733|       |
 2734|       |    /* open first to avoid TOCTOU */
 2735|  2.18k|    fd = open(filename, O_RDONLY);
 2736|  2.18k|    if (fd == -1) {
  ------------------
  |  Branch (2736:9): [True: 1.94k, False: 243]
  ------------------
 2737|  1.94k|        SSH_LOG_STRERROR(SSH_LOG_TRACE,
  ------------------
  |  |  285|  1.94k|    do {                                                            \
  |  |  286|  1.94k|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  287|  1.94k|        _ssh_log(priority,                                          \
  |  |  288|  1.94k|                 __func__,                                          \
  |  |  289|  1.94k|                 __VA_ARGS__,                                       \
  |  |  290|  1.94k|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  522|  1.94k|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  291|  1.94k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (291:14): [Folded, False: 1.94k]
  |  |  ------------------
  ------------------
 2738|  1.94k|                         errno,
 2739|  1.94k|                         "Failed to open a file %s for reading: %s",
 2740|  1.94k|                         filename);
 2741|  1.94k|        return NULL;
 2742|  1.94k|    }
 2743|       |
 2744|       |    /* Check the file is sensible for a configuration file */
 2745|    243|    r = fstat(fd, &sb);
 2746|    243|    if (r != 0) {
  ------------------
  |  Branch (2746:9): [True: 0, False: 243]
  ------------------
 2747|      0|        SSH_LOG_STRERROR(SSH_LOG_TRACE,
  ------------------
  |  |  285|      0|    do {                                                            \
  |  |  286|      0|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  287|      0|        _ssh_log(priority,                                          \
  |  |  288|      0|                 __func__,                                          \
  |  |  289|      0|                 __VA_ARGS__,                                       \
  |  |  290|      0|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  522|      0|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  291|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (291:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2748|      0|                         errno,
 2749|      0|                         "Failed to stat %s: %s",
 2750|      0|                         filename);
 2751|      0|        close(fd);
 2752|      0|        return NULL;
 2753|      0|    }
 2754|    243|    if ((sb.st_mode & S_IFMT) != S_IFREG) {
  ------------------
  |  Branch (2754:9): [True: 143, False: 100]
  ------------------
 2755|    143|        SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|    143|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2756|    143|                "The file %s is not a regular file: skipping",
 2757|    143|                filename);
 2758|    143|        close(fd);
 2759|    143|        return NULL;
 2760|    143|    }
 2761|       |
 2762|    100|    if ((size_t)sb.st_size > max_file_size) {
  ------------------
  |  Branch (2762:9): [True: 0, False: 100]
  ------------------
 2763|      0|        SSH_LOG(SSH_LOG_TRACE,
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 2764|      0|                "The file %s is too large (%jd MB > %zu MB): skipping",
 2765|      0|                filename,
 2766|      0|                (intmax_t)sb.st_size / 1024 / 1024,
 2767|      0|                max_file_size / 1024 / 1024);
 2768|      0|        close(fd);
 2769|      0|        return NULL;
 2770|      0|    }
 2771|       |
 2772|    100|    f = fdopen(fd, "r");
 2773|    100|    if (f == NULL) {
  ------------------
  |  Branch (2773:9): [True: 0, False: 100]
  ------------------
 2774|      0|        SSH_LOG_STRERROR(SSH_LOG_TRACE,
  ------------------
  |  |  285|      0|    do {                                                            \
  |  |  286|      0|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  287|      0|        _ssh_log(priority,                                          \
  |  |  288|      0|                 __func__,                                          \
  |  |  289|      0|                 __VA_ARGS__,                                       \
  |  |  290|      0|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  522|      0|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  291|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (291:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2775|      0|                         errno,
 2776|      0|                         "Failed to open a file %s for reading: %s",
 2777|      0|                         filename);
 2778|      0|        close(fd);
 2779|      0|        return NULL;
 2780|      0|    }
 2781|       |
 2782|       |    /* the flcose() will close also the underlying fd */
 2783|    100|    return f;
 2784|    100|}
ssh_normalize_loose_ip:
 2843|    573|{
 2844|    573|    struct in_addr addr;
 2845|    573|    char buf[INET_ADDRSTRLEN];
 2846|    573|    const char *p = NULL;
 2847|    573|    int rc;
 2848|    573|    int is_ip;
 2849|       |#ifdef _WIN32
 2850|       |    unsigned long ip;
 2851|       |    int is_broadcast;
 2852|       |#endif
 2853|       |
 2854|    573|    if (host == NULL || result == NULL) {
  ------------------
  |  Branch (2854:9): [True: 0, False: 573]
  |  Branch (2854:25): [True: 0, False: 573]
  ------------------
 2855|      0|        return -1;
 2856|      0|    }
 2857|       |
 2858|       |    /* We don't want to normalize stricter IP checks already handled by valid
 2859|       |     * IPv4/IPv6 */
 2860|    573|    is_ip = ssh_is_ipaddr(host);
 2861|    573|    if (is_ip) {
  ------------------
  |  Branch (2861:9): [True: 0, False: 573]
  ------------------
 2862|      0|        return 1; /* not a loose IP — already a strict address */
 2863|      0|    }
 2864|       |
 2865|       |#ifdef _WIN32
 2866|       |    ip = inet_addr(host);
 2867|       |    is_broadcast = strcmp(host, "255.255.255.255");
 2868|       |    if (ip == INADDR_NONE && is_broadcast != 0) {
 2869|       |        return 1; /* not a loose IP */
 2870|       |    }
 2871|       |    addr.S_un.S_addr = ip;
 2872|       |#else
 2873|    573|    rc = inet_aton(host, &addr);
 2874|    573|    if (rc == 0) {
  ------------------
  |  Branch (2874:9): [True: 573, False: 0]
  ------------------
 2875|    573|        return 1; /* not a loose IP */
 2876|    573|    }
 2877|      0|#endif
 2878|       |
 2879|      0|    p = inet_ntop(AF_INET, &addr, buf, sizeof(buf));
 2880|      0|    if (p == NULL) {
  ------------------
  |  Branch (2880:9): [True: 0, False: 0]
  ------------------
 2881|      0|        return -1;
 2882|      0|    }
 2883|       |
 2884|      0|    *result = strdup(p);
 2885|      0|    if (*result == NULL) {
  ------------------
  |  Branch (2885:9): [True: 0, False: 0]
  ------------------
 2886|      0|        return -1;
 2887|      0|    }
 2888|       |
 2889|      0|    return 0;
 2890|      0|}
misc.c:ssh_get_user_home_dir_internal:
  322|  1.91k|{
  323|  1.91k|    char *szPath = NULL;
  324|  1.91k|    struct passwd pwd;
  325|  1.91k|    struct passwd *pwdbuf = NULL;
  326|  1.91k|    char buf[NSS_BUFLEN_PASSWD] = {0};
  327|  1.91k|    int rc;
  328|       |
  329|  1.91k|    rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
  330|  1.91k|    if (rc != 0 || pwdbuf == NULL ) {
  ------------------
  |  Branch (330:9): [True: 0, False: 1.91k]
  |  Branch (330:20): [True: 0, False: 1.91k]
  ------------------
  331|      0|        szPath = getenv("HOME");
  332|      0|        if (szPath == NULL) {
  ------------------
  |  Branch (332:13): [True: 0, False: 0]
  ------------------
  333|      0|            return NULL;
  334|      0|        }
  335|      0|        snprintf(buf, sizeof(buf), "%s", szPath);
  336|      0|        return strdup(buf);
  337|      0|    }
  338|       |
  339|  1.91k|    szPath = strdup(pwd.pw_dir);
  340|       |
  341|  1.91k|    return szPath;
  342|  1.91k|}
misc.c:ssh_iterator_new:
  940|  11.9k|{
  941|  11.9k|    struct ssh_iterator *iterator = malloc(sizeof(struct ssh_iterator));
  942|       |
  943|  11.9k|    if (iterator == NULL) {
  ------------------
  |  Branch (943:9): [True: 0, False: 11.9k]
  ------------------
  944|      0|        return NULL;
  945|      0|    }
  946|  11.9k|    iterator->next = NULL;
  947|  11.9k|    iterator->data = data;
  948|  11.9k|    return iterator;
  949|  11.9k|}
misc.c:ssh_path_expand_internal:
 1485|     23|{
 1486|     23|    char *buf = NULL;
 1487|     23|    char *r = NULL;
 1488|     23|    char *x = NULL;
 1489|     23|    const char *p = NULL;
 1490|     23|    size_t i, l;
 1491|       |
 1492|     23|    if (expand_tilde) {
  ------------------
  |  Branch (1492:9): [True: 0, False: 23]
  ------------------
 1493|      0|        r = ssh_path_expand_tilde(s);
 1494|     23|    } else {
 1495|     23|        r = strdup(s);
 1496|     23|    }
 1497|     23|    if (r == NULL) {
  ------------------
  |  Branch (1497:9): [True: 0, False: 23]
  ------------------
 1498|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1499|      0|        return NULL;
 1500|      0|    }
 1501|       |
 1502|     23|    if (strlen(r) > MAX_BUF_SIZE) {
  ------------------
  |  |  230|     23|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1502:9): [True: 0, False: 23]
  ------------------
 1503|      0|        ssh_set_error(session, SSH_FATAL, "string to expand too long");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1504|      0|        free(r);
 1505|      0|        return NULL;
 1506|      0|    }
 1507|       |
 1508|     23|    buf = malloc(MAX_BUF_SIZE);
  ------------------
  |  |  230|     23|#define MAX_BUF_SIZE 4096
  ------------------
 1509|     23|    if (buf == NULL) {
  ------------------
  |  Branch (1509:9): [True: 0, False: 23]
  ------------------
 1510|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1511|      0|        free(r);
 1512|      0|        return NULL;
 1513|      0|    }
 1514|       |
 1515|     23|    p = r;
 1516|     23|    buf[0] = '\0';
 1517|       |
 1518|  2.05k|    for (i = 0; *p != '\0'; p++) {
  ------------------
  |  Branch (1518:17): [True: 2.03k, False: 23]
  ------------------
 1519|  2.03k|        if (*p != '%') {
  ------------------
  |  Branch (1519:13): [True: 1.51k, False: 518]
  ------------------
 1520|  1.51k|            buf[i] = *p;
 1521|  1.51k|            i++;
 1522|  1.51k|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|  1.51k|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1522:17): [True: 0, False: 1.51k]
  ------------------
 1523|      0|                free(buf);
 1524|      0|                free(r);
 1525|      0|                return NULL;
 1526|      0|            }
 1527|  1.51k|            buf[i] = '\0';
 1528|  1.51k|            continue;
 1529|  1.51k|        }
 1530|       |
 1531|    518|        p++;
 1532|    518|        if (*p == '\0') {
  ------------------
  |  Branch (1532:13): [True: 0, False: 518]
  ------------------
 1533|       |            /* HostName expansion rejects trailing '%' to match the parse-time
 1534|       |             * scan. Keep the general expansion path unchanged, where a
 1535|       |             * trailing '%' is truncated.
 1536|       |             */
 1537|      0|            if (hostname_lenient) {
  ------------------
  |  Branch (1537:17): [True: 0, False: 0]
  ------------------
 1538|      0|                ssh_set_error(session, SSH_FATAL, "Incomplete Hostname token");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1539|      0|                free(buf);
 1540|      0|                free(r);
 1541|      0|                return NULL;
 1542|      0|            }
 1543|      0|            break;
 1544|      0|        }
 1545|       |
 1546|    518|        if (hostname_lenient && *p != '%' && *p != 'h') {
  ------------------
  |  Branch (1546:13): [True: 518, False: 0]
  |  Branch (1546:33): [True: 423, False: 95]
  |  Branch (1546:46): [True: 0, False: 423]
  ------------------
 1547|      0|            buf[i] = '%';
 1548|      0|            i++;
 1549|      0|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|      0|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1549:17): [True: 0, False: 0]
  ------------------
 1550|      0|                ssh_set_error(session, SSH_FATAL, "String too long");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1551|      0|                free(buf);
 1552|      0|                free(r);
 1553|      0|                return NULL;
 1554|      0|            }
 1555|      0|            buf[i] = *p;
 1556|      0|            i++;
 1557|      0|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|      0|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1557:17): [True: 0, False: 0]
  ------------------
 1558|      0|                ssh_set_error(session, SSH_FATAL, "String too long");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1559|      0|                free(buf);
 1560|      0|                free(r);
 1561|      0|                return NULL;
 1562|      0|            }
 1563|      0|            buf[i] = '\0';
 1564|      0|            continue;
 1565|      0|        }
 1566|       |
 1567|    518|        switch (*p) {
 1568|     95|        case '%':
  ------------------
  |  Branch (1568:9): [True: 95, False: 423]
  ------------------
 1569|     95|            buf[i] = '%';
 1570|     95|            i++;
 1571|     95|            if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|     95|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1571:17): [True: 0, False: 95]
  ------------------
 1572|      0|                free(buf);
 1573|      0|                free(r);
 1574|      0|                return NULL;
 1575|      0|            }
 1576|     95|            buf[i] = '\0';
 1577|     95|            continue;
 1578|      0|        case 'd':
  ------------------
  |  Branch (1578:9): [True: 0, False: 518]
  ------------------
 1579|      0|            x = ssh_get_user_home_dir(session);
 1580|      0|            if (x == NULL) {
  ------------------
  |  Branch (1580:17): [True: 0, False: 0]
  ------------------
 1581|      0|                ssh_set_error(session, SSH_FATAL, "Cannot expand homedir");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1582|      0|                free(buf);
 1583|      0|                free(r);
 1584|      0|                return NULL;
 1585|      0|            }
 1586|      0|            break;
 1587|      0|        case 'u':
  ------------------
  |  Branch (1587:9): [True: 0, False: 518]
  ------------------
 1588|      0|            x = ssh_get_local_username();
 1589|      0|            break;
 1590|      0|        case 'l':
  ------------------
  |  Branch (1590:9): [True: 0, False: 518]
  ------------------
 1591|      0|            x = ssh_get_local_hostname();
 1592|      0|            break;
 1593|    423|        case 'h':
  ------------------
  |  Branch (1593:9): [True: 423, False: 95]
  ------------------
 1594|    423|            if (session->opts.host) {
  ------------------
  |  Branch (1594:17): [True: 423, False: 0]
  ------------------
 1595|    423|                x = strdup(session->opts.host);
 1596|    423|            } else if (session->opts.originalhost) {
  ------------------
  |  Branch (1596:24): [True: 0, False: 0]
  ------------------
 1597|      0|                x = strdup(session->opts.originalhost);
 1598|      0|            } else {
 1599|      0|                ssh_set_error(session, SSH_FATAL, "Cannot expand host");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1600|      0|                free(buf);
 1601|      0|                free(r);
 1602|      0|                return NULL;
 1603|      0|            }
 1604|    423|            break;
 1605|    423|        case 'n':
  ------------------
  |  Branch (1605:9): [True: 0, False: 518]
  ------------------
 1606|      0|            if (session->opts.originalhost) {
  ------------------
  |  Branch (1606:17): [True: 0, False: 0]
  ------------------
 1607|      0|                x = strdup(session->opts.originalhost);
 1608|      0|            } else {
 1609|      0|                ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1610|      0|                              SSH_FATAL,
 1611|      0|                              "Cannot expand original host");
 1612|      0|                free(buf);
 1613|      0|                free(r);
 1614|      0|                return NULL;
 1615|      0|            }
 1616|      0|            break;
 1617|      0|        case 'r':
  ------------------
  |  Branch (1617:9): [True: 0, False: 518]
  ------------------
 1618|      0|            if (session->opts.username) {
  ------------------
  |  Branch (1618:17): [True: 0, False: 0]
  ------------------
 1619|      0|                x = strdup(session->opts.username);
 1620|      0|            } else {
 1621|      0|                ssh_set_error(session, SSH_FATAL, "Cannot expand username");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1622|      0|                free(buf);
 1623|      0|                free(r);
 1624|      0|                return NULL;
 1625|      0|            }
 1626|      0|            break;
 1627|      0|        case 'p': {
  ------------------
  |  Branch (1627:9): [True: 0, False: 518]
  ------------------
 1628|      0|            char tmp[6];
 1629|      0|            unsigned int port;
 1630|       |
 1631|      0|            ssh_options_get_port(session, &port);
 1632|      0|            snprintf(tmp, sizeof(tmp), "%u", port);
 1633|      0|            x = strdup(tmp);
 1634|      0|            break;
 1635|      0|        }
 1636|      0|        case 'j':
  ------------------
  |  Branch (1636:9): [True: 0, False: 518]
  ------------------
 1637|      0|            if (session->opts.proxy_jumps_str != NULL) {
  ------------------
  |  Branch (1637:17): [True: 0, False: 0]
  ------------------
 1638|      0|                x = strdup(session->opts.proxy_jumps_str);
 1639|      0|            } else {
 1640|      0|                x = strdup("");
 1641|      0|            }
 1642|      0|            break;
 1643|      0|        case 'C':
  ------------------
  |  Branch (1643:9): [True: 0, False: 518]
  ------------------
 1644|      0|            x = get_connection_hash(session);
 1645|      0|            break;
 1646|      0|        default:
  ------------------
  |  Branch (1646:9): [True: 0, False: 518]
  ------------------
 1647|      0|            ssh_set_error(session, SSH_FATAL, "Wrong escape sequence detected");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1648|      0|            free(buf);
 1649|      0|            free(r);
 1650|      0|            return NULL;
 1651|    518|        }
 1652|       |
 1653|    423|        if (x == NULL) {
  ------------------
  |  Branch (1653:13): [True: 0, False: 423]
  ------------------
 1654|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1655|      0|            free(buf);
 1656|      0|            free(r);
 1657|      0|            return NULL;
 1658|      0|        }
 1659|       |
 1660|    423|        i += strlen(x);
 1661|    423|        if (i >= MAX_BUF_SIZE) {
  ------------------
  |  |  230|    423|#define MAX_BUF_SIZE 4096
  ------------------
  |  Branch (1661:13): [True: 0, False: 423]
  ------------------
 1662|      0|            ssh_set_error(session, SSH_FATAL, "String too long");
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1663|      0|            free(buf);
 1664|      0|            free(x);
 1665|      0|            free(r);
 1666|      0|            return NULL;
 1667|      0|        }
 1668|    423|        l = strlen(buf);
 1669|    423|        strlcpy(buf + l, x, MAX_BUF_SIZE - l);
  ------------------
  |  |  230|    423|#define MAX_BUF_SIZE 4096
  ------------------
 1670|    423|        buf[i] = '\0';
 1671|    423|        SAFE_FREE(x);
  ------------------
  |  |  375|    423|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 423, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 423]
  |  |  ------------------
  ------------------
 1672|    423|    }
 1673|       |
 1674|     23|    free(r);
 1675|       |
 1676|       |    /* strip the unused space by realloc */
 1677|     23|    x = realloc(buf, strlen(buf) + 1);
 1678|     23|    if (x == NULL) {
  ------------------
  |  Branch (1678:9): [True: 0, False: 23]
  ------------------
 1679|      0|        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1680|      0|        free(buf);
 1681|      0|    }
 1682|     23|    return x;
 1683|     23|}

ssh_options_set_algo:
  470|    445|{
  471|       |    /* When the list start with +,-,^ the filtration of unknown algorithms
  472|       |     * gets handled inside the helper functions, otherwise the list is taken
  473|       |     * as it is. */
  474|    445|    char *p = (char *)list;
  475|       |
  476|       |    /* Clear errno so ENOMEM means allocation failure (best-effort). */
  477|    445|    errno = 0;
  478|       |
  479|    445|    if (algo < SSH_COMP_C_S) {
  ------------------
  |  Branch (479:9): [True: 403, False: 42]
  ------------------
  480|    403|        if (list[0] == '+') {
  ------------------
  |  Branch (480:13): [True: 215, False: 188]
  ------------------
  481|    215|            p = ssh_add_to_default_algos(algo, list+1);
  482|    215|        } else if (list[0] == '-') {
  ------------------
  |  Branch (482:20): [True: 55, False: 133]
  ------------------
  483|     55|            p = ssh_remove_from_default_algos(algo, list+1);
  484|    133|        } else if (list[0] == '^') {
  ------------------
  |  Branch (484:20): [True: 47, False: 86]
  ------------------
  485|     47|            p = ssh_prefix_default_algos(algo, list+1);
  486|     47|        }
  487|    403|    }
  488|       |
  489|    445|    if (p == list) {
  ------------------
  |  Branch (489:9): [True: 128, False: 317]
  ------------------
  490|    128|        bool fips = ssh_fips_mode();
  ------------------
  |  |  117|    128|#define ssh_fips_mode() EVP_default_properties_is_fips_enabled(NULL)
  ------------------
  491|       |
  492|       |        /*
  493|       |         * ssh_fips_mode() can set errno itself (OpenSSL config probe).
  494|       |         * Clear it after the probe, before the allocating filter.
  495|       |         */
  496|    128|        errno = 0;
  497|       |
  498|    128|        if (fips) {
  ------------------
  |  Branch (498:13): [True: 0, False: 128]
  ------------------
  499|      0|            p = ssh_keep_fips_algos(algo, list);
  500|    128|        } else {
  501|    128|            p = ssh_keep_known_algos(algo, list);
  502|    128|        }
  503|    128|    }
  504|       |
  505|    445|    if (p == NULL) {
  ------------------
  |  Branch (505:9): [True: 94, False: 351]
  ------------------
  506|     94|        if (errno == ENOMEM) {
  ------------------
  |  Branch (506:13): [True: 0, False: 94]
  ------------------
  507|      0|            ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
  508|      0|            return -1;
  509|      0|        }
  510|       |
  511|     94|        ssh_set_error(session, SSH_REQUEST_DENIED,
  ------------------
  |  |  313|     94|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
  512|     94|                "Setting method: no allowed algorithm for method \"%s\" (%s)",
  513|     94|                ssh_kex_get_description(algo), list);
  514|     94|        return -1;
  515|     94|    }
  516|       |
  517|    351|    SAFE_FREE(*place);
  ------------------
  |  |  375|    351|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 351]
  |  |  |  Branch (375:71): [Folded, False: 351]
  |  |  ------------------
  ------------------
  518|    351|    *place = p;
  519|       |
  520|    351|    return 0;
  521|    445|}
ssh_options_set:
 1236|  20.7k|{
 1237|  20.7k|    const char *v = NULL;
 1238|  20.7k|    char *p = NULL, *q = NULL;
 1239|  20.7k|    long int i;
 1240|  20.7k|    unsigned int u;
 1241|  20.7k|    int rc;
 1242|  20.7k|    char **wanted_methods = session->opts.wanted_methods;
 1243|  20.7k|    struct ssh_jump_callbacks_struct *j = NULL;
 1244|  20.7k|    enum ssh_config_opcode_e opcode;
 1245|       |
 1246|  20.7k|    if (session == NULL) {
  ------------------
  |  Branch (1246:9): [True: 0, False: 20.7k]
  ------------------
 1247|      0|        return -1;
 1248|      0|    }
 1249|       |
 1250|  20.7k|    switch (type) {
 1251|    632|        case SSH_OPTIONS_HOST:
  ------------------
  |  Branch (1251:9): [True: 632, False: 20.1k]
  ------------------
 1252|    632|            v = value;
 1253|    632|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1253:17): [True: 0, False: 632]
  |  Branch (1253:30): [True: 0, False: 632]
  ------------------
 1254|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1255|      0|                return -1;
 1256|    632|            } else if (session->opts.config_hostname_only) {
  ------------------
  |  Branch (1256:24): [True: 59, False: 573]
  ------------------
 1257|       |                /* HostName values are plain hostnames, not user@host URIs */
 1258|     59|                SAFE_FREE(session->opts.host);
  ------------------
  |  |  375|     59|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 59, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 59]
  |  |  ------------------
  ------------------
 1259|     59|                session->opts.host = strdup(value);
 1260|     59|                if (session->opts.host == NULL) {
  ------------------
  |  Branch (1260:21): [True: 0, False: 59]
  ------------------
 1261|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1262|      0|                    return -1;
 1263|      0|                }
 1264|    573|            } else {
 1265|    573|                char *username = NULL, *hostname = NULL;
 1266|    573|                char *strict_hostname = NULL;
 1267|    573|                char *normalized = NULL;
 1268|       |
 1269|       |                /* Non-strict parse: reject shell metacharacters */
 1270|    573|                rc = ssh_config_parse_uri(value,
 1271|    573|                                          &username,
 1272|    573|                                          &hostname,
 1273|    573|                                          NULL,
 1274|    573|                                          true,
 1275|    573|                                          false);
 1276|    573|                if (rc != SSH_OK || hostname == NULL) {
  ------------------
  |  |  315|  1.14k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1276:21): [True: 0, False: 573]
  |  Branch (1276:37): [True: 0, False: 573]
  ------------------
 1277|      0|                    SAFE_FREE(username);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1278|      0|                    SAFE_FREE(hostname);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1279|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1280|      0|                    return -1;
 1281|      0|                }
 1282|       |
 1283|       |                /* Non-strict passed: set username and originalhost */
 1284|    573|                if (username != NULL) {
  ------------------
  |  Branch (1284:21): [True: 0, False: 573]
  ------------------
 1285|      0|                    SAFE_FREE(session->opts.username);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1286|      0|                    session->opts.username = username;
 1287|      0|                }
 1288|    573|                SAFE_FREE(session->opts.config_hostname);
  ------------------
  |  |  375|    573|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 573]
  |  |  |  Branch (375:71): [Folded, False: 573]
  |  |  ------------------
  ------------------
 1289|    573|                SAFE_FREE(session->opts.originalhost);
  ------------------
  |  |  375|    573|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 573]
  |  |  |  Branch (375:71): [Folded, False: 573]
  |  |  ------------------
  ------------------
 1290|    573|                session->opts.originalhost = hostname;
 1291|       |
 1292|       |                /* Strict parse: set host only if valid hostname or IP */
 1293|    573|                rc = ssh_normalize_loose_ip(value, &normalized);
 1294|    573|                if (rc == -1) {
  ------------------
  |  Branch (1294:21): [True: 0, False: 573]
  ------------------
 1295|       |                    /* Error */
 1296|      0|                    SAFE_FREE(username);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1297|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1298|      0|                    return -1;
 1299|      0|                }
 1300|    573|                rc = ssh_config_parse_uri(
 1301|    573|                    (normalized != NULL) ? normalized : value,
  ------------------
  |  Branch (1301:21): [True: 0, False: 573]
  ------------------
 1302|    573|                    NULL,
 1303|    573|                    &strict_hostname,
 1304|    573|                    NULL,
 1305|    573|                    true,
 1306|    573|                    true);
 1307|    573|                SAFE_FREE(normalized);
  ------------------
  |  |  375|    573|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 573]
  |  |  |  Branch (375:71): [Folded, False: 573]
  |  |  ------------------
  ------------------
 1308|       |
 1309|    573|                if (rc != SSH_OK || strict_hostname == NULL) {
  ------------------
  |  |  315|  1.14k|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1309:21): [True: 0, False: 573]
  |  Branch (1309:37): [True: 0, False: 573]
  ------------------
 1310|      0|                    SAFE_FREE(session->opts.host);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1311|      0|                    SAFE_FREE(strict_hostname);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1312|    573|                } else {
 1313|    573|                    SAFE_FREE(session->opts.host);
  ------------------
  |  |  375|    573|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 573]
  |  |  |  Branch (375:71): [Folded, False: 573]
  |  |  ------------------
  ------------------
 1314|    573|                    session->opts.host = strict_hostname;
 1315|    573|                }
 1316|    573|            }
 1317|    632|            break;
 1318|    632|        case SSH_OPTIONS_PORT:
  ------------------
  |  Branch (1318:9): [True: 11, False: 20.7k]
  ------------------
 1319|     11|            if (value == NULL) {
  ------------------
  |  Branch (1319:17): [True: 0, False: 11]
  ------------------
 1320|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1321|      0|                return -1;
 1322|     11|            } else {
 1323|     11|                int *x = (int *) value;
 1324|     11|                if (*x <= 0 || *x > 65535) {
  ------------------
  |  Branch (1324:21): [True: 0, False: 11]
  |  Branch (1324:32): [True: 0, False: 11]
  ------------------
 1325|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1326|      0|                    return -1;
 1327|      0|                }
 1328|       |
 1329|     11|                session->opts.port = *x;
 1330|     11|            }
 1331|     11|            break;
 1332|     11|        case SSH_OPTIONS_PORT_STR:
  ------------------
  |  Branch (1332:9): [True: 0, False: 20.7k]
  ------------------
 1333|      0|            v = value;
 1334|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1334:17): [True: 0, False: 0]
  |  Branch (1334:30): [True: 0, False: 0]
  ------------------
 1335|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1336|      0|                return -1;
 1337|      0|            } else {
 1338|      0|                q = strdup(v);
 1339|      0|                if (q == NULL) {
  ------------------
  |  Branch (1339:21): [True: 0, False: 0]
  ------------------
 1340|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1341|      0|                    return -1;
 1342|      0|                }
 1343|      0|                i = strtol(q, &p, 10);
 1344|      0|                if (q == p || *p != '\0') {
  ------------------
  |  Branch (1344:21): [True: 0, False: 0]
  |  Branch (1344:31): [True: 0, False: 0]
  ------------------
 1345|      0|                    SSH_LOG(SSH_LOG_DEBUG, "No port number was parsed");
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1346|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1347|      0|                                  SSH_FATAL,
 1348|      0|                                  "Invalid port number: %s",
 1349|      0|                                  v);
 1350|      0|                    SAFE_FREE(q);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1351|      0|                    return -1;
 1352|      0|                }
 1353|      0|                SAFE_FREE(q);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1354|      0|                if (i > 65535) {
  ------------------
  |  Branch (1354:21): [True: 0, False: 0]
  ------------------
 1355|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1356|      0|                                  SSH_FATAL,
 1357|      0|                                  "The provided port number (%ld) is "
 1358|      0|                                  "too large",
 1359|      0|                                  i);
 1360|      0|                    return -1;
 1361|      0|                }
 1362|      0|                if (i <= 0) {
  ------------------
  |  Branch (1362:21): [True: 0, False: 0]
  ------------------
 1363|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 1364|      0|                                  SSH_FATAL,
 1365|      0|                                  "The provided port number (%ld) is "
 1366|      0|                                  "negative or zero",
 1367|      0|                                  i);
 1368|      0|                    return -1;
 1369|      0|                }
 1370|       |
 1371|      0|                session->opts.port = i;
 1372|      0|            }
 1373|      0|            break;
 1374|      0|        case SSH_OPTIONS_FD:
  ------------------
  |  Branch (1374:9): [True: 0, False: 20.7k]
  ------------------
 1375|      0|            if (value == NULL) {
  ------------------
  |  Branch (1375:17): [True: 0, False: 0]
  ------------------
 1376|      0|                session->opts.fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  123|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
 1377|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1378|      0|                return -1;
 1379|      0|            } else {
 1380|      0|                socket_t *x = (socket_t *) value;
 1381|      0|                if (*x < 0) {
  ------------------
  |  Branch (1381:21): [True: 0, False: 0]
  ------------------
 1382|      0|                    session->opts.fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  123|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
 1383|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1384|      0|                    return -1;
 1385|      0|                }
 1386|       |
 1387|      0|                session->opts.fd = *x & 0xffff;
 1388|      0|            }
 1389|      0|            break;
 1390|     20|        case SSH_OPTIONS_BINDADDR:
  ------------------
  |  Branch (1390:9): [True: 20, False: 20.7k]
  ------------------
 1391|     20|            v = value;
 1392|     20|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1392:17): [True: 0, False: 20]
  |  Branch (1392:30): [True: 0, False: 20]
  ------------------
 1393|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1394|      0|                return -1;
 1395|      0|            }
 1396|       |
 1397|     20|            q = strdup(v);
 1398|     20|            if (q == NULL) {
  ------------------
  |  Branch (1398:17): [True: 0, False: 20]
  ------------------
 1399|      0|                return -1;
 1400|      0|            }
 1401|     20|            SAFE_FREE(session->opts.bindaddr);
  ------------------
  |  |  375|     20|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 20]
  |  |  |  Branch (375:71): [Folded, False: 20]
  |  |  ------------------
  ------------------
 1402|     20|            session->opts.bindaddr = q;
 1403|     20|            break;
 1404|     25|        case SSH_OPTIONS_USER:
  ------------------
  |  Branch (1404:9): [True: 25, False: 20.7k]
  ------------------
 1405|     25|            v = value;
 1406|     25|            SAFE_FREE(session->opts.username);
  ------------------
  |  |  375|     25|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 25]
  |  |  |  Branch (375:71): [Folded, False: 25]
  |  |  ------------------
  ------------------
 1407|     25|            if (v == NULL) {
  ------------------
  |  Branch (1407:17): [True: 0, False: 25]
  ------------------
 1408|      0|                q = ssh_get_local_username();
 1409|      0|                if (q == NULL) {
  ------------------
  |  Branch (1409:21): [True: 0, False: 0]
  ------------------
 1410|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1411|      0|                    return -1;
 1412|      0|                }
 1413|      0|                session->opts.username = q;
 1414|     25|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (1414:24): [True: 0, False: 25]
  ------------------
 1415|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1416|      0|                return -1;
 1417|     25|            } else { /* username provided */
 1418|     25|                session->opts.username = strdup(value);
 1419|     25|                if (session->opts.username == NULL) {
  ------------------
  |  Branch (1419:21): [True: 0, False: 25]
  ------------------
 1420|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1421|      0|                    return -1;
 1422|      0|                }
 1423|     25|                rc = ssh_check_username_syntax(session->opts.username);
 1424|     25|                if (rc != SSH_OK) {
  ------------------
  |  |  315|     25|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1424:21): [True: 10, False: 15]
  ------------------
 1425|     10|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|     10|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1426|     10|                    return -1;
 1427|     10|                }
 1428|     25|            }
 1429|     15|            break;
 1430|    573|        case SSH_OPTIONS_SSH_DIR:
  ------------------
  |  Branch (1430:9): [True: 573, False: 20.1k]
  ------------------
 1431|    573|            v = value;
 1432|    573|            SAFE_FREE(session->opts.sshdir);
  ------------------
  |  |  375|    573|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 573]
  |  |  |  Branch (375:71): [Folded, False: 573]
  |  |  ------------------
  ------------------
 1433|    573|            if (v == NULL) {
  ------------------
  |  Branch (1433:17): [True: 573, False: 0]
  ------------------
 1434|    573|                session->opts.sshdir = ssh_path_expand_tilde("~/.ssh");
 1435|    573|                if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (1435:21): [True: 0, False: 573]
  ------------------
 1436|      0|                    return -1;
 1437|      0|                }
 1438|    573|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (1438:24): [True: 0, False: 0]
  ------------------
 1439|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1440|      0|                return -1;
 1441|      0|            } else {
 1442|      0|                session->opts.sshdir = ssh_path_expand_tilde(v);
 1443|      0|                if (session->opts.sshdir == NULL) {
  ------------------
  |  Branch (1443:21): [True: 0, False: 0]
  ------------------
 1444|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1445|      0|                    return -1;
 1446|      0|                }
 1447|      0|            }
 1448|    573|            break;
 1449|    573|        case SSH_OPTIONS_IDENTITY:
  ------------------
  |  Branch (1449:9): [True: 0, False: 20.7k]
  ------------------
 1450|  1.32k|        case SSH_OPTIONS_ADD_IDENTITY: {
  ------------------
  |  Branch (1450:9): [True: 1.32k, False: 19.4k]
  ------------------
 1451|  1.32k|            struct ssh_iterator *id_it = NULL;
 1452|       |
 1453|  1.32k|            v = value;
 1454|  1.32k|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1454:17): [True: 0, False: 1.32k]
  |  Branch (1454:30): [True: 180, False: 1.14k]
  ------------------
 1455|    180|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|    180|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1456|    180|                return -1;
 1457|    180|            }
 1458|  1.14k|            q = strdup(v);
 1459|  1.14k|            if (q == NULL) {
  ------------------
  |  Branch (1459:17): [True: 0, False: 1.14k]
  ------------------
 1460|      0|                return -1;
 1461|      0|            }
 1462|       |            /* Deduplicate: skip if the same path is already in the list */
 1463|  1.14k|            for (id_it = ssh_list_get_iterator(session->opts.identity_non_exp);
 1464|  3.61k|                 id_it != NULL; id_it = id_it->next) {
  ------------------
  |  Branch (1464:18): [True: 3.38k, False: 226]
  ------------------
 1465|  3.38k|                int cmp = strcmp(ssh_iterator_value(char *, id_it), q);
  ------------------
  |  |  122|  3.38k|  ((type)((iterator)->data))
  ------------------
 1466|  3.38k|                if (cmp == 0) {
  ------------------
  |  Branch (1466:21): [True: 921, False: 2.46k]
  ------------------
 1467|    921|                    free(q);
 1468|    921|                    return 0;
 1469|    921|                }
 1470|  3.38k|            }
 1471|    226|            if (session->opts.exp_flags & SSH_OPT_EXP_FLAG_IDENTITY) {
  ------------------
  |  |  118|    226|#define SSH_OPT_EXP_FLAG_IDENTITY 0x8
  ------------------
  |  Branch (1471:17): [True: 0, False: 226]
  ------------------
 1472|      0|                rc = ssh_list_append(session->opts.identity_non_exp, q);
 1473|    226|            } else {
 1474|    226|                rc = ssh_list_prepend(session->opts.identity_non_exp, q);
 1475|    226|            }
 1476|    226|            if (rc < 0) {
  ------------------
  |  Branch (1476:17): [True: 0, False: 226]
  ------------------
 1477|      0|                free(q);
 1478|      0|                return -1;
 1479|      0|            }
 1480|    226|            break;
 1481|    226|        }
 1482|  3.04k|        case SSH_OPTIONS_CERTIFICATE: {
  ------------------
  |  Branch (1482:9): [True: 3.04k, False: 17.7k]
  ------------------
 1483|  3.04k|            struct ssh_iterator *cert_it = NULL;
 1484|       |
 1485|  3.04k|            v = value;
 1486|  3.04k|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1486:17): [True: 0, False: 3.04k]
  |  Branch (1486:30): [True: 117, False: 2.92k]
  ------------------
 1487|    117|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|    117|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1488|    117|                return -1;
 1489|    117|            }
 1490|  2.92k|            q = strdup(v);
 1491|  2.92k|            if (q == NULL) {
  ------------------
  |  Branch (1491:17): [True: 0, False: 2.92k]
  ------------------
 1492|      0|                return -1;
 1493|      0|            }
 1494|       |            /* Allocate on first use (no longer pre-allocated in ssh_new()) */
 1495|  2.92k|            if (session->opts.certificate_non_exp == NULL) {
  ------------------
  |  Branch (1495:17): [True: 90, False: 2.83k]
  ------------------
 1496|     90|                session->opts.certificate_non_exp = ssh_list_new();
 1497|     90|                if (session->opts.certificate_non_exp == NULL) {
  ------------------
  |  Branch (1497:21): [True: 0, False: 90]
  ------------------
 1498|      0|                    free(q);
 1499|      0|                    return -1;
 1500|      0|                }
 1501|     90|            }
 1502|       |
 1503|       |            /* Deduplicate: skip if the same path is already in the list */
 1504|  2.92k|            for (cert_it = ssh_list_get_iterator(session->opts.certificate_non_exp);
 1505|  11.1k|                 cert_it != NULL; cert_it = cert_it->next) {
  ------------------
  |  Branch (1505:18): [True: 10.7k, False: 368]
  ------------------
 1506|  10.7k|                int cmp = strcmp(ssh_iterator_value(char *, cert_it), q);
  ------------------
  |  |  122|  10.7k|  ((type)((iterator)->data))
  ------------------
 1507|  10.7k|                if (cmp == 0) {
  ------------------
  |  Branch (1507:21): [True: 2.55k, False: 8.23k]
  ------------------
 1508|  2.55k|                    free(q);
 1509|  2.55k|                    return 0;
 1510|  2.55k|                }
 1511|  10.7k|            }
 1512|    368|            rc = ssh_list_append(session->opts.certificate_non_exp, q);
 1513|    368|            if (rc < 0) {
  ------------------
  |  Branch (1513:17): [True: 0, False: 368]
  ------------------
 1514|      0|                free(q);
 1515|      0|                return -1;
 1516|      0|            }
 1517|    368|            break;
 1518|    368|        }
 1519|    368|        case SSH_OPTIONS_KNOWNHOSTS:
  ------------------
  |  Branch (1519:9): [True: 0, False: 20.7k]
  ------------------
 1520|      0|            v = value;
 1521|      0|            SAFE_FREE(session->opts.knownhosts);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1522|      0|            if (v == NULL) {
  ------------------
  |  Branch (1522:17): [True: 0, False: 0]
  ------------------
 1523|       |                /* The default value will be set by the ssh_options_apply() */
 1524|      0|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (1524:24): [True: 0, False: 0]
  ------------------
 1525|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1526|      0|                return -1;
 1527|      0|            } else {
 1528|      0|                session->opts.knownhosts = strdup(v);
 1529|      0|                if (session->opts.knownhosts == NULL) {
  ------------------
  |  Branch (1529:21): [True: 0, False: 0]
  ------------------
 1530|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1531|      0|                    return -1;
 1532|      0|                }
 1533|      0|                session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_KNOWNHOSTS;
  ------------------
  |  |  115|      0|#define SSH_OPT_EXP_FLAG_KNOWNHOSTS 0x1
  ------------------
 1534|      0|            }
 1535|      0|            break;
 1536|      6|        case SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
  ------------------
  |  Branch (1536:9): [True: 6, False: 20.7k]
  ------------------
 1537|      6|            v = value;
 1538|      6|            SAFE_FREE(session->opts.global_knownhosts);
  ------------------
  |  |  375|      6|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 6]
  |  |  |  Branch (375:71): [Folded, False: 6]
  |  |  ------------------
  ------------------
 1539|      6|            if (v == NULL) {
  ------------------
  |  Branch (1539:17): [True: 0, False: 6]
  ------------------
 1540|      0|                session->opts.global_knownhosts =
 1541|      0|                    strdup(GLOBAL_CONF_DIR "/ssh_known_hosts");
  ------------------
  |  |   13|      0|#define GLOBAL_CONF_DIR "/etc/ssh"
  ------------------
 1542|      0|                if (session->opts.global_knownhosts == NULL) {
  ------------------
  |  Branch (1542:21): [True: 0, False: 0]
  ------------------
 1543|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1544|      0|                    return -1;
 1545|      0|                }
 1546|      6|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (1546:24): [True: 0, False: 6]
  ------------------
 1547|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1548|      0|                return -1;
 1549|      6|            } else {
 1550|      6|                session->opts.global_knownhosts = strdup(v);
 1551|      6|                if (session->opts.global_knownhosts == NULL) {
  ------------------
  |  Branch (1551:21): [True: 0, False: 6]
  ------------------
 1552|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1553|      0|                    return -1;
 1554|      0|                }
 1555|      6|                session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_GLOBAL_KNOWNHOSTS;
  ------------------
  |  |  116|      6|#define SSH_OPT_EXP_FLAG_GLOBAL_KNOWNHOSTS 0x2
  ------------------
 1556|      6|            }
 1557|      6|            break;
 1558|      9|        case SSH_OPTIONS_TIMEOUT:
  ------------------
  |  Branch (1558:9): [True: 9, False: 20.7k]
  ------------------
 1559|      9|            if (value == NULL) {
  ------------------
  |  Branch (1559:17): [True: 0, False: 9]
  ------------------
 1560|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1561|      0|                return -1;
 1562|      9|            } else {
 1563|      9|                long *x = (long *) value;
 1564|      9|                if (*x < 0) {
  ------------------
  |  Branch (1564:21): [True: 0, False: 9]
  ------------------
 1565|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1566|      0|                    return -1;
 1567|      0|                }
 1568|       |
 1569|      9|                session->opts.timeout = *x & 0xffffffffU;
 1570|      9|            }
 1571|      9|            break;
 1572|      9|        case SSH_OPTIONS_TIMEOUT_USEC:
  ------------------
  |  Branch (1572:9): [True: 0, False: 20.7k]
  ------------------
 1573|      0|            if (value == NULL) {
  ------------------
  |  Branch (1573:17): [True: 0, False: 0]
  ------------------
 1574|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1575|      0|                return -1;
 1576|      0|            } else {
 1577|      0|                long *x = (long *) value;
 1578|      0|                if (*x < 0) {
  ------------------
  |  Branch (1578:21): [True: 0, False: 0]
  ------------------
 1579|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1580|      0|                    return -1;
 1581|      0|                }
 1582|       |
 1583|      0|                session->opts.timeout_usec = *x & 0xffffffffU;
 1584|      0|            }
 1585|      0|            break;
 1586|      0|        case SSH_OPTIONS_SSH1:
  ------------------
  |  Branch (1586:9): [True: 0, False: 20.7k]
  ------------------
 1587|      0|            break;
 1588|      0|        case SSH_OPTIONS_SSH2:
  ------------------
  |  Branch (1588:9): [True: 0, False: 20.7k]
  ------------------
 1589|      0|            break;
 1590|      2|        case SSH_OPTIONS_LOG_VERBOSITY:
  ------------------
  |  Branch (1590:9): [True: 2, False: 20.7k]
  ------------------
 1591|      2|            if (value == NULL) {
  ------------------
  |  Branch (1591:17): [True: 0, False: 2]
  ------------------
 1592|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1593|      0|                return -1;
 1594|      2|            } else {
 1595|      2|                int *x = (int *) value;
 1596|      2|                if (*x < 0) {
  ------------------
  |  Branch (1596:21): [True: 0, False: 2]
  ------------------
 1597|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1598|      0|                    return -1;
 1599|      0|                }
 1600|       |
 1601|      2|                session->common.log_verbosity = *x & 0xffffU;
 1602|      2|                ssh_set_log_level(*x & 0xffffU);
 1603|      2|            }
 1604|      2|            break;
 1605|      2|        case SSH_OPTIONS_LOG_VERBOSITY_STR:
  ------------------
  |  Branch (1605:9): [True: 0, False: 20.7k]
  ------------------
 1606|      0|            v = value;
 1607|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1607:17): [True: 0, False: 0]
  |  Branch (1607:30): [True: 0, False: 0]
  ------------------
 1608|      0|                session->common.log_verbosity = 0;
 1609|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1610|      0|                return -1;
 1611|      0|            } else {
 1612|      0|                q = strdup(v);
 1613|      0|                if (q == NULL) {
  ------------------
  |  Branch (1613:21): [True: 0, False: 0]
  ------------------
 1614|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1615|      0|                    return -1;
 1616|      0|                }
 1617|      0|                i = strtol(q, &p, 10);
 1618|      0|                if (q == p) {
  ------------------
  |  Branch (1618:21): [True: 0, False: 0]
  ------------------
 1619|      0|                    SSH_LOG(SSH_LOG_DEBUG, "No log verbositiy was parsed");
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
 1620|      0|                    SAFE_FREE(q);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1621|      0|                    return -1;
 1622|      0|                }
 1623|      0|                SAFE_FREE(q);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1624|      0|                if (i < 0) {
  ------------------
  |  Branch (1624:21): [True: 0, False: 0]
  ------------------
 1625|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1626|      0|                    return -1;
 1627|      0|                }
 1628|       |
 1629|      0|                session->common.log_verbosity = i & 0xffffU;
 1630|      0|                ssh_set_log_level(i & 0xffffU);
 1631|      0|            }
 1632|      0|            break;
 1633|     28|        case SSH_OPTIONS_CIPHERS_C_S:
  ------------------
  |  Branch (1633:9): [True: 28, False: 20.7k]
  ------------------
 1634|     28|            v = value;
 1635|     28|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1635:17): [True: 0, False: 28]
  |  Branch (1635:30): [True: 0, False: 28]
  ------------------
 1636|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1637|      0|                return -1;
 1638|     28|            } else {
 1639|     28|                rc = ssh_options_set_algo(session,
 1640|     28|                                          SSH_CRYPT_C_S,
 1641|     28|                                          v,
 1642|     28|                                          &wanted_methods[SSH_CRYPT_C_S]);
 1643|     28|                if (rc < 0)
  ------------------
  |  Branch (1643:21): [True: 3, False: 25]
  ------------------
 1644|      3|                    return -1;
 1645|     28|            }
 1646|     25|            break;
 1647|     28|        case SSH_OPTIONS_CIPHERS_S_C:
  ------------------
  |  Branch (1647:9): [True: 28, False: 20.7k]
  ------------------
 1648|     28|            v = value;
 1649|     28|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1649:17): [True: 0, False: 28]
  |  Branch (1649:30): [True: 0, False: 28]
  ------------------
 1650|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1651|      0|                return -1;
 1652|     28|            } else {
 1653|     28|                rc = ssh_options_set_algo(session,
 1654|     28|                                          SSH_CRYPT_S_C,
 1655|     28|                                          v,
 1656|     28|                                          &wanted_methods[SSH_CRYPT_S_C]);
 1657|     28|                if (rc < 0)
  ------------------
  |  Branch (1657:21): [True: 3, False: 25]
  ------------------
 1658|      3|                    return -1;
 1659|     28|            }
 1660|     25|            break;
 1661|     32|        case SSH_OPTIONS_KEY_EXCHANGE:
  ------------------
  |  Branch (1661:9): [True: 32, False: 20.7k]
  ------------------
 1662|     32|            v = value;
 1663|     32|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1663:17): [True: 0, False: 32]
  |  Branch (1663:30): [True: 0, False: 32]
  ------------------
 1664|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1665|      0|                return -1;
 1666|     32|            } else {
 1667|     32|                rc = ssh_options_set_algo(session,
 1668|     32|                                          SSH_KEX,
 1669|     32|                                          v,
 1670|     32|                                          &wanted_methods[SSH_KEX]);
 1671|     32|                if (rc < 0)
  ------------------
  |  Branch (1671:21): [True: 14, False: 18]
  ------------------
 1672|     14|                    return -1;
 1673|     32|            }
 1674|     18|            break;
 1675|     18|        case SSH_OPTIONS_HOSTKEYS:
  ------------------
  |  Branch (1675:9): [True: 15, False: 20.7k]
  ------------------
 1676|     15|            v = value;
 1677|     15|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1677:17): [True: 0, False: 15]
  |  Branch (1677:30): [True: 0, False: 15]
  ------------------
 1678|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1679|      0|                return -1;
 1680|     15|            } else {
 1681|     15|                rc = ssh_options_set_algo(session,
 1682|     15|                                          SSH_HOSTKEYS,
 1683|     15|                                          v,
 1684|     15|                                          &wanted_methods[SSH_HOSTKEYS]);
 1685|     15|                if (rc < 0)
  ------------------
  |  Branch (1685:21): [True: 8, False: 7]
  ------------------
 1686|      8|                    return -1;
 1687|     15|            }
 1688|      7|            break;
 1689|     48|        case SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES:
  ------------------
  |  Branch (1689:9): [True: 48, False: 20.6k]
  ------------------
 1690|     48|            v = value;
 1691|     48|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1691:17): [True: 0, False: 48]
  |  Branch (1691:30): [True: 0, False: 48]
  ------------------
 1692|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1693|      0|                return -1;
 1694|     48|            } else {
 1695|     48|                rc = ssh_options_set_algo(session,
 1696|     48|                                          SSH_HOSTKEYS,
 1697|     48|                                          v,
 1698|     48|                                          &session->opts.pubkey_accepted_types);
 1699|     48|                if (rc < 0)
  ------------------
  |  Branch (1699:21): [True: 4, False: 44]
  ------------------
 1700|      4|                    return -1;
 1701|     48|            }
 1702|     44|            break;
 1703|    126|        case SSH_OPTIONS_HMAC_C_S:
  ------------------
  |  Branch (1703:9): [True: 126, False: 20.6k]
  ------------------
 1704|    126|            v = value;
 1705|    126|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1705:17): [True: 0, False: 126]
  |  Branch (1705:30): [True: 0, False: 126]
  ------------------
 1706|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1707|      0|                return -1;
 1708|    126|            } else {
 1709|    126|                rc = ssh_options_set_algo(session,
 1710|    126|                                          SSH_MAC_C_S,
 1711|    126|                                          v,
 1712|    126|                                          &wanted_methods[SSH_MAC_C_S]);
 1713|    126|                if (rc < 0)
  ------------------
  |  Branch (1713:21): [True: 31, False: 95]
  ------------------
 1714|     31|                    return -1;
 1715|    126|            }
 1716|     95|            break;
 1717|    126|         case SSH_OPTIONS_HMAC_S_C:
  ------------------
  |  Branch (1717:10): [True: 126, False: 20.6k]
  ------------------
 1718|    126|            v = value;
 1719|    126|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1719:17): [True: 0, False: 126]
  |  Branch (1719:30): [True: 0, False: 126]
  ------------------
 1720|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1721|      0|                return -1;
 1722|    126|            } else {
 1723|    126|                rc = ssh_options_set_algo(session,
 1724|    126|                                          SSH_MAC_S_C,
 1725|    126|                                          v,
 1726|    126|                                          &wanted_methods[SSH_MAC_S_C]);
 1727|    126|                if (rc < 0)
  ------------------
  |  Branch (1727:21): [True: 31, False: 95]
  ------------------
 1728|     31|                    return -1;
 1729|    126|            }
 1730|     95|            break;
 1731|     95|        case SSH_OPTIONS_COMPRESSION_C_S:
  ------------------
  |  Branch (1731:9): [True: 21, False: 20.7k]
  ------------------
 1732|     21|            v = value;
 1733|     21|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1733:17): [True: 0, False: 21]
  |  Branch (1733:30): [True: 0, False: 21]
  ------------------
 1734|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1735|      0|                return -1;
 1736|     21|            } else {
 1737|     21|                const char *tmp = v;
 1738|     21|                if (strcasecmp(value, "yes") == 0){
  ------------------
  |  Branch (1738:21): [True: 0, False: 21]
  ------------------
 1739|      0|                    tmp = "zlib@openssh.com,none";
 1740|     21|                } else if (strcasecmp(value, "no") == 0){
  ------------------
  |  Branch (1740:28): [True: 21, False: 0]
  ------------------
 1741|     21|                    tmp = "none,zlib@openssh.com";
 1742|     21|                }
 1743|     21|                rc = ssh_options_set_algo(session,
 1744|     21|                                          SSH_COMP_C_S,
 1745|     21|                                          tmp,
 1746|     21|                                          &wanted_methods[SSH_COMP_C_S]);
 1747|     21|                if (rc < 0)
  ------------------
  |  Branch (1747:21): [True: 0, False: 21]
  ------------------
 1748|      0|                    return -1;
 1749|     21|            }
 1750|     21|            break;
 1751|     21|        case SSH_OPTIONS_COMPRESSION_S_C:
  ------------------
  |  Branch (1751:9): [True: 21, False: 20.7k]
  ------------------
 1752|     21|            v = value;
 1753|     21|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1753:17): [True: 0, False: 21]
  |  Branch (1753:30): [True: 0, False: 21]
  ------------------
 1754|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1755|      0|                return -1;
 1756|     21|            } else {
 1757|     21|                const char *tmp = v;
 1758|     21|                if (strcasecmp(value, "yes") == 0){
  ------------------
  |  Branch (1758:21): [True: 0, False: 21]
  ------------------
 1759|      0|                    tmp = "zlib@openssh.com,none";
 1760|     21|                } else if (strcasecmp(value, "no") == 0){
  ------------------
  |  Branch (1760:28): [True: 21, False: 0]
  ------------------
 1761|     21|                    tmp = "none,zlib@openssh.com";
 1762|     21|                }
 1763|       |
 1764|     21|                rc = ssh_options_set_algo(session,
 1765|     21|                                          SSH_COMP_S_C,
 1766|     21|                                          tmp,
 1767|     21|                                          &wanted_methods[SSH_COMP_S_C]);
 1768|     21|                if (rc < 0)
  ------------------
  |  Branch (1768:21): [True: 0, False: 21]
  ------------------
 1769|      0|                    return -1;
 1770|     21|            }
 1771|     21|            break;
 1772|     21|        case SSH_OPTIONS_COMPRESSION:
  ------------------
  |  Branch (1772:9): [True: 21, False: 20.7k]
  ------------------
 1773|     21|            v = value;
 1774|     21|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1774:17): [True: 0, False: 21]
  |  Branch (1774:30): [True: 0, False: 21]
  ------------------
 1775|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1776|      0|                return -1;
 1777|      0|            }
 1778|     21|            if(ssh_options_set(session,SSH_OPTIONS_COMPRESSION_C_S, v) < 0)
  ------------------
  |  Branch (1778:16): [True: 0, False: 21]
  ------------------
 1779|      0|                return -1;
 1780|     21|            if(ssh_options_set(session,SSH_OPTIONS_COMPRESSION_S_C, v) < 0)
  ------------------
  |  Branch (1780:16): [True: 0, False: 21]
  ------------------
 1781|      0|                return -1;
 1782|     21|            break;
 1783|     21|        case SSH_OPTIONS_COMPRESSION_LEVEL:
  ------------------
  |  Branch (1783:9): [True: 0, False: 20.7k]
  ------------------
 1784|      0|            break;
 1785|     13|        case SSH_OPTIONS_STRICTHOSTKEYCHECK:
  ------------------
  |  Branch (1785:9): [True: 13, False: 20.7k]
  ------------------
 1786|     13|            if (value == NULL) {
  ------------------
  |  Branch (1786:17): [True: 0, False: 13]
  ------------------
 1787|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1788|      0|                return -1;
 1789|     13|            } else {
 1790|     13|                int *x = (int *) value;
 1791|     13|                int mode = *x;
 1792|       |
 1793|     13|                switch (mode) {
 1794|      0|                case SSH_STRICT_HOSTKEY_OFF:
  ------------------
  |  Branch (1794:17): [True: 0, False: 13]
  ------------------
 1795|     13|                case SSH_STRICT_HOSTKEY_YES:
  ------------------
  |  Branch (1795:17): [True: 13, False: 0]
  ------------------
 1796|     13|                case SSH_STRICT_HOSTKEY_ASK:
  ------------------
  |  Branch (1796:17): [True: 0, False: 13]
  ------------------
 1797|     13|                case SSH_STRICT_HOSTKEY_ACCEPT_NEW:
  ------------------
  |  Branch (1797:17): [True: 0, False: 13]
  ------------------
 1798|     13|                    session->opts.StrictHostKeyChecking = mode;
 1799|     13|                    break;
 1800|      0|                default:
  ------------------
  |  Branch (1800:17): [True: 0, False: 13]
  ------------------
 1801|       |                    /* Preserve the legacy low-byte "non-zero means yes"
 1802|       |                     * normalization.
 1803|       |                     */
 1804|      0|                    session->opts.StrictHostKeyChecking =
 1805|      0|                        (mode & 0xff) > 0 ? SSH_STRICT_HOSTKEY_YES
  ------------------
  |  Branch (1805:25): [True: 0, False: 0]
  ------------------
 1806|      0|                                          : SSH_STRICT_HOSTKEY_OFF;
 1807|      0|                    break;
 1808|     13|                }
 1809|     13|            }
 1810|     13|            break;
 1811|     38|        case SSH_OPTIONS_PROXYCOMMAND:
  ------------------
  |  Branch (1811:9): [True: 38, False: 20.7k]
  ------------------
 1812|     38|            v = value;
 1813|     38|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1813:17): [True: 0, False: 38]
  |  Branch (1813:30): [True: 9, False: 29]
  ------------------
 1814|      9|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      9|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1815|      9|                return -1;
 1816|     29|            } else {
 1817|     29|                SAFE_FREE(session->opts.ProxyCommand);
  ------------------
  |  |  375|     29|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 29]
  |  |  |  Branch (375:71): [Folded, False: 29]
  |  |  ------------------
  ------------------
 1818|       |                /* Setting the command to 'none' disables this option. */
 1819|     29|                rc = strcasecmp(v, "none");
 1820|     29|                if (rc != 0) {
  ------------------
  |  Branch (1820:21): [True: 29, False: 0]
  ------------------
 1821|     29|                    q = strdup(v);
 1822|     29|                    if (q == NULL) {
  ------------------
  |  Branch (1822:25): [True: 0, False: 29]
  ------------------
 1823|      0|                        return -1;
 1824|      0|                    }
 1825|     29|                    session->opts.ProxyCommand = q;
 1826|     29|                    session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_PROXYCOMMAND;
  ------------------
  |  |  117|     29|#define SSH_OPT_EXP_FLAG_PROXYCOMMAND 0x4
  ------------------
 1827|     29|                }
 1828|     29|            }
 1829|     29|            break;
 1830|     29|        case SSH_OPTIONS_PROXYJUMP:
  ------------------
  |  Branch (1830:9): [True: 0, False: 20.7k]
  ------------------
 1831|      0|            v = value;
 1832|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1832:17): [True: 0, False: 0]
  |  Branch (1832:30): [True: 0, False: 0]
  ------------------
 1833|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1834|      0|                return -1;
 1835|      0|            } else {
 1836|      0|                rc = ssh_config_parse_proxy_jump(session, v, true);
 1837|      0|                if (rc != SSH_OK) {
  ------------------
  |  |  315|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1837:21): [True: 0, False: 0]
  ------------------
 1838|      0|                    return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1839|      0|                }
 1840|      0|            }
 1841|      0|            break;
 1842|      0|        case SSH_OPTIONS_PROXYJUMP_CB_LIST_APPEND:
  ------------------
  |  Branch (1842:9): [True: 0, False: 20.7k]
  ------------------
 1843|      0|            j = (struct ssh_jump_callbacks_struct *)value;
 1844|      0|            if (j == NULL) {
  ------------------
  |  Branch (1844:17): [True: 0, False: 0]
  ------------------
 1845|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1846|      0|                return -1;
 1847|      0|            } else {
 1848|       |                /* Allocate on first use (no longer pre-allocated in ssh_new()) */
 1849|      0|                if (session->opts.proxy_jumps_user_cb == NULL) {
  ------------------
  |  Branch (1849:21): [True: 0, False: 0]
  ------------------
 1850|      0|                    session->opts.proxy_jumps_user_cb = ssh_list_new();
 1851|      0|                    if (session->opts.proxy_jumps_user_cb == NULL) {
  ------------------
  |  Branch (1851:25): [True: 0, False: 0]
  ------------------
 1852|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1853|      0|                        return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1854|      0|                    }
 1855|      0|                }
 1856|      0|                rc = ssh_list_prepend(session->opts.proxy_jumps_user_cb, j);
 1857|      0|                if (rc != SSH_OK) {
  ------------------
  |  |  315|      0|#define SSH_OK 0     /* No error */
  ------------------
  |  Branch (1857:21): [True: 0, False: 0]
  ------------------
 1858|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1859|      0|                    return SSH_ERROR;
  ------------------
  |  |  316|      0|#define SSH_ERROR -1 /* Error of some kind */
  ------------------
 1860|      0|                }
 1861|      0|            }
 1862|      0|            break;
 1863|      9|        case SSH_OPTIONS_GSSAPI_SERVER_IDENTITY:
  ------------------
  |  Branch (1863:9): [True: 9, False: 20.7k]
  ------------------
 1864|      9|            v = value;
 1865|      9|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1865:17): [True: 0, False: 9]
  |  Branch (1865:30): [True: 0, False: 9]
  ------------------
 1866|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1867|      0|                return -1;
 1868|      9|            } else {
 1869|      9|                SAFE_FREE(session->opts.gss_server_identity);
  ------------------
  |  |  375|      9|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 9]
  |  |  |  Branch (375:71): [Folded, False: 9]
  |  |  ------------------
  ------------------
 1870|      9|                session->opts.gss_server_identity = strdup(v);
 1871|      9|                if (session->opts.gss_server_identity == NULL) {
  ------------------
  |  Branch (1871:21): [True: 0, False: 9]
  ------------------
 1872|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1873|      0|                    return -1;
 1874|      0|                }
 1875|      9|            }
 1876|      9|            break;
 1877|      9|        case SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY:
  ------------------
  |  Branch (1877:9): [True: 8, False: 20.7k]
  ------------------
 1878|      8|            v = value;
 1879|      8|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (1879:17): [True: 0, False: 8]
  |  Branch (1879:30): [True: 0, False: 8]
  ------------------
 1880|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1881|      0|                return -1;
 1882|      8|            } else {
 1883|      8|                SAFE_FREE(session->opts.gss_client_identity);
  ------------------
  |  |  375|      8|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 8]
  |  |  |  Branch (375:71): [Folded, False: 8]
  |  |  ------------------
  ------------------
 1884|      8|                session->opts.gss_client_identity = strdup(v);
 1885|      8|                if (session->opts.gss_client_identity == NULL) {
  ------------------
  |  Branch (1885:21): [True: 0, False: 8]
  ------------------
 1886|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 1887|      0|                    return -1;
 1888|      0|                }
 1889|      8|            }
 1890|      8|            break;
 1891|      9|        case SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS:
  ------------------
  |  Branch (1891:9): [True: 9, False: 20.7k]
  ------------------
 1892|      9|            if (value == NULL) {
  ------------------
  |  Branch (1892:17): [True: 0, False: 9]
  ------------------
 1893|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1894|      0|                return -1;
 1895|      9|            } else {
 1896|      9|                int x = *(int *)value;
 1897|       |
 1898|      9|                session->opts.gss_delegate_creds = (x & 0xff);
 1899|      9|            }
 1900|      9|            break;
 1901|       |#ifdef WITH_GSSAPI
 1902|       |        case SSH_OPTIONS_GSSAPI_KEY_EXCHANGE:
 1903|       |            if (value == NULL) {
 1904|       |                ssh_set_error_invalid(session);
 1905|       |                return -1;
 1906|       |            } else {
 1907|       |                bool *x = (bool *)value;
 1908|       |                session->opts.gssapi_key_exchange = *x;
 1909|       |            }
 1910|       |            break;
 1911|       |        case SSH_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS:
 1912|       |            v = value;
 1913|       |            if (v == NULL || v[0] == '\0') {
 1914|       |                ssh_set_error_invalid(session);
 1915|       |                return -1;
 1916|       |            } else {
 1917|       |                /* Check if algorithms are supported */
 1918|       |                char *ret =
 1919|       |                    ssh_find_all_matching(GSSAPI_KEY_EXCHANGE_SUPPORTED, v);
 1920|       |                if (ret == NULL) {
 1921|       |                    ssh_set_error(session,
 1922|       |                                  SSH_FATAL,
 1923|       |                                  "GSSAPI key exchange algorithms not "
 1924|       |                                  "supported or invalid");
 1925|       |                    return -1;
 1926|       |                }
 1927|       |                SAFE_FREE(session->opts.gssapi_key_exchange_algs);
 1928|       |                session->opts.gssapi_key_exchange_algs = ret;
 1929|       |            }
 1930|       |            break;
 1931|       |#endif
 1932|      9|        case SSH_OPTIONS_PASSWORD_AUTH:
  ------------------
  |  Branch (1932:9): [True: 2, False: 20.7k]
  ------------------
 1933|      4|        case SSH_OPTIONS_PUBKEY_AUTH:
  ------------------
  |  Branch (1933:9): [True: 2, False: 20.7k]
  ------------------
 1934|      4|        case SSH_OPTIONS_KBDINT_AUTH:
  ------------------
  |  Branch (1934:9): [True: 0, False: 20.7k]
  ------------------
 1935|      5|        case SSH_OPTIONS_GSSAPI_AUTH:
  ------------------
  |  Branch (1935:9): [True: 1, False: 20.7k]
  ------------------
 1936|      5|            if (value == NULL) {
  ------------------
  |  Branch (1936:17): [True: 0, False: 5]
  ------------------
 1937|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1938|      0|                return -1;
 1939|      5|            } else {
 1940|      5|                int x = *(int *)value;
 1941|      5|                u = type == SSH_OPTIONS_PASSWORD_AUTH ?
  ------------------
  |  Branch (1941:21): [True: 2, False: 3]
  ------------------
 1942|      2|                    SSH_OPT_FLAG_PASSWORD_AUTH:
  ------------------
  |  |  109|      2|#define SSH_OPT_FLAG_PASSWORD_AUTH 0x1
  ------------------
 1943|      5|                    type == SSH_OPTIONS_PUBKEY_AUTH ?
  ------------------
  |  Branch (1943:21): [True: 2, False: 1]
  ------------------
 1944|      2|                        SSH_OPT_FLAG_PUBKEY_AUTH:
  ------------------
  |  |  110|      2|#define SSH_OPT_FLAG_PUBKEY_AUTH 0x2
  ------------------
 1945|      3|                        type == SSH_OPTIONS_KBDINT_AUTH ?
  ------------------
  |  Branch (1945:25): [True: 0, False: 1]
  ------------------
 1946|      0|                            SSH_OPT_FLAG_KBDINT_AUTH:
  ------------------
  |  |  111|      0|#define SSH_OPT_FLAG_KBDINT_AUTH 0x4
  ------------------
 1947|      1|                            SSH_OPT_FLAG_GSSAPI_AUTH;
  ------------------
  |  |  112|      6|#define SSH_OPT_FLAG_GSSAPI_AUTH 0x8
  ------------------
 1948|      5|                if (x != 0) {
  ------------------
  |  Branch (1948:21): [True: 3, False: 2]
  ------------------
 1949|      3|                    session->opts.flags |= u;
 1950|      3|                } else {
 1951|      2|                    session->opts.flags &= ~u;
 1952|      2|                }
 1953|      5|                if (type == SSH_OPTIONS_PUBKEY_AUTH) {
  ------------------
  |  Branch (1953:21): [True: 2, False: 3]
  ------------------
 1954|       |                    /*
 1955|       |                     * Keep the legacy enabled/disabled auth flag semantics in
 1956|       |                     * sync above while also storing the selected
 1957|       |                     * PubkeyAuthentication mode here.
 1958|       |                     */
 1959|      2|                    switch (x) {
 1960|      0|                    case SSH_PUBKEY_AUTH_NO:
  ------------------
  |  Branch (1960:21): [True: 0, False: 2]
  ------------------
 1961|      0|                    case SSH_PUBKEY_AUTH_ALL:
  ------------------
  |  Branch (1961:21): [True: 0, False: 2]
  ------------------
 1962|      0|                    case SSH_PUBKEY_AUTH_UNBOUND:
  ------------------
  |  Branch (1962:21): [True: 0, False: 2]
  ------------------
 1963|      2|                    case SSH_PUBKEY_AUTH_HOST_BOUND:
  ------------------
  |  Branch (1963:21): [True: 2, False: 0]
  ------------------
 1964|      2|                        session->opts.pubkey_auth = x;
 1965|      2|                        break;
 1966|      0|                    default:
  ------------------
  |  Branch (1966:21): [True: 0, False: 2]
  ------------------
 1967|       |                        /* Preserve the legacy non-zero "yes" normalization
 1968|       |                         * here so callers passing -1 still land on
 1969|       |                         * SSH_PUBKEY_AUTH_ALL.
 1970|       |                         */
 1971|      0|                        session->opts.pubkey_auth = SSH_PUBKEY_AUTH_ALL;
 1972|      0|                        break;
 1973|      2|                    }
 1974|      2|                }
 1975|      5|            }
 1976|      5|            break;
 1977|      5|        case SSH_OPTIONS_NODELAY:
  ------------------
  |  Branch (1977:9): [True: 0, False: 20.7k]
  ------------------
 1978|      0|            if (value == NULL) {
  ------------------
  |  Branch (1978:17): [True: 0, False: 0]
  ------------------
 1979|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1980|      0|                return -1;
 1981|      0|            } else {
 1982|      0|                int *x = (int *) value;
 1983|      0|                session->opts.nodelay = (*x & 0xff) > 0 ? 1 : 0;
  ------------------
  |  Branch (1983:41): [True: 0, False: 0]
  ------------------
 1984|      0|            }
 1985|      0|            break;
 1986|      0|        case SSH_OPTIONS_PROCESS_CONFIG:
  ------------------
  |  Branch (1986:9): [True: 0, False: 20.7k]
  ------------------
 1987|      0|            if (value == NULL) {
  ------------------
  |  Branch (1987:17): [True: 0, False: 0]
  ------------------
 1988|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1989|      0|                return -1;
 1990|      0|            } else {
 1991|      0|                bool *x = (bool *)value;
 1992|      0|                session->opts.config_processed = !(*x);
 1993|      0|            }
 1994|      0|            break;
 1995|    125|        case SSH_OPTIONS_REKEY_DATA:
  ------------------
  |  Branch (1995:9): [True: 125, False: 20.6k]
  ------------------
 1996|    125|            if (value == NULL) {
  ------------------
  |  Branch (1996:17): [True: 0, False: 125]
  ------------------
 1997|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 1998|      0|                return -1;
 1999|    125|            } else {
 2000|    125|                uint64_t *x = (uint64_t *)value;
 2001|    125|                session->opts.rekey_data = *x;
 2002|    125|            }
 2003|    125|            break;
 2004|    125|        case SSH_OPTIONS_REKEY_TIME:
  ------------------
  |  Branch (2004:9): [True: 77, False: 20.6k]
  ------------------
 2005|     77|            if (value == NULL) {
  ------------------
  |  Branch (2005:17): [True: 0, False: 77]
  ------------------
 2006|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2007|      0|                return -1;
 2008|     77|            } else {
 2009|     77|                uint32_t *x = (uint32_t *)value;
 2010|     77|                if (*x > UINT32_MAX / 1000) {
  ------------------
  |  Branch (2010:21): [True: 31, False: 46]
  ------------------
 2011|     31|                    ssh_set_error(session, SSH_REQUEST_DENIED,
  ------------------
  |  |  313|     31|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 2012|     31|                                  "The provided value (%" PRIu32 ") for rekey"
 2013|     31|                                  " time is too large", *x);
 2014|     31|                    return -1;
 2015|     31|                }
 2016|     46|                session->opts.rekey_time = (*x) * 1000;
 2017|     46|            }
 2018|     46|            break;
 2019|     46|        case SSH_OPTIONS_RSA_MIN_SIZE:
  ------------------
  |  Branch (2019:9): [True: 12, False: 20.7k]
  ------------------
 2020|     12|            if (value == NULL) {
  ------------------
  |  Branch (2020:17): [True: 0, False: 12]
  ------------------
 2021|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2022|      0|                return -1;
 2023|     12|            } else {
 2024|     12|                int *x = (int *)value;
 2025|       |
 2026|     12|                if (*x < 0) {
  ------------------
  |  Branch (2026:21): [True: 0, False: 12]
  ------------------
 2027|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2028|      0|                    return -1;
 2029|      0|                }
 2030|       |
 2031|       |                /* (*x == 0) is allowed as it is used to revert to default */
 2032|       |
 2033|     12|                if (*x > 0 && *x < RSA_MIN_KEY_SIZE) {
  ------------------
  |  |   49|     11|#define RSA_MIN_KEY_SIZE      1024
  ------------------
  |  Branch (2033:21): [True: 11, False: 1]
  |  Branch (2033:31): [True: 0, False: 11]
  ------------------
 2034|      0|                    ssh_set_error(session,
  ------------------
  |  |  313|      0|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 2035|      0|                                  SSH_REQUEST_DENIED,
 2036|      0|                                  "The provided value (%d) for minimal RSA key "
 2037|      0|                                  "size is too small. Use at least %d bits.",
 2038|      0|                                  *x,
 2039|      0|                                  RSA_MIN_KEY_SIZE);
 2040|      0|                    return -1;
 2041|      0|                }
 2042|     12|                session->opts.rsa_min_size = *x;
 2043|     12|            }
 2044|     12|            break;
 2045|     16|        case SSH_OPTIONS_IDENTITY_AGENT:
  ------------------
  |  Branch (2045:9): [True: 16, False: 20.7k]
  ------------------
 2046|     16|            v = value;
 2047|     16|            SAFE_FREE(session->opts.agent_socket);
  ------------------
  |  |  375|     16|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 16]
  |  |  |  Branch (375:71): [Folded, False: 16]
  |  |  ------------------
  ------------------
 2048|     16|            if (v == NULL) {
  ------------------
  |  Branch (2048:17): [True: 0, False: 16]
  ------------------
 2049|       |                /* The default value will be set by the ssh_options_apply() */
 2050|     16|            } else if (v[0] == '\0') {
  ------------------
  |  Branch (2050:24): [True: 13, False: 3]
  ------------------
 2051|     13|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|     13|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2052|     13|                return -1;
 2053|     13|            } else {
 2054|      3|                session->opts.agent_socket = ssh_path_expand_tilde(v);
 2055|      3|                if (session->opts.agent_socket == NULL) {
  ------------------
  |  Branch (2055:21): [True: 2, False: 1]
  ------------------
 2056|      2|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      2|    _ssh_set_error_oom(error, __func__)
  ------------------
 2057|      2|                    return -1;
 2058|      2|                }
 2059|      3|            }
 2060|      1|            break;
 2061|      5|        case SSH_OPTIONS_IDENTITIES_ONLY:
  ------------------
  |  Branch (2061:9): [True: 5, False: 20.7k]
  ------------------
 2062|      5|            if (value == NULL) {
  ------------------
  |  Branch (2062:17): [True: 0, False: 5]
  ------------------
 2063|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2064|      0|                return -1;
 2065|      5|            } else {
 2066|      5|                bool *x = (bool *)value;
 2067|      5|                session->opts.identities_only = *x;
 2068|      5|            }
 2069|      5|            break;
 2070|      5|        case SSH_OPTIONS_CONTROL_MASTER:
  ------------------
  |  Branch (2070:9): [True: 0, False: 20.7k]
  ------------------
 2071|      0|            if (value == NULL) {
  ------------------
  |  Branch (2071:17): [True: 0, False: 0]
  ------------------
 2072|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2073|      0|                return -1;
 2074|      0|            } else {
 2075|      0|                int *x = (int *) value;
 2076|      0|                if (*x < SSH_CONTROL_MASTER_NO || *x > SSH_CONTROL_MASTER_AUTOASK) {
  ------------------
  |  Branch (2076:21): [True: 0, False: 0]
  |  Branch (2076:51): [True: 0, False: 0]
  ------------------
 2077|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2078|      0|                    return -1;
 2079|      0|                }
 2080|      0|                session->opts.control_master = *x;
 2081|      0|            }
 2082|      0|            break;
 2083|      0|        case SSH_OPTIONS_CONTROL_PATH:
  ------------------
  |  Branch (2083:9): [True: 0, False: 20.7k]
  ------------------
 2084|      0|            v = value;
 2085|      0|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (2085:17): [True: 0, False: 0]
  |  Branch (2085:30): [True: 0, False: 0]
  ------------------
 2086|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2087|      0|                return -1;
 2088|      0|            } else {
 2089|      0|                SAFE_FREE(session->opts.control_path);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2090|      0|                rc = strcasecmp(v, "none");
 2091|      0|                if (rc != 0) {
  ------------------
  |  Branch (2091:21): [True: 0, False: 0]
  ------------------
 2092|      0|                    session->opts.control_path = ssh_path_expand_tilde(v);
 2093|      0|                    if (session->opts.control_path == NULL) {
  ------------------
  |  Branch (2093:25): [True: 0, False: 0]
  ------------------
 2094|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2095|      0|                        return -1;
 2096|      0|                    }
 2097|      0|                    session->opts.exp_flags &= ~SSH_OPT_EXP_FLAG_CONTROL_PATH;
  ------------------
  |  |  119|      0|#define SSH_OPT_EXP_FLAG_CONTROL_PATH 0x10
  ------------------
 2098|      0|                }
 2099|      0|            }
 2100|      0|            break;
 2101|      0|        case SSH_OPTIONS_PKI_CONTEXT:
  ------------------
  |  Branch (2101:9): [True: 0, False: 20.7k]
  ------------------
 2102|      0|            if (value == NULL) {
  ------------------
  |  Branch (2102:17): [True: 0, False: 0]
  ------------------
 2103|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2104|      0|                return -1;
 2105|      0|            }
 2106|       |
 2107|      0|            SSH_PKI_CTX_FREE(session->pki_context);
  ------------------
  |  | 1017|      0|    do {                         \
  |  | 1018|      0|        if ((x) != NULL) {       \
  |  |  ------------------
  |  |  |  Branch (1018:13): [True: 0, False: 0]
  |  |  ------------------
  |  | 1019|      0|            ssh_pki_ctx_free(x); \
  |  | 1020|      0|            x = NULL;            \
  |  | 1021|      0|        }                        \
  |  | 1022|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (1022:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2108|       |
 2109|      0|            session->pki_context = ssh_pki_ctx_dup((const ssh_pki_ctx)value);
 2110|      0|            if (session->pki_context == NULL) {
  ------------------
  |  Branch (2110:17): [True: 0, False: 0]
  ------------------
 2111|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2112|      0|                return -1;
 2113|      0|            }
 2114|      0|            break;
 2115|      1|        case SSH_OPTIONS_ADDRESS_FAMILY:
  ------------------
  |  Branch (2115:9): [True: 1, False: 20.7k]
  ------------------
 2116|      1|            if (value == NULL) {
  ------------------
  |  Branch (2116:17): [True: 0, False: 1]
  ------------------
 2117|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2118|      0|                return -1;
 2119|      1|            } else {
 2120|      1|                int *x = (int *)value;
 2121|      1|                if (*x < SSH_ADDRESS_FAMILY_ANY ||
  ------------------
  |  Branch (2121:21): [True: 0, False: 1]
  ------------------
 2122|      1|                    *x > SSH_ADDRESS_FAMILY_INET6) {
  ------------------
  |  Branch (2122:21): [True: 0, False: 1]
  ------------------
 2123|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2124|      0|                    return -1;
 2125|      0|                }
 2126|      1|                session->opts.address_family = *x;
 2127|      1|            }
 2128|      1|            break;
 2129|      4|        case SSH_OPTIONS_BATCH_MODE:
  ------------------
  |  Branch (2129:9): [True: 4, False: 20.7k]
  ------------------
 2130|      4|            if (value == NULL) {
  ------------------
  |  Branch (2130:17): [True: 0, False: 4]
  ------------------
 2131|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2132|      0|                return -1;
 2133|      4|            } else {
 2134|      4|                bool *x = (bool *)value;
 2135|      4|                session->opts.batch_mode = *x;
 2136|      4|            }
 2137|      4|            break;
 2138|     13|        case SSH_OPTIONS_SERVER_ALIVE_INTERVAL:
  ------------------
  |  Branch (2138:9): [True: 13, False: 20.7k]
  ------------------
 2139|     13|            if (value == NULL) {
  ------------------
  |  Branch (2139:17): [True: 0, False: 13]
  ------------------
 2140|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2141|      0|                return -1;
 2142|     13|            } else {
 2143|     13|                int *x = (int *)value;
 2144|     13|                if (*x < 0) {
  ------------------
  |  Branch (2144:21): [True: 0, False: 13]
  ------------------
 2145|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2146|      0|                    return -1;
 2147|      0|                }
 2148|     13|                session->opts.server_alive_interval = *x;
 2149|     13|            }
 2150|     13|            break;
 2151|     13|        case SSH_OPTIONS_SERVER_ALIVE_COUNT_MAX:
  ------------------
  |  Branch (2151:9): [True: 1, False: 20.7k]
  ------------------
 2152|      1|            if (value == NULL) {
  ------------------
  |  Branch (2152:17): [True: 0, False: 1]
  ------------------
 2153|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2154|      0|                return -1;
 2155|      1|            } else {
 2156|      1|                int *x = (int *)value;
 2157|      1|                if (*x < 0) {
  ------------------
  |  Branch (2157:21): [True: 0, False: 1]
  ------------------
 2158|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2159|      0|                    return -1;
 2160|      0|                }
 2161|      1|                session->opts.server_alive_count_max = *x;
 2162|      1|            }
 2163|      1|            break;
 2164|      3|        case SSH_OPTIONS_ESCAPE_CHAR:
  ------------------
  |  Branch (2164:9): [True: 3, False: 20.7k]
  ------------------
 2165|      3|            if (value == NULL) {
  ------------------
  |  Branch (2165:17): [True: 0, False: 3]
  ------------------
 2166|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2167|      0|                return -1;
 2168|      3|            } else {
 2169|      3|                int *x = (int *)value;
 2170|      3|                if (*x == 0 || *x < -1 || *x > 255) {
  ------------------
  |  Branch (2170:21): [True: 0, False: 3]
  |  Branch (2170:32): [True: 0, False: 3]
  |  Branch (2170:43): [True: 0, False: 3]
  ------------------
 2171|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2172|      0|                    return -1;
 2173|      0|                }
 2174|      3|                session->opts.escape_char = *x;
 2175|      3|            }
 2176|      3|            break;
 2177|    322|        case SSH_OPTIONS_LOCAL_FORWARD:
  ------------------
  |  Branch (2177:9): [True: 322, False: 20.4k]
  ------------------
 2178|    322|            v = value;
 2179|    322|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (2179:17): [True: 0, False: 322]
  |  Branch (2179:30): [True: 0, False: 322]
  ------------------
 2180|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2181|      0|                return -1;
 2182|      0|            }
 2183|    322|            q = strdup(v);
 2184|    322|            if (q == NULL) {
  ------------------
  |  Branch (2184:17): [True: 0, False: 322]
  ------------------
 2185|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2186|      0|                return -1;
 2187|      0|            }
 2188|       |            /* Allocate on first use (no longer pre-allocated in ssh_new()) */
 2189|    322|            if (session->opts.local_forward == NULL) {
  ------------------
  |  Branch (2189:17): [True: 49, False: 273]
  ------------------
 2190|     49|                session->opts.local_forward = ssh_list_new();
 2191|     49|                if (session->opts.local_forward == NULL) {
  ------------------
  |  Branch (2191:21): [True: 0, False: 49]
  ------------------
 2192|      0|                    free(q);
 2193|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2194|      0|                    return -1;
 2195|      0|                }
 2196|     49|            }
 2197|    322|            rc = ssh_list_append(session->opts.local_forward, q);
 2198|    322|            if (rc < 0) {
  ------------------
  |  Branch (2198:17): [True: 0, False: 322]
  ------------------
 2199|      0|                free(q);
 2200|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2201|      0|                return -1;
 2202|      0|            }
 2203|    322|            break;
 2204|    322|        case SSH_OPTIONS_REMOTE_FORWARD:
  ------------------
  |  Branch (2204:9): [True: 155, False: 20.5k]
  ------------------
 2205|    155|            v = value;
 2206|    155|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (2206:17): [True: 0, False: 155]
  |  Branch (2206:30): [True: 0, False: 155]
  ------------------
 2207|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2208|      0|                return -1;
 2209|      0|            }
 2210|    155|            q = strdup(v);
 2211|    155|            if (q == NULL) {
  ------------------
  |  Branch (2211:17): [True: 0, False: 155]
  ------------------
 2212|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2213|      0|                return -1;
 2214|      0|            }
 2215|       |            /* Lazy allocation: allocate list on first use */
 2216|    155|            if (session->opts.remote_forward == NULL) {
  ------------------
  |  Branch (2216:17): [True: 47, False: 108]
  ------------------
 2217|     47|                session->opts.remote_forward = ssh_list_new();
 2218|     47|                if (session->opts.remote_forward == NULL) {
  ------------------
  |  Branch (2218:21): [True: 0, False: 47]
  ------------------
 2219|      0|                    free(q);
 2220|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2221|      0|                    return -1;
 2222|      0|                }
 2223|     47|            }
 2224|    155|            rc = ssh_list_append(session->opts.remote_forward, q);
 2225|    155|            if (rc < 0) {
  ------------------
  |  Branch (2225:17): [True: 0, False: 155]
  ------------------
 2226|      0|                free(q);
 2227|      0|                ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2228|      0|                return -1;
 2229|      0|            }
 2230|    155|            break;
 2231|    155|        case SSH_OPTIONS_PREFERRED_AUTHENTICATIONS:
  ------------------
  |  Branch (2231:9): [True: 1, False: 20.7k]
  ------------------
 2232|      1|            v = value;
 2233|      1|            SAFE_FREE(session->opts.preferred_authentications);
  ------------------
  |  |  375|      1|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 1]
  |  |  |  Branch (375:71): [Folded, False: 1]
  |  |  ------------------
  ------------------
 2234|      1|            if (v != NULL) {
  ------------------
  |  Branch (2234:17): [True: 1, False: 0]
  ------------------
 2235|      1|                if (v[0] == '\0') {
  ------------------
  |  Branch (2235:21): [True: 0, False: 1]
  ------------------
 2236|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2237|      0|                    return -1;
 2238|      0|                }
 2239|      1|                session->opts.preferred_authentications = strdup(v);
 2240|      1|                if (session->opts.preferred_authentications == NULL) {
  ------------------
  |  Branch (2240:21): [True: 0, False: 1]
  ------------------
 2241|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2242|      0|                    return -1;
 2243|      0|                }
 2244|      1|            }
 2245|      1|            break;
 2246|      6|        case SSH_OPTIONS_NUMBER_OF_PASSWORD_PROMPTS:
  ------------------
  |  Branch (2246:9): [True: 6, False: 20.7k]
  ------------------
 2247|      6|            if (value == NULL) {
  ------------------
  |  Branch (2247:17): [True: 0, False: 6]
  ------------------
 2248|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2249|      0|                return -1;
 2250|      6|            } else {
 2251|      6|                int *x = (int *)value;
 2252|      6|                if (*x <= 0) {
  ------------------
  |  Branch (2252:21): [True: 0, False: 6]
  ------------------
 2253|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2254|      0|                    return -1;
 2255|      0|                }
 2256|      6|                session->opts.number_of_password_prompts = *x;
 2257|      6|            }
 2258|      6|            break;
 2259|      6|        case SSH_OPTIONS_REQUEST_TTY:
  ------------------
  |  Branch (2259:9): [True: 6, False: 20.7k]
  ------------------
 2260|      6|            if (value == NULL) {
  ------------------
  |  Branch (2260:17): [True: 0, False: 6]
  ------------------
 2261|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2262|      0|                return -1;
 2263|      6|            } else {
 2264|      6|                int *x = (int *)value;
 2265|      6|                if (*x < SSH_REQUEST_TTY_NO || *x > SSH_REQUEST_TTY_FORCE) {
  ------------------
  |  Branch (2265:21): [True: 0, False: 6]
  |  Branch (2265:48): [True: 0, False: 6]
  ------------------
 2266|      0|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2267|      0|                    return -1;
 2268|      0|                }
 2269|      6|                session->opts.request_tty = *x;
 2270|      6|            }
 2271|      6|            break;
 2272|  13.7k|        case SSH_OPTIONS_SEND_ENV:
  ------------------
  |  Branch (2272:9): [True: 13.7k, False: 7.02k]
  ------------------
 2273|  13.7k|            v = value;
 2274|  13.7k|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (2274:17): [True: 0, False: 13.7k]
  |  Branch (2274:30): [True: 0, False: 13.7k]
  ------------------
 2275|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2276|      0|                return -1;
 2277|      0|            }
 2278|       |            /* A leading '-' removes the pattern from the list */
 2279|  13.7k|            if (v[0] == '-') {
  ------------------
  |  Branch (2279:17): [True: 4.74k, False: 8.97k]
  ------------------
 2280|  4.74k|                const char *pattern = NULL;
 2281|  4.74k|                const char *env_value = NULL;
 2282|  4.74k|                struct ssh_iterator *it = NULL;
 2283|  4.74k|                struct ssh_iterator *next = NULL;
 2284|  4.74k|                int cmp = 0;
 2285|       |
 2286|  4.74k|                pattern = v + 1;
 2287|  4.74k|                if (pattern[0] == '\0') {
  ------------------
  |  Branch (2287:21): [True: 382, False: 4.36k]
  ------------------
 2288|    382|                    ssh_set_error_invalid(session);
  ------------------
  |  |  324|    382|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2289|    382|                    return -1;
 2290|    382|                }
 2291|  4.36k|                it = ssh_list_get_iterator(session->opts.send_env);
 2292|   307k|                while (it != NULL) {
  ------------------
  |  Branch (2292:24): [True: 303k, False: 4.36k]
  ------------------
 2293|   303k|                    env_value = ssh_iterator_value(const char *, it);
  ------------------
  |  |  122|   303k|  ((type)((iterator)->data))
  ------------------
 2294|   303k|                    cmp = strcmp(env_value, pattern);
 2295|   303k|                    next = it->next;
 2296|   303k|                    if (cmp == 0) {
  ------------------
  |  Branch (2296:25): [True: 5.64k, False: 297k]
  ------------------
 2297|  5.64k|                        free((void *)env_value);
 2298|  5.64k|                        ssh_list_remove(session->opts.send_env, it);
 2299|  5.64k|                    }
 2300|   303k|                    it = next;
 2301|   303k|                }
 2302|  4.36k|                rc = SSH_OK;
  ------------------
  |  |  315|  4.36k|#define SSH_OK 0     /* No error */
  ------------------
 2303|  8.97k|            } else {
 2304|  8.97k|                q = strdup(v);
 2305|  8.97k|                if (q == NULL) {
  ------------------
  |  Branch (2305:21): [True: 0, False: 8.97k]
  ------------------
 2306|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2307|      0|                    return -1;
 2308|      0|                }
 2309|       |                /* Allocate on first use (no longer pre-allocated in ssh_new()) */
 2310|  8.97k|                if (session->opts.send_env == NULL) {
  ------------------
  |  Branch (2310:21): [True: 116, False: 8.85k]
  ------------------
 2311|    116|                    session->opts.send_env = ssh_list_new();
 2312|    116|                    if (session->opts.send_env == NULL) {
  ------------------
  |  Branch (2312:25): [True: 0, False: 116]
  ------------------
 2313|      0|                        free(q);
 2314|      0|                        ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2315|      0|                        return -1;
 2316|      0|                    }
 2317|    116|                }
 2318|  8.97k|                rc = ssh_list_append(session->opts.send_env, q);
 2319|  8.97k|                if (rc < 0) {
  ------------------
  |  Branch (2319:21): [True: 0, False: 8.97k]
  ------------------
 2320|      0|                    free(q);
 2321|      0|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|      0|    _ssh_set_error_oom(error, __func__)
  ------------------
 2322|      0|                    return -1;
 2323|      0|                }
 2324|  8.97k|            }
 2325|  13.3k|            break;
 2326|  13.3k|        case SSH_OPTIONS_EXIT_ON_FORWARD_FAILURE:
  ------------------
  |  Branch (2326:9): [True: 3, False: 20.7k]
  ------------------
 2327|      3|            if (value == NULL) {
  ------------------
  |  Branch (2327:17): [True: 0, False: 3]
  ------------------
 2328|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2329|      0|                return -1;
 2330|      3|            } else {
 2331|      3|                bool *x = (bool *)value;
 2332|      3|                session->opts.exit_on_forward_failure = *x;
 2333|      3|            }
 2334|      3|            break;
 2335|     20|        case SSH_OPTIONS_FORWARD_AGENT:
  ------------------
  |  Branch (2335:9): [True: 20, False: 20.7k]
  ------------------
 2336|     20|            if (value == NULL) {
  ------------------
  |  Branch (2336:17): [True: 0, False: 20]
  ------------------
 2337|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2338|      0|                return -1;
 2339|     20|            } else {
 2340|     20|                bool *x = (bool *)value;
 2341|     20|                session->opts.forward_agent = *x;
 2342|     20|            }
 2343|     20|            break;
 2344|     20|        case SSH_OPTIONS_FORWARD_AGENT_SOCK_PATH:
  ------------------
  |  Branch (2344:9): [True: 20, False: 20.7k]
  ------------------
 2345|     20|            v = value;
 2346|     20|            SAFE_FREE(session->opts.forward_agent_sock_path);
  ------------------
  |  |  375|     20|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 20]
  |  |  |  Branch (375:71): [Folded, False: 20]
  |  |  ------------------
  ------------------
 2347|     20|            if (v == NULL || v[0] == '\0') {
  ------------------
  |  Branch (2347:17): [True: 0, False: 20]
  |  Branch (2347:30): [True: 0, False: 20]
  ------------------
 2348|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2349|      0|                return -1;
 2350|     20|            } else {
 2351|     20|                session->opts.forward_agent_sock_path =
 2352|     20|                    ssh_path_expand_tilde(v);
 2353|     20|                if (session->opts.forward_agent_sock_path == NULL) {
  ------------------
  |  Branch (2353:21): [True: 14, False: 6]
  ------------------
 2354|     14|                    ssh_set_error_oom(session);
  ------------------
  |  |  320|     14|    _ssh_set_error_oom(error, __func__)
  ------------------
 2355|     14|                    return -1;
 2356|     14|                }
 2357|     20|            }
 2358|      6|            break;
 2359|      6|        case SSH_OPTIONS_GATEWAY_PORTS:
  ------------------
  |  Branch (2359:9): [True: 2, False: 20.7k]
  ------------------
 2360|      2|            if (value == NULL) {
  ------------------
  |  Branch (2360:17): [True: 0, False: 2]
  ------------------
 2361|      0|                ssh_set_error_invalid(session);
  ------------------
  |  |  324|      0|    _ssh_set_error_invalid(error, __func__)
  ------------------
 2362|      0|                return -1;
 2363|      2|            } else {
 2364|      2|                bool *x = (bool *)value;
 2365|      2|                session->opts.gateway_ports = *x;
 2366|      2|            }
 2367|      2|            break;
 2368|     39|        default:
  ------------------
  |  Branch (2368:9): [True: 39, False: 20.7k]
  ------------------
 2369|     39|            ssh_set_error(session, SSH_REQUEST_DENIED, "Unknown ssh option %d", type);
  ------------------
  |  |  313|     39|    _ssh_set_error(error, code, __func__, __VA_ARGS__)
  ------------------
 2370|     39|            return -1;
 2371|      0|            break;
 2372|  20.7k|    }
 2373|       |
 2374|       |    /*
 2375|       |     * The option was set successfully. Mark config-backed options as
 2376|       |     * explicitly set so that later processing of OpenSSH configuration files
 2377|       |     * keeps the application's value (issue #365). Options that map to
 2378|       |     * SOC_UNKNOWN are intentionally left unmarked.
 2379|       |     */
 2380|  16.3k|    opcode = ssh_opt_type_to_opcode(type);
 2381|  16.3k|    if (opcode != SOC_UNKNOWN) {
  ------------------
  |  Branch (2381:9): [True: 761, False: 15.6k]
  ------------------
 2382|    761|        session->opts.options_seen[opcode] = 1;
 2383|    761|    }
 2384|       |
 2385|  16.3k|    return 0;
 2386|  20.7k|}
options.c:ssh_opt_type_to_opcode:
  538|  16.3k|{
  539|  16.3k|    switch (type) {
  ------------------
  |  Branch (539:13): [True: 16.3k, False: 0]
  ------------------
  540|     11|    case SSH_OPTIONS_PORT:
  ------------------
  |  Branch (540:5): [True: 11, False: 16.3k]
  ------------------
  541|     11|    case SSH_OPTIONS_PORT_STR:
  ------------------
  |  Branch (541:5): [True: 0, False: 16.3k]
  ------------------
  542|     11|        return SOC_PORT;
  543|     15|    case SSH_OPTIONS_USER:
  ------------------
  |  Branch (543:5): [True: 15, False: 16.3k]
  ------------------
  544|     15|        return SOC_USERNAME;
  545|      0|    case SSH_OPTIONS_KNOWNHOSTS:
  ------------------
  |  Branch (545:5): [True: 0, False: 16.3k]
  ------------------
  546|      0|        return SOC_KNOWNHOSTS;
  547|      6|    case SSH_OPTIONS_GLOBAL_KNOWNHOSTS:
  ------------------
  |  Branch (547:5): [True: 6, False: 16.3k]
  ------------------
  548|      6|        return SOC_GLOBALKNOWNHOSTSFILE;
  549|      9|    case SSH_OPTIONS_TIMEOUT:
  ------------------
  |  Branch (549:5): [True: 9, False: 16.3k]
  ------------------
  550|      9|        return SOC_TIMEOUT;
  551|     25|    case SSH_OPTIONS_CIPHERS_C_S:
  ------------------
  |  Branch (551:5): [True: 25, False: 16.3k]
  ------------------
  552|     50|    case SSH_OPTIONS_CIPHERS_S_C:
  ------------------
  |  Branch (552:5): [True: 25, False: 16.3k]
  ------------------
  553|     50|        return SOC_CIPHERS;
  554|     21|    case SSH_OPTIONS_COMPRESSION:
  ------------------
  |  Branch (554:5): [True: 21, False: 16.3k]
  ------------------
  555|     42|    case SSH_OPTIONS_COMPRESSION_C_S:
  ------------------
  |  Branch (555:5): [True: 21, False: 16.3k]
  ------------------
  556|     63|    case SSH_OPTIONS_COMPRESSION_S_C:
  ------------------
  |  Branch (556:5): [True: 21, False: 16.3k]
  ------------------
  557|     63|        return SOC_COMPRESSION;
  558|     29|    case SSH_OPTIONS_PROXYCOMMAND:
  ------------------
  |  Branch (558:5): [True: 29, False: 16.3k]
  ------------------
  559|     29|        return SOC_PROXYCOMMAND;
  560|      0|    case SSH_OPTIONS_PROXYJUMP:
  ------------------
  |  Branch (560:5): [True: 0, False: 16.3k]
  ------------------
  561|      0|        return SOC_PROXYJUMP;
  562|     20|    case SSH_OPTIONS_BINDADDR:
  ------------------
  |  Branch (562:5): [True: 20, False: 16.3k]
  ------------------
  563|     20|        return SOC_BINDADDRESS;
  564|     13|    case SSH_OPTIONS_STRICTHOSTKEYCHECK:
  ------------------
  |  Branch (564:5): [True: 13, False: 16.3k]
  ------------------
  565|     13|        return SOC_STRICTHOSTKEYCHECK;
  566|     18|    case SSH_OPTIONS_KEY_EXCHANGE:
  ------------------
  |  Branch (566:5): [True: 18, False: 16.3k]
  ------------------
  567|     18|        return SOC_KEXALGORITHMS;
  568|      7|    case SSH_OPTIONS_HOSTKEYS:
  ------------------
  |  Branch (568:5): [True: 7, False: 16.3k]
  ------------------
  569|      7|        return SOC_HOSTKEYALGORITHMS;
  570|     44|    case SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES:
  ------------------
  |  Branch (570:5): [True: 44, False: 16.3k]
  ------------------
  571|     44|        return SOC_PUBKEYACCEPTEDKEYTYPES;
  572|     95|    case SSH_OPTIONS_HMAC_C_S:
  ------------------
  |  Branch (572:5): [True: 95, False: 16.2k]
  ------------------
  573|    190|    case SSH_OPTIONS_HMAC_S_C:
  ------------------
  |  Branch (573:5): [True: 95, False: 16.2k]
  ------------------
  574|    190|        return SOC_MACS;
  575|      9|    case SSH_OPTIONS_GSSAPI_SERVER_IDENTITY:
  ------------------
  |  Branch (575:5): [True: 9, False: 16.3k]
  ------------------
  576|      9|        return SOC_GSSAPISERVERIDENTITY;
  577|      8|    case SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY:
  ------------------
  |  Branch (577:5): [True: 8, False: 16.3k]
  ------------------
  578|      8|        return SOC_GSSAPICLIENTIDENTITY;
  579|      9|    case SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS:
  ------------------
  |  Branch (579:5): [True: 9, False: 16.3k]
  ------------------
  580|      9|        return SOC_GSSAPIDELEGATECREDENTIALS;
  581|      0|    case SSH_OPTIONS_GSSAPI_KEY_EXCHANGE:
  ------------------
  |  Branch (581:5): [True: 0, False: 16.3k]
  ------------------
  582|      0|        return SOC_GSSAPIKEYEXCHANGE;
  583|      0|    case SSH_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS:
  ------------------
  |  Branch (583:5): [True: 0, False: 16.3k]
  ------------------
  584|      0|        return SOC_GSSAPIKEXALGORITHMS;
  585|      2|    case SSH_OPTIONS_PASSWORD_AUTH:
  ------------------
  |  Branch (585:5): [True: 2, False: 16.3k]
  ------------------
  586|      2|        return SOC_PASSWORDAUTHENTICATION;
  587|      2|    case SSH_OPTIONS_PUBKEY_AUTH:
  ------------------
  |  Branch (587:5): [True: 2, False: 16.3k]
  ------------------
  588|      2|        return SOC_PUBKEYAUTHENTICATION;
  589|      0|    case SSH_OPTIONS_KBDINT_AUTH:
  ------------------
  |  Branch (589:5): [True: 0, False: 16.3k]
  ------------------
  590|      0|        return SOC_KBDINTERACTIVEAUTHENTICATION;
  591|      1|    case SSH_OPTIONS_GSSAPI_AUTH:
  ------------------
  |  Branch (591:5): [True: 1, False: 16.3k]
  ------------------
  592|      1|        return SOC_GSSAPIAUTHENTICATION;
  593|      1|    case SSH_OPTIONS_PREFERRED_AUTHENTICATIONS:
  ------------------
  |  Branch (593:5): [True: 1, False: 16.3k]
  ------------------
  594|      1|        return SOC_PREFERRED_AUTHENTICATIONS;
  595|    125|    case SSH_OPTIONS_REKEY_DATA:
  ------------------
  |  Branch (595:5): [True: 125, False: 16.2k]
  ------------------
  596|    171|    case SSH_OPTIONS_REKEY_TIME:
  ------------------
  |  Branch (596:5): [True: 46, False: 16.3k]
  ------------------
  597|    171|        return SOC_REKEYLIMIT;
  598|     12|    case SSH_OPTIONS_RSA_MIN_SIZE:
  ------------------
  |  Branch (598:5): [True: 12, False: 16.3k]
  ------------------
  599|     12|        return SOC_REQUIRED_RSA_SIZE;
  600|      1|    case SSH_OPTIONS_IDENTITY_AGENT:
  ------------------
  |  Branch (600:5): [True: 1, False: 16.3k]
  ------------------
  601|      1|        return SOC_IDENTITYAGENT;
  602|      5|    case SSH_OPTIONS_IDENTITIES_ONLY:
  ------------------
  |  Branch (602:5): [True: 5, False: 16.3k]
  ------------------
  603|      5|        return SOC_IDENTITIESONLY;
  604|      0|    case SSH_OPTIONS_CONTROL_MASTER:
  ------------------
  |  Branch (604:5): [True: 0, False: 16.3k]
  ------------------
  605|      0|        return SOC_CONTROLMASTER;
  606|      0|    case SSH_OPTIONS_CONTROL_PATH:
  ------------------
  |  Branch (606:5): [True: 0, False: 16.3k]
  ------------------
  607|      0|        return SOC_CONTROLPATH;
  608|      1|    case SSH_OPTIONS_ADDRESS_FAMILY:
  ------------------
  |  Branch (608:5): [True: 1, False: 16.3k]
  ------------------
  609|      1|        return SOC_ADDRESSFAMILY;
  610|     13|    case SSH_OPTIONS_SERVER_ALIVE_INTERVAL:
  ------------------
  |  Branch (610:5): [True: 13, False: 16.3k]
  ------------------
  611|     13|        return SOC_SERVERALIVEINTERVAL;
  612|      1|    case SSH_OPTIONS_SERVER_ALIVE_COUNT_MAX:
  ------------------
  |  Branch (612:5): [True: 1, False: 16.3k]
  ------------------
  613|      1|        return SOC_SERVERALIVECOUNTMAX;
  614|      4|    case SSH_OPTIONS_BATCH_MODE:
  ------------------
  |  Branch (614:5): [True: 4, False: 16.3k]
  ------------------
  615|      4|        return SOC_BATCHMODE;
  616|      6|    case SSH_OPTIONS_NUMBER_OF_PASSWORD_PROMPTS:
  ------------------
  |  Branch (616:5): [True: 6, False: 16.3k]
  ------------------
  617|      6|        return SOC_NUMBER_OF_PASSWORD_PROMPTS;
  618|      6|    case SSH_OPTIONS_REQUEST_TTY:
  ------------------
  |  Branch (618:5): [True: 6, False: 16.3k]
  ------------------
  619|      6|        return SOC_REQUEST_TTY;
  620|      3|    case SSH_OPTIONS_ESCAPE_CHAR:
  ------------------
  |  Branch (620:5): [True: 3, False: 16.3k]
  ------------------
  621|      3|        return SOC_ESCAPE_CHAR;
  622|      3|    case SSH_OPTIONS_EXIT_ON_FORWARD_FAILURE:
  ------------------
  |  Branch (622:5): [True: 3, False: 16.3k]
  ------------------
  623|      3|        return SOC_EXIT_ON_FORWARD_FAILURE;
  624|     20|    case SSH_OPTIONS_FORWARD_AGENT:
  ------------------
  |  Branch (624:5): [True: 20, False: 16.3k]
  ------------------
  625|     26|    case SSH_OPTIONS_FORWARD_AGENT_SOCK_PATH:
  ------------------
  |  Branch (625:5): [True: 6, False: 16.3k]
  ------------------
  626|     26|        return SOC_FORWARD_AGENT;
  627|      2|    case SSH_OPTIONS_GATEWAY_PORTS:
  ------------------
  |  Branch (627:5): [True: 2, False: 16.3k]
  ------------------
  628|      2|        return SOC_GATEWAY_PORTS;
  629|       |    /*
  630|       |     * Accumulative options append to a list instead of replacing a value, so
  631|       |     * the "first value wins" precedence between config and the application does
  632|       |     * not apply to them.
  633|       |     */
  634|      0|    case SSH_OPTIONS_IDENTITY:
  ------------------
  |  Branch (634:5): [True: 0, False: 16.3k]
  ------------------
  635|    226|    case SSH_OPTIONS_ADD_IDENTITY:
  ------------------
  |  Branch (635:5): [True: 226, False: 16.1k]
  ------------------
  636|    594|    case SSH_OPTIONS_CERTIFICATE:
  ------------------
  |  Branch (636:5): [True: 368, False: 16.0k]
  ------------------
  637|    594|    case SSH_OPTIONS_PROXYJUMP_CB_LIST_APPEND:
  ------------------
  |  Branch (637:5): [True: 0, False: 16.3k]
  ------------------
  638|    916|    case SSH_OPTIONS_LOCAL_FORWARD:
  ------------------
  |  Branch (638:5): [True: 322, False: 16.0k]
  ------------------
  639|  1.07k|    case SSH_OPTIONS_REMOTE_FORWARD:
  ------------------
  |  Branch (639:5): [True: 155, False: 16.2k]
  ------------------
  640|  14.4k|    case SSH_OPTIONS_SEND_ENV:
  ------------------
  |  Branch (640:5): [True: 13.3k, False: 3.03k]
  ------------------
  641|       |    /*
  642|       |     * SSH_OPTIONS_HOST carries the destination as given by the application,
  643|       |     * which is OpenSSH's "host" (the Host/Match lookup key), not its
  644|       |     * "hostname". Config HostName resolves that key to the real hostname and
  645|       |     * must keep doing so. HostName has its own "first value wins" precedence
  646|       |     * between config entries, enforced independently via seen[SOC_HOSTNAME]
  647|       |     * while parsing the configuration.
  648|       |     */
  649|  15.0k|    case SSH_OPTIONS_HOST:
  ------------------
  |  Branch (649:5): [True: 632, False: 15.7k]
  ------------------
  650|       |    /*
  651|       |     * Operational settings that applications and frameworks routinely set on
  652|       |     * their own, independent of the connection configuration. OpenSSH's config
  653|       |     * parser notably does not let a previously-set value suppress LogLevel, so
  654|       |     * we follow it and leave log verbosity unprotected.
  655|       |     */
  656|  15.0k|    case SSH_OPTIONS_LOG_VERBOSITY:
  ------------------
  |  Branch (656:5): [True: 2, False: 16.3k]
  ------------------
  657|  15.0k|    case SSH_OPTIONS_LOG_VERBOSITY_STR:
  ------------------
  |  Branch (657:5): [True: 0, False: 16.3k]
  ------------------
  658|       |    /*
  659|       |     * Options with no OpenSSH ssh_config equivalent (or that are never applied
  660|       |     * from a config file), so there is no config value that could override the
  661|       |     * application's choice.
  662|       |     */
  663|  15.0k|    case SSH_OPTIONS_FD:
  ------------------
  |  Branch (663:5): [True: 0, False: 16.3k]
  ------------------
  664|  15.6k|    case SSH_OPTIONS_SSH_DIR:
  ------------------
  |  Branch (664:5): [True: 573, False: 15.8k]
  ------------------
  665|  15.6k|    case SSH_OPTIONS_SSH1:
  ------------------
  |  Branch (665:5): [True: 0, False: 16.3k]
  ------------------
  666|  15.6k|    case SSH_OPTIONS_SSH2:
  ------------------
  |  Branch (666:5): [True: 0, False: 16.3k]
  ------------------
  667|  15.6k|    case SSH_OPTIONS_TIMEOUT_USEC:
  ------------------
  |  Branch (667:5): [True: 0, False: 16.3k]
  ------------------
  668|  15.6k|    case SSH_OPTIONS_COMPRESSION_LEVEL:
  ------------------
  |  Branch (668:5): [True: 0, False: 16.3k]
  ------------------
  669|  15.6k|    case SSH_OPTIONS_NODELAY:
  ------------------
  |  Branch (669:5): [True: 0, False: 16.3k]
  ------------------
  670|  15.6k|    case SSH_OPTIONS_PROCESS_CONFIG:
  ------------------
  |  Branch (670:5): [True: 0, False: 16.3k]
  ------------------
  671|  15.6k|    case SSH_OPTIONS_PKI_CONTEXT:
  ------------------
  |  Branch (671:5): [True: 0, False: 16.3k]
  ------------------
  672|       |    /*
  673|       |     * Getter-only options: ssh_options_set() rejects them, so they never reach
  674|       |     * the marking step. Listed to keep the switch exhaustive.
  675|       |     */
  676|  15.6k|    case SSH_OPTIONS_NEXT_IDENTITY:
  ------------------
  |  Branch (676:5): [True: 0, False: 16.3k]
  ------------------
  677|  15.6k|    case SSH_OPTIONS_NEXT_LOCAL_FORWARD:
  ------------------
  |  Branch (677:5): [True: 0, False: 16.3k]
  ------------------
  678|  15.6k|    case SSH_OPTIONS_NEXT_REMOTE_FORWARD:
  ------------------
  |  Branch (678:5): [True: 0, False: 16.3k]
  ------------------
  679|  15.6k|    case SSH_OPTIONS_NEXT_SEND_ENV:
  ------------------
  |  Branch (679:5): [True: 0, False: 16.3k]
  ------------------
  680|  15.6k|        return SOC_UNKNOWN;
  681|  16.3k|    }
  682|       |
  683|      0|    return SOC_UNKNOWN;
  684|  16.3k|}

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

ssh_pki_ctx_new:
   49|    573|{
   50|    573|    struct ssh_pki_ctx_struct *ctx = NULL;
   51|       |
   52|    573|    ctx = calloc(1, sizeof(struct ssh_pki_ctx_struct));
   53|    573|    if (ctx == NULL) {
  ------------------
  |  Branch (53:9): [True: 0, False: 573]
  ------------------
   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|    573|    return ctx;
   77|    573|}
ssh_pki_ctx_free:
   86|    573|{
   87|    573|    if (context == NULL) {
  ------------------
  |  Branch (87:9): [True: 0, False: 573]
  ------------------
   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|    573|    SAFE_FREE(context);
  ------------------
  |  |  375|    573|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 573, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 573]
  |  |  ------------------
  ------------------
   99|    573|}

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

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

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|  1.28k|{
  183|  1.28k|    ssh_socket s;
  184|       |
  185|  1.28k|    s = calloc(1, sizeof(struct ssh_socket_struct));
  186|  1.28k|    if (s == NULL) {
  ------------------
  |  Branch (186:9): [True: 66, False: 1.22k]
  ------------------
  187|     66|        ssh_set_error_oom(session);
  ------------------
  |  |  320|     66|    _ssh_set_error_oom(error, __func__)
  ------------------
  188|     66|        return NULL;
  189|     66|    }
  190|  1.22k|    s->fd = SSH_INVALID_SOCKET;
  ------------------
  |  |  123|  1.22k|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  191|  1.22k|    s->last_errno = -1;
  192|  1.22k|    s->fd_is_socket = 1;
  193|  1.22k|    s->session = session;
  194|  1.22k|    s->in_buffer = ssh_buffer_new();
  195|  1.22k|    if (s->in_buffer == NULL) {
  ------------------
  |  Branch (195:9): [True: 55, False: 1.16k]
  ------------------
  196|     55|        ssh_set_error_oom(session);
  ------------------
  |  |  320|     55|    _ssh_set_error_oom(error, __func__)
  ------------------
  197|     55|        SAFE_FREE(s);
  ------------------
  |  |  375|     55|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 55, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 55]
  |  |  ------------------
  ------------------
  198|     55|        return NULL;
  199|     55|    }
  200|  1.16k|    s->out_buffer=ssh_buffer_new();
  201|  1.16k|    if (s->out_buffer == NULL) {
  ------------------
  |  Branch (201:9): [True: 15, False: 1.15k]
  ------------------
  202|     15|        ssh_set_error_oom(session);
  ------------------
  |  |  320|     15|    _ssh_set_error_oom(error, __func__)
  ------------------
  203|     15|        SSH_BUFFER_FREE(s->in_buffer);
  ------------------
  |  |  924|     15|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (924:14): [True: 15, False: 0]
  |  |  |  Branch (924:69): [Folded, False: 15]
  |  |  ------------------
  ------------------
  204|     15|        SAFE_FREE(s);
  ------------------
  |  |  375|     15|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 15, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 15]
  |  |  ------------------
  ------------------
  205|     15|        return NULL;
  206|     15|    }
  207|  1.15k|    s->read_wontblock = 0;
  208|  1.15k|    s->write_wontblock = 0;
  209|  1.15k|    s->data_except = 0;
  210|       |    s->poll_handle = NULL;
  211|  1.15k|    s->state=SSH_SOCKET_NONE;
  212|  1.15k|    return s;
  213|  1.16k|}
ssh_socket_free:
  473|  1.41k|{
  474|  1.41k|    if (s == NULL) {
  ------------------
  |  Branch (474:9): [True: 264, False: 1.15k]
  ------------------
  475|    264|        return;
  476|    264|    }
  477|  1.15k|    ssh_socket_close(s);
  478|  1.15k|    SSH_BUFFER_FREE(s->in_buffer);
  ------------------
  |  |  924|  1.15k|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (924:14): [True: 1.15k, False: 0]
  |  |  |  Branch (924:69): [Folded, False: 1.15k]
  |  |  ------------------
  ------------------
  479|  1.15k|    SSH_BUFFER_FREE(s->out_buffer);
  ------------------
  |  |  924|  1.15k|    do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (924:14): [True: 1.15k, False: 0]
  |  |  |  Branch (924:69): [Folded, False: 1.15k]
  |  |  ------------------
  ------------------
  480|       |    SAFE_FREE(s);
  ------------------
  |  |  375|  1.15k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 1.15k, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 1.15k]
  |  |  ------------------
  ------------------
  481|  1.15k|}
ssh_socket_close:
  546|  1.72k|{
  547|  1.72k|    if (ssh_socket_is_open(s)) {
  ------------------
  |  Branch (547:9): [True: 0, False: 1.72k]
  ------------------
  548|       |#ifdef _WIN32
  549|       |        CLOSE_SOCKET(s->fd);
  550|       |        s->last_errno = WSAGetLastError();
  551|       |#else
  552|      0|        CLOSE_SOCKET(s->fd);
  ------------------
  |  |  474|      0|#define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
  |  |  ------------------
  |  |  |  |  123|      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)
  |  |  ------------------
  |  |  |  |  123|      0|#define SSH_INVALID_SOCKET ((socket_t) -1)
  |  |  ------------------
  |  |  |  Branch (474:34): [True: 0, False: 0]
  |  |  |  Branch (474:116): [Folded, False: 0]
  |  |  ------------------
  ------------------
  553|      0|        s->last_errno = errno;
  554|      0|#endif
  555|      0|    }
  556|       |
  557|  1.72k|    if (s->poll_handle != NULL && !ssh_poll_is_locked(s->poll_handle)) {
  ------------------
  |  Branch (557:9): [True: 0, False: 1.72k]
  |  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.72k|    s->state = SSH_SOCKET_CLOSED;
  563|       |
  564|  1.72k|#ifndef _WIN32
  565|       |    /* If the proxy command still runs try to kill it */
  566|  1.72k|    if (s->proxy_pid != 0) {
  ------------------
  |  Branch (566:9): [True: 0, False: 1.72k]
  ------------------
  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");
  ------------------
  |  |  285|      0|    do {                                                            \
  |  |  286|      0|        char err_msg[SSH_ERRNO_MSG_MAX] = {0};                      \
  |  |  287|      0|        _ssh_log(priority,                                          \
  |  |  288|      0|                 __func__,                                          \
  |  |  289|      0|                 __VA_ARGS__,                                       \
  |  |  290|      0|                 ssh_strerror(errnum, err_msg, SSH_ERRNO_MSG_MAX)); \
  |  |  ------------------
  |  |  |  |  522|      0|#define SSH_ERRNO_MSG_MAX   1024
  |  |  ------------------
  |  |  291|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (291: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");
  ------------------
  |  |  283|      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));
  ------------------
  |  |  283|      0|    _ssh_log(priority, __func__, __VA_ARGS__)
  ------------------
  583|      0|    }
  584|  1.72k|#endif
  585|  1.72k|}
ssh_socket_is_open:
  643|  1.72k|{
  644|  1.72k|    return s->fd != SSH_INVALID_SOCKET;
  ------------------
  |  |  123|  1.72k|#define SSH_INVALID_SOCKET ((socket_t) -1)
  ------------------
  645|  1.72k|}

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

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

ssh_cipher_clear:
  124|  1.43k|void ssh_cipher_clear(struct ssh_cipher_struct *cipher){
  125|       |#ifdef HAVE_LIBGCRYPT
  126|       |    unsigned int i;
  127|       |#endif
  128|       |
  129|  1.43k|    if (cipher == NULL) {
  ------------------
  |  Branch (129:9): [True: 1.43k, False: 0]
  ------------------
  130|  1.43k|        return;
  131|  1.43k|    }
  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|    843|{
  154|    843|    struct ssh_crypto_struct *crypto = NULL;
  155|       |
  156|    843|    crypto = calloc(1, sizeof(struct ssh_crypto_struct));
  157|    843|    if (crypto == NULL) {
  ------------------
  |  Branch (157:9): [True: 128, False: 715]
  ------------------
  158|    128|        return NULL;
  159|    128|    }
  160|    715|    return crypto;
  161|    843|}
crypto_free:
  164|  1.68k|{
  165|  1.68k|    size_t i;
  166|       |
  167|  1.68k|    if (crypto == NULL) {
  ------------------
  |  Branch (167:9): [True: 971, False: 715]
  ------------------
  168|    971|        return;
  169|    971|    }
  170|       |
  171|    715|    ssh_key_free(crypto->server_pubkey);
  172|       |
  173|    715|    ssh_dh_cleanup(crypto);
  174|    715|    bignum_safe_free(crypto->shared_secret);
  ------------------
  |  |   71|    715|#define bignum_safe_free(num) do { \
  |  |   72|    715|    if ((num) != NULL) { \
  |  |  ------------------
  |  |  |  Branch (72:9): [True: 0, False: 715]
  |  |  ------------------
  |  |   73|      0|        BN_clear_free((num)); \
  |  |   74|      0|        (num)=NULL; \
  |  |   75|      0|    } \
  |  |   76|    715|    } while(0)
  |  |  ------------------
  |  |  |  Branch (76:13): [Folded, False: 715]
  |  |  ------------------
  ------------------
  175|    715|#ifdef HAVE_ECDH
  176|    715|    SAFE_FREE(crypto->ecdh_client_pubkey);
  ------------------
  |  |  375|    715|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 715]
  |  |  |  Branch (375:71): [Folded, False: 715]
  |  |  ------------------
  ------------------
  177|    715|    SAFE_FREE(crypto->ecdh_server_pubkey);
  ------------------
  |  |  375|    715|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 715]
  |  |  |  Branch (375:71): [Folded, False: 715]
  |  |  ------------------
  ------------------
  178|    715|    if (crypto->ecdh_privkey != NULL) {
  ------------------
  |  Branch (178:9): [True: 0, False: 715]
  ------------------
  179|      0|#ifdef HAVE_OPENSSL_ECC
  180|       |#if OPENSSL_VERSION_NUMBER < 0x30000000L
  181|       |        EC_KEY_free(crypto->ecdh_privkey);
  182|       |#else
  183|      0|        EVP_PKEY_free(crypto->ecdh_privkey);
  184|      0|#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|    715|#endif
  194|    715|#ifdef HAVE_LIBCRYPTO
  195|    715|    EVP_PKEY_free(crypto->curve25519_privkey);
  196|       |#elif defined(HAVE_GCRYPT_CURVE25519)
  197|       |    gcry_sexp_release(crypto->curve25519_privkey);
  198|       |#endif
  199|    715|    SAFE_FREE(crypto->dh_server_signature);
  ------------------
  |  |  375|    715|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 715]
  |  |  |  Branch (375:71): [Folded, False: 715]
  |  |  ------------------
  ------------------
  200|    715|    if (crypto->session_id != NULL) {
  ------------------
  |  Branch (200:9): [True: 0, False: 715]
  ------------------
  201|      0|        ssh_burn(crypto->session_id, crypto->session_id_len);
  ------------------
  |  |  390|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  202|      0|        SAFE_FREE(crypto->session_id);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  203|      0|    }
  204|    715|    if (crypto->secret_hash != NULL) {
  ------------------
  |  Branch (204:9): [True: 0, False: 715]
  ------------------
  205|      0|        ssh_burn(crypto->secret_hash, crypto->digest_len);
  ------------------
  |  |  390|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  206|      0|        SAFE_FREE(crypto->secret_hash);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  207|      0|    }
  208|    715|    compress_cleanup(crypto);
  209|    715|    BURN_FREE(crypto->encryptIV, crypto->digest_len);
  ------------------
  |  |  414|    715|    do {                           \
  |  |  415|    715|        if ((x) != NULL) {         \
  |  |  ------------------
  |  |  |  Branch (415:13): [True: 0, False: 715]
  |  |  ------------------
  |  |  416|      0|            burn_free((x), (len)); \
  |  |  417|      0|            (x) = NULL;            \
  |  |  418|      0|        }                          \
  |  |  419|    715|    } while (0)
  |  |  ------------------
  |  |  |  Branch (419:14): [Folded, False: 715]
  |  |  ------------------
  ------------------
  210|    715|    BURN_FREE(crypto->decryptIV, crypto->digest_len);
  ------------------
  |  |  414|    715|    do {                           \
  |  |  415|    715|        if ((x) != NULL) {         \
  |  |  ------------------
  |  |  |  Branch (415:13): [True: 0, False: 715]
  |  |  ------------------
  |  |  416|      0|            burn_free((x), (len)); \
  |  |  417|      0|            (x) = NULL;            \
  |  |  418|      0|        }                          \
  |  |  419|    715|    } while (0)
  |  |  ------------------
  |  |  |  Branch (419:14): [Folded, False: 715]
  |  |  ------------------
  ------------------
  211|    715|    BURN_FREE(crypto->encryptMAC, hmac_digest_len(crypto->out_hmac));
  ------------------
  |  |  414|    715|    do {                           \
  |  |  415|    715|        if ((x) != NULL) {         \
  |  |  ------------------
  |  |  |  Branch (415:13): [True: 0, False: 715]
  |  |  ------------------
  |  |  416|      0|            burn_free((x), (len)); \
  |  |  417|      0|            (x) = NULL;            \
  |  |  418|      0|        }                          \
  |  |  419|    715|    } while (0)
  |  |  ------------------
  |  |  |  Branch (419:14): [Folded, False: 715]
  |  |  ------------------
  ------------------
  212|    715|    BURN_FREE(crypto->decryptMAC, hmac_digest_len(crypto->in_hmac));
  ------------------
  |  |  414|    715|    do {                           \
  |  |  415|    715|        if ((x) != NULL) {         \
  |  |  ------------------
  |  |  |  Branch (415:13): [True: 0, False: 715]
  |  |  ------------------
  |  |  416|      0|            burn_free((x), (len)); \
  |  |  417|      0|            (x) = NULL;            \
  |  |  418|      0|        }                          \
  |  |  419|    715|    } while (0)
  |  |  ------------------
  |  |  |  Branch (419:14): [Folded, False: 715]
  |  |  ------------------
  ------------------
  213|    715|    if (crypto->encryptkey != NULL) {
  ------------------
  |  Branch (213:9): [True: 0, False: 715]
  ------------------
  214|      0|        ssh_burn(crypto->encryptkey, crypto->out_cipher->keysize / 8);
  ------------------
  |  |  390|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  215|      0|        SAFE_FREE(crypto->encryptkey);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  216|      0|    }
  217|    715|    if (crypto->decryptkey != NULL) {
  ------------------
  |  Branch (217:9): [True: 0, False: 715]
  ------------------
  218|      0|        ssh_burn(crypto->decryptkey, crypto->in_cipher->keysize / 8);
  ------------------
  |  |  390|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  219|      0|        SAFE_FREE(crypto->decryptkey);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  220|      0|    }
  221|       |
  222|    715|    cipher_free(crypto->in_cipher);
  223|    715|    cipher_free(crypto->out_cipher);
  224|       |
  225|  7.86k|    for (i = 0; i < SSH_KEX_METHODS; i++) {
  ------------------
  |  |   27|  7.86k|#define SSH_KEX_METHODS 10
  ------------------
  |  Branch (225:17): [True: 7.15k, False: 715]
  ------------------
  226|  7.15k|        SAFE_FREE(crypto->client_kex.methods[i]);
  ------------------
  |  |  375|  7.15k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 7.15k]
  |  |  |  Branch (375:71): [Folded, False: 7.15k]
  |  |  ------------------
  ------------------
  227|  7.15k|        SAFE_FREE(crypto->server_kex.methods[i]);
  ------------------
  |  |  375|  7.15k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 7.15k]
  |  |  |  Branch (375:71): [Folded, False: 7.15k]
  |  |  ------------------
  ------------------
  228|  7.15k|        SAFE_FREE(crypto->kex_methods[i]);
  ------------------
  |  |  375|  7.15k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 7.15k]
  |  |  |  Branch (375:71): [Folded, False: 7.15k]
  |  |  ------------------
  ------------------
  229|  7.15k|    }
  230|       |
  231|       |#ifdef HAVE_OPENSSL_MLKEM
  232|       |    EVP_PKEY_free(crypto->mlkem_privkey);
  233|       |#else
  234|    715|    if (crypto->mlkem_privkey != NULL) {
  ------------------
  |  Branch (234:9): [True: 0, False: 715]
  ------------------
  235|      0|        ssh_burn(crypto->mlkem_privkey, crypto->mlkem_privkey_len);
  ------------------
  |  |  390|      0|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  236|      0|        SAFE_FREE(crypto->mlkem_privkey);
  ------------------
  |  |  375|      0|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 0]
  |  |  ------------------
  ------------------
  237|      0|        crypto->mlkem_privkey_len = 0;
  238|      0|    }
  239|    715|#endif
  240|    715|    ssh_string_burn(crypto->hybrid_shared_secret);
  241|    715|    ssh_string_free(crypto->mlkem_client_pubkey);
  242|    715|    ssh_string_free(crypto->mlkem_ciphertext);
  243|    715|    ssh_string_free(crypto->hybrid_client_init);
  244|    715|    ssh_string_free(crypto->hybrid_server_reply);
  245|    715|    ssh_string_free(crypto->hybrid_shared_secret);
  246|       |
  247|    715|    ssh_burn(crypto, sizeof(struct ssh_crypto_struct));
  ------------------
  |  |  390|    715|#define ssh_burn(ptr, len) explicit_bzero((ptr), (len))
  ------------------
  248|       |
  249|       |    SAFE_FREE(crypto);
  ------------------
  |  |  375|    715|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 715, False: 0]
  |  |  |  Branch (375:71): [Folded, False: 715]
  |  |  ------------------
  ------------------
  250|    715|}
wrapper.c:cipher_free:
  147|  1.43k|static void cipher_free(struct ssh_cipher_struct *cipher) {
  148|  1.43k|  ssh_cipher_clear(cipher);
  149|       |  SAFE_FREE(cipher);
  ------------------
  |  |  375|  1.43k|#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
  |  |  ------------------
  |  |  |  Branch (375:31): [True: 0, False: 1.43k]
  |  |  |  Branch (375:71): [Folded, False: 1.43k]
  |  |  ------------------
  ------------------
  150|  1.43k|}

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: 0, False: 2]
  ------------------
  130|      0|        nalloc_random_bitmask = false;
  131|      0|        nalloc_bitmask = 0;
  132|      0|        return;
  133|      0|    }
  134|       |
  135|      2|    char *verbose = getenv("NALLOC_VERBOSE");
  136|      2|    if (verbose) {
  ------------------
  |  Branch (136:9): [True: 0, False: 2]
  ------------------
  137|       |        nalloc_verbose = true;
  138|      0|    }
  139|      2|}
read:
  271|      1|{
  272|      1|    if (nalloc_fail(count, "read")) {
  ------------------
  |  Branch (272:9): [True: 0, False: 1]
  ------------------
  273|      0|        errno = EIO;
  274|      0|        return -1;
  275|      0|    }
  276|      1|    return nalloc_read(fd, buf, count);
  ------------------
  |  |  263|      1|#define nalloc_read(f, b, s)    __read(f, b, s)
  ------------------
  277|      1|}
calloc:
  307|  11.6k|{
  308|  11.6k|    if (nalloc_fail(size, "calloc")) {
  ------------------
  |  Branch (308:9): [True: 526, False: 11.1k]
  ------------------
  309|    526|        errno = ENOMEM;
  310|    526|        return NULL;
  311|    526|    }
  312|  11.1k|    return nalloc_calloc(nmemb, size);
  ------------------
  |  |  259|  11.1k|#define nalloc_calloc(s, n)          __libc_calloc(s, n)
  ------------------
  313|  11.6k|}
malloc:
  316|   476k|{
  317|   476k|    if (nalloc_fail(size, "malloc")) {
  ------------------
  |  Branch (317:9): [True: 0, False: 476k]
  ------------------
  318|      0|        errno = ENOMEM;
  319|      0|        return NULL;
  320|      0|    }
  321|   476k|    return nalloc_malloc(size);
  ------------------
  |  |  258|   476k|#define nalloc_malloc(s)             __libc_malloc(s)
  ------------------
  322|   476k|}
realloc:
  325|  3.55k|{
  326|  3.55k|    if (nalloc_fail(size, "realloc")) {
  ------------------
  |  Branch (326:9): [True: 35, False: 3.51k]
  ------------------
  327|     35|        errno = ENOMEM;
  328|     35|        return NULL;
  329|     35|    }
  330|  3.51k|    return nalloc_realloc(ptr, size);
  ------------------
  |  |  260|  3.51k|#define nalloc_realloc(p, s)         __libc_realloc(p, s)
  ------------------
  331|  3.55k|}
ssh_client_config_fuzzer.c:nalloc_fail:
  194|   491k|{
  195|       |    // do not fail before thread init
  196|   491k|    if (nalloc_runs == 0) {
  ------------------
  |  Branch (196:9): [True: 10.4k, False: 481k]
  ------------------
  197|  10.4k|        return false;
  198|  10.4k|    }
  199|   481k|    if (__sync_fetch_and_add(&nalloc_running, 1) != 1) {
  ------------------
  |  Branch (199:9): [True: 6.80k, False: 474k]
  ------------------
  200|       |        // do not fail allocations outside of fuzzer input
  201|       |        // and do not fail inside of this function
  202|  6.80k|        __sync_fetch_and_sub(&nalloc_running, 1);
  203|  6.80k|        return false;
  204|  6.80k|    }
  205|   474k|    nalloc_random_update((uint8_t)size);
  206|   474k|    if (size >= 0x100) {
  ------------------
  |  Branch (206:9): [True: 10.4k, False: 463k]
  ------------------
  207|  10.4k|        nalloc_random_update((uint8_t)(size >> 8));
  208|  10.4k|        if (size >= 0x10000) {
  ------------------
  |  Branch (208:13): [True: 0, False: 10.4k]
  ------------------
  209|      0|            nalloc_random_update((uint8_t)(size >> 16));
  210|       |            // bigger may already fail or oom
  211|      0|        }
  212|  10.4k|    }
  213|   474k|    if (((nalloc_random_state ^ nalloc_magic) & nalloc_bitmask) == 0) {
  ------------------
  |  Branch (213:9): [True: 561, False: 473k]
  ------------------
  214|    561|        if (nalloc_backtrace_exclude(size, op)) {
  ------------------
  |  Branch (214:13): [True: 0, False: 561]
  ------------------
  215|      0|            __sync_fetch_and_sub(&nalloc_running, 1);
  216|      0|            return false;
  217|      0|        }
  218|    561|        __sync_fetch_and_sub(&nalloc_running, 1);
  219|    561|        return true;
  220|    561|    }
  221|   473k|    __sync_fetch_and_sub(&nalloc_running, 1);
  222|       |    return false;
  223|   474k|}
ssh_client_config_fuzzer.c:nalloc_random_update:
  143|  31.4M|{
  144|  31.4M|    nalloc_random_state =
  145|  31.4M|        ((uint32_t)((uint32_t)nalloc_random_state << 8)) ^
  146|  31.4M|        nalloc_crc32_table[((nalloc_random_state >> 24) ^ b) & 0xFF];
  147|  31.4M|}
ssh_client_config_fuzzer.c:nalloc_backtrace_exclude:
  181|    561|{
  182|    561|    if (nalloc_verbose) {
  ------------------
  |  Branch (182:9): [True: 0, False: 561]
  ------------------
  183|      0|        fprintf(stderr, "failed %s(%zu) \n", op, size);
  184|       |#ifdef NALLOC_ASAN
  185|       |        __sanitizer_print_stack_trace();
  186|       |#endif
  187|      0|    }
  188|       |
  189|       |    return false;
  190|    561|}
ssh_client_config_fuzzer.c:nalloc_start:
  151|  1.13k|{
  152|  1.13k|    if (nalloc_random_bitmask) {
  ------------------
  |  Branch (152:9): [True: 1.13k, False: 0]
  ------------------
  153|  1.13k|        if (nalloc_random_state & 0x10) {
  ------------------
  |  Branch (153:13): [True: 573, False: 561]
  ------------------
  154|    573|            nalloc_bitmask = 0xFFFFFFFF;
  155|    573|        } else {
  156|    561|            nalloc_bitmask = 1 << (5 + (nalloc_random_state & 0xF));
  157|    561|        }
  158|  1.13k|    } else if (nalloc_bitmask == 0) {
  ------------------
  |  Branch (158:16): [True: 0, False: 0]
  ------------------
  159|       |        // nalloc disabled
  160|      0|        return 2;
  161|      0|    }
  162|  1.13k|    nalloc_random_state = 0;
  163|  30.9M|    for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (163:24): [True: 30.9M, False: 1.13k]
  ------------------
  164|  30.9M|        nalloc_random_update(data[i]);
  165|  30.9M|    }
  166|  1.13k|    if (__sync_fetch_and_add(&nalloc_running, 1)) {
  ------------------
  |  Branch (166:9): [True: 0, False: 1.13k]
  ------------------
  167|      0|        __sync_fetch_and_sub(&nalloc_running, 1);
  168|      0|        return 0;
  169|      0|    }
  170|  1.13k|    nalloc_runs++;
  171|  1.13k|    return 1;
  172|  1.13k|}
ssh_client_config_fuzzer.c:nalloc_end:
  176|  1.13k|{
  177|  1.13k|    __sync_fetch_and_sub(&nalloc_running, 1);
  178|  1.13k|}

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|  1.13k|{
   48|  1.13k|    ssh_session session = NULL;
   49|  1.13k|    char *input = NULL;
   50|  1.13k|    const char *env = NULL;
   51|       |
   52|  1.13k|    input = (char *)malloc(size+1);
   53|  1.13k|    if (!input) {
  ------------------
  |  Branch (53:9): [True: 0, False: 1.13k]
  ------------------
   54|      0|        return 1;
   55|      0|    }
   56|  1.13k|    memcpy(input, data, size);
   57|  1.13k|    input[size] = '\0';
   58|       |
   59|  1.13k|    assert(nalloc_start(data, size) > 0);
  ------------------
  |  Branch (59:5): [True: 0, False: 1.13k]
  |  Branch (59:5): [True: 1.13k, False: 0]
  ------------------
   60|       |
   61|  1.13k|    session = ssh_new();
   62|  1.13k|    if (session == NULL) {
  ------------------
  |  Branch (62:9): [True: 561, False: 573]
  ------------------
   63|    561|        goto out;
   64|    561|    }
   65|       |
   66|    573|    env = getenv("LIBSSH_VERBOSITY");
   67|    573|    if (env != NULL && strlen(env) > 0) {
  ------------------
  |  Branch (67:9): [True: 0, False: 573]
  |  Branch (67:24): [True: 0, False: 0]
  ------------------
   68|      0|        ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY_STR, env);
   69|      0|    }
   70|       |    /* Make sure we have default options set */
   71|    573|    ssh_options_set(session, SSH_OPTIONS_SSH_DIR, NULL);
   72|    573|    ssh_options_set(session, SSH_OPTIONS_HOST, "example.com");
   73|       |
   74|    573|    ssh_config_parse_string(session, input);
   75|       |
   76|    573|    ssh_free(session);
   77|       |
   78|  1.13k|out:
   79|  1.13k|    free(input);
   80|       |
   81|  1.13k|    nalloc_end();
   82|  1.13k|    return 0;
   83|    573|}
ssh_client_config_fuzzer.c:_fuzz_finalize:
   29|      2|{
   30|      2|    ssh_finalize();
   31|      2|}

