aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Init.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2021-10-18 22:11:26 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-10-30 21:15:50 +0200
commit3d76ed45e22f7a71de3ca0e918da01bb5936f0cf (patch)
treef0a05973c863d58dc8db08a365ed840e97635889 /nx-X11/programs/Xserver/hw/nxagent/Init.c
parentc26b9b291562ea2cd3b021db7f81cf086c99bd2c (diff)
downloadnx-libs-3d76ed45e22f7a71de3ca0e918da01bb5936f0cf.tar.gz
nx-libs-3d76ed45e22f7a71de3ca0e918da01bb5936f0cf.tar.bz2
nx-libs-3d76ed45e22f7a71de3ca0e918da01bb5936f0cf.zip
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.
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Init.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Init.c38
1 files changed, 35 insertions, 3 deletions
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
/*