diff mbox series

[2/4] um: port_user: Allow setting path to port-helper using UML_PORT_HELPER envvar

Message ID 6ae7e7114a5c61ae3f87d42a3e1be2e4328be9b4.1646292328.git.development@efficientek.com
State Accepted
Headers show
Series [1/4] um: port_user: Search for in.telnetd in PATH | expand

Commit Message

Glenn Washburn March 3, 2022, 7:53 a.m. UTC
This is useful when the uml-utilities user-space package has not been
installed by the administrator and an unprivileged user wants to be able to
telnet into a UML instance. The user can install the port-helper binary to
a writable path and set UML_PORT_HELPER. Fallback to using hardcoded path to
port-helper if environment variable is not set.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 arch/um/drivers/port_user.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/arch/um/drivers/port_user.c b/arch/um/drivers/port_user.c
index 0625aa42041d..3e32351dadad 100644
--- a/arch/um/drivers/port_user.c
+++ b/arch/um/drivers/port_user.c
@@ -167,10 +167,14 @@  static void port_pre_exec(void *arg)
 int port_connection(int fd, int *socket, int *pid_out)
 {
 	int new, err;
+	char *env;
 	char *argv[] = { "in.telnetd", "-L",
 			 OS_LIB_PATH "/uml/port-helper", NULL };
 	struct port_pre_exec_data data;
 
+	if ((env = getenv("UML_PORT_HELPER")))
+		argv[2] = env;
+
 	new = accept(fd, NULL, 0);
 	if (new < 0)
 		return -errno;