use REMOTE_HOSTNAME to pass the user's advertised hostname

The previously used HOSTNAME variable is being overriden by bash and
thus was not a reliable one. We switch to setting REMOTE_HOSTNAME,
but keep the HOSTNAME for compatibility.

This also changes 'test-pass-script' to check for the new variable.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
Nikos Mavrogiannopoulos
2020-08-04 17:48:42 +02:00
parent 91712b3420
commit 7a7d432d0f
4 changed files with 17 additions and 6 deletions

View File

@@ -341,6 +341,7 @@ const char* script, *next_script = NULL;
setenv("USERNAME", proc->username, 1);
setenv("GROUPNAME", proc->groupname, 1);
setenv("HOSTNAME", proc->hostname, 1);
setenv("REMOTE_HOSTNAME", proc->hostname, 1);
setenv("DEVICE", proc->tun_lease.name, 1);
setenv("USER_AGENT", proc->user_agent, 1);
setenv("DEVICE_TYPE", proc->device_type, 1);