asn1_read_value() and friends understand the ?CURRENT keyword.
[platform/upstream/libtasn1.git] / tests / threadsafety
1 #!/bin/sh
2
3 # Copyright (C) 2004-2014 Free Software Foundation, Inc.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 FILES="$@"
19 FILES=${FILES:-$THREADSAFETY_FILES}
20 EGREP=${EGREP:-egrep}
21
22 if test -z "$FILES"; then
23     echo "Usage: $0 [FILE...]"
24     exit 1
25 fi
26
27 UNSAFE=""
28
29 # Thread unsafe functions according to latest POSIX, see:
30 # http://www.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09_01
31 UNSAFE="$UNSAFE asctime"
32 UNSAFE="$UNSAFE basename"
33 UNSAFE="$UNSAFE catgets"
34 UNSAFE="$UNSAFE crypt"
35 UNSAFE="$UNSAFE ctime"
36 UNSAFE="$UNSAFE dbm_clearerr"
37 UNSAFE="$UNSAFE dbm_close"
38 UNSAFE="$UNSAFE dbm_delete"
39 UNSAFE="$UNSAFE dbm_error"
40 UNSAFE="$UNSAFE dbm_fetch"
41 UNSAFE="$UNSAFE dbm_firstkey"
42 UNSAFE="$UNSAFE dbm_nextkey"
43 UNSAFE="$UNSAFE dbm_open"
44 UNSAFE="$UNSAFE dbm_store"
45 UNSAFE="$UNSAFE dirname"
46 UNSAFE="$UNSAFE dlerror"
47 UNSAFE="$UNSAFE drand48"
48 UNSAFE="$UNSAFE encrypt"
49 UNSAFE="$UNSAFE endgrent"
50 UNSAFE="$UNSAFE endpwent"
51 UNSAFE="$UNSAFE endutxent"
52 UNSAFE="$UNSAFE ftw"
53 UNSAFE="$UNSAFE getc_unlocked"
54 UNSAFE="$UNSAFE getchar_unlocked"
55 UNSAFE="$UNSAFE getdate"
56 UNSAFE="$UNSAFE getenv"
57 UNSAFE="$UNSAFE getgrent"
58 UNSAFE="$UNSAFE getgrgid"
59 UNSAFE="$UNSAFE getgrnam"
60 UNSAFE="$UNSAFE gethostent"
61 UNSAFE="$UNSAFE getlogin"
62 UNSAFE="$UNSAFE getnetbyaddr"
63 UNSAFE="$UNSAFE getnetbyname"
64 UNSAFE="$UNSAFE getnetent"
65 UNSAFE="$UNSAFE getopt"
66 UNSAFE="$UNSAFE getprotobyname"
67 UNSAFE="$UNSAFE getprotobynumber"
68 UNSAFE="$UNSAFE getprotoent"
69 UNSAFE="$UNSAFE getpwent"
70 UNSAFE="$UNSAFE getpwnam"
71 UNSAFE="$UNSAFE getpwuid"
72 UNSAFE="$UNSAFE getservbyname"
73 UNSAFE="$UNSAFE getservbyport"
74 UNSAFE="$UNSAFE getservent"
75 UNSAFE="$UNSAFE getutxent"
76 UNSAFE="$UNSAFE getutxid"
77 UNSAFE="$UNSAFE getutxline"
78 UNSAFE="$UNSAFE gmtime"
79 UNSAFE="$UNSAFE hcreate"
80 UNSAFE="$UNSAFE hdestroy"
81 UNSAFE="$UNSAFE hsearch"
82 UNSAFE="$UNSAFE inet_ntoa"
83 UNSAFE="$UNSAFE l64a"
84 UNSAFE="$UNSAFE lgamma"
85 UNSAFE="$UNSAFE lgammaf"
86 UNSAFE="$UNSAFE lgammal"
87 UNSAFE="$UNSAFE localeconv"
88 UNSAFE="$UNSAFE localtime"
89 UNSAFE="$UNSAFE lrand48"
90 UNSAFE="$UNSAFE mrand48"
91 UNSAFE="$UNSAFE nftw"
92 UNSAFE="$UNSAFE nl_langinfo"
93 UNSAFE="$UNSAFE ptsname"
94 UNSAFE="$UNSAFE putc_unlocked"
95 UNSAFE="$UNSAFE putchar_unlocked"
96 UNSAFE="$UNSAFE putenv"
97 UNSAFE="$UNSAFE pututxline"
98 UNSAFE="$UNSAFE rand"
99 UNSAFE="$UNSAFE readdir"
100 UNSAFE="$UNSAFE setenv"
101 UNSAFE="$UNSAFE setgrent"
102 UNSAFE="$UNSAFE setkey"
103 UNSAFE="$UNSAFE setpwent"
104 UNSAFE="$UNSAFE setutxent"
105 UNSAFE="$UNSAFE strerror"
106 UNSAFE="$UNSAFE strsignal"
107 UNSAFE="$UNSAFE strtok"
108 UNSAFE="$UNSAFE system"
109 UNSAFE="$UNSAFE ttyname"
110 UNSAFE="$UNSAFE unsetenv"
111 UNSAFE="$UNSAFE wcstombs"
112 UNSAFE="$UNSAFE wctomb"
113
114 # Additional functions that aren't thread-safe if passed a NULL argument
115 UNSAFE="$UNSAFE ctermid"
116 UNSAFE="$UNSAFE tmpname"
117 UNSAFE="$UNSAFE wcrtomb"
118 UNSAFE="$UNSAFE wcsrtombs"
119
120 # Legacy functions removed between issue 6 and 7, see:
121 # http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html#tag_02_09_01
122 UNSAFE="$UNSAFE ecvt"
123 UNSAFE="$UNSAFE fcvt"
124 UNSAFE="$UNSAFE gcvt"
125 UNSAFE="$UNSAFE gethostbyaddr"
126 UNSAFE="$UNSAFE gethostbyname"
127
128 # Other (potentially) thread unsafe functions, see:
129 # http://blog.josefsson.org/2009/06/23/thread-safe-functions/
130 UNSAFE="$UNSAFE erand48"
131 UNSAFE="$UNSAFE ether_aton"
132 UNSAFE="$UNSAFE ether_ntoa"
133 UNSAFE="$UNSAFE fgetgrent"
134 UNSAFE="$UNSAFE fgetpwent"
135 UNSAFE="$UNSAFE fgetspent"
136 UNSAFE="$UNSAFE getaliasbyname"
137 UNSAFE="$UNSAFE getaliasent"
138 UNSAFE="$UNSAFE gethostbyname2"
139 UNSAFE="$UNSAFE getmntent"
140 UNSAFE="$UNSAFE getnetgrent"
141 UNSAFE="$UNSAFE getrpcbyname"
142 UNSAFE="$UNSAFE getrpcbynumber"
143 UNSAFE="$UNSAFE getrpcent"
144 UNSAFE="$UNSAFE getspent"
145 UNSAFE="$UNSAFE getspnam"
146 UNSAFE="$UNSAFE getutent"
147 UNSAFE="$UNSAFE getutid"
148 UNSAFE="$UNSAFE getutline"
149 UNSAFE="$UNSAFE initstate"
150 UNSAFE="$UNSAFE jrand48"
151 UNSAFE="$UNSAFE lcong48"
152 UNSAFE="$UNSAFE nrand48"
153 UNSAFE="$UNSAFE qecvt"
154 UNSAFE="$UNSAFE qfcvt"
155 UNSAFE="$UNSAFE random"
156 UNSAFE="$UNSAFE seed48"
157 UNSAFE="$UNSAFE setstate"
158 UNSAFE="$UNSAFE sgetspent"
159 UNSAFE="$UNSAFE srand48"
160 UNSAFE="$UNSAFE srandom"
161
162 set -- $UNSAFE
163 cmd="-e [^.>=_0-9a-z]($1"
164 shift
165 while test "$1"; do
166     cmd="${cmd}|$1"
167     shift
168 done
169 cmd="${cmd})[^.>=_0-9a-z]*\("
170
171 if $EGREP $cmd $FILES; then
172     exit 1
173 fi
174
175 exit 0