This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch 3.6.x in repository nx-libs.
commit 3d76ed45e22f7a71de3ca0e918da01bb5936f0cf Author: Ulrich Sibiller <ul...@gmx.de> Date: Mon Oct 18 22:11:26 2021 +0200 nxagent: extend x2go check do not only depend on the program name but also check the DISPLAY variable and the command line parameters. This mainly helps for testing some special constructs when you want to use an alternative nxagent for x2go connections. --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Init.c | 38 ++++++++++++++++++++++++++++--- nx-X11/programs/Xserver/hw/nxagent/Init.h | 2 +- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index ea17e4813..e2dc8c083 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -201,7 +201,7 @@ int ddxProcessArgument(int argc, char *argv[], int i) /* * Check if we are running as X2Go Agent */ - checkX2goAgent(); + checkX2goAgent(argc, argv); #endif } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index 8a9964154..fe51b595a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -183,20 +183,52 @@ Bool nxagentX2go; /* * Check if agent is X2goAgent */ -void checkX2goAgent(void) +void checkX2goAgent(int argc, char * argv[]) { #ifdef TEST fprintf(stderr, "%s: nxagentProgName [%s]\n", __func__, nxagentProgName); #endif + nxagentX2go = False; + if (strcasecmp(nxagentProgName,"x2goagent") == 0) { - fprintf(stderr, "\nrunning as X2Go Agent\n"); nxagentX2go = True; } else - nxagentX2go = False; + { + char *envDisplay = getenv("DISPLAY"); + + /* x2go DISPLAY variable contains ".x2go" */ + if (envDisplay && strstr(envDisplay, ".x2go-")) + { + nxagentX2go = True; + } + else + { + for (int i = 1; i < argc; i++) + { + /* x2go session names are passed with -name and start with "X2GO-" */ + if (argv[i] && strncmp(argv[i], "-name", 5) == 0) + { + if (i < argc - 1) + { + if (strstr(argv[i+1], "X2GO-")) + { + nxagentX2go = True; + break; + } + } + } + } + } + } + + if (nxagentX2go) + fprintf(stderr, "\nrunning as X2Go Agent\n"); } + + #endif /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.h b/nx-X11/programs/Xserver/hw/nxagent/Init.h index ec0bb3483..d08517771 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.h @@ -47,7 +47,7 @@ extern Bool nxagentSaveUnder; #ifdef X2GO extern Bool nxagentX2go; -void checkX2goAgent(void); +void checkX2goAgent(int argc, char *argv[]); #endif extern ServerGrabInfoRec nxagentGrabServerInfo; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git _______________________________________________ x2go-commits mailing list x2go-commits@lists.x2go.org https://lists.x2go.org/listinfo/x2go-commits