View | Details | Raw Unified | Return to bug 2685 | Differences between
and this patch

Collapse All | Expand All

(-)a/readconf.c (-2 / +8 lines)
Lines 550-555 match_cfg_line(Options *options, char **condition, struct passwd *pw, Link Here
550
    const char *filename, int linenum)
550
    const char *filename, int linenum)
551
{
551
{
552
	char *arg, *oattrib, *attrib, *cmd, *cp = *condition, *host, *criteria;
552
	char *arg, *oattrib, *attrib, *cmd, *cp = *condition, *host, *criteria;
553
	char *hostlc;
553
	const char *ruser;
554
	const char *ruser;
554
	int r, port, this_result, result = 1, attributes = 0, negate;
555
	int r, port, this_result, result = 1, attributes = 0, negate;
555
	char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
556
	char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
Lines 570-575 match_cfg_line(Options *options, char **condition, struct passwd *pw, Link Here
570
		host = xstrdup(host_arg);
571
		host = xstrdup(host_arg);
571
	}
572
	}
572
573
574
	/* match_hostname() requires the hostname to be lowercase */
575
	hostlc = xstrdup(host);
576
	lowercase(hostlc);
577
573
	debug2("checking match for '%s' host %s originally %s",
578
	debug2("checking match for '%s' host %s originally %s",
574
	    cp, host, original_host);
579
	    cp, host, original_host);
575
	while ((oattrib = attrib = strdelim(&cp)) && *attrib != '\0') {
580
	while ((oattrib = attrib = strdelim(&cp)) && *attrib != '\0') {
Lines 608-615 match_cfg_line(Options *options, char **condition, struct passwd *pw, Link Here
608
			goto out;
613
			goto out;
609
		}
614
		}
610
		if (strcasecmp(attrib, "host") == 0) {
615
		if (strcasecmp(attrib, "host") == 0) {
611
			criteria = xstrdup(host);
616
			criteria = xstrdup(hostlc);
612
			r = match_hostname(host, arg) == 1;
617
			r = match_hostname(hostlc, arg) == 1;
613
			if (r == (negate ? 1 : 0))
618
			if (r == (negate ? 1 : 0))
614
				this_result = result = 0;
619
				this_result = result = 0;
615
		} else if (strcasecmp(attrib, "originalhost") == 0) {
620
		} else if (strcasecmp(attrib, "originalhost") == 0) {
Lines 682-687 match_cfg_line(Options *options, char **condition, struct passwd *pw, Link Here
682
	if (result != -1)
687
	if (result != -1)
683
		debug2("match %sfound", result ? "" : "not ");
688
		debug2("match %sfound", result ? "" : "not ");
684
	*condition = cp;
689
	*condition = cp;
690
	free(hostlc);
685
	free(host);
691
	free(host);
686
	return result;
692
	return result;
687
}
693
}

Return to bug 2685