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

Collapse All | Expand All

(-)a/clientloop.c (-6 / +3 lines)
Lines 2135-2147 client_session2_setup(int id, int want_tty, int want_subsystem, Link Here
2135
			*val++ = '\0';
2135
			*val++ = '\0';
2136
2136
2137
			matched = 0;
2137
			matched = 0;
2138
			for (j = 0; j < options.num_send_env; j++) {
2138
			for (j = 0; (! matched) && (j < options.num_send_env); j++) {
2139
				if (match_pattern(name, options.send_env[j])) {
2139
				matched = match_possibly_negated_pattern(name, options.send_env[j]);
2140
					matched = 1;
2141
					break;
2142
				}
2143
			}
2140
			}
2144
			if (!matched) {
2141
			if (matched <= 0) { /* accept only strictly positive matches */
2145
				debug3("Ignored env %s", name);
2142
				debug3("Ignored env %s", name);
2146
				free(name);
2143
				free(name);
2147
				continue;
2144
				continue;
(-)a/match.c (+25 lines)
Lines 110-115 match_pattern(const char *s, const char *pattern) Link Here
110
}
110
}
111
111
112
/*
112
/*
113
 * Tries to match the string against the pattern, possibly preceded by ! to
114
 * indicate negation).  Returns -1 if negation matches, 1 if there is
115
 * a positive match, 0 if there is no match at all.
116
 */
117
118
int
119
match_possibly_negated_pattern(const char *s, const char *pattern)
120
{
121
   int retval_if_matched;
122
123
   /* inizialize retval_if_matched according to pattern negation, if any */
124
   retval_if_matched = 1;
125
   if (*pattern == '!') {
126
      retval_if_matched = -1;
127
      /* eliminate negation character */
128
      pattern++;
129
   }
130
131
   if (match_pattern(s, pattern)) {
132
      return retval_if_matched;
133
   }
134
   return 0;
135
}
136
137
/*
113
 * Tries to match the string against the
138
 * Tries to match the string against the
114
 * comma-separated sequence of subpatterns (each possibly preceded by ! to
139
 * comma-separated sequence of subpatterns (each possibly preceded by ! to
115
 * indicate negation).  Returns -1 if negation matches, 1 if there is
140
 * indicate negation).  Returns -1 if negation matches, 1 if there is
(-)a/match.h (+1 lines)
Lines 15-20 Link Here
15
#define MATCH_H
15
#define MATCH_H
16
16
17
int	 match_pattern(const char *, const char *);
17
int	 match_pattern(const char *, const char *);
18
int	 match_possibly_negated_pattern(const char *, const char *);
18
int	 match_pattern_list(const char *, const char *, u_int, int);
19
int	 match_pattern_list(const char *, const char *, u_int, int);
19
int	 match_hostname(const char *, const char *, u_int);
20
int	 match_hostname(const char *, const char *, u_int);
20
int	 match_host_and_ip(const char *, const char *, const char *);
21
int	 match_host_and_ip(const char *, const char *, const char *);

Return to bug 1285