|
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 |
|