summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-10-31 22:10:49 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-10-31 22:10:49 +0000
commitaeec4f72499a8a08103446203ccecc512ff047ae (patch)
tree8a0c37d91a1ae64043110382f091036cdb7a9935 /Build/source/texk/web2c/lib
parentd474c86b089e7e0eda9e61e902bc0a5b705f1923 (diff)
web2c/lib/texmfmp.c: Improve a little (w32 only).
git-svn-id: svn://tug.org/texlive/trunk@38748 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib')
-rw-r--r--Build/source/texk/web2c/lib/ChangeLog4
-rw-r--r--Build/source/texk/web2c/lib/texmfmp.c36
2 files changed, 35 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog
index 4215b00ff60..4a369888ba1 100644
--- a/Build/source/texk/web2c/lib/ChangeLog
+++ b/Build/source/texk/web2c/lib/ChangeLog
@@ -1,3 +1,7 @@
+2015-10-31 Akira Kakuto <kakuto@fuk.kinidai.ac.jp>
+
+ * texmfmp.c: Improve restricted shell escape for w32 a little.
+
2015-08-19 Peter Breitenlohner <peb@mppmu.mpg.de>
* texmfmp.c: Another minor modification (unused static).
diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c
index 8d9f6422182..4545eb9b49e 100644
--- a/Build/source/texk/web2c/lib/texmfmp.c
+++ b/Build/source/texk/web2c/lib/texmfmp.c
@@ -179,8 +179,7 @@ Isspace (char c)
Internally, all arguments are quoted by ' (Unix) or " (Windows)
before calling the system() function in order to forbid execution
- of any embedded command. In addition, on Windows, special
- characters of cmd.exe are escaped by using (^).
+ of any embedded command.
If the --shell-escape option is given, we set
shellenabledp = 1 and restrictedshell = 0, i.e., any command is allowed.
@@ -381,11 +380,20 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
example:
--format="other text files" becomes
'--format=''other text files' (Unix)
- "--format=""other text files" (Windows) */
+ "--format"="other text files" (Windows) */
- if (pre == 0)
+ if (pre == 0) {
+#ifdef WIN32
+ if (*(s-1) == '=') {
+ *(d-1) = QUOTE;
+ *d++ = '=';
+ } else {
+ *d++ = QUOTE;
+ }
+#else
*d++ = QUOTE;
-
+#endif
+ }
pre = 0;
/* output the quotation mark for the quoted argument */
*d++ = QUOTE;
@@ -395,10 +403,16 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
/* Illegal use of ', or closing quotation mark is missing */
if (*s == '\'' || *s == '\0')
return -1;
+#if 0
+/*
+ The following in WIN32 may not be necessary, because
+ all arguments are quoted.
+*/
#ifdef WIN32
if (char_needs_quote (*s))
*d++ = '^';
#endif
+#endif
*d++ = *s++;
}
@@ -415,10 +429,16 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
} else if (pre == 1 && !Isspace (*s)) {
pre = 0;
*d++ = QUOTE;
+#if 0
+/*
+ The following in WIN32 may not be necessary, because
+ all arguments are quoted.
+*/
#ifdef WIN32
if (char_needs_quote (*s))
*d++ = '^';
#endif
+#endif
*d++ = *s++;
/* Ending of a usual argument */
@@ -429,10 +449,16 @@ shell_cmd_is_allowed (const char *cmd, char **safecmd, char **cmdname)
*d++ = *s++;
} else {
/* Copy a character from cmd to *safecmd. */
+#if 0
+/*
+ The following in WIN32 may not be necessary, because
+ all arguments are quoted.
+*/
#ifdef WIN32
if (char_needs_quote (*s))
*d++ = '^';
#endif
+#endif
*d++ = *s++;
}
}