diff options
author | Christian Breunig <christian@breunig.cc> | 2024-06-24 19:34:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-24 19:34:05 +0200 |
commit | 0259c4337c80264d5818193a7023e5bd652b36af (patch) | |
tree | 7e8a8f89e20d89a67556a6140f24b474b3ad19ee /src/shim/vyshim.c | |
parent | 340e44c59663d2b94e7b1fddb05c49a3ad737938 (diff) | |
parent | 99c81fbe8fa0d6dd257c00a8e7fe1c5e1a15ca72 (diff) | |
download | vyos-1x-0259c4337c80264d5818193a7023e5bd652b36af.tar.gz vyos-1x-0259c4337c80264d5818193a7023e5bd652b36af.zip |
Merge pull request #3719 from vyos/mergify/bp/circinus/pr-3701
configd: T6504: send sudo_user on session init and set env variable (backport #3701)
Diffstat (limited to 'src/shim/vyshim.c')
-rw-r--r-- | src/shim/vyshim.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/shim/vyshim.c b/src/shim/vyshim.c index 41723e7a4..4d836127d 100644 --- a/src/shim/vyshim.c +++ b/src/shim/vyshim.c @@ -178,6 +178,13 @@ int initialization(void* Requester) strsep(&pid_val, "_"); debug_print("config session pid: %s\n", pid_val); + char *sudo_user = getenv("SUDO_USER"); + if (!sudo_user) { + char nobody[] = "nobody"; + sudo_user = nobody; + } + debug_print("sudo_user is %s\n", sudo_user); + debug_print("Sending init announcement\n"); char *init_announce = mkjson(MKJSON_OBJ, 1, MKJSON_STRING, "type", "init"); @@ -240,6 +247,10 @@ int initialization(void* Requester) zmq_recv(Requester, buffer, 16, 0); debug_print("Received pid receipt\n"); + debug_print("Sending config session sudo_user\n"); + zmq_send(Requester, sudo_user, strlen(sudo_user), 0); + zmq_recv(Requester, buffer, 16, 0); + debug_print("Received sudo_user receipt\n"); return 0; } |