Diff

Differences From Artifact [42e8cab931]:

To Artifact [ac9bd0a2ba]:


366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
    char *realhost;
    void *logctx;

    if (host == NULL || host[0] == '\0')
	bump("Empty host name");

    /*
     * Remove fiddly bits of address: remove a colon suffix, and
     * the square brackets around an IPv6 literal address.
     */
    if (host[0] == '[') {
	host++;
	host[strcspn(host, "]")] = '\0';
    } else {
	host[strcspn(host, ":")] = '\0';
    }

    /*
     * If we haven't loaded session details already (e.g., from -load),
     * try looking for a session called "host".
     */
    if (!loaded_session) {
	/* Try to load settings for `host' into a temporary config */







|
<

<
<
<
<
|
<







366
367
368
369
370
371
372
373

374




375

376
377
378
379
380
381
382
    char *realhost;
    void *logctx;

    if (host == NULL || host[0] == '\0')
	bump("Empty host name");

    /*
     * Remove a colon suffix.

     */




    host[host_strcspn(host, ":")] = '\0';


    /*
     * If we haven't loaded session details already (e.g., from -load),
     * try looking for a session called "host".
     */
    if (!loaded_session) {
	/* Try to load settings for `host' into a temporary config */
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
{
    /* We ignore a leading colon, since the hostname cannot be
       empty. We also ignore a colon as second character because
       of filenames like f:myfile.txt. */
    if (str[0] == '\0' || str[0] == ':' ||
        (str[0] != '[' && str[1] == ':'))
	return (NULL);
    while (*str != '\0' && *str != ':' && *str != '/' && *str != '\\') {
	if (*str == '[') {
	    /* Skip over IPv6 literal addresses
	     * (eg: 'jeroen@[2001:db8::1]:myfile.txt') */
	    char *ipv6_end = strchr(str, ']');
	    if (ipv6_end) {
		str = ipv6_end;
	    }
	}
	str++;
    }
    if (*str == ':')
	return (str);
    else
	return (NULL);
}

/*







<
<
<
<
|
<
<
<
<
<
<







603
604
605
606
607
608
609




610






611
612
613
614
615
616
617
{
    /* We ignore a leading colon, since the hostname cannot be
       empty. We also ignore a colon as second character because
       of filenames like f:myfile.txt. */
    if (str[0] == '\0' || str[0] == ':' ||
        (str[0] != '[' && str[1] == ':'))
	return (NULL);




    str += host_strcspn(str, ":/\\");






    if (*str == ':')
	return (str);
    else
	return (NULL);
}

/*