version 1.367, 2022/04/20 15:56:49 |
version 1.368, 2022/06/03 04:30:47 |
|
|
static void |
static void |
rm_env(Options *options, const char *arg, const char *filename, int linenum) |
rm_env(Options *options, const char *arg, const char *filename, int linenum) |
{ |
{ |
int i, j, onum_send_env = options->num_send_env; |
u_int i, j, onum_send_env = options->num_send_env; |
|
|
/* Remove an environment variable */ |
/* Remove an environment variable */ |
for (i = 0; i < options->num_send_env; ) { |
for (i = 0; i < options->num_send_env; ) { |
|
|
/* Removing an env var */ |
/* Removing an env var */ |
rm_env(options, arg, filename, linenum); |
rm_env(options, arg, filename, linenum); |
continue; |
continue; |
} else { |
|
/* Adding an env var */ |
|
if (options->num_send_env >= INT_MAX) { |
|
error("%s line %d: too many send env.", |
|
filename, linenum); |
|
goto out; |
|
} |
|
options->send_env = xrecallocarray( |
|
options->send_env, options->num_send_env, |
|
options->num_send_env + 1, |
|
sizeof(*options->send_env)); |
|
options->send_env[options->num_send_env++] = |
|
xstrdup(arg); |
|
} |
} |
|
opt_array_append(filename, linenum, |
|
lookup_opcode_name(opcode), |
|
&options->send_env, &options->num_send_env, arg); |
} |
} |
break; |
break; |
|
|
|
|
} |
} |
if (!*activep || value != 0) |
if (!*activep || value != 0) |
continue; |
continue; |
/* Adding a setenv var */ |
if (lookup_setenv_in_list(arg, options->setenv, |
if (options->num_setenv >= INT_MAX) { |
options->num_setenv) != NULL) { |
error("%s line %d: too many SetEnv.", |
debug2("%s line %d: ignoring duplicate env " |
filename, linenum); |
"name \"%.64s\"", filename, linenum, arg); |
goto out; |
continue; |
} |
} |
options->setenv = xrecallocarray( |
opt_array_append(filename, linenum, |
options->setenv, options->num_setenv, |
lookup_opcode_name(opcode), |
options->num_setenv + 1, sizeof(*options->setenv)); |
&options->setenv, &options->num_setenv, arg); |
options->setenv[options->num_setenv++] = xstrdup(arg); |
|
} |
} |
break; |
break; |
|
|
|
|
} |
} |
free(o->remote_forwards); |
free(o->remote_forwards); |
free(o->stdio_forward_host); |
free(o->stdio_forward_host); |
FREE_ARRAY(int, o->num_send_env, o->send_env); |
FREE_ARRAY(u_int, o->num_send_env, o->send_env); |
free(o->send_env); |
free(o->send_env); |
FREE_ARRAY(int, o->num_setenv, o->setenv); |
FREE_ARRAY(u_int, o->num_setenv, o->setenv); |
free(o->setenv); |
free(o->setenv); |
free(o->control_path); |
free(o->control_path); |
free(o->local_command); |
free(o->local_command); |