Diff

Differences From Artifact [0b759298fc]:

To Artifact [acd4171235]:


542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565


566
567









568

569
570
571
572
573
574
575
542
543
544
545
546
547
548













549
550
551

552
553
554

555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572







-
-
-
-
-
-
-
-
-
-
-
-
-



-
+
+

-
+
+
+
+
+
+
+
+
+

+








/*
 *  Find a colon in str and return a pointer to the colon.
 *  This is used to separate hostname from filename.
 */
static char *colon(char *str)
{
    /* Check and process IPv6 literal addresses
     * (eg: 'jeroen@[2001:db8::1]:myfile.txt') */
    char *ipv6 = strchr(str, '[');
    if (ipv6) {
	str = strchr(str, ']');
	if (str) {
	    /* Terminate on the closing bracket */
	    *str++ = '\0';
	    return (str);
	}
	return (NULL);
    }

    /* 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[1] == ':')
    if (str[0] == '\0' || str[0] == ':' ||
        (str[0] != '[' && str[1] == ':'))
	return (NULL);
    while (*str != '\0' && *str != ':' && *str != '/' && *str != '\\')
    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);
}

/*