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

Collapse All | Expand All

(-)a/readconf.c (-5 / +41 lines)
Lines 684-689 match_cfg_line(Options *options, char **condition, struct passwd *pw, Link Here
684
	return result;
684
	return result;
685
}
685
}
686
686
687
/* Remove environment variable by pattern */
688
static void
689
rm_env(Options *options, const char *arg, const char *filename, int linenum)
690
{
691
	int i, j;
692
	char *cp;
693
694
	/* Remove an environment variable */
695
	for (i = 0; i < options->num_send_env; ) {
696
		cp = xstrdup(options->send_env[i]);
697
		if (!match_pattern(cp, arg + 1)) {
698
			free(cp);
699
			i++;
700
			continue;
701
		}
702
		debug3("%s line %d: removing environment %s",
703
		    filename, linenum, cp);
704
		free(cp);
705
		free(options->send_env[i]);
706
		options->send_env[i] = NULL;
707
		for (j = i; j < options->num_send_env - 1; j++) {
708
			options->send_env[j] = options->send_env[j + 1];
709
			options->send_env[j + 1] = NULL;
710
		}
711
		options->num_send_env--;
712
		/* NB. don't increment i */
713
	}
714
}
715
687
/*
716
/*
688
 * Returns the number of the token pointed to by cp or oBadOption.
717
 * Returns the number of the token pointed to by cp or oBadOption.
689
 */
718
 */
Lines 1359-1369 parse_keytypes: Link Here
1359
				    filename, linenum);
1388
				    filename, linenum);
1360
			if (!*activep)
1389
			if (!*activep)
1361
				continue;
1390
				continue;
1362
			if (options->num_send_env >= MAX_SEND_ENV)
1391
			if (*arg == '-') {
1363
				fatal("%s line %d: too many send env.",
1392
				/* Removing an env var */
1364
				    filename, linenum);
1393
				rm_env(options, arg, filename, linenum);
1365
			options->send_env[options->num_send_env++] =
1394
				continue;
1366
			    xstrdup(arg);
1395
			} else {
1396
				/* Adding an env var */
1397
				if (options->num_send_env >= MAX_SEND_ENV)
1398
					fatal("%s line %d: too many send env.",
1399
					    filename, linenum);
1400
				options->send_env[options->num_send_env++] =
1401
				    xstrdup(arg);
1402
			}
1367
		}
1403
		}
1368
		break;
1404
		break;
1369
1405
(-)a/ssh_config.5 (-4 / +9 lines)
Lines 1394-1404 Multiple environment variables may be separated by whitespace or spread Link Here
1394
across multiple
1394
across multiple
1395
.Cm SendEnv
1395
.Cm SendEnv
1396
directives.
1396
directives.
1397
.Pp
1398
See
1399
.Sx PATTERNS
1400
for more information on patterns.
1401
.Pp
1402
It is possible to clear previously-set
1403
.Cm SendEnv
1404
variable names by prefixing patterns with
1405
.Pa - .
1397
The default is not to send any environment variables.
1406
The default is not to send any environment variables.
1398
.Pp
1399
See
1400
.Sx PATTERNS
1401
for more information on patterns.
1402
.It Cm ServerAliveCountMax
1407
.It Cm ServerAliveCountMax
1403
Sets the number of server alive messages (see below) which may be
1408
Sets the number of server alive messages (see below) which may be
1404
sent without
1409
sent without

Return to bug 1285