aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/misc/texinfo.tex203
-rw-r--r--lib/secure_getenv.c29
-rw-r--r--lib/verify.h2
-rw-r--r--m4/secure_getenv.m41
4 files changed, 136 insertions, 99 deletions
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index d7e6b1f6b80..85846f4da41 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
3% Load plain if necessary, i.e., if running under initex. 3% Load plain if necessary, i.e., if running under initex.
4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi 4\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
5% 5%
6\def\texinfoversion{2016-05-26.20} 6\def\texinfoversion{2016-05-28.16}
7% 7%
8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, 8% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 9% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -4609,11 +4609,23 @@ end
4609% Like \expandablevalue, but completely expandable (the \message in the 4609% Like \expandablevalue, but completely expandable (the \message in the
4610% definition above operates at the execution level of TeX). Used when 4610% definition above operates at the execution level of TeX). Used when
4611% writing to auxiliary files, due to the expansion that \write does. 4611% writing to auxiliary files, due to the expansion that \write does.
4612% If flag is undefined, pass through an unexpanded @value command: maybe it
4613% will be set by the time it is read back in.
4612% 4614%
4613% NB flag names containing - or _ may not work here. 4615% NB flag names containing - or _ may not work here.
4614\def\dummyvalue#1{% 4616\def\dummyvalue#1{%
4615 \expandafter\ifx\csname SET#1\endcsname\relax 4617 \expandafter\ifx\csname SET#1\endcsname\relax
4616 [No value for ``#1'']% 4618 \noexpand\value{#1}%
4619 \else
4620 \csname SET#1\endcsname
4621 \fi
4622}
4623
4624% Used for @value's in index entries to form the sort key: expand the @value
4625% if possible, otherwise sort late.
4626\def\indexnofontsvalue#1{%
4627 \expandafter\ifx\csname SET#1\endcsname\relax
4628 ZZZZZZZ
4617 \else 4629 \else
4618 \csname SET#1\endcsname 4630 \csname SET#1\endcsname
4619 \fi 4631 \fi
@@ -4760,7 +4772,7 @@ end
4760 4772
4761% Define \doindex, the driver for all index macros. 4773% Define \doindex, the driver for all index macros.
4762% Argument #1 is generated by the calling \fooindex macro, 4774% Argument #1 is generated by the calling \fooindex macro,
4763% and it the two-letter name of the index. 4775% and it is the two-letter name of the index.
4764 4776
4765\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx} 4777\def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
4766\def\doindexxxx #1{\doind{\indexname}{#1}} 4778\def\doindexxxx #1{\doind{\indexname}{#1}}
@@ -4769,6 +4781,7 @@ end
4769\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx} 4781\def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
4770\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}} 4782\def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
4771 4783
4784
4772% Used when writing an index entry out to an index file to prevent 4785% Used when writing an index entry out to an index file to prevent
4773% expansion of Texinfo commands that can appear in an index entry. 4786% expansion of Texinfo commands that can appear in an index entry.
4774% 4787%
@@ -4787,9 +4800,11 @@ end
4787 \def\}{{\tt\char125}}% 4800 \def\}{{\tt\char125}}%
4788 % 4801 %
4789 % Do the redefinitions. 4802 % Do the redefinitions.
4790 \commondummies 4803 \definedummies
4791} 4804}
4792 4805
4806% Used for the aux and toc files, where @ is the escape character.
4807%
4793% For the aux and toc files, @ is the escape character. So we want to 4808% For the aux and toc files, @ is the escape character. So we want to
4794% redefine everything using @ as the escape character (instead of 4809% redefine everything using @ as the escape character (instead of
4795% \realbackslash, still used for index files). When everything uses @, 4810% \realbackslash, still used for index files). When everything uses @,
@@ -4802,30 +4817,35 @@ end
4802 \let\} = \rbraceatcmd 4817 \let\} = \rbraceatcmd
4803 % 4818 %
4804 % Do the redefinitions. 4819 % Do the redefinitions.
4805 \commondummies 4820 \definedummies
4806 \otherbackslash 4821 \otherbackslash
4807} 4822}
4808 4823
4809% Called from \indexdummies and \atdummies. 4824% \definedummyword defines \#1 as \string\#1\space, thus effectively
4825% preventing its expansion. This is used only for control words,
4826% not control letters, because the \space would be incorrect for
4827% control characters, but is needed to separate the control word
4828% from whatever follows.
4810% 4829%
4811\def\commondummies{% 4830% These can be used both for control words that take an argument and
4812 % \definedummyword defines \#1 as \string\#1\space, thus effectively 4831% those that do not. If it is followed by {arg} in the input, then
4813 % preventing its expansion. This is used only for control words, 4832% that will dutifully get written to the index (or wherever).
4814 % not control letters, because the \space would be incorrect for 4833%
4815 % control characters, but is needed to separate the control word 4834% For control letters, we have \definedummyletter, which omits the
4816 % from whatever follows. 4835% space.
4817 % 4836%
4818 % For control letters, we have \definedummyletter, which omits the 4837\def\definedummyword #1{\def#1{\string#1\space}}%
4819 % space. 4838\def\definedummyletter#1{\def#1{\string#1}}%
4820 % 4839\let\definedummyaccent\definedummyletter
4821 % These can be used both for control words that take an argument and 4840
4822 % those that do not. If it is followed by {arg} in the input, then 4841% Called from \indexdummies and \atdummies, to effectively prevent
4823 % that will dutifully get written to the index (or wherever). 4842% the expansion of commands.
4824 % 4843%
4825 \def\definedummyword ##1{\def##1{\string##1\space}}% 4844\def\definedummies{%
4826 \def\definedummyletter##1{\def##1{\string##1}}%
4827 \let\definedummyaccent\definedummyletter
4828 % 4845 %
4846 \let\commondummyword\definedummyword
4847 \let\commondummyletter\definedummyletter
4848 \let\commondummyaccent\definedummyaccent
4829 \commondummiesnofonts 4849 \commondummiesnofonts
4830 % 4850 %
4831 \definedummyletter\_% 4851 \definedummyletter\_%
@@ -4910,77 +4930,77 @@ end
4910 \normalturnoffactive 4930 \normalturnoffactive
4911} 4931}
4912 4932
4913% \commondummiesnofonts: common to \commondummies and \indexnofonts. 4933% \commondummiesnofonts: common to \definedummies and \indexnofonts.
4914% Define \definedumyletter, \definedummyaccent and \definedummyword before 4934% Define \commondummyletter, \commondummyaccent and \commondummyword before
4915% using. 4935% using. Used for accents, font commands, and various control letters.
4916% 4936%
4917\def\commondummiesnofonts{% 4937\def\commondummiesnofonts{%
4918 % Control letters and accents. 4938 % Control letters and accents.
4919 \definedummyletter\!% 4939 \commondummyletter\!%
4920 \definedummyaccent\"% 4940 \commondummyaccent\"%
4921 \definedummyaccent\'% 4941 \commondummyaccent\'%
4922 \definedummyletter\*% 4942 \commondummyletter\*%
4923 \definedummyaccent\,% 4943 \commondummyaccent\,%
4924 \definedummyletter\.% 4944 \commondummyletter\.%
4925 \definedummyletter\/% 4945 \commondummyletter\/%
4926 \definedummyletter\:% 4946 \commondummyletter\:%
4927 \definedummyaccent\=% 4947 \commondummyaccent\=%
4928 \definedummyletter\?% 4948 \commondummyletter\?%
4929 \definedummyaccent\^% 4949 \commondummyaccent\^%
4930 \definedummyaccent\`% 4950 \commondummyaccent\`%
4931 \definedummyaccent\~% 4951 \commondummyaccent\~%
4932 \definedummyword\u 4952 \commondummyword\u
4933 \definedummyword\v 4953 \commondummyword\v
4934 \definedummyword\H 4954 \commondummyword\H
4935 \definedummyword\dotaccent 4955 \commondummyword\dotaccent
4936 \definedummyword\ogonek 4956 \commondummyword\ogonek
4937 \definedummyword\ringaccent 4957 \commondummyword\ringaccent
4938 \definedummyword\tieaccent 4958 \commondummyword\tieaccent
4939 \definedummyword\ubaraccent 4959 \commondummyword\ubaraccent
4940 \definedummyword\udotaccent 4960 \commondummyword\udotaccent
4941 \definedummyword\dotless 4961 \commondummyword\dotless
4942 % 4962 %
4943 % Texinfo font commands. 4963 % Texinfo font commands.
4944 \definedummyword\b 4964 \commondummyword\b
4945 \definedummyword\i 4965 \commondummyword\i
4946 \definedummyword\r 4966 \commondummyword\r
4947 \definedummyword\sansserif 4967 \commondummyword\sansserif
4948 \definedummyword\sc 4968 \commondummyword\sc
4949 \definedummyword\slanted 4969 \commondummyword\slanted
4950 \definedummyword\t 4970 \commondummyword\t
4951 % 4971 %
4952 % Commands that take arguments. 4972 % Commands that take arguments.
4953 \definedummyword\abbr 4973 \commondummyword\abbr
4954 \definedummyword\acronym 4974 \commondummyword\acronym
4955 \definedummyword\anchor 4975 \commondummyword\anchor
4956 \definedummyword\cite 4976 \commondummyword\cite
4957 \definedummyword\code 4977 \commondummyword\code
4958 \definedummyword\command 4978 \commondummyword\command
4959 \definedummyword\dfn 4979 \commondummyword\dfn
4960 \definedummyword\dmn 4980 \commondummyword\dmn
4961 \definedummyword\email 4981 \commondummyword\email
4962 \definedummyword\emph 4982 \commondummyword\emph
4963 \definedummyword\env 4983 \commondummyword\env
4964 \definedummyword\file 4984 \commondummyword\file
4965 \definedummyword\image 4985 \commondummyword\image
4966 \definedummyword\indicateurl 4986 \commondummyword\indicateurl
4967 \definedummyword\inforef 4987 \commondummyword\inforef
4968 \definedummyword\kbd 4988 \commondummyword\kbd
4969 \definedummyword\key 4989 \commondummyword\key
4970 \definedummyword\math 4990 \commondummyword\math
4971 \definedummyword\option 4991 \commondummyword\option
4972 \definedummyword\pxref 4992 \commondummyword\pxref
4973 \definedummyword\ref 4993 \commondummyword\ref
4974 \definedummyword\samp 4994 \commondummyword\samp
4975 \definedummyword\strong 4995 \commondummyword\strong
4976 \definedummyword\tie 4996 \commondummyword\tie
4977 \definedummyword\U 4997 \commondummyword\U
4978 \definedummyword\uref 4998 \commondummyword\uref
4979 \definedummyword\url 4999 \commondummyword\url
4980 \definedummyword\var 5000 \commondummyword\var
4981 \definedummyword\verb 5001 \commondummyword\verb
4982 \definedummyword\w 5002 \commondummyword\w
4983 \definedummyword\xref 5003 \commondummyword\xref
4984} 5004}
4985 5005
4986% For testing: output @{ and @} in index sort strings as \{ and \}. 5006% For testing: output @{ and @} in index sort strings as \{ and \}.
@@ -5036,11 +5056,11 @@ end
5036% 5056%
5037\def\indexnofonts{% 5057\def\indexnofonts{%
5038 % Accent commands should become @asis. 5058 % Accent commands should become @asis.
5039 \def\definedummyaccent##1{\let##1\asis}% 5059 \def\commondummyaccent##1{\let##1\asis}%
5040 % We can just ignore other control letters. 5060 % We can just ignore other control letters.
5041 \def\definedummyletter##1{\let##1\empty}% 5061 \def\commondummyletter##1{\let##1\empty}%
5042 % All control words become @asis by default; overrides below. 5062 % All control words become @asis by default; overrides below.
5043 \let\definedummyword\definedummyaccent 5063 \let\commondummyword\commondummyaccent
5044 \commondummiesnofonts 5064 \commondummiesnofonts
5045 % 5065 %
5046 % Don't no-op \tt, since it isn't a user-level command 5066 % Don't no-op \tt, since it isn't a user-level command
@@ -5125,8 +5145,11 @@ end
5125 % goes to end-of-line is not handled. 5145 % goes to end-of-line is not handled.
5126 % 5146 %
5127 \macrolist 5147 \macrolist
5148 \let\value\indexnofontsvalue
5128} 5149}
5129 5150
5151
5152
5130 5153
5131\let\SETmarginindex=\relax % put index entries in margin (undocumented)? 5154\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
5132 5155
diff --git a/lib/secure_getenv.c b/lib/secure_getenv.c
index f359ab2173b..88a60dc33c3 100644
--- a/lib/secure_getenv.c
+++ b/lib/secure_getenv.c
@@ -1,4 +1,4 @@
1/* Look up an environment variable more securely. 1/* Look up an environment variable, returning NULL in insecure situations.
2 2
3 Copyright 2013-2016 Free Software Foundation, Inc. 3 Copyright 2013-2016 Free Software Foundation, Inc.
4 4
@@ -20,22 +20,35 @@
20#include <stdlib.h> 20#include <stdlib.h>
21 21
22#if !HAVE___SECURE_GETENV 22#if !HAVE___SECURE_GETENV
23# if HAVE_ISSETUGID 23# if HAVE_ISSETUGID || (HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID)
24# include <unistd.h> 24# include <unistd.h>
25# else
26# undef issetugid
27# define issetugid() 1
28# endif 25# endif
29#endif 26#endif
30 27
31char * 28char *
32secure_getenv (char const *name) 29secure_getenv (char const *name)
33{ 30{
34#if HAVE___SECURE_GETENV 31#if HAVE___SECURE_GETENV /* glibc */
35 return __secure_getenv (name); 32 return __secure_getenv (name);
36#else 33#elif HAVE_ISSETUGID /* OS X, FreeBSD, NetBSD, OpenBSD */
37 if (issetugid ()) 34 if (issetugid ())
38 return 0; 35 return NULL;
36 return getenv (name);
37#elif HAVE_GETUID && HAVE_GETEUID && HAVE_GETGID && HAVE_GETEGID /* other Unix */
38 if (geteuid () != getuid () || getegid () != getgid ())
39 return NULL;
39 return getenv (name); 40 return getenv (name);
41#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* native Windows */
42 /* On native Windows, there is no such concept as setuid or setgid binaries.
43 - Programs launched as system services have high privileges, but they don't
44 inherit environment variables from a user.
45 - Programs launched by a user with "Run as Administrator" have high
46 privileges and use the environment variables, but the user has been asked
47 whether he agrees.
48 - Programs launched by a user without "Run as Administrator" cannot gain
49 high privileges, therefore there is no risk. */
50 return getenv (name);
51#else
52 return NULL;
40#endif 53#endif
41} 54}
diff --git a/lib/verify.h b/lib/verify.h
index 2f4383743bb..5c8381d2906 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -263,7 +263,7 @@ template <int w>
263# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) 263# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
264#elif 1200 <= _MSC_VER 264#elif 1200 <= _MSC_VER
265# define assume(R) __assume (R) 265# define assume(R) __assume (R)
266#elif (defined lint \ 266#elif ((defined GCC_LINT || defined lint) \
267 && (__has_builtin (__builtin_trap) \ 267 && (__has_builtin (__builtin_trap) \
268 || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)))) 268 || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))))
269 /* Doing it this way helps various packages when configured with 269 /* Doing it this way helps various packages when configured with
diff --git a/m4/secure_getenv.m4 b/m4/secure_getenv.m4
index 00194c8497f..3983173603a 100644
--- a/m4/secure_getenv.m4
+++ b/m4/secure_getenv.m4
@@ -22,4 +22,5 @@ AC_DEFUN([gl_PREREQ_SECURE_GETENV], [
22 if test $ac_cv_func___secure_getenv = no; then 22 if test $ac_cv_func___secure_getenv = no; then
23 AC_CHECK_FUNCS([issetugid]) 23 AC_CHECK_FUNCS([issetugid])
24 fi 24 fi
25 AC_CHECK_FUNCS_ONCE([getuid geteuid getgid getegid])
25]) 26])