Skip to content

Commit 44a6f54

Browse files
committed
sshd updates USERDOMAIN env variable correctly
USERDOMAIN environment variable was not being updated by sshd before s shell or subsystem was started, hence it was left pointing to local logged on user;'s domain. Now we set it correctly for the remote ssh user's domain or local account
1 parent ded4138 commit 44a6f54

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

session.c

+5
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,11 @@ do_exec_no_pty(Session *s, const char *command)
740740
SetEnvironmentVariableW(L"HOME", s -> pw -> pw_dir);
741741
SetEnvironmentVariableW(L"USERPROFILE", s -> pw -> pw_dir);
742742

743+
// find the server name of the domain controller which created this token
744+
GetDomainFromToken ( &hToken, buf, sizeof(buf));
745+
if (buf[0])
746+
SetEnvironmentVariable("USERDOMAIN", buf );
747+
743748
/*
744749
* Set SSH_CLIENT variable.
745750
*/

0 commit comments

Comments
 (0)