aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-08-23 23:09:44 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-08-24 11:54:01 +0200
commit30a96273380a53320c8950f945b1f52c111337ce (patch)
tree1f123a90eb1ef9dc7e39ccdc6f97f07f89ae2e4e /nx-X11/programs/Xserver/hw/nxagent
parentf8e20d05f527daeb8e42e366ca2ebe1546b061df (diff)
downloadnx-libs-30a96273380a53320c8950f945b1f52c111337ce.tar.gz
nx-libs-30a96273380a53320c8950f945b1f52c111337ce.tar.bz2
nx-libs-30a96273380a53320c8950f945b1f52c111337ce.zip
Args.c: allow options to contain URL encoded characters
Same as in nxcomp's option handling. We really only need it for "," (%2C) and "=" (%3D), currently, but it can handle all encoded characters.
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c35
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/man/nxagent.15
2 files changed, 40 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index 30e3b8692..801ee0b22 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -1037,6 +1037,39 @@ int ddxProcessArgument(int argc, char *argv[], int i)
return 0;
}
+/* copy from nxcomp's Loop.cpp */
+static int
+hexval(char c) {
+ if ((c >= '0') && (c <= '9'))
+ return c - '0';
+ if ((c >= 'a') && (c <= 'f'))
+ return c - 'a' + 10;
+ if ((c >= 'A') && (c <= 'F'))
+ return c - 'A' + 10;
+ return -1;
+}
+
+static void
+URLDecodeInPlace(char *str)
+{
+ if (str) {
+ char *to = str;
+ while (str[0])
+ {
+ if ((str[0] == '%') &&
+ (hexval(str[1]) >= 0) &&
+ (hexval(str[2]) >= 0))
+ {
+ *(to++) = hexval(str[1]) * 16 + hexval(str[2]);
+ str += 3;
+ }
+ else
+ *(to++) = *(str++);
+ }
+ *to = '\0';
+ }
+}
+
static void nxagentParseSingleOption(char *name, char *value)
{
int size, argc;
@@ -1048,6 +1081,8 @@ static void nxagentParseSingleOption(char *name, char *value)
validateString(name), validateString(value));
#endif
+ URLDecodeInPlace(value);
+
if (!strcmp(name, "kbtype") ||
!strcmp(name, "keyboard") ||
!strcmp(name, "id") ||
diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1
index b9c81cdb4..6a0bfc103 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1
+++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1
@@ -480,6 +480,11 @@ As <proxy-port> you can pick an arbitrary (unused) TCP port or Unix
socket file path. This is the port / socket that you have to connect to
with the \fBnxproxy\fR application.
.PP
+The right hand side of an option (the part following the "=" character)
+can include URL encoded characters. It is required to URL encode at
+least "," (as %2D) and "=" (as %3D) to avoid wrong parsing of the
+options string.
+.PP
Available \fBnxagent\fR options (as an addition to nx/nx options supported
by nxcomp already):
.TP 8