Hello all.
I've encountered ths scp problem on FreeBSD 14.0. Now the default protocol is sftp on 14.
When I set command="..." in ~.ssh/authorized_keys, the command is invoked with SSH_ORIGINAL_COMMAND environment variable. However the variable contains trailing space. I checked sshd source code and and found that subsystem_args
may contain space if there isn't any argument defined in /etc/ssh/sshd_config.
In process_server_config_line_depth function on servconf.c.
Since arg2 (rest of command) doesn't have anything in this case, options->subsystem_args[] always has trailing space. Does anybody know what is the reason behind this? Why isn't arg2 checked before appending it?
I've encountered ths scp problem on FreeBSD 14.0. Now the default protocol is sftp on 14.
When I set command="..." in ~.ssh/authorized_keys, the command is invoked with SSH_ORIGINAL_COMMAND environment variable. However the variable contains trailing space. I checked sshd source code and and found that subsystem_args
may contain space if there isn't any argument defined in /etc/ssh/sshd_config.
Code:
# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server
In process_server_config_line_depth function on servconf.c.
Code:
options->subsystem_command[options->num_subsystems] =
xstrdup(arg);
/* Collect arguments (separate to executable) */
arg = argv_assemble(1, &arg); /* quote command correctly */
arg2 = argv_assemble(ac, av); /* rest of command */
xasprintf(&options->subsystem_args[options->num_subsystems],
"%s %s", arg, arg2);
free(arg2);