[Date Prev] [Date Index] [Date Next] [Thread Prev] [Thread Index] [Thread Next]
Artem Savkov asavkov@redhat.com
Thu, 4 Jun 2015 13:16:24 GMT
Exporting environmental variables to task ran by user: CONSERVER_USERNAME - username user logged in to conserver with CONSERVER_PEERNAME - user location, that is hostname user connected from Signed-off-by: Artem Savkov <asavkov@redhat.com> --- conserver/group.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conserver/group.c b/conserver/group.c index 99f0fcd..1a0bab9 100644 --- a/conserver/group.c +++ b/conserver/group.c @@ -1740,7 +1740,7 @@ SendBreak(CONSCLIENT *pCLServing, CONSENT *pCEServing, short bt) } static int -StartTask(CONSENT *pCE, char *cmd, uid_t uid, gid_t gid) +StartTask(CONSCLIENT *pCLServing, CONSENT *pCE, char *cmd, uid_t uid, gid_t gid) { int i; extern char **environ; @@ -1820,6 +1820,9 @@ StartTask(CONSENT *pCE, char *cmd, uid_t uid, gid_t gid) setuid(uid); } + setenv("CONSERVER_USERNAME", pCLServing->username->string, 1); + setenv("CONSERVER_PEERNAME", pCLServing->peername->string, 1); + SetupTty(pCE, 1); pcShell = "/bin/sh"; @@ -1893,7 +1896,7 @@ InvokeTask(CONSCLIENT *pCLServing, CONSENT *pCEServing, char id) ProcessSubst(substData, &cmd, (char **)0, (char *)0, t->subst); } - if (StartTask(pCEServing, cmd, t->uid, t->gid) == 0) { + if (StartTask(pCLServing, pCEServing, cmd, t->uid, t->gid) == 0) { CONSCLIENT *pCL; char *detail; -- 2.1.0