Imported Upstream version 2.10
Simon Josefsson
10 years ago
0 | Author | |
1 | ------ | |
0 | 2 | Simon Josefsson <simon@yubico.com> |
1 | 3 | |
2 | 4 | For technical feedback, please consider using our forum: |
3 | 5 | http://forum.yubico.com/ |
6 | ||
7 | ||
8 | Patches | |
9 | ------- | |
10 | Remi Mollon <remi.mollon@cern.ch> | |
11 | Supply server urls and add nonce to requests. | |
12 | ||
13 | Sebastien Martini <seb@dbzteam.org> and qistoph@gmail.com | |
14 | Patches for Protocol 2 support. | |
15 | ||
16 | Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
17 | Added support for persistent curl handles and cleanup of | |
18 | error conditions in the library. |
0 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
1 | ||
2 | * NEWS: Version 2.10. | |
3 | ||
4 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
5 | ||
6 | * Makefile.am: Fix dist. | |
7 | ||
8 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
9 | ||
10 | * Makefile.am, README, simple.mk: Drop simple.mk build style. | |
11 | ||
12 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
13 | ||
14 | * Makefile.am: Update release target. | |
15 | ||
16 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
17 | ||
18 | * NEWS: Add. | |
19 | ||
20 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
21 | ||
22 | * Makefile.am, tool.c, ykclient.c, ykclient.h, | |
23 | ykclient_server_response.c, ykclient_server_response.h, | |
24 | ykclient_version.c, ykclient_version.h.in: Indent code. | |
25 | ||
26 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
27 | ||
28 | * configure.ac: Bump libtool version since we added APIs. | |
29 | ||
30 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
31 | ||
32 | * README: Clarify help2man requirement. | |
33 | ||
34 | 2013-05-15 Simon Josefsson <simon@josefsson.org> | |
35 | ||
36 | * Makefile.am: ykclient.1: Don't build before binary is built. | |
37 | Reported by eworm-de. | |
38 | ||
39 | 2013-05-13 Simon Josefsson <simon@josefsson.org> | |
40 | ||
41 | * .gitignore, Makefile.am, NEWS, configure.ac, tool.c: ykclient: | |
42 | Cleanup command line tool a bit to make it more useful. | |
43 | ||
44 | 2013-04-11 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
45 | ||
46 | * ykclient.c: Reduce indentation in parts of ykclient_request_send | |
47 | to make it easier to understand. Signed-off-by: Simon Josefsson <simon@josefsson.org> | |
48 | ||
49 | 2013-04-11 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
50 | ||
51 | * ykclient.c: Call curl_multi_perform once more on cleanup Signed-off-by: Simon Josefsson <simon@josefsson.org> | |
52 | ||
53 | 2013-04-11 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
54 | ||
55 | * ykclient.c: Leave it to the caller to cleanup the connection The behaviour of the libcurl multi interface is not well documented. One apparent issue is if you do not wait for all easy handle | |
56 | requests to complete and remove them from the multi handle, libcurl | |
57 | will immediately tear down the connection, sending a TCP RST to the | |
58 | server. Assuming the calling application implements its own connection pool | |
59 | logic (as FreeRADIUS does), it can create multiple handles, and only | |
60 | cleanup when the handle is next used, by which time the transfer | |
61 | will of hopefully completed. Signed-off-by: Simon Josefsson <simon@josefsson.org> | |
62 | ||
63 | 2013-04-15 Simon Josefsson <simon@josefsson.org> | |
64 | ||
65 | * .gitignore, ykclient_version.c: Add implementation of versioning | |
66 | interface. | |
67 | ||
68 | 2013-04-15 Simon Josefsson <simon@josefsson.org> | |
69 | ||
70 | * Makefile.am, NEWS, configure.ac, tests/selftest.c, ykclient.h, | |
71 | ykclient_version.h.in: Add versioning information to library. | |
72 | ||
73 | 2013-04-15 Simon Josefsson <simon@josefsson.org> | |
74 | ||
75 | * ykclient.h, ykclient_errors.h, ykclient_server_response.h: Cleanup | |
76 | ykclient_errors.h split. | |
77 | ||
78 | 2013-04-11 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
79 | ||
80 | * .gitignore: Ignore .swp files Signed-off-by: Simon Josefsson <simon@josefsson.org> | |
81 | ||
82 | 2013-04-11 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
83 | ||
84 | * ykclient.c: Quit early on OK. Continue processing after | |
85 | YKCLIENT_PARSE_ERROR and YKCLIENT_REPLAYED_REQUEST Signed-off-by: Simon Josefsson <simon@josefsson.org> | |
86 | ||
87 | 2013-04-11 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
88 | ||
89 | * ykclient.c: We should check the state of the nonce we were passed, | |
90 | not the one in ykc | |
91 | ||
92 | 2013-04-11 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
93 | ||
94 | * ykclient.c: Remove and re-add easy handles to the multihandle on | |
95 | cleanup (this is confusingly documented requirement of libcurl) Signed-off-by: Simon Josefsson <simon@josefsson.org> | |
96 | ||
97 | 2013-04-15 Simon Josefsson <simon@josefsson.org> | |
98 | ||
99 | * ykclient.c: Check for out of memory in ykclient_generate_nonce(). | |
100 | ||
101 | 2013-04-15 Simon Josefsson <simon@josefsson.org> | |
102 | ||
103 | * NEWS, tests/selftest.c, ykclient.c, ykclient.h: Add | |
104 | ykclient_global_init and ykclient_global_done. | |
105 | ||
106 | 2013-04-10 Klas Lindfors <klas@yubico.com> | |
107 | ||
108 | * ykclient_server_response.c: add void to function arguments | |
109 | ||
110 | 2013-04-10 Klas Lindfors <klas@yubico.com> | |
111 | ||
112 | * ykclient.c: remove extra ; | |
113 | ||
114 | 2013-04-10 Klas Lindfors <klas@yubico.com> | |
115 | ||
116 | * ykclient.c: add switch default case (shouldn't be needed but will | |
117 | silence warnings). | |
118 | ||
119 | 2013-04-10 Klas Lindfors <klas@yubico.com> | |
120 | ||
121 | * ykclient_server_response.h: silence warning, function prototype | |
122 | should specify void argument. | |
123 | ||
124 | 2013-04-10 Klas Lindfors <klas@yubico.com> | |
125 | ||
126 | * AUTHORS: expand the AUTHORS file | |
127 | ||
128 | 2013-04-10 Klas Lindfors <klas@yubico.com> | |
129 | ||
130 | * tool.c: fix warnings in the ykclient tool | |
131 | ||
132 | 2013-04-09 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
133 | ||
134 | * Makefile.am, ykclient.c, ykclient.h, ykclient_errors.h, | |
135 | ykclient_server_response.c, ykclient_server_response.h: Fix warnings | |
136 | from GCC and clang | |
137 | ||
138 | 2013-04-09 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
139 | ||
140 | * .gitignore: Don't ignore changes to manywarnings.m4 and | |
141 | warnings.m4 | |
142 | ||
143 | 2013-04-04 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
144 | ||
145 | * .gitignore: Ignore products of make check | |
146 | ||
147 | 2013-04-04 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
148 | ||
149 | * ykclient.c, ykclient.h: Use new handles and add separate function | |
150 | for processing requests without allocating new handles Breakout URL expansion into a new function Use handles for storing expanded URLs Breakout nonce generation into its own function Only build user_agent string once on initialise | |
151 | ||
152 | 2013-04-04 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
153 | ||
154 | * ykclient.c: Move curl callback | |
155 | ||
156 | 2013-04-04 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
157 | ||
158 | * ykclient.c, ykclient.h: Use proper typedef instead of int in | |
159 | function return types (this allows the compiler to detect return | |
160 | values outside of the enum) | |
161 | ||
162 | 2013-04-04 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
163 | ||
164 | * ykclient.c: Move example functions to bottom of file | |
165 | ||
166 | 2013-04-04 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
167 | ||
168 | * ykclient.c, ykclient.h: Add new functions for creating, cleaning | |
169 | and destroying handles | |
170 | ||
171 | 2013-03-29 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
172 | ||
173 | * .gitignore: Simplify and fix .gitignore | |
174 | ||
175 | 2013-03-29 Arran Cudbard-Bell <a.cudbardb@freeradius.org> | |
176 | ||
177 | * ykclient.c: Make formatting consistent | |
178 | ||
179 | 2013-01-18 Klas Lindfors <klas@yubico.com> | |
180 | ||
181 | * configure.ac: we need automake 1.11 nowadays | |
182 | ||
183 | 2012-08-24 Clemens Lang <neverpanic@gmail.com> | |
184 | ||
185 | * configure.ac: Silence warning in automake >= 1.12 | |
186 | ||
187 | 2012-11-07 Klas Lindfors <klas@yubico.com> | |
188 | ||
189 | * tests/Makefile.am, tests/selftest.c: add test cases for hmac-sha1 | |
190 | from rfc 2202 | |
191 | ||
192 | 2012-11-06 Klas Lindfors <klas@yubico.com> | |
193 | ||
194 | * README, configure.ac: add whitelisting of AM_PROG_AR to work with | |
195 | automake 1.12 | |
196 | ||
197 | 2012-09-13 Klas Lindfors <klas@yubico.com> | |
198 | ||
199 | * .travis.yml: add travis continuous-integration configuration | |
200 | ||
201 | 2012-08-28 Klas Lindfors <klas@yubico.com> | |
202 | ||
203 | * ykclient.c: assign out so we can be sure it's assigned before | |
204 | return | |
205 | ||
206 | 2012-08-28 Klas Lindfors <klas@yubico.com> | |
207 | ||
208 | * ykclient.c: code is never used, remove it and move other | |
209 | declaration up | |
210 | ||
211 | 2012-08-28 Klas Lindfors <klas@yubico.com> | |
212 | ||
213 | * ykclient.c: cast ykc->key to const unsigned char to keep constness | |
214 | ||
215 | 2012-08-28 Klas Lindfors <klas@yubico.com> | |
216 | ||
217 | * ykclient.c: snprintf returns an int, check if it's negative | |
218 | ||
219 | 2012-08-28 Klas Lindfors <klas@yubico.com> | |
220 | ||
221 | * ykclient.c: move up declarations and convert loop variable to | |
222 | size_t to avoid warnings | |
223 | ||
224 | 2012-08-28 Klas Lindfors <klas@yubico.com> | |
225 | ||
226 | * ykclient.c: use size_t for looping to avoid warnings | |
227 | ||
228 | 2012-08-27 Klas Lindfors <klas@yubico.com> | |
229 | ||
230 | * ykclient.c: as curl_ret is a CURLMCode, use CURLM_OK instead | |
231 | ||
232 | 2012-08-27 Klas Lindfors <klas@yubico.com> | |
233 | ||
234 | * Makefile.am, configure.ac, m4/manywarnings.m4, m4/warnings.m4: add | |
235 | the same warnings package used in yubico-c | |
236 | ||
237 | 2012-08-24 Clemens Lang <neverpanic@gmail.com> | |
238 | ||
239 | * ykclient.c: Fix clang -Wconversion warning curl_multi_strerror expects a CURLMcode, but is given a CURLcode in | |
240 | line 673, causing: ykclient.c:673:63: warning: implicit conversion from enumeration | |
241 | type 'CURLcode' to different enumeration type 'CURLMcode' | |
242 | [-Wconversion] fprintf(stderr, "Error with curl: %s\n", | |
243 | curl_multi_strerror(curl_ret)); ~~~~~~~~~~~~~~~~~~~ ^~~~~~~~ This can be fixed by changing the type of the variable holding the | |
244 | return value of curl_multi_perform to CURLMcode (as its declaration | |
245 | says it is). | |
246 | ||
247 | 2012-08-24 Clemens Lang <neverpanic@gmail.com> | |
248 | ||
249 | * ykclient.c: Fix clang warning for tautologic compare size_t is defined to be unsigned, thus size_t < 0 is a tautologic | |
250 | compare. | |
251 | ||
252 | 2012-08-13 Rony Shapiro <ronys@users.sourceforge.net> | |
253 | ||
254 | * README: Tweak README: State libcurl-dev dependency explicitly, | |
255 | correct make invokation. | |
256 | ||
257 | 2012-08-07 Klas Lindfors <klas@yubico.com> | |
258 | ||
259 | * NEWS, configure.ac: bump versions after version 2.9 | |
260 | ||
0 | 261 | 2012-08-07 Klas Lindfors <klas@yubico.com> |
1 | 262 | |
2 | 263 | * simple.mk: add curl with LDLIBS instead of LDFLAGS |
0 | 0 | # Written by Simon Josefsson <simon@josefsson.org>. |
1 | # Copyright (c) 2008-2012 Yubico AB | |
1 | # Copyright (c) 2008-2013 Yubico AB | |
2 | 2 | # All rights reserved. |
3 | 3 | # |
4 | 4 | # Redistribution and use in source and binary forms, with or without |
29 | 29 | |
30 | 30 | AM_CPPFLAGS = @LIBCURL_CPPFLAGS@ |
31 | 31 | ACLOCAL_AMFLAGS = -I m4 |
32 | AM_CFLAGS = $(WARN_CFLAGS) | |
32 | 33 | |
33 | 34 | # The library. |
34 | 35 | |
35 | 36 | lib_LTLIBRARIES = libykclient.la |
36 | include_HEADERS = ykclient_server_response.h ykclient.h | |
37 | include_HEADERS = ykclient_server_response.h ykclient.h \ | |
38 | ykclient_errors.h ykclient_version.h | |
37 | 39 | |
38 | libykclient_la_SOURCES = ykclient_server_response.h ykclient_server_response.c \ | |
39 | ykclient.h ykclient.c | |
40 | libykclient_la_SOURCES = ykclient_server_response.h \ | |
41 | ykclient_server_response.c | |
42 | libykclient_la_SOURCES += ykclient.h ykclient_errors.h \ | |
43 | ykclient_version.h | |
44 | libykclient_la_SOURCES += ykclient.c ykclient_version.c | |
40 | 45 | libykclient_la_SOURCES += rfc4634/sha.h rfc4634/sha-private.h \ |
41 | 46 | rfc4634/hmac.c rfc4634/sha1.c rfc4634/usha.c \ |
42 | 47 | rfc4634/sha224-256.c rfc4634/sha384-512.c |
54 | 59 | ykclient_SOURCES = tool.c |
55 | 60 | ykclient_LDADD = ./libykclient.la |
56 | 61 | |
62 | # Man page | |
63 | ||
64 | dist_man_MANS = ykclient.1 | |
65 | DISTCLEANFILES = $(dist_man_MANS) | |
66 | ||
67 | ykclient.1: $(builddir)/ykclient $(srcdir)/tool.c $(srcdir)/configure.ac | |
68 | $(HELP2MAN) \ | |
69 | --output=$@ $(builddir)/ykclient$(EXEEXT) \ | |
70 | --name="YubiCloud One-Time-Password Validation Client" \ | |
71 | --no-info | |
72 | ||
57 | 73 | # Release |
58 | 74 | |
59 | EXTRA_DIST = simple.mk | |
75 | indent: | |
76 | indent *.c *.h *.h.in | |
77 | indent *.c *.h *.h.in | |
60 | 78 | |
61 | 79 | ChangeLog: |
62 | 80 | cd $(srcdir) && git2cl > ChangeLog |
64 | 82 | PROJECT = yubico-c-client |
65 | 83 | |
66 | 84 | release: |
67 | @if test -z "$(USER)" || test -z "$(KEYID)"; then \ | |
85 | @if test -z "$(KEYID)"; then \ | |
68 | 86 | echo "Try this instead:"; \ |
69 | echo " make release USER=[GOOGLEUSERNAME] KEYID=[PGPKEYID]"; \ | |
87 | echo " make release KEYID=[PGPKEYID]"; \ | |
70 | 88 | echo "For example:"; \ |
71 | echo " make release USER=simon@yubico.com KEYID=2117364A"; \ | |
72 | echo " make release USER=fredrikyubico@gmail.com KEYID=4EAA4232"; \ | |
89 | echo " make release KEYID=2117364A"; \ | |
90 | exit 1; \ | |
91 | fi | |
92 | @if test ! -d "$(YUBICO_GITHUB_REPO)"; then \ | |
93 | echo "yubico.github.com repo not found!"; \ | |
94 | echo "Make sure that YUBICO_GITHUB_REPO is set"; \ | |
73 | 95 | exit 1; \ |
74 | 96 | fi |
75 | 97 | @head -3 $(srcdir)/NEWS | grep -q "Version $(VERSION) .released `date -I`" || \ |
76 | (echo 'error: Update date/version in $(srcdir)/NEWS.'; exit 1) | |
77 | # check that non-autoconf build system works | |
78 | cd $(srcdir) && make -f simple.mk check clean | |
98 | (echo 'error: You need to update date/version in $(srcdir)/NEWS'; exit 1) | |
79 | 99 | rm -f $(srcdir)/ChangeLog |
80 | 100 | make ChangeLog distcheck |
81 | 101 | gpg --detach-sign --default-key $(KEYID) $(PACKAGE)-$(VERSION).tar.gz |
83 | 103 | cd $(srcdir) && git push |
84 | 104 | cd $(srcdir) && git tag -u $(KEYID)! -m $(VERSION) $(PACKAGE)-$(VERSION) |
85 | 105 | cd $(srcdir) && git push --tags |
86 | mkdir -p ../releases/$(PACKAGE)/ && \ | |
87 | cp -v $(PACKAGE)-$(VERSION).tar.gz* ../releases/$(PACKAGE)/ | |
88 | googlecode_upload.py -s "OpenPGP signature for $(PACKAGE) $(VERSION)." \ | |
89 | -p $(PROJECT) -u $(USER) $(PACKAGE)-$(VERSION).tar.gz.sig | |
90 | googlecode_upload.py -s "$(PACKAGE) $(VERSION)" \ | |
91 | -p $(PROJECT) -u $(USER) $(PACKAGE)-$(VERSION).tar.gz | |
106 | $(YUBICO_GITHUB_REPO)/publish $(PROJECT) $(VERSION) $(PACKAGE)-$(VERSION).tar.gz* | |
107 | @if test -d $(srcdir)/../wiki-$(PROJECT); then \ | |
108 | cd $(srcdir) && \ | |
109 | cp README ../wiki-$(PROJECT)/ReadMe.wiki && \ | |
110 | cd ../wiki-$(PROJECT) && \ | |
111 | git commit -m Sync. ReadMe.wiki; \ | |
112 | fi |
0 | # Makefile.in generated by automake 1.11.3 from Makefile.am. | |
0 | # Makefile.in generated by automake 1.11.6 from Makefile.am. | |
1 | 1 | # @configure_input@ |
2 | 2 | |
3 | 3 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
15 | 15 | @SET_MAKE@ |
16 | 16 | |
17 | 17 | # Written by Simon Josefsson <simon@josefsson.org>. |
18 | # Copyright (c) 2008-2012 Yubico AB | |
18 | # Copyright (c) 2008-2013 Yubico AB | |
19 | 19 | # All rights reserved. |
20 | 20 | # |
21 | 21 | # Redistribution and use in source and binary forms, with or without |
45 | 45 | |
46 | 46 | |
47 | 47 | VPATH = @srcdir@ |
48 | am__make_dryrun = \ | |
49 | { \ | |
50 | am__dry=no; \ | |
51 | case $$MAKEFLAGS in \ | |
52 | *\\[\ \ ]*) \ | |
53 | echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | |
54 | | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ | |
55 | *) \ | |
56 | for am__flg in $$MAKEFLAGS; do \ | |
57 | case $$am__flg in \ | |
58 | *=*|--*) ;; \ | |
59 | *n*) am__dry=yes; break;; \ | |
60 | esac; \ | |
61 | done;; \ | |
62 | esac; \ | |
63 | test $$am__dry = yes; \ | |
64 | } | |
48 | 65 | pkgdatadir = $(datadir)/@PACKAGE@ |
49 | 66 | pkgincludedir = $(includedir)/@PACKAGE@ |
50 | 67 | pkglibdir = $(libdir)/@PACKAGE@ |
65 | 82 | host_triplet = @host@ |
66 | 83 | bin_PROGRAMS = ykclient$(EXEEXT) |
67 | 84 | subdir = . |
68 | DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ | |
69 | $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ | |
70 | $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ | |
71 | config.guess config.sub depcomp install-sh ltmain.sh missing | |
85 | DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \ | |
86 | $(include_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ | |
87 | $(srcdir)/ykclient_version.h.in $(top_srcdir)/configure \ | |
88 | AUTHORS COPYING ChangeLog INSTALL NEWS ar-lib config.guess \ | |
89 | config.sub depcomp install-sh ltmain.sh missing | |
72 | 90 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
73 | 91 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ |
74 | 92 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ |
75 | 93 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ |
94 | $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/warnings.m4 \ | |
76 | 95 | $(top_srcdir)/configure.ac |
77 | 96 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
78 | 97 | $(ACLOCAL_M4) |
79 | 98 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ |
80 | 99 | configure.lineno config.status.lineno |
81 | 100 | mkinstalldirs = $(install_sh) -d |
82 | CONFIG_CLEAN_FILES = | |
101 | CONFIG_CLEAN_FILES = ykclient_version.h | |
83 | 102 | CONFIG_CLEAN_VPATH_FILES = |
84 | 103 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; |
85 | 104 | am__vpath_adj = case $$p in \ |
109 | 128 | $(am__cd) "$$dir" && rm -f $$files; }; \ |
110 | 129 | } |
111 | 130 | am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ |
112 | "$(DESTDIR)$(includedir)" | |
131 | "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(includedir)" | |
113 | 132 | LTLIBRARIES = $(lib_LTLIBRARIES) |
114 | 133 | libykclient_la_DEPENDENCIES = |
115 | 134 | am_libykclient_la_OBJECTS = ykclient_server_response.lo ykclient.lo \ |
116 | hmac.lo sha1.lo usha.lo sha224-256.lo sha384-512.lo cencode.lo \ | |
117 | cdecode.lo | |
135 | ykclient_version.lo hmac.lo sha1.lo usha.lo sha224-256.lo \ | |
136 | sha384-512.lo cencode.lo cdecode.lo | |
118 | 137 | libykclient_la_OBJECTS = $(am_libykclient_la_OBJECTS) |
119 | 138 | AM_V_lt = $(am__v_lt_@AM_V@) |
120 | 139 | am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) |
162 | 181 | install-pdf-recursive install-ps-recursive install-recursive \ |
163 | 182 | installcheck-recursive installdirs-recursive pdf-recursive \ |
164 | 183 | ps-recursive uninstall-recursive |
184 | am__can_run_installinfo = \ | |
185 | case $$AM_UPDATE_INFO_DIR in \ | |
186 | n|no|NO) false;; \ | |
187 | *) (install-info --version) >/dev/null 2>&1;; \ | |
188 | esac | |
189 | man1dir = $(mandir)/man1 | |
190 | NROFF = nroff | |
191 | MANS = $(dist_man_MANS) | |
165 | 192 | HEADERS = $(include_HEADERS) |
166 | 193 | RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ |
167 | 194 | distclean-recursive maintainer-clean-recursive |
238 | 265 | EXEEXT = @EXEEXT@ |
239 | 266 | FGREP = @FGREP@ |
240 | 267 | GREP = @GREP@ |
268 | HELP2MAN = @HELP2MAN@ | |
241 | 269 | INSTALL = @INSTALL@ |
242 | 270 | INSTALL_DATA = @INSTALL_DATA@ |
243 | 271 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
279 | 307 | SHELL = @SHELL@ |
280 | 308 | STRIP = @STRIP@ |
281 | 309 | VERSION = @VERSION@ |
310 | WARN_CFLAGS = @WARN_CFLAGS@ | |
311 | YKCLIENT_VERSION_MAJOR = @YKCLIENT_VERSION_MAJOR@ | |
312 | YKCLIENT_VERSION_MINOR = @YKCLIENT_VERSION_MINOR@ | |
313 | YKCLIENT_VERSION_NUMBER = @YKCLIENT_VERSION_NUMBER@ | |
314 | YKCLIENT_VERSION_PATCH = @YKCLIENT_VERSION_PATCH@ | |
282 | 315 | _libcurl_config = @_libcurl_config@ |
283 | 316 | abs_builddir = @abs_builddir@ |
284 | 317 | abs_srcdir = @abs_srcdir@ |
335 | 368 | SUBDIRS = . tests |
336 | 369 | AM_CPPFLAGS = @LIBCURL_CPPFLAGS@ |
337 | 370 | ACLOCAL_AMFLAGS = -I m4 |
371 | AM_CFLAGS = $(WARN_CFLAGS) | |
338 | 372 | |
339 | 373 | # The library. |
340 | 374 | lib_LTLIBRARIES = libykclient.la |
341 | include_HEADERS = ykclient_server_response.h ykclient.h | |
375 | include_HEADERS = ykclient_server_response.h ykclient.h \ | |
376 | ykclient_errors.h ykclient_version.h | |
377 | ||
342 | 378 | libykclient_la_SOURCES = ykclient_server_response.h \ |
343 | ykclient_server_response.c ykclient.h ykclient.c rfc4634/sha.h \ | |
379 | ykclient_server_response.c ykclient.h ykclient_errors.h \ | |
380 | ykclient_version.h ykclient.c ykclient_version.c rfc4634/sha.h \ | |
344 | 381 | rfc4634/sha-private.h rfc4634/hmac.c rfc4634/sha1.c \ |
345 | 382 | rfc4634/usha.c rfc4634/sha224-256.c rfc4634/sha384-512.c \ |
346 | 383 | b64/cencode.h b64/cencode.c b64/cdecode.h b64/cdecode.c |
352 | 389 | ykclient_SOURCES = tool.c |
353 | 390 | ykclient_LDADD = ./libykclient.la |
354 | 391 | |
355 | # Release | |
356 | EXTRA_DIST = simple.mk | |
392 | # Man page | |
393 | dist_man_MANS = ykclient.1 | |
394 | DISTCLEANFILES = $(dist_man_MANS) | |
357 | 395 | PROJECT = yubico-c-client |
358 | 396 | all: all-recursive |
359 | 397 | |
393 | 431 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) |
394 | 432 | $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) |
395 | 433 | $(am__aclocal_m4_deps): |
434 | ykclient_version.h: $(top_builddir)/config.status $(srcdir)/ykclient_version.h.in | |
435 | cd $(top_builddir) && $(SHELL) ./config.status $@ | |
396 | 436 | install-libLTLIBRARIES: $(lib_LTLIBRARIES) |
397 | 437 | @$(NORMAL_INSTALL) |
398 | test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" | |
399 | 438 | @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ |
400 | 439 | list2=; for p in $$list; do \ |
401 | 440 | if test -f $$p; then \ |
403 | 442 | else :; fi; \ |
404 | 443 | done; \ |
405 | 444 | test -z "$$list2" || { \ |
445 | echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ | |
446 | $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ | |
406 | 447 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ |
407 | 448 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ |
408 | 449 | } |
428 | 469 | $(AM_V_CCLD)$(libykclient_la_LINK) -rpath $(libdir) $(libykclient_la_OBJECTS) $(libykclient_la_LIBADD) $(LIBS) |
429 | 470 | install-binPROGRAMS: $(bin_PROGRAMS) |
430 | 471 | @$(NORMAL_INSTALL) |
431 | test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" | |
432 | 472 | @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ |
473 | if test -n "$$list"; then \ | |
474 | echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ | |
475 | $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ | |
476 | fi; \ | |
433 | 477 | for p in $$list; do echo "$$p $$p"; done | \ |
434 | 478 | sed 's/$(EXEEXT)$$//' | \ |
435 | 479 | while read p p1; do if test -f $$p || test -f $$p1; \ |
489 | 533 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usha.Plo@am__quote@ |
490 | 534 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ykclient.Plo@am__quote@ |
491 | 535 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ykclient_server_response.Plo@am__quote@ |
536 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ykclient_version.Plo@am__quote@ | |
492 | 537 | |
493 | 538 | .c.o: |
494 | 539 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< |
568 | 613 | |
569 | 614 | distclean-libtool: |
570 | 615 | -rm -f libtool config.lt |
616 | install-man1: $(dist_man_MANS) | |
617 | @$(NORMAL_INSTALL) | |
618 | @list1=''; \ | |
619 | list2='$(dist_man_MANS)'; \ | |
620 | test -n "$(man1dir)" \ | |
621 | && test -n "`echo $$list1$$list2`" \ | |
622 | || exit 0; \ | |
623 | echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ | |
624 | $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ | |
625 | { for i in $$list1; do echo "$$i"; done; \ | |
626 | if test -n "$$list2"; then \ | |
627 | for i in $$list2; do echo "$$i"; done \ | |
628 | | sed -n '/\.1[a-z]*$$/p'; \ | |
629 | fi; \ | |
630 | } | while read p; do \ | |
631 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ | |
632 | echo "$$d$$p"; echo "$$p"; \ | |
633 | done | \ | |
634 | sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ | |
635 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ | |
636 | sed 'N;N;s,\n, ,g' | { \ | |
637 | list=; while read file base inst; do \ | |
638 | if test "$$base" = "$$inst"; then list="$$list $$file"; else \ | |
639 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ | |
640 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ | |
641 | fi; \ | |
642 | done; \ | |
643 | for i in $$list; do echo "$$i"; done | $(am__base_list) | \ | |
644 | while read files; do \ | |
645 | test -z "$$files" || { \ | |
646 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ | |
647 | $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ | |
648 | done; } | |
649 | ||
650 | uninstall-man1: | |
651 | @$(NORMAL_UNINSTALL) | |
652 | @list=''; test -n "$(man1dir)" || exit 0; \ | |
653 | files=`{ for i in $$list; do echo "$$i"; done; \ | |
654 | l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ | |
655 | sed -n '/\.1[a-z]*$$/p'; \ | |
656 | } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ | |
657 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ | |
658 | dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) | |
571 | 659 | install-includeHEADERS: $(include_HEADERS) |
572 | 660 | @$(NORMAL_INSTALL) |
573 | test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" | |
574 | 661 | @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ |
662 | if test -n "$$list"; then \ | |
663 | echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ | |
664 | $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ | |
665 | fi; \ | |
575 | 666 | for p in $$list; do \ |
576 | 667 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ |
577 | 668 | echo "$$d$$p"; \ |
723 | 814 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags |
724 | 815 | |
725 | 816 | distdir: $(DISTFILES) |
817 | @list='$(MANS)'; if test -n "$$list"; then \ | |
818 | list=`for p in $$list; do \ | |
819 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ | |
820 | if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ | |
821 | if test -n "$$list" && \ | |
822 | grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ | |
823 | echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ | |
824 | grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ | |
825 | echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ | |
826 | echo " typically \`make maintainer-clean' will remove them" >&2; \ | |
827 | exit 1; \ | |
828 | else :; fi; \ | |
829 | else :; fi | |
726 | 830 | $(am__remove_distdir) |
727 | 831 | test -d "$(distdir)" || mkdir "$(distdir)" |
728 | 832 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
756 | 860 | done |
757 | 861 | @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ |
758 | 862 | if test "$$subdir" = .; then :; else \ |
759 | test -d "$(distdir)/$$subdir" \ | |
760 | || $(MKDIR_P) "$(distdir)/$$subdir" \ | |
761 | || exit 1; \ | |
762 | fi; \ | |
763 | done | |
764 | @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ | |
765 | if test "$$subdir" = .; then :; else \ | |
863 | $(am__make_dryrun) \ | |
864 | || test -d "$(distdir)/$$subdir" \ | |
865 | || $(MKDIR_P) "$(distdir)/$$subdir" \ | |
866 | || exit 1; \ | |
766 | 867 | dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ |
767 | 868 | $(am__relativize); \ |
768 | 869 | new_distdir=$$reldir; \ |
848 | 949 | *.zip*) \ |
849 | 950 | unzip $(distdir).zip ;;\ |
850 | 951 | esac |
851 | chmod -R a-w $(distdir); chmod a+w $(distdir) | |
952 | chmod -R a-w $(distdir); chmod u+w $(distdir) | |
852 | 953 | mkdir $(distdir)/_build |
853 | 954 | mkdir $(distdir)/_inst |
854 | 955 | chmod a-w $(distdir) |
914 | 1015 | exit 1; } >&2 |
915 | 1016 | check-am: all-am |
916 | 1017 | check: check-recursive |
917 | all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) | |
1018 | all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) | |
918 | 1019 | install-binPROGRAMS: install-libLTLIBRARIES |
919 | 1020 | |
920 | 1021 | installdirs: installdirs-recursive |
921 | 1022 | installdirs-am: |
922 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \ | |
1023 | for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(includedir)"; do \ | |
923 | 1024 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ |
924 | 1025 | done |
925 | 1026 | install: install-recursive |
948 | 1049 | distclean-generic: |
949 | 1050 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) |
950 | 1051 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) |
1052 | -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) | |
951 | 1053 | |
952 | 1054 | maintainer-clean-generic: |
953 | 1055 | @echo "This command is intended for maintainers to use" |
976 | 1078 | |
977 | 1079 | info-am: |
978 | 1080 | |
979 | install-data-am: install-includeHEADERS | |
1081 | install-data-am: install-includeHEADERS install-man | |
980 | 1082 | |
981 | 1083 | install-dvi: install-dvi-recursive |
982 | 1084 | |
992 | 1094 | |
993 | 1095 | install-info-am: |
994 | 1096 | |
995 | install-man: | |
1097 | install-man: install-man1 | |
996 | 1098 | |
997 | 1099 | install-pdf: install-pdf-recursive |
998 | 1100 | |
1025 | 1127 | ps-am: |
1026 | 1128 | |
1027 | 1129 | uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ |
1028 | uninstall-libLTLIBRARIES | |
1130 | uninstall-libLTLIBRARIES uninstall-man | |
1131 | ||
1132 | uninstall-man: uninstall-man1 | |
1029 | 1133 | |
1030 | 1134 | .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ |
1031 | 1135 | install-am install-strip tags-recursive |
1042 | 1146 | install-data-am install-dvi install-dvi-am install-exec \ |
1043 | 1147 | install-exec-am install-html install-html-am \ |
1044 | 1148 | install-includeHEADERS install-info install-info-am \ |
1045 | install-libLTLIBRARIES install-man install-pdf install-pdf-am \ | |
1046 | install-ps install-ps-am install-strip installcheck \ | |
1047 | installcheck-am installdirs installdirs-am maintainer-clean \ | |
1048 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | |
1049 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | |
1050 | tags tags-recursive uninstall uninstall-am \ | |
1149 | install-libLTLIBRARIES install-man install-man1 install-pdf \ | |
1150 | install-pdf-am install-ps install-ps-am install-strip \ | |
1151 | installcheck installcheck-am installdirs installdirs-am \ | |
1152 | maintainer-clean maintainer-clean-generic mostlyclean \ | |
1153 | mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ | |
1154 | pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ | |
1051 | 1155 | uninstall-binPROGRAMS uninstall-includeHEADERS \ |
1052 | uninstall-libLTLIBRARIES | |
1053 | ||
1156 | uninstall-libLTLIBRARIES uninstall-man uninstall-man1 | |
1157 | ||
1158 | ||
1159 | ykclient.1: $(builddir)/ykclient $(srcdir)/tool.c $(srcdir)/configure.ac | |
1160 | $(HELP2MAN) \ | |
1161 | --output=$@ $(builddir)/ykclient$(EXEEXT) \ | |
1162 | --name="YubiCloud One-Time-Password Validation Client" \ | |
1163 | --no-info | |
1164 | ||
1165 | # Release | |
1166 | ||
1167 | indent: | |
1168 | indent *.c *.h *.h.in | |
1169 | indent *.c *.h *.h.in | |
1054 | 1170 | |
1055 | 1171 | ChangeLog: |
1056 | 1172 | cd $(srcdir) && git2cl > ChangeLog |
1057 | 1173 | |
1058 | 1174 | release: |
1059 | @if test -z "$(USER)" || test -z "$(KEYID)"; then \ | |
1175 | @if test -z "$(KEYID)"; then \ | |
1060 | 1176 | echo "Try this instead:"; \ |
1061 | echo " make release USER=[GOOGLEUSERNAME] KEYID=[PGPKEYID]"; \ | |
1177 | echo " make release KEYID=[PGPKEYID]"; \ | |
1062 | 1178 | echo "For example:"; \ |
1063 | echo " make release USER=simon@yubico.com KEYID=2117364A"; \ | |
1064 | echo " make release USER=fredrikyubico@gmail.com KEYID=4EAA4232"; \ | |
1179 | echo " make release KEYID=2117364A"; \ | |
1180 | exit 1; \ | |
1181 | fi | |
1182 | @if test ! -d "$(YUBICO_GITHUB_REPO)"; then \ | |
1183 | echo "yubico.github.com repo not found!"; \ | |
1184 | echo "Make sure that YUBICO_GITHUB_REPO is set"; \ | |
1065 | 1185 | exit 1; \ |
1066 | 1186 | fi |
1067 | 1187 | @head -3 $(srcdir)/NEWS | grep -q "Version $(VERSION) .released `date -I`" || \ |
1068 | (echo 'error: Update date/version in $(srcdir)/NEWS.'; exit 1) | |
1069 | # check that non-autoconf build system works | |
1070 | cd $(srcdir) && make -f simple.mk check clean | |
1188 | (echo 'error: You need to update date/version in $(srcdir)/NEWS'; exit 1) | |
1071 | 1189 | rm -f $(srcdir)/ChangeLog |
1072 | 1190 | make ChangeLog distcheck |
1073 | 1191 | gpg --detach-sign --default-key $(KEYID) $(PACKAGE)-$(VERSION).tar.gz |
1075 | 1193 | cd $(srcdir) && git push |
1076 | 1194 | cd $(srcdir) && git tag -u $(KEYID)! -m $(VERSION) $(PACKAGE)-$(VERSION) |
1077 | 1195 | cd $(srcdir) && git push --tags |
1078 | mkdir -p ../releases/$(PACKAGE)/ && \ | |
1079 | cp -v $(PACKAGE)-$(VERSION).tar.gz* ../releases/$(PACKAGE)/ | |
1080 | googlecode_upload.py -s "OpenPGP signature for $(PACKAGE) $(VERSION)." \ | |
1081 | -p $(PROJECT) -u $(USER) $(PACKAGE)-$(VERSION).tar.gz.sig | |
1082 | googlecode_upload.py -s "$(PACKAGE) $(VERSION)" \ | |
1083 | -p $(PROJECT) -u $(USER) $(PACKAGE)-$(VERSION).tar.gz | |
1196 | $(YUBICO_GITHUB_REPO)/publish $(PROJECT) $(VERSION) $(PACKAGE)-$(VERSION).tar.gz* | |
1197 | @if test -d $(srcdir)/../wiki-$(PROJECT); then \ | |
1198 | cd $(srcdir) && \ | |
1199 | cp README ../wiki-$(PROJECT)/ReadMe.wiki && \ | |
1200 | cd ../wiki-$(PROJECT) && \ | |
1201 | git commit -m Sync. ReadMe.wiki; \ | |
1202 | fi | |
1084 | 1203 | |
1085 | 1204 | # Tell versions [3.59,3.63) of GNU make to not export all variables. |
1086 | 1205 | # Otherwise a system limit (for SysV at least) may be exceeded. |
0 | 0 | Yubikey-c-client NEWS -- History of user-visible changes. -*- outline -*- |
1 | ||
2 | * Version 2.10 (released 2013-05-15) | |
3 | ||
4 | ** Add ykclient_global_init and ykclient_global_done. | |
5 | ||
6 | ** Add ykclient_version.h header file with versioning information. | |
7 | New symbols are YKCLIENT_VERSION_STRING, YKCLIENT_VERSION_NUMBER, | |
8 | YKCLIENT_VERSION_MAJOR, YKCLIENT_VERSION_MINOR, | |
9 | YKCLIENT_VERSION_PATCH. New function ykclient_check_version. | |
10 | ||
11 | ** Modified API to use 'ykclient_rc' enum as return type instead of 'int'. | |
12 | ** Enum also moved to separate new header file ykclient_errors.h. | |
13 | This should be backwards compatible. It makes the return type | |
14 | clearer. From Arran Cudbard-Bell <a.cudbardb@freeradius.org>. | |
15 | ||
16 | ** Improve curl multi usage. | |
17 | From Arran Cudbard-Bell <a.cudbardb@freeradius.org>. | |
18 | ||
19 | ** ykclient: Cleanup command line tool a bit to make it more useful. | |
20 | Added --help, --version and --debug. Defaults to silent output. Exit | |
21 | codes are documented and more useful. Added manpage. | |
1 | 22 | |
2 | 23 | * Version 2.9 (released 2012-08-07) |
3 | 24 |
13 | 13 | * tool.c: Source for command line tool "ykclient" to validate an OTP. |
14 | 14 | |
15 | 15 | * selftest.c: Self tests of the library. |
16 | ||
17 | * simple.mk: Simple makefile to build the above parts. | |
18 | 16 | |
19 | 17 | * configure.ac, Makefile.am: Autoconf/Automake files. |
20 | 18 | |
46 | 44 | $ cd yubico-c-client |
47 | 45 | ----------- |
48 | 46 | |
49 | Autoconf, automake and libtool must be installed. | |
47 | Autoconf, automake and libtool must be installed. Help2man is used to | |
48 | generate the manpages. Libcurl-dev must be installed. | |
50 | 49 | |
51 | 50 | Generate the build system using: |
52 | 51 | |
53 | 52 | ----------- |
54 | 53 | $ autoreconf --install |
55 | 54 | ----------- |
56 | ||
57 | If you get "linking libraries using a non-POSIX archiver requires 'AM_PROG_AR' in 'configure.ac'" | |
58 | you're probably using automake 1.12, use 1.11 or add -Wno-extra-portability in configure.ac. Adding | |
59 | this breaks compability with automake before 1.11.2. | |
60 | ||
61 | 55 | |
62 | 56 | Building |
63 | 57 | -------- |
68 | 62 | |
69 | 63 | ----------- |
70 | 64 | $ ./configure |
71 | $ make check install | |
65 | $ make check && sudo make install | |
72 | 66 | ----------- |
73 | ||
74 | Another way to build the package is by running 'make -f simple.mk | |
75 | check'. It will build each component, and also test it. See below | |
76 | for sample session. This is useful if you want to target a platform | |
77 | that doesn't support Autoconf/automake/libtool well. | |
78 | ||
79 | ----------- | |
80 | jas@mocca:~/src/yubico-c-client$ make -f simple.mk check | |
81 | cc -I. -Wall -g -DPACKAGE=\"ykclient\" -DPACKAGE_VERSION=\"0\" -c -o ykclient.o ykclient.c | |
82 | cc -lcurl ykclient.o tool.c -o ykclient | |
83 | cc -I. -Wall -g -DPACKAGE=\"ykclient\" -DPACKAGE_VERSION=\"0\" -lcurl selftest.c ykclient.o -o selftest | |
84 | ./selftest | |
85 | ykclient_init (0): Success | |
86 | ykclient_request (2): Yubikey OTP was replayed (REPLAYED_OTP) | |
87 | yubikey_request (2): Yubikey OTP was replayed (REPLAYED_OTP) | |
88 | strerror(0): Success | |
89 | strerror(BAD_OTP): Yubikey OTP was bad (BAD_OTP) | |
90 | jas@mocca:~/src/yubico-c-client$ | |
91 | ----------- | |
92 | ||
93 | 67 | |
94 | 68 | Command-line tools |
95 | 69 | ------------------ |
0 | # generated automatically by aclocal 1.11.3 -*- Autoconf -*- | |
0 | # generated automatically by aclocal 1.11.6 -*- Autoconf -*- | |
1 | 1 | |
2 | 2 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
3 | 3 | # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, |
13 | 13 | |
14 | 14 | m4_ifndef([AC_AUTOCONF_VERSION], |
15 | 15 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
16 | m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, | |
17 | [m4_warning([this file was generated for autoconf 2.68. | |
16 | m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, | |
17 | [m4_warning([this file was generated for autoconf 2.69. | |
18 | 18 | You have another version of autoconf. It may work, but is not guaranteed to. |
19 | 19 | If you have problems, you may need to regenerate the build system entirely. |
20 | 20 | To do so, use the procedure documented by the package, typically `autoreconf'.])]) |
167 | 167 | _libcurl_save_libs=$LIBS |
168 | 168 | LIBS="$LIBCURL $LIBS" |
169 | 169 | |
170 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <curl/curl.h>],[ | |
170 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[ | |
171 | 171 | /* Try and use a few common options to force a failure if we are |
172 | 172 | missing symbols or can't link. */ |
173 | 173 | int x; |
178 | 178 | x=CURLOPT_ERRORBUFFER; |
179 | 179 | x=CURLOPT_STDERR; |
180 | 180 | x=CURLOPT_VERBOSE; |
181 | ])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) | |
181 | if (x) ; | |
182 | ]])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) | |
182 | 183 | |
183 | 184 | CPPFLAGS=$_libcurl_save_cppflags |
184 | 185 | LIBS=$_libcurl_save_libs |
288 | 289 | [am__api_version='1.11' |
289 | 290 | dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
290 | 291 | dnl require some minimum version. Point them to the right macro. |
291 | m4_if([$1], [1.11.3], [], | |
292 | m4_if([$1], [1.11.6], [], | |
292 | 293 | [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
293 | 294 | ]) |
294 | 295 | |
304 | 305 | # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. |
305 | 306 | # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
306 | 307 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
307 | [AM_AUTOMAKE_VERSION([1.11.3])dnl | |
308 | [AM_AUTOMAKE_VERSION([1.11.6])dnl | |
308 | 309 | m4_ifndef([AC_AUTOCONF_VERSION], |
309 | 310 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
310 | 311 | _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
312 | ||
313 | # Copyright (C) 2011 Free Software Foundation, Inc. | |
314 | # | |
315 | # This file is free software; the Free Software Foundation | |
316 | # gives unlimited permission to copy and/or distribute it, | |
317 | # with or without modifications, as long as this notice is preserved. | |
318 | ||
319 | # serial 1 | |
320 | ||
321 | # AM_PROG_AR([ACT-IF-FAIL]) | |
322 | # ------------------------- | |
323 | # Try to determine the archiver interface, and trigger the ar-lib wrapper | |
324 | # if it is needed. If the detection of archiver interface fails, run | |
325 | # ACT-IF-FAIL (default is to abort configure with a proper error message). | |
326 | AC_DEFUN([AM_PROG_AR], | |
327 | [AC_BEFORE([$0], [LT_INIT])dnl | |
328 | AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl | |
329 | AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl | |
330 | AC_REQUIRE_AUX_FILE([ar-lib])dnl | |
331 | AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) | |
332 | : ${AR=ar} | |
333 | ||
334 | AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], | |
335 | [am_cv_ar_interface=ar | |
336 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], | |
337 | [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' | |
338 | AC_TRY_EVAL([am_ar_try]) | |
339 | if test "$ac_status" -eq 0; then | |
340 | am_cv_ar_interface=ar | |
341 | else | |
342 | am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' | |
343 | AC_TRY_EVAL([am_ar_try]) | |
344 | if test "$ac_status" -eq 0; then | |
345 | am_cv_ar_interface=lib | |
346 | else | |
347 | am_cv_ar_interface=unknown | |
348 | fi | |
349 | fi | |
350 | rm -f conftest.lib libconftest.a | |
351 | ]) | |
352 | ]) | |
353 | ||
354 | case $am_cv_ar_interface in | |
355 | ar) | |
356 | ;; | |
357 | lib) | |
358 | # Microsoft lib, so override with the ar-lib wrapper script. | |
359 | # FIXME: It is wrong to rewrite AR. | |
360 | # But if we don't then we get into trouble of one sort or another. | |
361 | # A longer-term fix would be to have automake use am__AR in this case, | |
362 | # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something | |
363 | # similar. | |
364 | AR="$am_aux_dir/ar-lib $AR" | |
365 | ;; | |
366 | unknown) | |
367 | m4_default([$1], | |
368 | [AC_MSG_ERROR([could not determine $AR interface])]) | |
369 | ;; | |
370 | esac | |
371 | AC_SUBST([AR])dnl | |
372 | ]) | |
311 | 373 | |
312 | 374 | # AM_AUX_DIR_EXPAND -*- Autoconf -*- |
313 | 375 | |
1281 | 1343 | m4_include([m4/ltsugar.m4]) |
1282 | 1344 | m4_include([m4/ltversion.m4]) |
1283 | 1345 | m4_include([m4/lt~obsolete.m4]) |
1346 | m4_include([m4/manywarnings.m4]) | |
1347 | m4_include([m4/warnings.m4]) |
0 | #! /bin/sh | |
1 | # Wrapper for Microsoft lib.exe | |
2 | ||
3 | me=ar-lib | |
4 | scriptversion=2012-03-01.08; # UTC | |
5 | ||
6 | # Copyright (C) 2010, 2012 Free Software Foundation, Inc. | |
7 | # Written by Peter Rosin <peda@lysator.liu.se>. | |
8 | # | |
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the GNU General Public License as published by | |
11 | # the Free Software Foundation; either version 2, or (at your option) | |
12 | # any later version. | |
13 | # | |
14 | # This program is distributed in the hope that it will be useful, | |
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | # GNU General Public License for more details. | |
18 | # | |
19 | # You should have received a copy of the GNU General Public License | |
20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | # As a special exception to the GNU General Public License, if you | |
23 | # distribute this file as part of a program that contains a | |
24 | # configuration script generated by Autoconf, you may include it under | |
25 | # the same distribution terms that you use for the rest of that program. | |
26 | ||
27 | # This file is maintained in Automake, please report | |
28 | # bugs to <bug-automake@gnu.org> or send patches to | |
29 | # <automake-patches@gnu.org>. | |
30 | ||
31 | ||
32 | # func_error message | |
33 | func_error () | |
34 | { | |
35 | echo "$me: $1" 1>&2 | |
36 | exit 1 | |
37 | } | |
38 | ||
39 | file_conv= | |
40 | ||
41 | # func_file_conv build_file | |
42 | # Convert a $build file to $host form and store it in $file | |
43 | # Currently only supports Windows hosts. | |
44 | func_file_conv () | |
45 | { | |
46 | file=$1 | |
47 | case $file in | |
48 | / | /[!/]*) # absolute file, and not a UNC file | |
49 | if test -z "$file_conv"; then | |
50 | # lazily determine how to convert abs files | |
51 | case `uname -s` in | |
52 | MINGW*) | |
53 | file_conv=mingw | |
54 | ;; | |
55 | CYGWIN*) | |
56 | file_conv=cygwin | |
57 | ;; | |
58 | *) | |
59 | file_conv=wine | |
60 | ;; | |
61 | esac | |
62 | fi | |
63 | case $file_conv in | |
64 | mingw) | |
65 | file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` | |
66 | ;; | |
67 | cygwin) | |
68 | file=`cygpath -m "$file" || echo "$file"` | |
69 | ;; | |
70 | wine) | |
71 | file=`winepath -w "$file" || echo "$file"` | |
72 | ;; | |
73 | esac | |
74 | ;; | |
75 | esac | |
76 | } | |
77 | ||
78 | # func_at_file at_file operation archive | |
79 | # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE | |
80 | # for each of them. | |
81 | # When interpreting the content of the @FILE, do NOT use func_file_conv, | |
82 | # since the user would need to supply preconverted file names to | |
83 | # binutils ar, at least for MinGW. | |
84 | func_at_file () | |
85 | { | |
86 | operation=$2 | |
87 | archive=$3 | |
88 | at_file_contents=`cat "$1"` | |
89 | eval set x "$at_file_contents" | |
90 | shift | |
91 | ||
92 | for member | |
93 | do | |
94 | $AR -NOLOGO $operation:"$member" "$archive" || exit $? | |
95 | done | |
96 | } | |
97 | ||
98 | case $1 in | |
99 | '') | |
100 | func_error "no command. Try '$0 --help' for more information." | |
101 | ;; | |
102 | -h | --h*) | |
103 | cat <<EOF | |
104 | Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...] | |
105 | ||
106 | Members may be specified in a file named with @FILE. | |
107 | EOF | |
108 | exit $? | |
109 | ;; | |
110 | -v | --v*) | |
111 | echo "$me, version $scriptversion" | |
112 | exit $? | |
113 | ;; | |
114 | esac | |
115 | ||
116 | if test $# -lt 3; then | |
117 | func_error "you must specify a program, an action and an archive" | |
118 | fi | |
119 | ||
120 | AR=$1 | |
121 | shift | |
122 | while : | |
123 | do | |
124 | if test $# -lt 2; then | |
125 | func_error "you must specify a program, an action and an archive" | |
126 | fi | |
127 | case $1 in | |
128 | -lib | -LIB \ | |
129 | | -ltcg | -LTCG \ | |
130 | | -machine* | -MACHINE* \ | |
131 | | -subsystem* | -SUBSYSTEM* \ | |
132 | | -verbose | -VERBOSE \ | |
133 | | -wx* | -WX* ) | |
134 | AR="$AR $1" | |
135 | shift | |
136 | ;; | |
137 | *) | |
138 | action=$1 | |
139 | shift | |
140 | break | |
141 | ;; | |
142 | esac | |
143 | done | |
144 | orig_archive=$1 | |
145 | shift | |
146 | func_file_conv "$orig_archive" | |
147 | archive=$file | |
148 | ||
149 | # strip leading dash in $action | |
150 | action=${action#-} | |
151 | ||
152 | delete= | |
153 | extract= | |
154 | list= | |
155 | quick= | |
156 | replace= | |
157 | index= | |
158 | create= | |
159 | ||
160 | while test -n "$action" | |
161 | do | |
162 | case $action in | |
163 | d*) delete=yes ;; | |
164 | x*) extract=yes ;; | |
165 | t*) list=yes ;; | |
166 | q*) quick=yes ;; | |
167 | r*) replace=yes ;; | |
168 | s*) index=yes ;; | |
169 | S*) ;; # the index is always updated implicitly | |
170 | c*) create=yes ;; | |
171 | u*) ;; # TODO: don't ignore the update modifier | |
172 | v*) ;; # TODO: don't ignore the verbose modifier | |
173 | *) | |
174 | func_error "unknown action specified" | |
175 | ;; | |
176 | esac | |
177 | action=${action#?} | |
178 | done | |
179 | ||
180 | case $delete$extract$list$quick$replace,$index in | |
181 | yes,* | ,yes) | |
182 | ;; | |
183 | yesyes*) | |
184 | func_error "more than one action specified" | |
185 | ;; | |
186 | *) | |
187 | func_error "no action specified" | |
188 | ;; | |
189 | esac | |
190 | ||
191 | if test -n "$delete"; then | |
192 | if test ! -f "$orig_archive"; then | |
193 | func_error "archive not found" | |
194 | fi | |
195 | for member | |
196 | do | |
197 | case $1 in | |
198 | @*) | |
199 | func_at_file "${1#@}" -REMOVE "$archive" | |
200 | ;; | |
201 | *) | |
202 | func_file_conv "$1" | |
203 | $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $? | |
204 | ;; | |
205 | esac | |
206 | done | |
207 | ||
208 | elif test -n "$extract"; then | |
209 | if test ! -f "$orig_archive"; then | |
210 | func_error "archive not found" | |
211 | fi | |
212 | if test $# -gt 0; then | |
213 | for member | |
214 | do | |
215 | case $1 in | |
216 | @*) | |
217 | func_at_file "${1#@}" -EXTRACT "$archive" | |
218 | ;; | |
219 | *) | |
220 | func_file_conv "$1" | |
221 | $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $? | |
222 | ;; | |
223 | esac | |
224 | done | |
225 | else | |
226 | $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member | |
227 | do | |
228 | $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? | |
229 | done | |
230 | fi | |
231 | ||
232 | elif test -n "$quick$replace"; then | |
233 | if test ! -f "$orig_archive"; then | |
234 | if test -z "$create"; then | |
235 | echo "$me: creating $orig_archive" | |
236 | fi | |
237 | orig_archive= | |
238 | else | |
239 | orig_archive=$archive | |
240 | fi | |
241 | ||
242 | for member | |
243 | do | |
244 | case $1 in | |
245 | @*) | |
246 | func_file_conv "${1#@}" | |
247 | set x "$@" "@$file" | |
248 | ;; | |
249 | *) | |
250 | func_file_conv "$1" | |
251 | set x "$@" "$file" | |
252 | ;; | |
253 | esac | |
254 | shift | |
255 | shift | |
256 | done | |
257 | ||
258 | if test -n "$orig_archive"; then | |
259 | $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $? | |
260 | else | |
261 | $AR -NOLOGO -OUT:"$archive" "$@" || exit $? | |
262 | fi | |
263 | ||
264 | elif test -n "$list"; then | |
265 | if test ! -f "$orig_archive"; then | |
266 | func_error "archive not found" | |
267 | fi | |
268 | $AR -NOLOGO -LIST "$archive" || exit $? | |
269 | fi |
3 | 3 | # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, |
4 | 4 | # 2011, 2012 Free Software Foundation, Inc. |
5 | 5 | |
6 | timestamp='2012-02-10' | |
6 | timestamp='2012-04-18' | |
7 | 7 | |
8 | 8 | # This file is (in principle) common to ALL GNU software. |
9 | 9 | # The presence of a machine in this file suggests that SOME GNU software |
223 | 223 | ;; |
224 | 224 | -isc*) |
225 | 225 | basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` |
226 | ;; | |
227 | -lynx*178) | |
228 | os=-lynxos178 | |
229 | ;; | |
230 | -lynx*5) | |
231 | os=-lynxos5 | |
226 | 232 | ;; |
227 | 233 | -lynx*) |
228 | 234 | os=-lynxos |
1536 | 1542 | c4x-* | tic4x-*) |
1537 | 1543 | os=-coff |
1538 | 1544 | ;; |
1545 | hexagon-*) | |
1546 | os=-elf | |
1547 | ;; | |
1539 | 1548 | tic54x-*) |
1540 | 1549 | os=-coff |
1541 | 1550 | ;; |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.68 for ykclient 2.9. | |
2 | # Generated by GNU Autoconf 2.69 for ykclient 2.10. | |
3 | 3 | # |
4 | 4 | # Report bugs to <yubico-devel@googlegroups.com>. |
5 | 5 | # |
6 | 6 | # |
7 | # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, | |
8 | # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software | |
9 | # Foundation, Inc. | |
7 | # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. | |
10 | 8 | # |
11 | 9 | # |
12 | 10 | # This configure script is free software; the Free Software Foundation |
135 | 133 | # CDPATH. |
136 | 134 | (unset CDPATH) >/dev/null 2>&1 && unset CDPATH |
137 | 135 | |
136 | # Use a proper internal environment variable to ensure we don't fall | |
137 | # into an infinite loop, continuously re-executing ourselves. | |
138 | if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then | |
139 | _as_can_reexec=no; export _as_can_reexec; | |
140 | # We cannot yet assume a decent shell, so we have to provide a | |
141 | # neutralization value for shells without unset; and this also | |
142 | # works around shells that cannot unset nonexistent variables. | |
143 | # Preserve -v and -x to the replacement shell. | |
144 | BASH_ENV=/dev/null | |
145 | ENV=/dev/null | |
146 | (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV | |
147 | case $- in # (((( | |
148 | *v*x* | *x*v* ) as_opts=-vx ;; | |
149 | *v* ) as_opts=-v ;; | |
150 | *x* ) as_opts=-x ;; | |
151 | * ) as_opts= ;; | |
152 | esac | |
153 | exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} | |
154 | # Admittedly, this is quite paranoid, since all the known shells bail | |
155 | # out after a failed `exec'. | |
156 | $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 | |
157 | as_fn_exit 255 | |
158 | fi | |
159 | # We don't want this to propagate to other subprocesses. | |
160 | { _as_can_reexec=; unset _as_can_reexec;} | |
138 | 161 | if test "x$CONFIG_SHELL" = x; then |
139 | 162 | as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : |
140 | 163 | emulate sh |
168 | 191 | else |
169 | 192 | exitcode=1; echo positional parameters were not saved. |
170 | 193 | fi |
171 | test x\$exitcode = x0 || exit 1" | |
194 | test x\$exitcode = x0 || exit 1 | |
195 | test -x / || exit 1" | |
172 | 196 | as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO |
173 | 197 | as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO |
174 | 198 | eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && |
221 | 245 | |
222 | 246 | |
223 | 247 | if test "x$CONFIG_SHELL" != x; then : |
224 | # We cannot yet assume a decent shell, so we have to provide a | |
225 | # neutralization value for shells without unset; and this also | |
226 | # works around shells that cannot unset nonexistent variables. | |
227 | # Preserve -v and -x to the replacement shell. | |
228 | BASH_ENV=/dev/null | |
229 | ENV=/dev/null | |
230 | (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV | |
231 | export CONFIG_SHELL | |
232 | case $- in # (((( | |
233 | *v*x* | *x*v* ) as_opts=-vx ;; | |
234 | *v* ) as_opts=-v ;; | |
235 | *x* ) as_opts=-x ;; | |
236 | * ) as_opts= ;; | |
237 | esac | |
238 | exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} | |
248 | export CONFIG_SHELL | |
249 | # We cannot yet assume a decent shell, so we have to provide a | |
250 | # neutralization value for shells without unset; and this also | |
251 | # works around shells that cannot unset nonexistent variables. | |
252 | # Preserve -v and -x to the replacement shell. | |
253 | BASH_ENV=/dev/null | |
254 | ENV=/dev/null | |
255 | (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV | |
256 | case $- in # (((( | |
257 | *v*x* | *x*v* ) as_opts=-vx ;; | |
258 | *v* ) as_opts=-v ;; | |
259 | *x* ) as_opts=-x ;; | |
260 | * ) as_opts= ;; | |
261 | esac | |
262 | exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} | |
263 | # Admittedly, this is quite paranoid, since all the known shells bail | |
264 | # out after a failed `exec'. | |
265 | $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 | |
266 | exit 255 | |
239 | 267 | fi |
240 | 268 | |
241 | 269 | if test x$as_have_required = xno; then : |
338 | 366 | |
339 | 367 | |
340 | 368 | } # as_fn_mkdir_p |
369 | ||
370 | # as_fn_executable_p FILE | |
371 | # ----------------------- | |
372 | # Test if FILE is an executable regular file. | |
373 | as_fn_executable_p () | |
374 | { | |
375 | test -f "$1" && test -x "$1" | |
376 | } # as_fn_executable_p | |
341 | 377 | # as_fn_append VAR VALUE |
342 | 378 | # ---------------------- |
343 | 379 | # Append the text in VALUE to the end of the definition contained in VAR. Take |
459 | 495 | chmod +x "$as_me.lineno" || |
460 | 496 | { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } |
461 | 497 | |
498 | # If we had to re-execute with $CONFIG_SHELL, we're ensured to have | |
499 | # already done that, so ensure we don't try to do so again and fall | |
500 | # in an infinite loop. This has already happened in practice. | |
501 | _as_can_reexec=no; export _as_can_reexec | |
462 | 502 | # Don't try to exec as it changes $[0], causing all sort of problems |
463 | 503 | # (the dirname of $[0] is not the place where we might find the |
464 | 504 | # original and so on. Autoconf is especially sensitive to this). |
493 | 533 | # ... but there are two gotchas: |
494 | 534 | # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. |
495 | 535 | # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. |
496 | # In both cases, we have to default to `cp -p'. | |
536 | # In both cases, we have to default to `cp -pR'. | |
497 | 537 | ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || |
498 | as_ln_s='cp -p' | |
538 | as_ln_s='cp -pR' | |
499 | 539 | elif ln conf$$.file conf$$ 2>/dev/null; then |
500 | 540 | as_ln_s=ln |
501 | 541 | else |
502 | as_ln_s='cp -p' | |
542 | as_ln_s='cp -pR' | |
503 | 543 | fi |
504 | 544 | else |
505 | as_ln_s='cp -p' | |
545 | as_ln_s='cp -pR' | |
506 | 546 | fi |
507 | 547 | rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file |
508 | 548 | rmdir conf$$.dir 2>/dev/null |
514 | 554 | as_mkdir_p=false |
515 | 555 | fi |
516 | 556 | |
517 | if test -x / >/dev/null 2>&1; then | |
518 | as_test_x='test -x' | |
519 | else | |
520 | if ls -dL / >/dev/null 2>&1; then | |
521 | as_ls_L_option=L | |
522 | else | |
523 | as_ls_L_option= | |
524 | fi | |
525 | as_test_x=' | |
526 | eval sh -c '\'' | |
527 | if test -d "$1"; then | |
528 | test -d "$1/."; | |
529 | else | |
530 | case $1 in #( | |
531 | -*)set "./$1";; | |
532 | esac; | |
533 | case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( | |
534 | ???[sx]*):;;*)false;;esac;fi | |
535 | '\'' sh | |
536 | ' | |
537 | fi | |
538 | as_executable_p=$as_test_x | |
557 | as_test_x='test -x' | |
558 | as_executable_p=as_fn_executable_p | |
539 | 559 | |
540 | 560 | # Sed expression to map a string onto a valid CPP name. |
541 | 561 | as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" |
569 | 589 | # Identity of this package. |
570 | 590 | PACKAGE_NAME='ykclient' |
571 | 591 | PACKAGE_TARNAME='ykclient' |
572 | PACKAGE_VERSION='2.9' | |
573 | PACKAGE_STRING='ykclient 2.9' | |
592 | PACKAGE_VERSION='2.10' | |
593 | PACKAGE_STRING='ykclient 2.10' | |
574 | 594 | PACKAGE_BUGREPORT='yubico-devel@googlegroups.com' |
575 | 595 | PACKAGE_URL='' |
576 | 596 | |
614 | 634 | am__EXEEXT_TRUE |
615 | 635 | LTLIBOBJS |
616 | 636 | LIBOBJS |
637 | YKCLIENT_VERSION_NUMBER | |
638 | YKCLIENT_VERSION_PATCH | |
639 | YKCLIENT_VERSION_MINOR | |
640 | YKCLIENT_VERSION_MAJOR | |
641 | WARN_CFLAGS | |
617 | 642 | LIBCURL |
618 | 643 | LIBCURL_CPPFLAGS |
619 | 644 | _libcurl_config |
625 | 650 | DSYMUTIL |
626 | 651 | MANIFEST_TOOL |
627 | 652 | RANLIB |
628 | ac_ct_AR | |
629 | AR | |
630 | 653 | LN_S |
631 | 654 | NM |
632 | 655 | ac_ct_DUMPBIN |
648 | 671 | build_vendor |
649 | 672 | build_cpu |
650 | 673 | build |
674 | HELP2MAN | |
675 | ac_ct_AR | |
676 | AR | |
651 | 677 | am__fastdepCC_FALSE |
652 | 678 | am__fastdepCC_TRUE |
653 | 679 | CCDEPMODE |
746 | 772 | with_sysroot |
747 | 773 | enable_libtool_lock |
748 | 774 | with_libcurl |
775 | enable_gcc_warnings | |
749 | 776 | ' |
750 | 777 | ac_precious_vars='build_alias |
751 | 778 | host_alias |
1211 | 1238 | if test "x$host_alias" != x; then |
1212 | 1239 | if test "x$build_alias" = x; then |
1213 | 1240 | cross_compiling=maybe |
1214 | $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. | |
1215 | If a cross compiler is detected then cross compile mode will be used" >&2 | |
1216 | 1241 | elif test "x$build_alias" != "x$host_alias"; then |
1217 | 1242 | cross_compiling=yes |
1218 | 1243 | fi |
1298 | 1323 | # Omit some internal or obsolete options to make the list less imposing. |
1299 | 1324 | # This message is too long to be a string in the A/UX 3.1 sh. |
1300 | 1325 | cat <<_ACEOF |
1301 | \`configure' configures ykclient 2.9 to adapt to many kinds of systems. | |
1326 | \`configure' configures ykclient 2.10 to adapt to many kinds of systems. | |
1302 | 1327 | |
1303 | 1328 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1304 | 1329 | |
1368 | 1393 | |
1369 | 1394 | if test -n "$ac_init_help"; then |
1370 | 1395 | case $ac_init_help in |
1371 | short | recursive ) echo "Configuration of ykclient 2.9:";; | |
1396 | short | recursive ) echo "Configuration of ykclient 2.10:";; | |
1372 | 1397 | esac |
1373 | 1398 | cat <<\_ACEOF |
1374 | 1399 | |
1385 | 1410 | --enable-fast-install[=PKGS] |
1386 | 1411 | optimize for fast installation [default=yes] |
1387 | 1412 | --disable-libtool-lock avoid locking (might break parallel builds) |
1413 | --enable-gcc-warnings turn on lots of GCC warnings (for developers) | |
1388 | 1414 | |
1389 | 1415 | Optional Packages: |
1390 | 1416 | --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
1473 | 1499 | test -n "$ac_init_help" && exit $ac_status |
1474 | 1500 | if $ac_init_version; then |
1475 | 1501 | cat <<\_ACEOF |
1476 | ykclient configure 2.9 | |
1477 | generated by GNU Autoconf 2.68 | |
1478 | ||
1479 | Copyright (C) 2010 Free Software Foundation, Inc. | |
1502 | ykclient configure 2.10 | |
1503 | generated by GNU Autoconf 2.69 | |
1504 | ||
1505 | Copyright (C) 2012 Free Software Foundation, Inc. | |
1480 | 1506 | This configure script is free software; the Free Software Foundation |
1481 | 1507 | gives unlimited permission to copy, distribute and modify it. |
1482 | 1508 | _ACEOF |
1552 | 1578 | test ! -s conftest.err |
1553 | 1579 | } && test -s conftest$ac_exeext && { |
1554 | 1580 | test "$cross_compiling" = yes || |
1555 | $as_test_x conftest$ac_exeext | |
1581 | test -x conftest$ac_exeext | |
1556 | 1582 | }; then : |
1557 | 1583 | ac_retval=0 |
1558 | 1584 | else |
1751 | 1777 | This file contains any messages produced by compilers while |
1752 | 1778 | running configure, to aid debugging if configure makes a mistake. |
1753 | 1779 | |
1754 | It was created by ykclient $as_me 2.9, which was | |
1755 | generated by GNU Autoconf 2.68. Invocation command line was | |
1780 | It was created by ykclient $as_me 2.10, which was | |
1781 | generated by GNU Autoconf 2.69. Invocation command line was | |
1756 | 1782 | |
1757 | 1783 | $ $0 $@ |
1758 | 1784 | |
2105 | 2131 | # Interfaces changed/added/removed: CURRENT++ REVISION=0 |
2106 | 2132 | # Interfaces added: AGE++ |
2107 | 2133 | # Interfaces removed: AGE=0 |
2108 | LT_CURRENT=7 | |
2109 | ||
2110 | LT_REVISION=1 | |
2111 | ||
2112 | LT_AGE=4 | |
2134 | LT_CURRENT=8 | |
2135 | ||
2136 | LT_REVISION=0 | |
2137 | ||
2138 | LT_AGE=5 | |
2113 | 2139 | |
2114 | 2140 | |
2115 | 2141 | am__api_version='1.11' |
2180 | 2206 | # by default. |
2181 | 2207 | for ac_prog in ginstall scoinst install; do |
2182 | 2208 | for ac_exec_ext in '' $ac_executable_extensions; do |
2183 | if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then | |
2209 | if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then | |
2184 | 2210 | if test $ac_prog = install && |
2185 | 2211 | grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then |
2186 | 2212 | # AIX install. It has an incompatible calling convention. |
2349 | 2375 | IFS=$as_save_IFS |
2350 | 2376 | test -z "$as_dir" && as_dir=. |
2351 | 2377 | for ac_exec_ext in '' $ac_executable_extensions; do |
2352 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2378 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2353 | 2379 | ac_cv_prog_STRIP="${ac_tool_prefix}strip" |
2354 | 2380 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2355 | 2381 | break 2 |
2389 | 2415 | IFS=$as_save_IFS |
2390 | 2416 | test -z "$as_dir" && as_dir=. |
2391 | 2417 | for ac_exec_ext in '' $ac_executable_extensions; do |
2392 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2418 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2393 | 2419 | ac_cv_prog_ac_ct_STRIP="strip" |
2394 | 2420 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2395 | 2421 | break 2 |
2440 | 2466 | test -z "$as_dir" && as_dir=. |
2441 | 2467 | for ac_prog in mkdir gmkdir; do |
2442 | 2468 | for ac_exec_ext in '' $ac_executable_extensions; do |
2443 | { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue | |
2469 | as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue | |
2444 | 2470 | case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( |
2445 | 2471 | 'mkdir (GNU coreutils) '* | \ |
2446 | 2472 | 'mkdir (coreutils) '* | \ |
2493 | 2519 | IFS=$as_save_IFS |
2494 | 2520 | test -z "$as_dir" && as_dir=. |
2495 | 2521 | for ac_exec_ext in '' $ac_executable_extensions; do |
2496 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2522 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2497 | 2523 | ac_cv_prog_AWK="$ac_prog" |
2498 | 2524 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2499 | 2525 | break 2 |
2579 | 2605 | |
2580 | 2606 | # Define the identity of the package. |
2581 | 2607 | PACKAGE='ykclient' |
2582 | VERSION='2.9' | |
2608 | VERSION='2.10' | |
2583 | 2609 | |
2584 | 2610 | |
2585 | 2611 | cat >>confdefs.h <<_ACEOF |
2680 | 2706 | IFS=$as_save_IFS |
2681 | 2707 | test -z "$as_dir" && as_dir=. |
2682 | 2708 | for ac_exec_ext in '' $ac_executable_extensions; do |
2683 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2709 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2684 | 2710 | ac_cv_prog_CC="${ac_tool_prefix}gcc" |
2685 | 2711 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2686 | 2712 | break 2 |
2720 | 2746 | IFS=$as_save_IFS |
2721 | 2747 | test -z "$as_dir" && as_dir=. |
2722 | 2748 | for ac_exec_ext in '' $ac_executable_extensions; do |
2723 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2749 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2724 | 2750 | ac_cv_prog_ac_ct_CC="gcc" |
2725 | 2751 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2726 | 2752 | break 2 |
2773 | 2799 | IFS=$as_save_IFS |
2774 | 2800 | test -z "$as_dir" && as_dir=. |
2775 | 2801 | for ac_exec_ext in '' $ac_executable_extensions; do |
2776 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2802 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2777 | 2803 | ac_cv_prog_CC="${ac_tool_prefix}cc" |
2778 | 2804 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2779 | 2805 | break 2 |
2814 | 2840 | IFS=$as_save_IFS |
2815 | 2841 | test -z "$as_dir" && as_dir=. |
2816 | 2842 | for ac_exec_ext in '' $ac_executable_extensions; do |
2817 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2843 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2818 | 2844 | if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then |
2819 | 2845 | ac_prog_rejected=yes |
2820 | 2846 | continue |
2872 | 2898 | IFS=$as_save_IFS |
2873 | 2899 | test -z "$as_dir" && as_dir=. |
2874 | 2900 | for ac_exec_ext in '' $ac_executable_extensions; do |
2875 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2901 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2876 | 2902 | ac_cv_prog_CC="$ac_tool_prefix$ac_prog" |
2877 | 2903 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2878 | 2904 | break 2 |
2916 | 2942 | IFS=$as_save_IFS |
2917 | 2943 | test -z "$as_dir" && as_dir=. |
2918 | 2944 | for ac_exec_ext in '' $ac_executable_extensions; do |
2919 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
2945 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
2920 | 2946 | ac_cv_prog_ac_ct_CC="$ac_prog" |
2921 | 2947 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
2922 | 2948 | break 2 |
3362 | 3388 | /* end confdefs.h. */ |
3363 | 3389 | #include <stdarg.h> |
3364 | 3390 | #include <stdio.h> |
3365 | #include <sys/types.h> | |
3366 | #include <sys/stat.h> | |
3391 | struct stat; | |
3367 | 3392 | /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ |
3368 | 3393 | struct buf { int x; }; |
3369 | 3394 | FILE * (*rcsopen) (struct buf *, struct stat *, int); |
3639 | 3664 | fi |
3640 | 3665 | |
3641 | 3666 | |
3667 | ||
3668 | ||
3669 | if test -n "$ac_tool_prefix"; then | |
3670 | for ac_prog in ar lib "link -lib" | |
3671 | do | |
3672 | # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. | |
3673 | set dummy $ac_tool_prefix$ac_prog; ac_word=$2 | |
3674 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
3675 | $as_echo_n "checking for $ac_word... " >&6; } | |
3676 | if ${ac_cv_prog_AR+:} false; then : | |
3677 | $as_echo_n "(cached) " >&6 | |
3678 | else | |
3679 | if test -n "$AR"; then | |
3680 | ac_cv_prog_AR="$AR" # Let the user override the test. | |
3681 | else | |
3682 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
3683 | for as_dir in $PATH | |
3684 | do | |
3685 | IFS=$as_save_IFS | |
3686 | test -z "$as_dir" && as_dir=. | |
3687 | for ac_exec_ext in '' $ac_executable_extensions; do | |
3688 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3689 | ac_cv_prog_AR="$ac_tool_prefix$ac_prog" | |
3690 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
3691 | break 2 | |
3692 | fi | |
3693 | done | |
3694 | done | |
3695 | IFS=$as_save_IFS | |
3696 | ||
3697 | fi | |
3698 | fi | |
3699 | AR=$ac_cv_prog_AR | |
3700 | if test -n "$AR"; then | |
3701 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 | |
3702 | $as_echo "$AR" >&6; } | |
3703 | else | |
3704 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
3705 | $as_echo "no" >&6; } | |
3706 | fi | |
3707 | ||
3708 | ||
3709 | test -n "$AR" && break | |
3710 | done | |
3711 | fi | |
3712 | if test -z "$AR"; then | |
3713 | ac_ct_AR=$AR | |
3714 | for ac_prog in ar lib "link -lib" | |
3715 | do | |
3716 | # Extract the first word of "$ac_prog", so it can be a program name with args. | |
3717 | set dummy $ac_prog; ac_word=$2 | |
3718 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 | |
3719 | $as_echo_n "checking for $ac_word... " >&6; } | |
3720 | if ${ac_cv_prog_ac_ct_AR+:} false; then : | |
3721 | $as_echo_n "(cached) " >&6 | |
3722 | else | |
3723 | if test -n "$ac_ct_AR"; then | |
3724 | ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. | |
3725 | else | |
3726 | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR | |
3727 | for as_dir in $PATH | |
3728 | do | |
3729 | IFS=$as_save_IFS | |
3730 | test -z "$as_dir" && as_dir=. | |
3731 | for ac_exec_ext in '' $ac_executable_extensions; do | |
3732 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3733 | ac_cv_prog_ac_ct_AR="$ac_prog" | |
3734 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 | |
3735 | break 2 | |
3736 | fi | |
3737 | done | |
3738 | done | |
3739 | IFS=$as_save_IFS | |
3740 | ||
3741 | fi | |
3742 | fi | |
3743 | ac_ct_AR=$ac_cv_prog_ac_ct_AR | |
3744 | if test -n "$ac_ct_AR"; then | |
3745 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 | |
3746 | $as_echo "$ac_ct_AR" >&6; } | |
3747 | else | |
3748 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 | |
3749 | $as_echo "no" >&6; } | |
3750 | fi | |
3751 | ||
3752 | ||
3753 | test -n "$ac_ct_AR" && break | |
3754 | done | |
3755 | ||
3756 | if test "x$ac_ct_AR" = x; then | |
3757 | AR="false" | |
3758 | else | |
3759 | case $cross_compiling:$ac_tool_warned in | |
3760 | yes:) | |
3761 | { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 | |
3762 | $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} | |
3763 | ac_tool_warned=yes ;; | |
3764 | esac | |
3765 | AR=$ac_ct_AR | |
3766 | fi | |
3767 | fi | |
3768 | ||
3769 | : ${AR=ar} | |
3770 | ||
3771 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 | |
3772 | $as_echo_n "checking the archiver ($AR) interface... " >&6; } | |
3773 | if ${am_cv_ar_interface+:} false; then : | |
3774 | $as_echo_n "(cached) " >&6 | |
3775 | else | |
3776 | am_cv_ar_interface=ar | |
3777 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
3778 | /* end confdefs.h. */ | |
3779 | int some_variable = 0; | |
3780 | _ACEOF | |
3781 | if ac_fn_c_try_compile "$LINENO"; then : | |
3782 | am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' | |
3783 | { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 | |
3784 | (eval $am_ar_try) 2>&5 | |
3785 | ac_status=$? | |
3786 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
3787 | test $ac_status = 0; } | |
3788 | if test "$ac_status" -eq 0; then | |
3789 | am_cv_ar_interface=ar | |
3790 | else | |
3791 | am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' | |
3792 | { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 | |
3793 | (eval $am_ar_try) 2>&5 | |
3794 | ac_status=$? | |
3795 | $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 | |
3796 | test $ac_status = 0; } | |
3797 | if test "$ac_status" -eq 0; then | |
3798 | am_cv_ar_interface=lib | |
3799 | else | |
3800 | am_cv_ar_interface=unknown | |
3801 | fi | |
3802 | fi | |
3803 | rm -f conftest.lib libconftest.a | |
3804 | ||
3805 | fi | |
3806 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
3807 | ||
3808 | fi | |
3809 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 | |
3810 | $as_echo "$am_cv_ar_interface" >&6; } | |
3811 | ||
3812 | case $am_cv_ar_interface in | |
3813 | ar) | |
3814 | ;; | |
3815 | lib) | |
3816 | # Microsoft lib, so override with the ar-lib wrapper script. | |
3817 | # FIXME: It is wrong to rewrite AR. | |
3818 | # But if we don't then we get into trouble of one sort or another. | |
3819 | # A longer-term fix would be to have automake use am__AR in this case, | |
3820 | # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something | |
3821 | # similar. | |
3822 | AR="$am_aux_dir/ar-lib $AR" | |
3823 | ;; | |
3824 | unknown) | |
3825 | as_fn_error $? "could not determine $AR interface" "$LINENO" 5 | |
3826 | ;; | |
3827 | esac | |
3828 | ||
3829 | ||
3830 | ||
3831 | HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} | |
3832 | ||
3642 | 3833 | # Make sure we can run config.sub. |
3643 | 3834 | $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || |
3644 | 3835 | as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 |
3731 | 3922 | IFS=$as_save_IFS |
3732 | 3923 | test -z "$as_dir" && as_dir=. |
3733 | 3924 | for ac_exec_ext in '' $ac_executable_extensions; do |
3734 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
3925 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3735 | 3926 | ac_cv_prog_AS="${ac_tool_prefix}as" |
3736 | 3927 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
3737 | 3928 | break 2 |
3771 | 3962 | IFS=$as_save_IFS |
3772 | 3963 | test -z "$as_dir" && as_dir=. |
3773 | 3964 | for ac_exec_ext in '' $ac_executable_extensions; do |
3774 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
3965 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3775 | 3966 | ac_cv_prog_ac_ct_AS="as" |
3776 | 3967 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
3777 | 3968 | break 2 |
3823 | 4014 | IFS=$as_save_IFS |
3824 | 4015 | test -z "$as_dir" && as_dir=. |
3825 | 4016 | for ac_exec_ext in '' $ac_executable_extensions; do |
3826 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
4017 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3827 | 4018 | ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" |
3828 | 4019 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
3829 | 4020 | break 2 |
3863 | 4054 | IFS=$as_save_IFS |
3864 | 4055 | test -z "$as_dir" && as_dir=. |
3865 | 4056 | for ac_exec_ext in '' $ac_executable_extensions; do |
3866 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
4057 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3867 | 4058 | ac_cv_prog_ac_ct_DLLTOOL="dlltool" |
3868 | 4059 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
3869 | 4060 | break 2 |
3915 | 4106 | IFS=$as_save_IFS |
3916 | 4107 | test -z "$as_dir" && as_dir=. |
3917 | 4108 | for ac_exec_ext in '' $ac_executable_extensions; do |
3918 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
4109 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3919 | 4110 | ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" |
3920 | 4111 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
3921 | 4112 | break 2 |
3955 | 4146 | IFS=$as_save_IFS |
3956 | 4147 | test -z "$as_dir" && as_dir=. |
3957 | 4148 | for ac_exec_ext in '' $ac_executable_extensions; do |
3958 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
4149 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
3959 | 4150 | ac_cv_prog_ac_ct_OBJDUMP="objdump" |
3960 | 4151 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
3961 | 4152 | break 2 |
4129 | 4320 | for ac_prog in sed gsed; do |
4130 | 4321 | for ac_exec_ext in '' $ac_executable_extensions; do |
4131 | 4322 | ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" |
4132 | { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue | |
4323 | as_fn_executable_p "$ac_path_SED" || continue | |
4133 | 4324 | # Check for GNU ac_path_SED and select it if it is found. |
4134 | 4325 | # Check for GNU $ac_path_SED |
4135 | 4326 | case `"$ac_path_SED" --version 2>&1` in |
4205 | 4396 | for ac_prog in grep ggrep; do |
4206 | 4397 | for ac_exec_ext in '' $ac_executable_extensions; do |
4207 | 4398 | ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" |
4208 | { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue | |
4399 | as_fn_executable_p "$ac_path_GREP" || continue | |
4209 | 4400 | # Check for GNU ac_path_GREP and select it if it is found. |
4210 | 4401 | # Check for GNU $ac_path_GREP |
4211 | 4402 | case `"$ac_path_GREP" --version 2>&1` in |
4271 | 4462 | for ac_prog in egrep; do |
4272 | 4463 | for ac_exec_ext in '' $ac_executable_extensions; do |
4273 | 4464 | ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" |
4274 | { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue | |
4465 | as_fn_executable_p "$ac_path_EGREP" || continue | |
4275 | 4466 | # Check for GNU ac_path_EGREP and select it if it is found. |
4276 | 4467 | # Check for GNU $ac_path_EGREP |
4277 | 4468 | case `"$ac_path_EGREP" --version 2>&1` in |
4338 | 4529 | for ac_prog in fgrep; do |
4339 | 4530 | for ac_exec_ext in '' $ac_executable_extensions; do |
4340 | 4531 | ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" |
4341 | { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue | |
4532 | as_fn_executable_p "$ac_path_FGREP" || continue | |
4342 | 4533 | # Check for GNU ac_path_FGREP and select it if it is found. |
4343 | 4534 | # Check for GNU $ac_path_FGREP |
4344 | 4535 | case `"$ac_path_FGREP" --version 2>&1` in |
4594 | 4785 | IFS=$as_save_IFS |
4595 | 4786 | test -z "$as_dir" && as_dir=. |
4596 | 4787 | for ac_exec_ext in '' $ac_executable_extensions; do |
4597 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
4788 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
4598 | 4789 | ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" |
4599 | 4790 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
4600 | 4791 | break 2 |
4638 | 4829 | IFS=$as_save_IFS |
4639 | 4830 | test -z "$as_dir" && as_dir=. |
4640 | 4831 | for ac_exec_ext in '' $ac_executable_extensions; do |
4641 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
4832 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
4642 | 4833 | ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" |
4643 | 4834 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
4644 | 4835 | break 2 |
5062 | 5253 | IFS=$as_save_IFS |
5063 | 5254 | test -z "$as_dir" && as_dir=. |
5064 | 5255 | for ac_exec_ext in '' $ac_executable_extensions; do |
5065 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5256 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5066 | 5257 | ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" |
5067 | 5258 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5068 | 5259 | break 2 |
5102 | 5293 | IFS=$as_save_IFS |
5103 | 5294 | test -z "$as_dir" && as_dir=. |
5104 | 5295 | for ac_exec_ext in '' $ac_executable_extensions; do |
5105 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5296 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5106 | 5297 | ac_cv_prog_ac_ct_OBJDUMP="objdump" |
5107 | 5298 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5108 | 5299 | break 2 |
5223 | 5414 | else |
5224 | 5415 | lt_cv_deplibs_check_method=pass_all |
5225 | 5416 | fi |
5226 | ;; | |
5227 | ||
5228 | gnu*) | |
5229 | lt_cv_deplibs_check_method=pass_all | |
5230 | 5417 | ;; |
5231 | 5418 | |
5232 | 5419 | haiku*) |
5267 | 5454 | ;; |
5268 | 5455 | |
5269 | 5456 | # This must be glibc/ELF. |
5270 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
5457 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
5271 | 5458 | lt_cv_deplibs_check_method=pass_all |
5272 | 5459 | ;; |
5273 | 5460 | |
5405 | 5592 | IFS=$as_save_IFS |
5406 | 5593 | test -z "$as_dir" && as_dir=. |
5407 | 5594 | for ac_exec_ext in '' $ac_executable_extensions; do |
5408 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5595 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5409 | 5596 | ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" |
5410 | 5597 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5411 | 5598 | break 2 |
5445 | 5632 | IFS=$as_save_IFS |
5446 | 5633 | test -z "$as_dir" && as_dir=. |
5447 | 5634 | for ac_exec_ext in '' $ac_executable_extensions; do |
5448 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5635 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5449 | 5636 | ac_cv_prog_ac_ct_DLLTOOL="dlltool" |
5450 | 5637 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5451 | 5638 | break 2 |
5526 | 5713 | |
5527 | 5714 | |
5528 | 5715 | |
5529 | ||
5530 | 5716 | if test -n "$ac_tool_prefix"; then |
5531 | 5717 | for ac_prog in ar |
5532 | 5718 | do |
5546 | 5732 | IFS=$as_save_IFS |
5547 | 5733 | test -z "$as_dir" && as_dir=. |
5548 | 5734 | for ac_exec_ext in '' $ac_executable_extensions; do |
5549 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5735 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5550 | 5736 | ac_cv_prog_AR="$ac_tool_prefix$ac_prog" |
5551 | 5737 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5552 | 5738 | break 2 |
5590 | 5776 | IFS=$as_save_IFS |
5591 | 5777 | test -z "$as_dir" && as_dir=. |
5592 | 5778 | for ac_exec_ext in '' $ac_executable_extensions; do |
5593 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5779 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5594 | 5780 | ac_cv_prog_ac_ct_AR="$ac_prog" |
5595 | 5781 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5596 | 5782 | break 2 |
5715 | 5901 | IFS=$as_save_IFS |
5716 | 5902 | test -z "$as_dir" && as_dir=. |
5717 | 5903 | for ac_exec_ext in '' $ac_executable_extensions; do |
5718 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5904 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5719 | 5905 | ac_cv_prog_STRIP="${ac_tool_prefix}strip" |
5720 | 5906 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5721 | 5907 | break 2 |
5755 | 5941 | IFS=$as_save_IFS |
5756 | 5942 | test -z "$as_dir" && as_dir=. |
5757 | 5943 | for ac_exec_ext in '' $ac_executable_extensions; do |
5758 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
5944 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5759 | 5945 | ac_cv_prog_ac_ct_STRIP="strip" |
5760 | 5946 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5761 | 5947 | break 2 |
5814 | 6000 | IFS=$as_save_IFS |
5815 | 6001 | test -z "$as_dir" && as_dir=. |
5816 | 6002 | for ac_exec_ext in '' $ac_executable_extensions; do |
5817 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6003 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5818 | 6004 | ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" |
5819 | 6005 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5820 | 6006 | break 2 |
5854 | 6040 | IFS=$as_save_IFS |
5855 | 6041 | test -z "$as_dir" && as_dir=. |
5856 | 6042 | for ac_exec_ext in '' $ac_executable_extensions; do |
5857 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6043 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
5858 | 6044 | ac_cv_prog_ac_ct_RANLIB="ranlib" |
5859 | 6045 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
5860 | 6046 | break 2 |
6503 | 6689 | IFS=$as_save_IFS |
6504 | 6690 | test -z "$as_dir" && as_dir=. |
6505 | 6691 | for ac_exec_ext in '' $ac_executable_extensions; do |
6506 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6692 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6507 | 6693 | ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" |
6508 | 6694 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6509 | 6695 | break 2 |
6543 | 6729 | IFS=$as_save_IFS |
6544 | 6730 | test -z "$as_dir" && as_dir=. |
6545 | 6731 | for ac_exec_ext in '' $ac_executable_extensions; do |
6546 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6732 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6547 | 6733 | ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" |
6548 | 6734 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6549 | 6735 | break 2 |
6623 | 6809 | IFS=$as_save_IFS |
6624 | 6810 | test -z "$as_dir" && as_dir=. |
6625 | 6811 | for ac_exec_ext in '' $ac_executable_extensions; do |
6626 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6812 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6627 | 6813 | ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" |
6628 | 6814 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6629 | 6815 | break 2 |
6663 | 6849 | IFS=$as_save_IFS |
6664 | 6850 | test -z "$as_dir" && as_dir=. |
6665 | 6851 | for ac_exec_ext in '' $ac_executable_extensions; do |
6666 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6852 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6667 | 6853 | ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" |
6668 | 6854 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6669 | 6855 | break 2 |
6715 | 6901 | IFS=$as_save_IFS |
6716 | 6902 | test -z "$as_dir" && as_dir=. |
6717 | 6903 | for ac_exec_ext in '' $ac_executable_extensions; do |
6718 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6904 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6719 | 6905 | ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" |
6720 | 6906 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6721 | 6907 | break 2 |
6755 | 6941 | IFS=$as_save_IFS |
6756 | 6942 | test -z "$as_dir" && as_dir=. |
6757 | 6943 | for ac_exec_ext in '' $ac_executable_extensions; do |
6758 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6944 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6759 | 6945 | ac_cv_prog_ac_ct_NMEDIT="nmedit" |
6760 | 6946 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6761 | 6947 | break 2 |
6807 | 6993 | IFS=$as_save_IFS |
6808 | 6994 | test -z "$as_dir" && as_dir=. |
6809 | 6995 | for ac_exec_ext in '' $ac_executable_extensions; do |
6810 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
6996 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6811 | 6997 | ac_cv_prog_LIPO="${ac_tool_prefix}lipo" |
6812 | 6998 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6813 | 6999 | break 2 |
6847 | 7033 | IFS=$as_save_IFS |
6848 | 7034 | test -z "$as_dir" && as_dir=. |
6849 | 7035 | for ac_exec_ext in '' $ac_executable_extensions; do |
6850 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
7036 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6851 | 7037 | ac_cv_prog_ac_ct_LIPO="lipo" |
6852 | 7038 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6853 | 7039 | break 2 |
6899 | 7085 | IFS=$as_save_IFS |
6900 | 7086 | test -z "$as_dir" && as_dir=. |
6901 | 7087 | for ac_exec_ext in '' $ac_executable_extensions; do |
6902 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
7088 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6903 | 7089 | ac_cv_prog_OTOOL="${ac_tool_prefix}otool" |
6904 | 7090 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6905 | 7091 | break 2 |
6939 | 7125 | IFS=$as_save_IFS |
6940 | 7126 | test -z "$as_dir" && as_dir=. |
6941 | 7127 | for ac_exec_ext in '' $ac_executable_extensions; do |
6942 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
7128 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6943 | 7129 | ac_cv_prog_ac_ct_OTOOL="otool" |
6944 | 7130 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6945 | 7131 | break 2 |
6991 | 7177 | IFS=$as_save_IFS |
6992 | 7178 | test -z "$as_dir" && as_dir=. |
6993 | 7179 | for ac_exec_ext in '' $ac_executable_extensions; do |
6994 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
7180 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
6995 | 7181 | ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" |
6996 | 7182 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
6997 | 7183 | break 2 |
7031 | 7217 | IFS=$as_save_IFS |
7032 | 7218 | test -z "$as_dir" && as_dir=. |
7033 | 7219 | for ac_exec_ext in '' $ac_executable_extensions; do |
7034 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
7220 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
7035 | 7221 | ac_cv_prog_ac_ct_OTOOL64="otool64" |
7036 | 7222 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
7037 | 7223 | break 2 |
8189 | 8375 | lt_prog_compiler_static='-non_shared' |
8190 | 8376 | ;; |
8191 | 8377 | |
8192 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
8378 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
8193 | 8379 | case $cc_basename in |
8194 | 8380 | # old Intel for x86_64 which still supported -KPIC. |
8195 | 8381 | ecc*) |
10359 | 10545 | esac |
10360 | 10546 | ;; |
10361 | 10547 | |
10362 | gnu*) | |
10363 | version_type=linux # correct to gnu/linux during the next big refactor | |
10364 | need_lib_prefix=no | |
10365 | need_version=no | |
10366 | library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' | |
10367 | soname_spec='${libname}${release}${shared_ext}$major' | |
10368 | shlibpath_var=LD_LIBRARY_PATH | |
10369 | shlibpath_overrides_runpath=no | |
10370 | hardcode_into_libs=yes | |
10371 | ;; | |
10372 | ||
10373 | 10548 | haiku*) |
10374 | 10549 | version_type=linux # correct to gnu/linux during the next big refactor |
10375 | 10550 | need_lib_prefix=no |
10486 | 10661 | ;; |
10487 | 10662 | |
10488 | 10663 | # This must be glibc/ELF. |
10489 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
10664 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
10490 | 10665 | version_type=linux # correct to gnu/linux during the next big refactor |
10491 | 10666 | need_lib_prefix=no |
10492 | 10667 | need_version=no |
11586 | 11761 | IFS=$as_save_IFS |
11587 | 11762 | test -z "$as_dir" && as_dir=. |
11588 | 11763 | for ac_exec_ext in '' $ac_executable_extensions; do |
11589 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
11764 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
11590 | 11765 | ac_cv_prog_AWK="$ac_prog" |
11591 | 11766 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
11592 | 11767 | break 2 |
11636 | 11811 | IFS=$as_save_IFS |
11637 | 11812 | test -z "$as_dir" && as_dir=. |
11638 | 11813 | for ac_exec_ext in '' $ac_executable_extensions; do |
11639 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
11814 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
11640 | 11815 | ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext" |
11641 | 11816 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
11642 | 11817 | break 2 |
11677 | 11852 | IFS=$as_save_IFS |
11678 | 11853 | test -z "$as_dir" && as_dir=. |
11679 | 11854 | for ac_exec_ext in '' $ac_executable_extensions; do |
11680 | if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then | |
11855 | if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then | |
11681 | 11856 | ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext" |
11682 | 11857 | $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 |
11683 | 11858 | break 2 |
11798 | 11973 | x=CURLOPT_ERRORBUFFER; |
11799 | 11974 | x=CURLOPT_STDERR; |
11800 | 11975 | x=CURLOPT_VERBOSE; |
11976 | if (x) ; | |
11801 | 11977 | |
11802 | 11978 | ; |
11803 | 11979 | return 0; |
11918 | 12094 | unset _libcurl_with |
11919 | 12095 | |
11920 | 12096 | |
11921 | ac_config_files="$ac_config_files Makefile tests/Makefile" | |
12097 | # Check whether --enable-gcc-warnings was given. | |
12098 | if test "${enable_gcc_warnings+set}" = set; then : | |
12099 | enableval=$enable_gcc_warnings; case $enableval in | |
12100 | yes|no) ;; | |
12101 | *) as_fn_error $? "bad value $enableval for gcc-warnings option" "$LINENO" 5 ;; | |
12102 | esac | |
12103 | gl_gcc_warnings=$enableval | |
12104 | else | |
12105 | gl_gcc_warnings=no | |
12106 | ||
12107 | fi | |
12108 | ||
12109 | ||
12110 | if test "$gl_gcc_warnings" = yes; then | |
12111 | nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings | |
12112 | nw="$nw -Wpadded" # Struct's arenot padded | |
12113 | nw="$nw -Wc++-compat" # We don't care strongly about C++ compilers | |
12114 | nw="$nw -Wtraditional" # Warns on #elif which we use often | |
12115 | nw="$nw -Wtraditional-conversion" # Too many warnings for now | |
12116 | nw="$nw -Wconversion" # Too many warnings for now | |
12117 | nw="$nw -Wsuggest-attribute=pure" # Is it worth using attributes? | |
12118 | ||
12119 | ||
12120 | ||
12121 | if test -n "$GCC"; then | |
12122 | ||
12123 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is supported" >&5 | |
12124 | $as_echo_n "checking whether -Wno-missing-field-initializers is supported... " >&6; } | |
12125 | if ${gl_cv_cc_nomfi_supported+:} false; then : | |
12126 | $as_echo_n "(cached) " >&6 | |
12127 | else | |
12128 | ||
12129 | gl_save_CFLAGS="$CFLAGS" | |
12130 | CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" | |
12131 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
12132 | /* end confdefs.h. */ | |
12133 | ||
12134 | int | |
12135 | main () | |
12136 | { | |
12137 | ||
12138 | ; | |
12139 | return 0; | |
12140 | } | |
12141 | _ACEOF | |
12142 | if ac_fn_c_try_compile "$LINENO"; then : | |
12143 | gl_cv_cc_nomfi_supported=yes | |
12144 | else | |
12145 | gl_cv_cc_nomfi_supported=no | |
12146 | fi | |
12147 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
12148 | CFLAGS="$gl_save_CFLAGS" | |
12149 | fi | |
12150 | ||
12151 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_supported" >&5 | |
12152 | $as_echo "$gl_cv_cc_nomfi_supported" >&6; } | |
12153 | ||
12154 | if test "$gl_cv_cc_nomfi_supported" = yes; then | |
12155 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is needed" >&5 | |
12156 | $as_echo_n "checking whether -Wno-missing-field-initializers is needed... " >&6; } | |
12157 | if ${gl_cv_cc_nomfi_needed+:} false; then : | |
12158 | $as_echo_n "(cached) " >&6 | |
12159 | else | |
12160 | ||
12161 | gl_save_CFLAGS="$CFLAGS" | |
12162 | CFLAGS="$CFLAGS -W -Werror" | |
12163 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
12164 | /* end confdefs.h. */ | |
12165 | void f (void) | |
12166 | { | |
12167 | typedef struct { int a; int b; } s_t; | |
12168 | s_t s1 = { 0, }; | |
12169 | } | |
12170 | ||
12171 | int | |
12172 | main () | |
12173 | { | |
12174 | ||
12175 | ; | |
12176 | return 0; | |
12177 | } | |
12178 | _ACEOF | |
12179 | if ac_fn_c_try_compile "$LINENO"; then : | |
12180 | gl_cv_cc_nomfi_needed=no | |
12181 | else | |
12182 | gl_cv_cc_nomfi_needed=yes | |
12183 | fi | |
12184 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
12185 | CFLAGS="$gl_save_CFLAGS" | |
12186 | ||
12187 | fi | |
12188 | ||
12189 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_needed" >&5 | |
12190 | $as_echo "$gl_cv_cc_nomfi_needed" >&6; } | |
12191 | fi | |
12192 | fi | |
12193 | ||
12194 | gl_manywarn_set= | |
12195 | for gl_manywarn_item in \ | |
12196 | -Wall \ | |
12197 | -W \ | |
12198 | -Wformat-y2k \ | |
12199 | -Wformat-nonliteral \ | |
12200 | -Wformat-security \ | |
12201 | -Winit-self \ | |
12202 | -Wmissing-include-dirs \ | |
12203 | -Wswitch-default \ | |
12204 | -Wswitch-enum \ | |
12205 | -Wunused \ | |
12206 | -Wunknown-pragmas \ | |
12207 | -Wstrict-aliasing \ | |
12208 | -Wstrict-overflow \ | |
12209 | -Wsystem-headers \ | |
12210 | -Wfloat-equal \ | |
12211 | -Wtraditional \ | |
12212 | -Wtraditional-conversion \ | |
12213 | -Wdeclaration-after-statement \ | |
12214 | -Wundef \ | |
12215 | -Wshadow \ | |
12216 | -Wunsafe-loop-optimizations \ | |
12217 | -Wpointer-arith \ | |
12218 | -Wbad-function-cast \ | |
12219 | -Wc++-compat \ | |
12220 | -Wcast-qual \ | |
12221 | -Wcast-align \ | |
12222 | -Wwrite-strings \ | |
12223 | -Wconversion \ | |
12224 | -Wsign-conversion \ | |
12225 | -Wlogical-op \ | |
12226 | -Waggregate-return \ | |
12227 | -Wstrict-prototypes \ | |
12228 | -Wold-style-definition \ | |
12229 | -Wmissing-prototypes \ | |
12230 | -Wmissing-declarations \ | |
12231 | -Wmissing-noreturn \ | |
12232 | -Wmissing-format-attribute \ | |
12233 | -Wpacked \ | |
12234 | -Wpadded \ | |
12235 | -Wredundant-decls \ | |
12236 | -Wnested-externs \ | |
12237 | -Wunreachable-code \ | |
12238 | -Winline \ | |
12239 | -Winvalid-pch \ | |
12240 | -Wlong-long \ | |
12241 | -Wvla \ | |
12242 | -Wvolatile-register-var \ | |
12243 | -Wdisabled-optimization \ | |
12244 | -Wstack-protector \ | |
12245 | -Woverlength-strings \ | |
12246 | -Wbuiltin-macro-redefined \ | |
12247 | -Wmudflap \ | |
12248 | -Wpacked-bitfield-compat \ | |
12249 | -Wsync-nand \ | |
12250 | ; do | |
12251 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | |
12252 | done | |
12253 | # The following are not documented in the manual but are included in | |
12254 | # output from gcc --help=warnings. | |
12255 | for gl_manywarn_item in \ | |
12256 | -Wattributes \ | |
12257 | -Wcoverage-mismatch \ | |
12258 | -Wunused-macros \ | |
12259 | ; do | |
12260 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | |
12261 | done | |
12262 | # More warnings from gcc 4.6.2 --help=warnings. | |
12263 | for gl_manywarn_item in \ | |
12264 | -Wabi \ | |
12265 | -Wcpp \ | |
12266 | -Wdeprecated \ | |
12267 | -Wdeprecated-declarations \ | |
12268 | -Wdiv-by-zero \ | |
12269 | -Wdouble-promotion \ | |
12270 | -Wendif-labels \ | |
12271 | -Wextra \ | |
12272 | -Wformat-contains-nul \ | |
12273 | -Wformat-extra-args \ | |
12274 | -Wformat-zero-length \ | |
12275 | -Wformat=2 \ | |
12276 | -Wmultichar \ | |
12277 | -Wnormalized=nfc \ | |
12278 | -Woverflow \ | |
12279 | -Wpointer-to-int-cast \ | |
12280 | -Wpragmas \ | |
12281 | -Wsuggest-attribute=const \ | |
12282 | -Wsuggest-attribute=noreturn \ | |
12283 | -Wsuggest-attribute=pure \ | |
12284 | -Wtrampolines \ | |
12285 | ; do | |
12286 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | |
12287 | done | |
12288 | ||
12289 | # Disable the missing-field-initializers warning if needed | |
12290 | if test "$gl_cv_cc_nomfi_needed" = yes; then | |
12291 | gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" | |
12292 | fi | |
12293 | ||
12294 | ws=$gl_manywarn_set | |
12295 | ||
12296 | ||
12297 | gl_warn_set= | |
12298 | set x $ws; shift | |
12299 | for gl_warn_item | |
12300 | do | |
12301 | case " $nw " in | |
12302 | *" $gl_warn_item "*) | |
12303 | ;; | |
12304 | *) | |
12305 | gl_warn_set="$gl_warn_set $gl_warn_item" | |
12306 | ;; | |
12307 | esac | |
12308 | done | |
12309 | ws=$gl_warn_set | |
12310 | ||
12311 | for w in $ws; do | |
12312 | as_gl_Warn=`$as_echo "gl_cv_warn_c_$w" | $as_tr_sh` | |
12313 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $w" >&5 | |
12314 | $as_echo_n "checking whether C compiler handles $w... " >&6; } | |
12315 | if eval \${$as_gl_Warn+:} false; then : | |
12316 | $as_echo_n "(cached) " >&6 | |
12317 | else | |
12318 | ||
12319 | gl_save_compiler_FLAGS="$CFLAGS" | |
12320 | as_fn_append CFLAGS " $w" | |
12321 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
12322 | /* end confdefs.h. */ | |
12323 | ||
12324 | int | |
12325 | main () | |
12326 | { | |
12327 | ||
12328 | ; | |
12329 | return 0; | |
12330 | } | |
12331 | _ACEOF | |
12332 | if ac_fn_c_try_compile "$LINENO"; then : | |
12333 | eval "$as_gl_Warn=yes" | |
12334 | else | |
12335 | eval "$as_gl_Warn=no" | |
12336 | fi | |
12337 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
12338 | CFLAGS="$gl_save_compiler_FLAGS" | |
12339 | ||
12340 | fi | |
12341 | eval ac_res=\$$as_gl_Warn | |
12342 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | |
12343 | $as_echo "$ac_res" >&6; } | |
12344 | if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then : | |
12345 | as_fn_append WARN_CFLAGS " $w" | |
12346 | fi | |
12347 | ||
12348 | ||
12349 | done | |
12350 | ||
12351 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -fdiagnostics-show-option" >&5 | |
12352 | $as_echo_n "checking whether C compiler handles -fdiagnostics-show-option... " >&6; } | |
12353 | if ${gl_cv_warn_c__fdiagnostics_show_option+:} false; then : | |
12354 | $as_echo_n "(cached) " >&6 | |
12355 | else | |
12356 | ||
12357 | gl_save_compiler_FLAGS="$CFLAGS" | |
12358 | as_fn_append CFLAGS " -fdiagnostics-show-option" | |
12359 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext | |
12360 | /* end confdefs.h. */ | |
12361 | ||
12362 | int | |
12363 | main () | |
12364 | { | |
12365 | ||
12366 | ; | |
12367 | return 0; | |
12368 | } | |
12369 | _ACEOF | |
12370 | if ac_fn_c_try_compile "$LINENO"; then : | |
12371 | gl_cv_warn_c__fdiagnostics_show_option=yes | |
12372 | else | |
12373 | gl_cv_warn_c__fdiagnostics_show_option=no | |
12374 | fi | |
12375 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | |
12376 | CFLAGS="$gl_save_compiler_FLAGS" | |
12377 | ||
12378 | fi | |
12379 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__fdiagnostics_show_option" >&5 | |
12380 | $as_echo "$gl_cv_warn_c__fdiagnostics_show_option" >&6; } | |
12381 | if test "x$gl_cv_warn_c__fdiagnostics_show_option" = xyes; then : | |
12382 | as_fn_append WARN_CFLAGS " -fdiagnostics-show-option" | |
12383 | fi | |
12384 | ||
12385 | ||
12386 | fi | |
12387 | ||
12388 | YKCLIENT_VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/\(.*\)\..*/\1/g'` | |
12389 | ||
12390 | YKCLIENT_VERSION_MINOR=`echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)/\1/g'` | |
12391 | ||
12392 | YKCLIENT_VERSION_PATCH=0 | |
12393 | ||
12394 | YKCLIENT_VERSION_NUMBER=`printf "0x%02x%02x%02x" $YKCLIENT_VERSION_MAJOR $YKCLIENT_VERSION_MINOR $YKCLIENT_VERSION_PATCH` | |
12395 | ||
12396 | ||
12397 | ac_config_files="$ac_config_files Makefile ykclient_version.h tests/Makefile" | |
11922 | 12398 | |
11923 | 12399 | cat >confcache <<\_ACEOF |
11924 | 12400 | # This file is a shell script that caches the results of configure |
12379 | 12855 | # ... but there are two gotchas: |
12380 | 12856 | # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. |
12381 | 12857 | # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. |
12382 | # In both cases, we have to default to `cp -p'. | |
12858 | # In both cases, we have to default to `cp -pR'. | |
12383 | 12859 | ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || |
12384 | as_ln_s='cp -p' | |
12860 | as_ln_s='cp -pR' | |
12385 | 12861 | elif ln conf$$.file conf$$ 2>/dev/null; then |
12386 | 12862 | as_ln_s=ln |
12387 | 12863 | else |
12388 | as_ln_s='cp -p' | |
12864 | as_ln_s='cp -pR' | |
12389 | 12865 | fi |
12390 | 12866 | else |
12391 | as_ln_s='cp -p' | |
12867 | as_ln_s='cp -pR' | |
12392 | 12868 | fi |
12393 | 12869 | rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file |
12394 | 12870 | rmdir conf$$.dir 2>/dev/null |
12448 | 12924 | as_mkdir_p=false |
12449 | 12925 | fi |
12450 | 12926 | |
12451 | if test -x / >/dev/null 2>&1; then | |
12452 | as_test_x='test -x' | |
12453 | else | |
12454 | if ls -dL / >/dev/null 2>&1; then | |
12455 | as_ls_L_option=L | |
12456 | else | |
12457 | as_ls_L_option= | |
12458 | fi | |
12459 | as_test_x=' | |
12460 | eval sh -c '\'' | |
12461 | if test -d "$1"; then | |
12462 | test -d "$1/."; | |
12463 | else | |
12464 | case $1 in #( | |
12465 | -*)set "./$1";; | |
12466 | esac; | |
12467 | case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( | |
12468 | ???[sx]*):;;*)false;;esac;fi | |
12469 | '\'' sh | |
12470 | ' | |
12471 | fi | |
12472 | as_executable_p=$as_test_x | |
12927 | ||
12928 | # as_fn_executable_p FILE | |
12929 | # ----------------------- | |
12930 | # Test if FILE is an executable regular file. | |
12931 | as_fn_executable_p () | |
12932 | { | |
12933 | test -f "$1" && test -x "$1" | |
12934 | } # as_fn_executable_p | |
12935 | as_test_x='test -x' | |
12936 | as_executable_p=as_fn_executable_p | |
12473 | 12937 | |
12474 | 12938 | # Sed expression to map a string onto a valid CPP name. |
12475 | 12939 | as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" |
12490 | 12954 | # report actual input values of CONFIG_FILES etc. instead of their |
12491 | 12955 | # values after options handling. |
12492 | 12956 | ac_log=" |
12493 | This file was extended by ykclient $as_me 2.9, which was | |
12494 | generated by GNU Autoconf 2.68. Invocation command line was | |
12957 | This file was extended by ykclient $as_me 2.10, which was | |
12958 | generated by GNU Autoconf 2.69. Invocation command line was | |
12495 | 12959 | |
12496 | 12960 | CONFIG_FILES = $CONFIG_FILES |
12497 | 12961 | CONFIG_HEADERS = $CONFIG_HEADERS |
12547 | 13011 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
12548 | 13012 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
12549 | 13013 | ac_cs_version="\\ |
12550 | ykclient config.status 2.9 | |
12551 | configured by $0, generated by GNU Autoconf 2.68, | |
13014 | ykclient config.status 2.10 | |
13015 | configured by $0, generated by GNU Autoconf 2.69, | |
12552 | 13016 | with options \\"\$ac_cs_config\\" |
12553 | 13017 | |
12554 | Copyright (C) 2010 Free Software Foundation, Inc. | |
13018 | Copyright (C) 2012 Free Software Foundation, Inc. | |
12555 | 13019 | This config.status script is free software; the Free Software Foundation |
12556 | 13020 | gives unlimited permission to copy, distribute and modify it." |
12557 | 13021 | |
12631 | 13095 | _ACEOF |
12632 | 13096 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
12633 | 13097 | if \$ac_cs_recheck; then |
12634 | set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion | |
13098 | set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion | |
12635 | 13099 | shift |
12636 | 13100 | \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 |
12637 | 13101 | CONFIG_SHELL='$SHELL' |
12947 | 13411 | "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; |
12948 | 13412 | "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; |
12949 | 13413 | "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; |
13414 | "ykclient_version.h") CONFIG_FILES="$CONFIG_FILES ykclient_version.h" ;; | |
12950 | 13415 | "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; |
12951 | 13416 | |
12952 | 13417 | *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; |
14143 | 14608 | $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} |
14144 | 14609 | fi |
14145 | 14610 | |
14611 | ||
14612 | { $as_echo "$as_me:${as_lineno-$LINENO}: summary of build options: | |
14613 | ||
14614 | version: ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE major $YKCLIENT_VERSION_MAJOR minor $YKCLIENT_VERSION_MINOR patch $YKCLIENT_VERSION_PATCH number $YKCLIENT_VERSION_NUMBER | |
14615 | Host type: ${host} | |
14616 | Install prefix: ${prefix} | |
14617 | Compiler: ${CC} | |
14618 | Shared library: ${enable_shared} | |
14619 | Static library: ${enable_static} | |
14620 | Curl CPPFLAGS: ${LIBCURL_CPPFLAGS} | |
14621 | LDFLAGS: ${LIBCURL} | |
14622 | " >&5 | |
14623 | $as_echo "$as_me: summary of build options: | |
14624 | ||
14625 | version: ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE major $YKCLIENT_VERSION_MAJOR minor $YKCLIENT_VERSION_MINOR patch $YKCLIENT_VERSION_PATCH number $YKCLIENT_VERSION_NUMBER | |
14626 | Host type: ${host} | |
14627 | Install prefix: ${prefix} | |
14628 | Compiler: ${CC} | |
14629 | Shared library: ${enable_shared} | |
14630 | Static library: ${enable_static} | |
14631 | Curl CPPFLAGS: ${LIBCURL_CPPFLAGS} | |
14632 | LDFLAGS: ${LIBCURL} | |
14633 | " >&6;} |
0 | 0 | # Written by Simon Josefsson <simon@josefsson.org>. |
1 | # Copyright (c) 2008-2012 Yubico AB | |
1 | # Copyright (c) 2008-2013 Yubico AB | |
2 | 2 | # All rights reserved. |
3 | 3 | # |
4 | 4 | # Redistribution and use in source and binary forms, with or without |
25 | 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 | 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 | |
28 | AC_INIT([ykclient], [2.9], [yubico-devel@googlegroups.com]) | |
28 | AC_INIT([ykclient], [2.10], [yubico-devel@googlegroups.com]) | |
29 | 29 | AC_CONFIG_MACRO_DIR([m4]) |
30 | 30 | |
31 | 31 | # Library code modified: REVISION++ |
32 | 32 | # Interfaces changed/added/removed: CURRENT++ REVISION=0 |
33 | 33 | # Interfaces added: AGE++ |
34 | 34 | # Interfaces removed: AGE=0 |
35 | AC_SUBST(LT_CURRENT, 7) | |
36 | AC_SUBST(LT_REVISION, 1) | |
37 | AC_SUBST(LT_AGE, 4) | |
35 | AC_SUBST(LT_CURRENT, 8) | |
36 | AC_SUBST(LT_REVISION, 0) | |
37 | AC_SUBST(LT_AGE, 5) | |
38 | 38 | |
39 | AM_INIT_AUTOMAKE([1.10 -Wall -Werror]) | |
39 | AM_INIT_AUTOMAKE([1.11 -Wall -Werror]) | |
40 | 40 | AM_SILENT_RULES([yes]) |
41 | 41 | AC_PROG_CC |
42 | ||
43 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) | |
44 | ||
45 | AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir) | |
42 | 46 | AC_LIBTOOL_WIN32_DLL |
43 | 47 | AC_PROG_LIBTOOL |
44 | 48 | |
45 | 49 | LIBCURL_CHECK_CONFIG([yes], [], [], [ |
46 | 50 | AC_MSG_ERROR([[Libcurl header files not found, install libcurl-dev.]])]) |
47 | 51 | |
52 | AC_ARG_ENABLE([gcc-warnings], | |
53 | [AS_HELP_STRING([--enable-gcc-warnings], | |
54 | [turn on lots of GCC warnings (for developers)])], | |
55 | [case $enableval in | |
56 | yes|no) ;; | |
57 | *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; | |
58 | esac | |
59 | gl_gcc_warnings=$enableval], | |
60 | [gl_gcc_warnings=no] | |
61 | ) | |
62 | ||
63 | if test "$gl_gcc_warnings" = yes; then | |
64 | nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings | |
65 | nw="$nw -Wpadded" # Struct's arenot padded | |
66 | nw="$nw -Wc++-compat" # We don't care strongly about C++ compilers | |
67 | nw="$nw -Wtraditional" # Warns on #elif which we use often | |
68 | nw="$nw -Wtraditional-conversion" # Too many warnings for now | |
69 | nw="$nw -Wconversion" # Too many warnings for now | |
70 | nw="$nw -Wsuggest-attribute=pure" # Is it worth using attributes? | |
71 | ||
72 | gl_MANYWARN_ALL_GCC([ws]) | |
73 | gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw]) | |
74 | for w in $ws; do | |
75 | gl_WARN_ADD([$w]) | |
76 | done | |
77 | ||
78 | gl_WARN_ADD([-fdiagnostics-show-option]) | |
79 | fi | |
80 | ||
81 | AC_SUBST(YKCLIENT_VERSION_MAJOR, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*/\1/g'`) | |
82 | AC_SUBST(YKCLIENT_VERSION_MINOR, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)/\1/g'`) | |
83 | AC_SUBST(YKCLIENT_VERSION_PATCH, 0) | |
84 | AC_SUBST(YKCLIENT_VERSION_NUMBER, `printf "0x%02x%02x%02x" $YKCLIENT_VERSION_MAJOR $YKCLIENT_VERSION_MINOR $YKCLIENT_VERSION_PATCH`) | |
85 | ||
48 | 86 | AC_CONFIG_FILES([ |
49 | Makefile | |
50 | tests/Makefile | |
87 | Makefile | |
88 | ykclient_version.h | |
89 | tests/Makefile | |
51 | 90 | ]) |
52 | 91 | AC_OUTPUT |
92 | ||
93 | AC_MSG_NOTICE([summary of build options: | |
94 | ||
95 | version: ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE major $YKCLIENT_VERSION_MAJOR minor $YKCLIENT_VERSION_MINOR patch $YKCLIENT_VERSION_PATCH number $YKCLIENT_VERSION_NUMBER | |
96 | Host type: ${host} | |
97 | Install prefix: ${prefix} | |
98 | Compiler: ${CC} | |
99 | Shared library: ${enable_shared} | |
100 | Static library: ${enable_static} | |
101 | Curl CPPFLAGS: ${LIBCURL_CPPFLAGS} | |
102 | LDFLAGS: ${LIBCURL} | |
103 | ]) |
0 | 0 | #! /bin/sh |
1 | 1 | # depcomp - compile a program generating dependencies as side-effects |
2 | 2 | |
3 | scriptversion=2011-12-04.11; # UTC | |
3 | scriptversion=2012-03-27.16; # UTC | |
4 | 4 | |
5 | 5 | # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, |
6 | # 2011 Free Software Foundation, Inc. | |
6 | # 2011, 2012 Free Software Foundation, Inc. | |
7 | 7 | |
8 | 8 | # This program is free software; you can redistribute it and/or modify |
9 | 9 | # it under the terms of the GNU General Public License as published by |
27 | 27 | |
28 | 28 | case $1 in |
29 | 29 | '') |
30 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 | |
30 | echo "$0: No command. Try '$0 --help' for more information." 1>&2 | |
31 | 31 | exit 1; |
32 | 32 | ;; |
33 | 33 | -h | --h*) |
39 | 39 | |
40 | 40 | Environment variables: |
41 | 41 | depmode Dependency tracking mode. |
42 | source Source file read by `PROGRAMS ARGS'. | |
43 | object Object file output by `PROGRAMS ARGS'. | |
42 | source Source file read by 'PROGRAMS ARGS'. | |
43 | object Object file output by 'PROGRAMS ARGS'. | |
44 | 44 | DEPDIR directory where to store dependencies. |
45 | 45 | depfile Dependency file to output. |
46 | 46 | tmpdepfile Temporary file to use when outputting dependencies. |
56 | 56 | ;; |
57 | 57 | esac |
58 | 58 | |
59 | # A tabulation character. | |
60 | tab=' ' | |
61 | # A newline character. | |
62 | nl=' | |
63 | ' | |
64 | ||
59 | 65 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then |
60 | 66 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 |
61 | 67 | exit 1 |
99 | 105 | # slashes to satisfy depend.m4 |
100 | 106 | cygpath_u='sed s,\\\\,/,g' |
101 | 107 | depmode=msvc7 |
108 | fi | |
109 | ||
110 | if test "$depmode" = xlc; then | |
111 | # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. | |
112 | gccflag=-qmakedep=gcc,-MF | |
113 | depmode=gcc | |
102 | 114 | fi |
103 | 115 | |
104 | 116 | case "$depmode" in |
155 | 167 | ## The second -e expression handles DOS-style file names with drive letters. |
156 | 168 | sed -e 's/^[^:]*: / /' \ |
157 | 169 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" |
158 | ## This next piece of magic avoids the `deleted header file' problem. | |
170 | ## This next piece of magic avoids the "deleted header file" problem. | |
159 | 171 | ## The problem is that when a header file which appears in a .P file |
160 | 172 | ## is deleted, the dependency causes make to die (because there is |
161 | 173 | ## typically no way to rebuild the header). We avoid this by adding |
162 | 174 | ## dummy dependencies for each header file. Too bad gcc doesn't do |
163 | 175 | ## this for us directly. |
164 | tr ' ' ' | |
165 | ' < "$tmpdepfile" | | |
166 | ## Some versions of gcc put a space before the `:'. On the theory | |
176 | tr ' ' "$nl" < "$tmpdepfile" | | |
177 | ## Some versions of gcc put a space before the ':'. On the theory | |
167 | 178 | ## that the space means something, we add a space to the output as |
168 | 179 | ## well. hp depmode also adds that space, but also prefixes the VPATH |
169 | 180 | ## to the object. Take care to not repeat it in the output. |
202 | 213 | # clever and replace this with sed code, as IRIX sed won't handle |
203 | 214 | # lines with more than a fixed number of characters (4096 in |
204 | 215 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; |
205 | # the IRIX cc adds comments like `#:fec' to the end of the | |
216 | # the IRIX cc adds comments like '#:fec' to the end of the | |
206 | 217 | # dependency line. |
207 | tr ' ' ' | |
208 | ' < "$tmpdepfile" \ | |
218 | tr ' ' "$nl" < "$tmpdepfile" \ | |
209 | 219 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ |
210 | tr ' | |
211 | ' ' ' >> "$depfile" | |
220 | tr "$nl" ' ' >> "$depfile" | |
212 | 221 | echo >> "$depfile" |
213 | 222 | |
214 | 223 | # The second pass generates a dummy entry for each header file. |
215 | tr ' ' ' | |
216 | ' < "$tmpdepfile" \ | |
224 | tr ' ' "$nl" < "$tmpdepfile" \ | |
217 | 225 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ |
218 | 226 | >> "$depfile" |
219 | 227 | else |
225 | 233 | rm -f "$tmpdepfile" |
226 | 234 | ;; |
227 | 235 | |
236 | xlc) | |
237 | # This case exists only to let depend.m4 do its work. It works by | |
238 | # looking at the text of this script. This case will never be run, | |
239 | # since it is checked for above. | |
240 | exit 1 | |
241 | ;; | |
242 | ||
228 | 243 | aix) |
229 | 244 | # The C for AIX Compiler uses -M and outputs the dependencies |
230 | 245 | # in a .u file. In older versions, this file always lives in the |
231 | # current directory. Also, the AIX compiler puts `$object:' at the | |
246 | # current directory. Also, the AIX compiler puts '$object:' at the | |
232 | 247 | # start of each line; $object doesn't have directory information. |
233 | 248 | # Version 6 uses the directory in both cases. |
234 | 249 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
258 | 273 | test -f "$tmpdepfile" && break |
259 | 274 | done |
260 | 275 | if test -f "$tmpdepfile"; then |
261 | # Each line is of the form `foo.o: dependent.h'. | |
276 | # Each line is of the form 'foo.o: dependent.h'. | |
262 | 277 | # Do two passes, one to just change these to |
263 | # `$object: dependent.h' and one to simply `dependent.h:'. | |
278 | # '$object: dependent.h' and one to simply 'dependent.h:'. | |
264 | 279 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
265 | # That's a tab and a space in the []. | |
266 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
280 | sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
267 | 281 | else |
268 | 282 | # The sourcefile does not contain any dependencies, so just |
269 | 283 | # store a dummy comment line, to avoid errors with the Makefile |
274 | 288 | ;; |
275 | 289 | |
276 | 290 | icc) |
277 | # Intel's C compiler understands `-MD -MF file'. However on | |
278 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c | |
291 | # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. | |
292 | # However on | |
293 | # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c | |
279 | 294 | # ICC 7.0 will fill foo.d with something like |
280 | 295 | # foo.o: sub/foo.c |
281 | 296 | # foo.o: sub/foo.h |
282 | # which is wrong. We want: | |
297 | # which is wrong. We want | |
283 | 298 | # sub/foo.o: sub/foo.c |
284 | 299 | # sub/foo.o: sub/foo.h |
285 | 300 | # sub/foo.c: |
286 | 301 | # sub/foo.h: |
287 | 302 | # ICC 7.1 will output |
288 | 303 | # foo.o: sub/foo.c sub/foo.h |
289 | # and will wrap long lines using \ : | |
304 | # and will wrap long lines using '\': | |
290 | 305 | # foo.o: sub/foo.c ... \ |
291 | 306 | # sub/foo.h ... \ |
292 | 307 | # ... |
293 | ||
308 | # tcc 0.9.26 (FIXME still under development at the moment of writing) | |
309 | # will emit a similar output, but also prepend the continuation lines | |
310 | # with horizontal tabulation characters. | |
294 | 311 | "$@" -MD -MF "$tmpdepfile" |
295 | 312 | stat=$? |
296 | 313 | if test $stat -eq 0; then : |
299 | 316 | exit $stat |
300 | 317 | fi |
301 | 318 | rm -f "$depfile" |
302 | # Each line is of the form `foo.o: dependent.h', | |
303 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. | |
319 | # Each line is of the form 'foo.o: dependent.h', | |
320 | # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. | |
304 | 321 | # Do two passes, one to just change these to |
305 | # `$object: dependent.h' and one to simply `dependent.h:'. | |
306 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" | |
307 | # Some versions of the HPUX 10.20 sed can't process this invocation | |
308 | # correctly. Breaking it into two sed invocations is a workaround. | |
309 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | | |
310 | sed -e 's/$/ :/' >> "$depfile" | |
322 | # '$object: dependent.h' and one to simply 'dependent.h:'. | |
323 | sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ | |
324 | < "$tmpdepfile" > "$depfile" | |
325 | sed ' | |
326 | s/[ '"$tab"'][ '"$tab"']*/ /g | |
327 | s/^ *// | |
328 | s/ *\\*$// | |
329 | s/^[^:]*: *// | |
330 | /^$/d | |
331 | /:$/d | |
332 | s/$/ :/ | |
333 | ' < "$tmpdepfile" >> "$depfile" | |
311 | 334 | rm -f "$tmpdepfile" |
312 | 335 | ;; |
313 | 336 | |
343 | 366 | done |
344 | 367 | if test -f "$tmpdepfile"; then |
345 | 368 | sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" |
346 | # Add `dependent.h:' lines. | |
369 | # Add 'dependent.h:' lines. | |
347 | 370 | sed -ne '2,${ |
348 | 371 | s/^ *// |
349 | 372 | s/ \\*$// |
358 | 381 | |
359 | 382 | tru64) |
360 | 383 | # The Tru64 compiler uses -MD to generate dependencies as a side |
361 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. | |
384 | # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. | |
362 | 385 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put |
363 | # dependencies in `foo.d' instead, so we check for that too. | |
386 | # dependencies in 'foo.d' instead, so we check for that too. | |
364 | 387 | # Subdirectories are respected. |
365 | 388 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` |
366 | 389 | test "x$dir" = "x$object" && dir= |
406 | 429 | done |
407 | 430 | if test -f "$tmpdepfile"; then |
408 | 431 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" |
409 | # That's a tab and a space in the []. | |
410 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
432 | sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" | |
411 | 433 | else |
412 | 434 | echo "#dummy" > "$depfile" |
413 | 435 | fi |
442 | 464 | p |
443 | 465 | }' | $cygpath_u | sort -u | sed -n ' |
444 | 466 | s/ /\\ /g |
445 | s/\(.*\)/ \1 \\/p | |
467 | s/\(.*\)/'"$tab"'\1 \\/p | |
446 | 468 | s/.\(.*\) \\/\1:/ |
447 | 469 | H |
448 | 470 | $ { |
449 | s/.*/ / | |
471 | s/.*/'"$tab"'/ | |
450 | 472 | G |
451 | 473 | p |
452 | 474 | }' >> "$depfile" |
477 | 499 | shift |
478 | 500 | fi |
479 | 501 | |
480 | # Remove `-o $object'. | |
502 | # Remove '-o $object'. | |
481 | 503 | IFS=" " |
482 | 504 | for arg |
483 | 505 | do |
497 | 519 | done |
498 | 520 | |
499 | 521 | test -z "$dashmflag" && dashmflag=-M |
500 | # Require at least two characters before searching for `:' | |
522 | # Require at least two characters before searching for ':' | |
501 | 523 | # in the target name. This is to cope with DOS-style filenames: |
502 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. | |
524 | # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. | |
503 | 525 | "$@" $dashmflag | |
504 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" | |
526 | sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" | |
505 | 527 | rm -f "$depfile" |
506 | 528 | cat < "$tmpdepfile" > "$depfile" |
507 | tr ' ' ' | |
508 | ' < "$tmpdepfile" | \ | |
529 | tr ' ' "$nl" < "$tmpdepfile" | \ | |
509 | 530 | ## Some versions of the HPUX 10.20 sed can't process this invocation |
510 | 531 | ## correctly. Breaking it into two sed invocations is a workaround. |
511 | 532 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
561 | 582 | # makedepend may prepend the VPATH from the source file name to the object. |
562 | 583 | # No need to regex-escape $object, excess matching of '.' is harmless. |
563 | 584 | sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" |
564 | sed '1,2d' "$tmpdepfile" | tr ' ' ' | |
565 | ' | \ | |
585 | sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ | |
566 | 586 | ## Some versions of the HPUX 10.20 sed can't process this invocation |
567 | 587 | ## correctly. Breaking it into two sed invocations is a workaround. |
568 | 588 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" |
582 | 602 | shift |
583 | 603 | fi |
584 | 604 | |
585 | # Remove `-o $object'. | |
605 | # Remove '-o $object'. | |
586 | 606 | IFS=" " |
587 | 607 | for arg |
588 | 608 | do |
651 | 671 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" |
652 | 672 | rm -f "$depfile" |
653 | 673 | echo "$object : \\" > "$depfile" |
654 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" | |
655 | echo " " >> "$depfile" | |
674 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" | |
675 | echo "$tab" >> "$depfile" | |
656 | 676 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" |
657 | 677 | rm -f "$tmpdepfile" |
658 | 678 | ;; |
0 | 0 | #!/bin/sh |
1 | 1 | # install - install a program, script, or datafile |
2 | 2 | |
3 | scriptversion=2009-04-28.21; # UTC | |
3 | scriptversion=2011-01-19.21; # UTC | |
4 | 4 | |
5 | 5 | # This originates from X11R5 (mit/util/scripts/install.sh), which was |
6 | 6 | # later released in X11R6 (xc/config/util/install.sh) with the |
155 | 155 | -s) stripcmd=$stripprog;; |
156 | 156 | |
157 | 157 | -t) dst_arg=$2 |
158 | # Protect names problematic for `test' and other utilities. | |
159 | case $dst_arg in | |
160 | -* | [=\(\)!]) dst_arg=./$dst_arg;; | |
161 | esac | |
158 | 162 | shift;; |
159 | 163 | |
160 | 164 | -T) no_target_directory=true;; |
185 | 189 | fi |
186 | 190 | shift # arg |
187 | 191 | dst_arg=$arg |
192 | # Protect names problematic for `test' and other utilities. | |
193 | case $dst_arg in | |
194 | -* | [=\(\)!]) dst_arg=./$dst_arg;; | |
195 | esac | |
188 | 196 | done |
189 | 197 | fi |
190 | 198 | |
199 | 207 | fi |
200 | 208 | |
201 | 209 | if test -z "$dir_arg"; then |
202 | trap '(exit $?); exit' 1 2 13 15 | |
210 | do_exit='(exit $ret); exit $ret' | |
211 | trap "ret=129; $do_exit" 1 | |
212 | trap "ret=130; $do_exit" 2 | |
213 | trap "ret=141; $do_exit" 13 | |
214 | trap "ret=143; $do_exit" 15 | |
203 | 215 | |
204 | 216 | # Set umask so as not to create temps with too-generous modes. |
205 | 217 | # However, 'strip' requires both read and write access to temps. |
227 | 239 | |
228 | 240 | for src |
229 | 241 | do |
230 | # Protect names starting with `-'. | |
242 | # Protect names problematic for `test' and other utilities. | |
231 | 243 | case $src in |
232 | -*) src=./$src;; | |
244 | -* | [=\(\)!]) src=./$src;; | |
233 | 245 | esac |
234 | 246 | |
235 | 247 | if test -n "$dir_arg"; then |
251 | 263 | echo "$0: no destination specified." >&2 |
252 | 264 | exit 1 |
253 | 265 | fi |
254 | ||
255 | 266 | dst=$dst_arg |
256 | # Protect names starting with `-'. | |
257 | case $dst in | |
258 | -*) dst=./$dst;; | |
259 | esac | |
260 | 267 | |
261 | 268 | # If destination is a directory, append the input filename; won't work |
262 | 269 | # if double slashes aren't ignored. |
384 | 391 | |
385 | 392 | case $dstdir in |
386 | 393 | /*) prefix='/';; |
387 | -*) prefix='./';; | |
394 | [-=\(\)!]*) prefix='./';; | |
388 | 395 | *) prefix='';; |
389 | 396 | esac |
390 | 397 | |
402 | 409 | |
403 | 410 | for d |
404 | 411 | do |
405 | test -z "$d" && continue | |
412 | test X"$d" = X && continue | |
406 | 413 | |
407 | 414 | prefix=$prefix$d |
408 | 415 | if test -d "$prefix"; then |
69 | 69 | # compiler: $LTCC |
70 | 70 | # compiler flags: $LTCFLAGS |
71 | 71 | # linker: $LD (gnu? $with_gnu_ld) |
72 | # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 | |
72 | # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.1 | |
73 | 73 | # automake: $automake_version |
74 | 74 | # autoconf: $autoconf_version |
75 | 75 | # |
79 | 79 | |
80 | 80 | PROGRAM=libtool |
81 | 81 | PACKAGE=libtool |
82 | VERSION="2.4.2 Debian-2.4.2-1ubuntu1" | |
82 | VERSION="2.4.2 Debian-2.4.2-1.1" | |
83 | 83 | TIMESTAMP="" |
84 | 84 | package_revision=1.3337 |
85 | 85 |
2511 | 2511 | esac |
2512 | 2512 | ;; |
2513 | 2513 | |
2514 | gnu*) | |
2515 | version_type=linux # correct to gnu/linux during the next big refactor | |
2516 | need_lib_prefix=no | |
2517 | need_version=no | |
2518 | library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' | |
2519 | soname_spec='${libname}${release}${shared_ext}$major' | |
2520 | shlibpath_var=LD_LIBRARY_PATH | |
2521 | shlibpath_overrides_runpath=no | |
2522 | hardcode_into_libs=yes | |
2523 | ;; | |
2524 | ||
2525 | 2514 | haiku*) |
2526 | 2515 | version_type=linux # correct to gnu/linux during the next big refactor |
2527 | 2516 | need_lib_prefix=no |
2638 | 2627 | ;; |
2639 | 2628 | |
2640 | 2629 | # This must be glibc/ELF. |
2641 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
2630 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
2642 | 2631 | version_type=linux # correct to gnu/linux during the next big refactor |
2643 | 2632 | need_lib_prefix=no |
2644 | 2633 | need_version=no |
3254 | 3243 | fi |
3255 | 3244 | ;; |
3256 | 3245 | |
3257 | gnu*) | |
3258 | lt_cv_deplibs_check_method=pass_all | |
3259 | ;; | |
3260 | ||
3261 | 3246 | haiku*) |
3262 | 3247 | lt_cv_deplibs_check_method=pass_all |
3263 | 3248 | ;; |
3296 | 3281 | ;; |
3297 | 3282 | |
3298 | 3283 | # This must be glibc/ELF. |
3299 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
3284 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
3300 | 3285 | lt_cv_deplibs_check_method=pass_all |
3301 | 3286 | ;; |
3302 | 3287 | |
4048 | 4033 | ;; |
4049 | 4034 | esac |
4050 | 4035 | ;; |
4051 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
4036 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
4052 | 4037 | case $cc_basename in |
4053 | 4038 | KCC*) |
4054 | 4039 | # KAI C++ Compiler |
4347 | 4332 | _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' |
4348 | 4333 | ;; |
4349 | 4334 | |
4350 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
4335 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
4351 | 4336 | case $cc_basename in |
4352 | 4337 | # old Intel for x86_64 which still supported -KPIC. |
4353 | 4338 | ecc*) |
6240 | 6225 | _LT_TAGVAR(ld_shlibs, $1)=yes |
6241 | 6226 | ;; |
6242 | 6227 | |
6243 | gnu*) | |
6244 | ;; | |
6245 | ||
6246 | 6228 | haiku*) |
6247 | 6229 | _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' |
6248 | 6230 | _LT_TAGVAR(link_all_deplibs, $1)=yes |
6404 | 6386 | _LT_TAGVAR(inherit_rpath, $1)=yes |
6405 | 6387 | ;; |
6406 | 6388 | |
6407 | linux* | k*bsd*-gnu | kopensolaris*-gnu) | |
6389 | linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) | |
6408 | 6390 | case $cc_basename in |
6409 | 6391 | KCC*) |
6410 | 6392 | # Kuck and Associates, Inc. (KAI) C++ Compiler |
0 | # manywarnings.m4 serial 4 | |
1 | dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. | |
2 | dnl This file is free software; the Free Software Foundation | |
3 | dnl gives unlimited permission to copy and/or distribute it, | |
4 | dnl with or without modifications, as long as this notice is preserved. | |
5 | ||
6 | dnl From Simon Josefsson | |
7 | ||
8 | # gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR) | |
9 | # -------------------------------------------------- | |
10 | # Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR. | |
11 | # Elements separated by whitespace. In set logic terms, the function | |
12 | # does OUTVAR = LISTVAR \ REMOVEVAR. | |
13 | AC_DEFUN([gl_MANYWARN_COMPLEMENT], | |
14 | [ | |
15 | gl_warn_set= | |
16 | set x $2; shift | |
17 | for gl_warn_item | |
18 | do | |
19 | case " $3 " in | |
20 | *" $gl_warn_item "*) | |
21 | ;; | |
22 | *) | |
23 | gl_warn_set="$gl_warn_set $gl_warn_item" | |
24 | ;; | |
25 | esac | |
26 | done | |
27 | $1=$gl_warn_set | |
28 | ]) | |
29 | ||
30 | # gl_MANYWARN_ALL_GCC(VARIABLE) | |
31 | # ----------------------------- | |
32 | # Add all documented GCC warning parameters to variable VARIABLE. | |
33 | # Note that you need to test them using gl_WARN_ADD if you want to | |
34 | # make sure your gcc understands it. | |
35 | AC_DEFUN([gl_MANYWARN_ALL_GCC], | |
36 | [ | |
37 | dnl First, check if -Wno-missing-field-initializers is needed. | |
38 | dnl -Wmissing-field-initializers is implied by -W, but that issues | |
39 | dnl warnings with GCC version before 4.7, for the common idiom | |
40 | dnl of initializing types on the stack to zero, using { 0, } | |
41 | AC_REQUIRE([AC_PROG_CC]) | |
42 | if test -n "$GCC"; then | |
43 | ||
44 | dnl First, check -W -Werror -Wno-missing-field-initializers is supported | |
45 | dnl with the current $CC $CFLAGS $CPPFLAGS. | |
46 | AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) | |
47 | AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [ | |
48 | gl_save_CFLAGS="$CFLAGS" | |
49 | CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers" | |
50 | AC_COMPILE_IFELSE( | |
51 | [AC_LANG_PROGRAM([[]], [[]])], | |
52 | [gl_cv_cc_nomfi_supported=yes], | |
53 | [gl_cv_cc_nomfi_supported=no]) | |
54 | CFLAGS="$gl_save_CFLAGS"]) | |
55 | AC_MSG_RESULT([$gl_cv_cc_nomfi_supported]) | |
56 | ||
57 | if test "$gl_cv_cc_nomfi_supported" = yes; then | |
58 | dnl Now check whether -Wno-missing-field-initializers is needed | |
59 | dnl for the { 0, } construct. | |
60 | AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) | |
61 | AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [ | |
62 | gl_save_CFLAGS="$CFLAGS" | |
63 | CFLAGS="$CFLAGS -W -Werror" | |
64 | AC_COMPILE_IFELSE( | |
65 | [AC_LANG_PROGRAM( | |
66 | [[void f (void) | |
67 | { | |
68 | typedef struct { int a; int b; } s_t; | |
69 | s_t s1 = { 0, }; | |
70 | } | |
71 | ]], | |
72 | [[]])], | |
73 | [gl_cv_cc_nomfi_needed=no], | |
74 | [gl_cv_cc_nomfi_needed=yes]) | |
75 | CFLAGS="$gl_save_CFLAGS" | |
76 | ]) | |
77 | AC_MSG_RESULT([$gl_cv_cc_nomfi_needed]) | |
78 | fi | |
79 | fi | |
80 | ||
81 | gl_manywarn_set= | |
82 | for gl_manywarn_item in \ | |
83 | -Wall \ | |
84 | -W \ | |
85 | -Wformat-y2k \ | |
86 | -Wformat-nonliteral \ | |
87 | -Wformat-security \ | |
88 | -Winit-self \ | |
89 | -Wmissing-include-dirs \ | |
90 | -Wswitch-default \ | |
91 | -Wswitch-enum \ | |
92 | -Wunused \ | |
93 | -Wunknown-pragmas \ | |
94 | -Wstrict-aliasing \ | |
95 | -Wstrict-overflow \ | |
96 | -Wsystem-headers \ | |
97 | -Wfloat-equal \ | |
98 | -Wtraditional \ | |
99 | -Wtraditional-conversion \ | |
100 | -Wdeclaration-after-statement \ | |
101 | -Wundef \ | |
102 | -Wshadow \ | |
103 | -Wunsafe-loop-optimizations \ | |
104 | -Wpointer-arith \ | |
105 | -Wbad-function-cast \ | |
106 | -Wc++-compat \ | |
107 | -Wcast-qual \ | |
108 | -Wcast-align \ | |
109 | -Wwrite-strings \ | |
110 | -Wconversion \ | |
111 | -Wsign-conversion \ | |
112 | -Wlogical-op \ | |
113 | -Waggregate-return \ | |
114 | -Wstrict-prototypes \ | |
115 | -Wold-style-definition \ | |
116 | -Wmissing-prototypes \ | |
117 | -Wmissing-declarations \ | |
118 | -Wmissing-noreturn \ | |
119 | -Wmissing-format-attribute \ | |
120 | -Wpacked \ | |
121 | -Wpadded \ | |
122 | -Wredundant-decls \ | |
123 | -Wnested-externs \ | |
124 | -Wunreachable-code \ | |
125 | -Winline \ | |
126 | -Winvalid-pch \ | |
127 | -Wlong-long \ | |
128 | -Wvla \ | |
129 | -Wvolatile-register-var \ | |
130 | -Wdisabled-optimization \ | |
131 | -Wstack-protector \ | |
132 | -Woverlength-strings \ | |
133 | -Wbuiltin-macro-redefined \ | |
134 | -Wmudflap \ | |
135 | -Wpacked-bitfield-compat \ | |
136 | -Wsync-nand \ | |
137 | ; do | |
138 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | |
139 | done | |
140 | # The following are not documented in the manual but are included in | |
141 | # output from gcc --help=warnings. | |
142 | for gl_manywarn_item in \ | |
143 | -Wattributes \ | |
144 | -Wcoverage-mismatch \ | |
145 | -Wunused-macros \ | |
146 | ; do | |
147 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | |
148 | done | |
149 | # More warnings from gcc 4.6.2 --help=warnings. | |
150 | for gl_manywarn_item in \ | |
151 | -Wabi \ | |
152 | -Wcpp \ | |
153 | -Wdeprecated \ | |
154 | -Wdeprecated-declarations \ | |
155 | -Wdiv-by-zero \ | |
156 | -Wdouble-promotion \ | |
157 | -Wendif-labels \ | |
158 | -Wextra \ | |
159 | -Wformat-contains-nul \ | |
160 | -Wformat-extra-args \ | |
161 | -Wformat-zero-length \ | |
162 | -Wformat=2 \ | |
163 | -Wmultichar \ | |
164 | -Wnormalized=nfc \ | |
165 | -Woverflow \ | |
166 | -Wpointer-to-int-cast \ | |
167 | -Wpragmas \ | |
168 | -Wsuggest-attribute=const \ | |
169 | -Wsuggest-attribute=noreturn \ | |
170 | -Wsuggest-attribute=pure \ | |
171 | -Wtrampolines \ | |
172 | ; do | |
173 | gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" | |
174 | done | |
175 | ||
176 | # Disable the missing-field-initializers warning if needed | |
177 | if test "$gl_cv_cc_nomfi_needed" = yes; then | |
178 | gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers" | |
179 | fi | |
180 | ||
181 | $1=$gl_manywarn_set | |
182 | ]) |
0 | # warnings.m4 serial 7 | |
1 | dnl Copyright (C) 2008-2012 Free Software Foundation, Inc. | |
2 | dnl This file is free software; the Free Software Foundation | |
3 | dnl gives unlimited permission to copy and/or distribute it, | |
4 | dnl with or without modifications, as long as this notice is preserved. | |
5 | ||
6 | dnl From Simon Josefsson | |
7 | ||
8 | # gl_AS_VAR_APPEND(VAR, VALUE) | |
9 | # ---------------------------- | |
10 | # Provide the functionality of AS_VAR_APPEND if Autoconf does not have it. | |
11 | m4_ifdef([AS_VAR_APPEND], | |
12 | [m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])], | |
13 | [m4_define([gl_AS_VAR_APPEND], | |
14 | [AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])]) | |
15 | ||
16 | ||
17 | # gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED], | |
18 | # [PROGRAM = AC_LANG_PROGRAM()]) | |
19 | # ----------------------------------------------------------------- | |
20 | # Check if the compiler supports OPTION when compiling PROGRAM. | |
21 | # | |
22 | # FIXME: gl_Warn must be used unquoted until we can assume Autoconf | |
23 | # 2.64 or newer. | |
24 | AC_DEFUN([gl_COMPILER_OPTION_IF], | |
25 | [AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl | |
26 | AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl | |
27 | AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [ | |
28 | gl_save_compiler_FLAGS="$gl_Flags" | |
29 | gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $1"]) | |
30 | AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])], | |
31 | [AS_VAR_SET(gl_Warn, [yes])], | |
32 | [AS_VAR_SET(gl_Warn, [no])]) | |
33 | gl_Flags="$gl_save_compiler_FLAGS" | |
34 | ]) | |
35 | AS_VAR_IF(gl_Warn, [yes], [$2], [$3]) | |
36 | AS_VAR_POPDEF([gl_Flags])dnl | |
37 | AS_VAR_POPDEF([gl_Warn])dnl | |
38 | ]) | |
39 | ||
40 | ||
41 | # gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS], | |
42 | # [PROGRAM = AC_LANG_PROGRAM()]) | |
43 | # --------------------------------------------- | |
44 | # Adds parameter to WARN_CFLAGS if the compiler supports it when | |
45 | # compiling PROGRAM. For example, gl_WARN_ADD([-Wparentheses]). | |
46 | # | |
47 | # If VARIABLE is a variable name, AC_SUBST it. | |
48 | AC_DEFUN([gl_WARN_ADD], | |
49 | [gl_COMPILER_OPTION_IF([$1], | |
50 | [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])], | |
51 | [], | |
52 | [$3]) | |
53 | m4_ifval([$2], | |
54 | [AS_LITERAL_IF([$2], [AC_SUBST([$2])])], | |
55 | [AC_SUBST([WARN_CFLAGS])])dnl | |
56 | ]) | |
57 | ||
58 | # Local Variables: | |
59 | # mode: autoconf | |
60 | # End: |
0 | # Makefile --- Instructions for make to build Yubikey client library and tools. | |
1 | # | |
2 | # Written by Simon Josefsson <simon@josefsson.org>. | |
3 | # Copyright (c) 2006-2012 Yubico AB | |
4 | # All rights reserved. | |
5 | # | |
6 | # Redistribution and use in source and binary forms, with or without | |
7 | # modification, are permitted provided that the following conditions are | |
8 | # met: | |
9 | # | |
10 | # * Redistributions of source code must retain the above copyright | |
11 | # notice, this list of conditions and the following disclaimer. | |
12 | # | |
13 | # * Redistributions in binary form must reproduce the above | |
14 | # copyright notice, this list of conditions and the following | |
15 | # disclaimer in the documentation and/or other materials provided | |
16 | # with the distribution. | |
17 | # | |
18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | ||
30 | MORE_CFLAGS ?= -Wall -g | |
31 | CFLAGS = $(MORE_CFLAGS) \ | |
32 | -I. \ | |
33 | -DPACKAGE=\"ykclient\" \ | |
34 | -DPACKAGE_VERSION=\"0\" | |
35 | ||
36 | LDLIBS = -lcurl | |
37 | ||
38 | PROGRAMS = ykclient selftest | |
39 | ||
40 | all: $(PROGRAMS) | |
41 | ||
42 | OBJECTS = ykclient_server_response.o ykclient.o rfc4634/hmac.o \ | |
43 | rfc4634/sha1.o rfc4634/usha.o rfc4634/sha224-256.o \ | |
44 | rfc4634/sha384-512.o b64/cencode.o b64/cdecode.o | |
45 | ||
46 | $(PROGRAMS): $(OBJECTS) | |
47 | ||
48 | ykclient: tool.c | |
49 | ||
50 | selftest.c: | |
51 | cp tests/selftest.c . | |
52 | ||
53 | clean: | |
54 | rm -f $(PROGRAMS) $(OBJECTS) *~ | |
55 | ||
56 | check: all | |
57 | ./selftest |
31 | 31 | AM_LDFLAGS = -no-install |
32 | 32 | AM_CFLAGS=-I$(srcdir)/.. |
33 | 33 | LDADD = ../libykclient.la -lcurl |
34 | selftest_SOURCES = selftest.c ../b64/cencode.c ../b64/cdecode.c | |
34 | selftest_SOURCES = selftest.c ../b64/cencode.c ../b64/cdecode.c \ | |
35 | ../rfc4634/hmac.c ../rfc4634/sha1.c ../rfc4634/usha.c \ | |
36 | ../rfc4634/sha224-256.c ../rfc4634/sha384-512.c | |
35 | 37 | |
36 | 38 | check_PROGRAMS = selftest |
37 | 39 | TESTS = $(check_PROGRAMS) |
0 | # Makefile.in generated by automake 1.11.3 from Makefile.am. | |
0 | # Makefile.in generated by automake 1.11.6 from Makefile.am. | |
1 | 1 | # @configure_input@ |
2 | 2 | |
3 | 3 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
44 | 44 | |
45 | 45 | # Self tests. |
46 | 46 | VPATH = @srcdir@ |
47 | am__make_dryrun = \ | |
48 | { \ | |
49 | am__dry=no; \ | |
50 | case $$MAKEFLAGS in \ | |
51 | *\\[\ \ ]*) \ | |
52 | echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | |
53 | | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ | |
54 | *) \ | |
55 | for am__flg in $$MAKEFLAGS; do \ | |
56 | case $$am__flg in \ | |
57 | *=*|--*) ;; \ | |
58 | *n*) am__dry=yes; break;; \ | |
59 | esac; \ | |
60 | done;; \ | |
61 | esac; \ | |
62 | test $$am__dry = yes; \ | |
63 | } | |
47 | 64 | pkgdatadir = $(datadir)/@PACKAGE@ |
48 | 65 | pkgincludedir = $(includedir)/@PACKAGE@ |
49 | 66 | pkglibdir = $(libdir)/@PACKAGE@ |
69 | 86 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ |
70 | 87 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ |
71 | 88 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ |
89 | $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/warnings.m4 \ | |
72 | 90 | $(top_srcdir)/configure.ac |
73 | 91 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
74 | 92 | $(ACLOCAL_M4) |
76 | 94 | CONFIG_CLEAN_FILES = |
77 | 95 | CONFIG_CLEAN_VPATH_FILES = |
78 | 96 | am_selftest_OBJECTS = selftest.$(OBJEXT) cencode.$(OBJEXT) \ |
79 | cdecode.$(OBJEXT) | |
97 | cdecode.$(OBJEXT) hmac.$(OBJEXT) sha1.$(OBJEXT) usha.$(OBJEXT) \ | |
98 | sha224-256.$(OBJEXT) sha384-512.$(OBJEXT) | |
80 | 99 | selftest_OBJECTS = $(am_selftest_OBJECTS) |
81 | 100 | selftest_LDADD = $(LDADD) |
82 | 101 | selftest_DEPENDENCIES = ../libykclient.la |
111 | 130 | am__v_GEN_0 = @echo " GEN " $@; |
112 | 131 | SOURCES = $(selftest_SOURCES) |
113 | 132 | DIST_SOURCES = $(selftest_SOURCES) |
133 | am__can_run_installinfo = \ | |
134 | case $$AM_UPDATE_INFO_DIR in \ | |
135 | n|no|NO) false;; \ | |
136 | *) (install-info --version) >/dev/null 2>&1;; \ | |
137 | esac | |
114 | 138 | ETAGS = etags |
115 | 139 | CTAGS = ctags |
116 | 140 | am__tty_colors = \ |
143 | 167 | EXEEXT = @EXEEXT@ |
144 | 168 | FGREP = @FGREP@ |
145 | 169 | GREP = @GREP@ |
170 | HELP2MAN = @HELP2MAN@ | |
146 | 171 | INSTALL = @INSTALL@ |
147 | 172 | INSTALL_DATA = @INSTALL_DATA@ |
148 | 173 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
184 | 209 | SHELL = @SHELL@ |
185 | 210 | STRIP = @STRIP@ |
186 | 211 | VERSION = @VERSION@ |
212 | WARN_CFLAGS = @WARN_CFLAGS@ | |
213 | YKCLIENT_VERSION_MAJOR = @YKCLIENT_VERSION_MAJOR@ | |
214 | YKCLIENT_VERSION_MINOR = @YKCLIENT_VERSION_MINOR@ | |
215 | YKCLIENT_VERSION_NUMBER = @YKCLIENT_VERSION_NUMBER@ | |
216 | YKCLIENT_VERSION_PATCH = @YKCLIENT_VERSION_PATCH@ | |
187 | 217 | _libcurl_config = @_libcurl_config@ |
188 | 218 | abs_builddir = @abs_builddir@ |
189 | 219 | abs_srcdir = @abs_srcdir@ |
241 | 271 | AM_LDFLAGS = -no-install |
242 | 272 | AM_CFLAGS = -I$(srcdir)/.. |
243 | 273 | LDADD = ../libykclient.la -lcurl |
244 | selftest_SOURCES = selftest.c ../b64/cencode.c ../b64/cdecode.c | |
274 | selftest_SOURCES = selftest.c ../b64/cencode.c ../b64/cdecode.c \ | |
275 | ../rfc4634/hmac.c ../rfc4634/sha1.c ../rfc4634/usha.c \ | |
276 | ../rfc4634/sha224-256.c ../rfc4634/sha384-512.c | |
277 | ||
245 | 278 | TESTS = $(check_PROGRAMS) |
246 | 279 | all: all-am |
247 | 280 | |
298 | 331 | |
299 | 332 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdecode.Po@am__quote@ |
300 | 333 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cencode.Po@am__quote@ |
334 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hmac.Po@am__quote@ | |
301 | 335 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/selftest.Po@am__quote@ |
336 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@ | |
337 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha224-256.Po@am__quote@ | |
338 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha384-512.Po@am__quote@ | |
339 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usha.Po@am__quote@ | |
302 | 340 | |
303 | 341 | .c.o: |
304 | 342 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< |
348 | 386 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../b64/cdecode.c' object='cdecode.obj' libtool=no @AMDEPBACKSLASH@ |
349 | 387 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
350 | 388 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cdecode.obj `if test -f '../b64/cdecode.c'; then $(CYGPATH_W) '../b64/cdecode.c'; else $(CYGPATH_W) '$(srcdir)/../b64/cdecode.c'; fi` |
389 | ||
390 | hmac.o: ../rfc4634/hmac.c | |
391 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hmac.o -MD -MP -MF $(DEPDIR)/hmac.Tpo -c -o hmac.o `test -f '../rfc4634/hmac.c' || echo '$(srcdir)/'`../rfc4634/hmac.c | |
392 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hmac.Tpo $(DEPDIR)/hmac.Po | |
393 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/hmac.c' object='hmac.o' libtool=no @AMDEPBACKSLASH@ | |
394 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
395 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hmac.o `test -f '../rfc4634/hmac.c' || echo '$(srcdir)/'`../rfc4634/hmac.c | |
396 | ||
397 | hmac.obj: ../rfc4634/hmac.c | |
398 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hmac.obj -MD -MP -MF $(DEPDIR)/hmac.Tpo -c -o hmac.obj `if test -f '../rfc4634/hmac.c'; then $(CYGPATH_W) '../rfc4634/hmac.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/hmac.c'; fi` | |
399 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/hmac.Tpo $(DEPDIR)/hmac.Po | |
400 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/hmac.c' object='hmac.obj' libtool=no @AMDEPBACKSLASH@ | |
401 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
402 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hmac.obj `if test -f '../rfc4634/hmac.c'; then $(CYGPATH_W) '../rfc4634/hmac.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/hmac.c'; fi` | |
403 | ||
404 | sha1.o: ../rfc4634/sha1.c | |
405 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sha1.o -MD -MP -MF $(DEPDIR)/sha1.Tpo -c -o sha1.o `test -f '../rfc4634/sha1.c' || echo '$(srcdir)/'`../rfc4634/sha1.c | |
406 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sha1.Tpo $(DEPDIR)/sha1.Po | |
407 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/sha1.c' object='sha1.o' libtool=no @AMDEPBACKSLASH@ | |
408 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
409 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sha1.o `test -f '../rfc4634/sha1.c' || echo '$(srcdir)/'`../rfc4634/sha1.c | |
410 | ||
411 | sha1.obj: ../rfc4634/sha1.c | |
412 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sha1.obj -MD -MP -MF $(DEPDIR)/sha1.Tpo -c -o sha1.obj `if test -f '../rfc4634/sha1.c'; then $(CYGPATH_W) '../rfc4634/sha1.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/sha1.c'; fi` | |
413 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sha1.Tpo $(DEPDIR)/sha1.Po | |
414 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/sha1.c' object='sha1.obj' libtool=no @AMDEPBACKSLASH@ | |
415 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
416 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sha1.obj `if test -f '../rfc4634/sha1.c'; then $(CYGPATH_W) '../rfc4634/sha1.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/sha1.c'; fi` | |
417 | ||
418 | usha.o: ../rfc4634/usha.c | |
419 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT usha.o -MD -MP -MF $(DEPDIR)/usha.Tpo -c -o usha.o `test -f '../rfc4634/usha.c' || echo '$(srcdir)/'`../rfc4634/usha.c | |
420 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/usha.Tpo $(DEPDIR)/usha.Po | |
421 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/usha.c' object='usha.o' libtool=no @AMDEPBACKSLASH@ | |
422 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
423 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o usha.o `test -f '../rfc4634/usha.c' || echo '$(srcdir)/'`../rfc4634/usha.c | |
424 | ||
425 | usha.obj: ../rfc4634/usha.c | |
426 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT usha.obj -MD -MP -MF $(DEPDIR)/usha.Tpo -c -o usha.obj `if test -f '../rfc4634/usha.c'; then $(CYGPATH_W) '../rfc4634/usha.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/usha.c'; fi` | |
427 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/usha.Tpo $(DEPDIR)/usha.Po | |
428 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/usha.c' object='usha.obj' libtool=no @AMDEPBACKSLASH@ | |
429 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
430 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o usha.obj `if test -f '../rfc4634/usha.c'; then $(CYGPATH_W) '../rfc4634/usha.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/usha.c'; fi` | |
431 | ||
432 | sha224-256.o: ../rfc4634/sha224-256.c | |
433 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sha224-256.o -MD -MP -MF $(DEPDIR)/sha224-256.Tpo -c -o sha224-256.o `test -f '../rfc4634/sha224-256.c' || echo '$(srcdir)/'`../rfc4634/sha224-256.c | |
434 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sha224-256.Tpo $(DEPDIR)/sha224-256.Po | |
435 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/sha224-256.c' object='sha224-256.o' libtool=no @AMDEPBACKSLASH@ | |
436 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
437 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sha224-256.o `test -f '../rfc4634/sha224-256.c' || echo '$(srcdir)/'`../rfc4634/sha224-256.c | |
438 | ||
439 | sha224-256.obj: ../rfc4634/sha224-256.c | |
440 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sha224-256.obj -MD -MP -MF $(DEPDIR)/sha224-256.Tpo -c -o sha224-256.obj `if test -f '../rfc4634/sha224-256.c'; then $(CYGPATH_W) '../rfc4634/sha224-256.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/sha224-256.c'; fi` | |
441 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sha224-256.Tpo $(DEPDIR)/sha224-256.Po | |
442 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/sha224-256.c' object='sha224-256.obj' libtool=no @AMDEPBACKSLASH@ | |
443 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
444 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sha224-256.obj `if test -f '../rfc4634/sha224-256.c'; then $(CYGPATH_W) '../rfc4634/sha224-256.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/sha224-256.c'; fi` | |
445 | ||
446 | sha384-512.o: ../rfc4634/sha384-512.c | |
447 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sha384-512.o -MD -MP -MF $(DEPDIR)/sha384-512.Tpo -c -o sha384-512.o `test -f '../rfc4634/sha384-512.c' || echo '$(srcdir)/'`../rfc4634/sha384-512.c | |
448 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sha384-512.Tpo $(DEPDIR)/sha384-512.Po | |
449 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/sha384-512.c' object='sha384-512.o' libtool=no @AMDEPBACKSLASH@ | |
450 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
451 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sha384-512.o `test -f '../rfc4634/sha384-512.c' || echo '$(srcdir)/'`../rfc4634/sha384-512.c | |
452 | ||
453 | sha384-512.obj: ../rfc4634/sha384-512.c | |
454 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sha384-512.obj -MD -MP -MF $(DEPDIR)/sha384-512.Tpo -c -o sha384-512.obj `if test -f '../rfc4634/sha384-512.c'; then $(CYGPATH_W) '../rfc4634/sha384-512.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/sha384-512.c'; fi` | |
455 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sha384-512.Tpo $(DEPDIR)/sha384-512.Po | |
456 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../rfc4634/sha384-512.c' object='sha384-512.obj' libtool=no @AMDEPBACKSLASH@ | |
457 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | |
458 | @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sha384-512.obj `if test -f '../rfc4634/sha384-512.c'; then $(CYGPATH_W) '../rfc4634/sha384-512.c'; else $(CYGPATH_W) '$(srcdir)/../rfc4634/sha384-512.c'; fi` | |
351 | 459 | |
352 | 460 | mostlyclean-libtool: |
353 | 461 | -rm -f *.lo |
0 | 0 | /* selftest.c --- Self-tests for Yubico client library. |
1 | 1 | * |
2 | 2 | * Written by Simon Josefsson <simon@josefsson.org>. |
3 | * Copyright (c) 2006-2012 Yubico AB | |
3 | * Copyright (c) 2006-2013 Yubico AB | |
4 | 4 | * All rights reserved. |
5 | 5 | * |
6 | 6 | * Redistribution and use in source and binary forms, with or without |
33 | 33 | #include <stdio.h> |
34 | 34 | #include <assert.h> |
35 | 35 | |
36 | #include <curl/curl.h> | |
37 | ||
38 | 36 | #include "b64/cencode.h" |
39 | 37 | #include "b64/cdecode.h" |
38 | ||
39 | #include "rfc4634/sha.h" | |
40 | 40 | |
41 | 41 | #define TEST(xX) printf ("\nTest %s:%d (%s): ", __FILE__, __LINE__, __FUNCTION__); \ |
42 | 42 | printf xX; \ |
116 | 116 | ret = strcmp(buf, "blahonga"); |
117 | 117 | assert(ret == 0); |
118 | 118 | } |
119 | ||
120 | /* test cases for HMAC-SHA1 from rcs 2202 */ | |
121 | void | |
122 | test_hmac (void) | |
123 | { | |
124 | int res; | |
125 | uint8_t result[USHAMaxHashSize]; | |
126 | ||
127 | unsigned char text1[] = "Hi There"; | |
128 | unsigned char key1[20]; | |
129 | memset(key1, 0x0b, 20); | |
130 | uint8_t expected1[] = {0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1, 0x46, 0xbe, 0x00}; | |
131 | ||
132 | unsigned char text2[] = "what do ya want for nothing?"; | |
133 | unsigned char key2[] = "Jefe"; | |
134 | uint8_t expected2[] = {0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74, 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79}; | |
135 | ||
136 | unsigned char text3[50]; | |
137 | memset(text3, 0xdd, 50); | |
138 | unsigned char key3[20]; | |
139 | memset(key3, 0xaa, 20); | |
140 | uint8_t expected3[] = {0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3, 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3}; | |
141 | ||
142 | unsigned char text4[50]; | |
143 | memset(text4, 0xcd, 50); | |
144 | unsigned char key4[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19}; | |
145 | uint8_t expected4[] = {0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84, 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda}; | |
146 | ||
147 | unsigned char text5[] = "Test With Truncation"; | |
148 | unsigned char key5[20]; | |
149 | memset(key5, 0x0c, 20); | |
150 | uint8_t expected5[] = {0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2, 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04}; | |
151 | ||
152 | unsigned char text6[] = "Test Using Larger Than Block-Size Key - Hash Key First"; | |
153 | unsigned char key6[80]; | |
154 | memset(key6, 0xaa, 80); | |
155 | uint8_t expected6[] = {0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70, 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12}; | |
156 | ||
157 | unsigned char text7[] = "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data"; | |
158 | unsigned char key7[80]; | |
159 | memset(key7, 0xaa, 80); | |
160 | uint8_t expected7[] = {0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b, 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91}; | |
161 | ||
162 | TEST(("HMAC-SHA1 case 1")); | |
163 | res = hmac (SHA1, text1, 8, key1, 20, result); | |
164 | assert(res == 0); | |
165 | assert(memcmp(result, expected1, 20) == 0); | |
166 | ||
167 | TEST(("HMAC-SHA1 case 2")); | |
168 | res = hmac (SHA1, text2, 28, key2, 4, result); | |
169 | assert(res == 0); | |
170 | assert(memcmp(result, expected2, 20) == 0); | |
171 | ||
172 | TEST(("HMAC-SHA1 case 3")); | |
173 | res = hmac (SHA1, text3, 50, key3, 20, result); | |
174 | assert(res == 0); | |
175 | assert(memcmp(result, expected3, 20) == 0); | |
176 | ||
177 | TEST(("HMAC-SHA1 case 4")); | |
178 | res = hmac (SHA1, text4, 50, key4, 25, result); | |
179 | assert(res == 0); | |
180 | assert(memcmp(result, expected4, 20) == 0); | |
181 | ||
182 | TEST(("HMAC-SHA1 case 5")); | |
183 | res = hmac (SHA1, text5, 20, key5, 20, result); | |
184 | assert(res == 0); | |
185 | assert(memcmp(result, expected5, 20) == 0); | |
186 | ||
187 | TEST(("HMAC-SHA1 case 6")); | |
188 | res = hmac (SHA1, text6, 54, key6, 80, result); | |
189 | assert(res == 0); | |
190 | assert(memcmp(result, expected6, 20) == 0); | |
191 | ||
192 | TEST(("HMAC-SHA1 case 7")); | |
193 | res = hmac (SHA1, text7, 73, key7, 80, result); | |
194 | assert(res == 0); | |
195 | assert(memcmp(result, expected7, 20) == 0); | |
196 | } | |
197 | ||
119 | 198 | |
120 | 199 | int |
121 | 200 | main (void) |
130 | 209 | ykclient_t *ykc; |
131 | 210 | int ret; |
132 | 211 | |
133 | curl_global_init(CURL_GLOBAL_ALL); | |
212 | if (strcmp (YKCLIENT_VERSION_STRING, ykclient_check_version (NULL)) != 0) | |
213 | { | |
214 | printf ("version mismatch %s != %s\n",YKCLIENT_VERSION_STRING, | |
215 | ykclient_check_version (NULL)); | |
216 | return 1; | |
217 | } | |
218 | ||
219 | if (ykclient_check_version (YKCLIENT_VERSION_STRING) == NULL) | |
220 | { | |
221 | printf ("version NULL?\n"); | |
222 | return 1; | |
223 | } | |
224 | ||
225 | if (ykclient_check_version ("99.99.99") != NULL) | |
226 | { | |
227 | printf ("version not NULL?\n"); | |
228 | return 1; | |
229 | } | |
230 | ||
231 | printf ("ykclient version: header %s library %s\n", | |
232 | YKCLIENT_VERSION_STRING, ykclient_check_version(NULL)); | |
233 | ||
234 | ret = ykclient_global_init (); | |
235 | assert (ret == YKCLIENT_OK); | |
134 | 236 | |
135 | 237 | TEST(("init self")); |
136 | 238 | ret = ykclient_init (&ykc); |
337 | 439 | |
338 | 440 | test_base64(); |
339 | 441 | |
442 | test_hmac(); | |
443 | ||
340 | 444 | printf ("All tests passed\n"); |
341 | 445 | |
342 | curl_global_cleanup(); | |
446 | ykclient_global_done(); | |
343 | 447 | |
344 | 448 | return 0; |
345 | 449 | } |
0 | 0 | /* tool.c --- Command line interface to libykclient. |
1 | 1 | * |
2 | * Copyright (c) 2006-2012 Yubico AB | |
2 | * Copyright (c) 2006-2013 Yubico AB | |
3 | 3 | * Copyright (c) 2012 Secure Mission Solutions |
4 | 4 | * All rights reserved. |
5 | 5 | * |
39 | 39 | #include <getopt.h> |
40 | 40 | |
41 | 41 | const char *usage = |
42 | "Usage: ykclient [options] <client_id> <yubikey_otp>\n" | |
43 | " client_id: your client id integer\n" | |
44 | " yubikey_otp: One-time password generated by yubikey\n" | |
42 | "Usage: ykclient [OPTION]... CLIENTID YUBIKEYOTP\n" | |
43 | "Validate the YUBIKEYOTP one-time-password against the YubiCloud\n" | |
44 | "using CLIENTID as the client identifier.\n" | |
45 | 45 | "\n" |
46 | " Options :\n" | |
47 | " --url URL Validation service URL (eg: \"http://api.yubico.com/wsapi/verify?id=%d&otp=%s\")\n" | |
48 | " --ca CA Path to directory containing the CAs (eg: \"/usr/local/etc/CERTS\")\n" | |
49 | " --apikey Key API key for HMAC validation of request/response\n"; | |
46 | "Mandatory arguments to long options are mandatory for short options too.\n" | |
47 | " --help Display this help screen\n" | |
48 | " --version Display version information\n" | |
49 | "\n" | |
50 | " --debug Print debugging information\n" | |
51 | " --url URL Validation service URL, for example,\n" | |
52 | " \"http://api.yubico.com/wsapi/verify?id=%d&otp=%s\"\n" | |
53 | " --ca CADIR Path to directory containing Certificate Authoritity,\n" | |
54 | " e.g., \"/usr/local/etc/CERTS\"\n" | |
55 | " --apikey Key API key for HMAC validation of request/response\n" | |
56 | "\n" | |
57 | "Exit status is 0 on success, 1 if there is a hard failure, 2 if the\n" | |
58 | "OTP was replayed, 3 for other soft OTP-related failures.\n" | |
59 | "\n" "Report bugs at <https://github.com/Yubico/yubico-c-client>.\n"; | |
50 | 60 | |
51 | 61 | static struct option long_options[] = { |
52 | 62 | {"url", 1, 0, 'u'}, |
53 | 63 | {"ca", 1, 0, 'c'}, |
54 | 64 | {"apikey", 1, 0, 'a'}, |
65 | {"debug", 0, 0, 'd'}, | |
66 | {"help", 0, 0, 'h'}, | |
67 | {"version", 0, 0, 'V'}, | |
55 | 68 | {0, 0, 0, 0} |
56 | 69 | }; |
57 | 70 | |
58 | 71 | /* Parse command line parameters. */ |
59 | void | |
72 | static void | |
60 | 73 | parse_args (int argc, char *argv[], |
61 | int *client_id, char **token, char **url, char **ca, char **api_key) | |
74 | unsigned int *client_id, char **token, char **url, char **ca, | |
75 | char **api_key, int *debug) | |
62 | 76 | { |
63 | 77 | while (1) |
64 | 78 | { |
80 | 94 | } |
81 | 95 | *api_key = optarg; |
82 | 96 | break; |
97 | ||
98 | case 'd': | |
99 | *debug = 1; | |
100 | break; | |
101 | ||
83 | 102 | case 'u': |
84 | 103 | if (strncmp ("http://", optarg, 7) != 0 |
85 | 104 | && strncmp ("https://", optarg, 8) != 0) |
89 | 108 | } |
90 | 109 | *url = optarg; |
91 | 110 | break; |
111 | ||
92 | 112 | case 'c': |
93 | 113 | if (strlen (optarg) < 1) |
94 | 114 | { |
95 | fprintf (stderr, "error: must give a valid directory containing CAs"); | |
115 | fprintf (stderr, | |
116 | "error: must give a valid directory containing CAs"); | |
96 | 117 | exit (EXIT_FAILURE); |
97 | 118 | } |
98 | 119 | *ca = optarg; |
99 | 120 | break; |
121 | ||
122 | case 'h': | |
123 | printf ("%s", usage); | |
124 | exit (EXIT_SUCCESS); | |
125 | break; | |
126 | ||
127 | case 'V': | |
128 | printf ("%s\n", VERSION); | |
129 | exit (EXIT_SUCCESS); | |
130 | break; | |
100 | 131 | } |
101 | 132 | } |
102 | 133 | |
103 | 134 | if (argc - optind != 2) |
104 | 135 | { |
105 | fprintf (stderr, "%s", usage); | |
106 | exit (EXIT_FAILURE); | |
136 | printf ("%s", usage); | |
137 | exit (EXIT_SUCCESS); | |
107 | 138 | } |
108 | 139 | |
109 | 140 | /* Now get mandatory numeric client_id */ |
110 | *client_id = atoi (argv[optind++]); | |
141 | *client_id = strtoul (argv[optind++], NULL, 10); | |
111 | 142 | |
112 | 143 | if (*client_id <= 0) |
113 | 144 | { |
128 | 159 | int |
129 | 160 | main (int argc, char *argv[]) |
130 | 161 | { |
131 | int client_id; | |
162 | unsigned int client_id; | |
132 | 163 | char *token, *url = NULL, *ca = NULL, *api_key = NULL; |
133 | int ret; | |
164 | int debug = 0; | |
165 | ykclient_rc ret; | |
134 | 166 | ykclient_t *ykc = NULL; |
135 | 167 | |
136 | parse_args (argc, argv, &client_id, &token, &url, &ca, &api_key); | |
168 | parse_args (argc, argv, &client_id, &token, &url, &ca, &api_key, &debug); | |
137 | 169 | |
138 | 170 | if (ca) |
139 | { | |
140 | ret = ykclient_init (&ykc); | |
141 | if (ret != YKCLIENT_OK) | |
142 | return EXIT_FAILURE; | |
143 | ||
144 | ykclient_set_ca_path (ykc, ca); | |
145 | } | |
146 | ||
147 | /* Debug. */ | |
148 | fprintf (stderr, "Input:\n"); | |
149 | if (url) | |
150 | fprintf (stderr, " validation URL: %s\n", url); | |
151 | if (ca) | |
152 | fprintf (stderr, " CA Path: %s\n", ca); | |
153 | fprintf (stderr, " client id: %d\n", client_id); | |
154 | fprintf (stderr, " token: %s\n", token); | |
155 | if (api_key != NULL) | |
156 | fprintf (stderr, " api key: %s\n", api_key); | |
157 | ||
158 | ret = | |
159 | ykclient_verify_otp_v2 ( ykc, token, client_id, NULL, 1, | |
160 | (const char **) &url, api_key); | |
161 | ||
162 | printf ("Verification output (%d): %s\n", ret, ykclient_strerror (ret)); | |
163 | ||
164 | if (ret != YKCLIENT_OK) | |
165 | return EXIT_FAILURE; | |
171 | { | |
172 | ret = ykclient_init (&ykc); | |
173 | if (ret != YKCLIENT_OK) | |
174 | return EXIT_FAILURE; | |
175 | ||
176 | ykclient_set_ca_path (ykc, ca); | |
177 | } | |
178 | ||
179 | if (debug) | |
180 | { | |
181 | fprintf (stderr, "Input:\n"); | |
182 | if (url) | |
183 | fprintf (stderr, " validation URL: %s\n", url); | |
184 | if (ca) | |
185 | fprintf (stderr, " CA Path: %s\n", ca); | |
186 | fprintf (stderr, " client id: %d\n", client_id); | |
187 | fprintf (stderr, " token: %s\n", token); | |
188 | if (api_key != NULL) | |
189 | fprintf (stderr, " api key: %s\n", api_key); | |
190 | } | |
191 | ||
192 | ret = ykclient_verify_otp_v2 (ykc, token, client_id, NULL, 1, | |
193 | (const char **) &url, api_key); | |
194 | ||
195 | if (debug) | |
196 | printf ("Verification output (%d): %s\n", ret, ykclient_strerror (ret)); | |
197 | ||
198 | if (ret == YKCLIENT_REPLAYED_OTP) | |
199 | return 2; | |
200 | else if (ret != YKCLIENT_OK) | |
201 | return 3; | |
166 | 202 | |
167 | 203 | return EXIT_SUCCESS; |
168 | 204 | } |
0 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.10. | |
1 | .TH YKCLIENT "1" "May 2013" "ykclient 2.10" "User Commands" | |
2 | .SH NAME | |
3 | ykclient \- YubiCloud One-Time-Password Validation Client | |
4 | .SH SYNOPSIS | |
5 | .B ykclient | |
6 | [\fIOPTION\fR]... \fICLIENTID YUBIKEYOTP\fR | |
7 | .SH DESCRIPTION | |
8 | Validate the YUBIKEYOTP one\-time\-password against the YubiCloud | |
9 | using CLIENTID as the client identifier. | |
10 | .PP | |
11 | Mandatory arguments to long options are mandatory for short options too. | |
12 | .TP | |
13 | \fB\-\-help\fR | |
14 | Display this help screen | |
15 | .TP | |
16 | \fB\-\-version\fR | |
17 | Display version information | |
18 | .TP | |
19 | \fB\-\-debug\fR | |
20 | Print debugging information | |
21 | .TP | |
22 | \fB\-\-url\fR URL | |
23 | Validation service URL, for example, | |
24 | "http://api.yubico.com/wsapi/verify?id=%d&otp=%s" | |
25 | .TP | |
26 | \fB\-\-ca\fR CADIR | |
27 | Path to directory containing Certificate Authoritity, | |
28 | e.g., "/usr/local/etc/CERTS" | |
29 | .TP | |
30 | \fB\-\-apikey\fR Key | |
31 | API key for HMAC validation of request/response | |
32 | .PP | |
33 | Exit status is 0 on success, 1 if there is a hard failure, 2 if the | |
34 | OTP was replayed, 3 for other soft OTP\-related failures. | |
35 | .SH "REPORTING BUGS" | |
36 | Report bugs at <https://github.com/Yubico/yubico\-c\-client>. |
0 | 0 | /* ykclient.c --- Implementation of Yubikey OTP validation client library. |
1 | 1 | * |
2 | 2 | * Written by Simon Josefsson <simon@josefsson.org>. |
3 | * Copyright (c) 2006-2012 Yubico AB | |
3 | * Copyright (c) 2006-2013 Yubico AB | |
4 | 4 | * All rights reserved. |
5 | 5 | * |
6 | 6 | * Redistribution and use in source and binary forms, with or without |
51 | 51 | { |
52 | 52 | const char *ca_path; |
53 | 53 | size_t num_templates; |
54 | const char **url_templates; | |
54 | char **url_templates; | |
55 | 55 | char last_url[256]; |
56 | 56 | unsigned int client_id; |
57 | 57 | size_t keylen; |
60 | 60 | char *nonce; |
61 | 61 | char nonce_supplied; |
62 | 62 | int verify_signature; |
63 | const char *user_agent; | |
63 | 64 | }; |
64 | 65 | |
65 | 66 | struct curl_data |
66 | 67 | { |
67 | 68 | char *curl_chunk; |
68 | 69 | size_t curl_chunk_size; |
70 | }; | |
71 | ||
72 | struct ykclient_handle_st | |
73 | { | |
74 | CURL **easy; | |
75 | CURLM *multi; | |
76 | size_t num_easy; | |
77 | struct curl_data *data; | |
78 | char **url_exp; | |
69 | 79 | }; |
70 | 80 | |
71 | 81 | const char *default_url_templates[] = { |
78 | 88 | |
79 | 89 | const size_t default_num_templates = 5; |
80 | 90 | |
81 | int | |
91 | /** Initialise the global context for the library | |
92 | * | |
93 | * This function is not thread safe. It must be invoked successfully | |
94 | * before using any other function. | |
95 | * | |
96 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
97 | */ | |
98 | ykclient_rc | |
99 | ykclient_global_init (void) | |
100 | { | |
101 | if (curl_global_init (CURL_GLOBAL_ALL) != 0) | |
102 | return YKCLIENT_CURL_INIT_ERROR; | |
103 | return YKCLIENT_OK; | |
104 | } | |
105 | ||
106 | /** Deinitialise the global context for the library | |
107 | * | |
108 | * This function is not thread safe. After this function has been | |
109 | * called, no other library functions may be used reliably. | |
110 | * | |
111 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
112 | */ | |
113 | void | |
114 | ykclient_global_done (void) | |
115 | { | |
116 | curl_global_cleanup (); | |
117 | } | |
118 | ||
119 | /** Initialise a new configuration structure | |
120 | * | |
121 | * Additional options can be set with ykclient_set_* functions | |
122 | * after memory for the configuration has been allocated with | |
123 | * this function. | |
124 | * | |
125 | * @param ykc Where to write a pointer to the new configuration. | |
126 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
127 | */ | |
128 | ykclient_rc | |
82 | 129 | ykclient_init (ykclient_t ** ykc) |
83 | 130 | { |
84 | 131 | ykclient_t *p; |
86 | 133 | p = malloc (sizeof (*p)); |
87 | 134 | |
88 | 135 | if (!p) |
89 | return YKCLIENT_OUT_OF_MEMORY; | |
90 | ||
91 | memset(p, 0, (sizeof (*p))); | |
136 | { | |
137 | return YKCLIENT_OUT_OF_MEMORY; | |
138 | } | |
139 | ||
140 | memset (p, 0, (sizeof (*p))); | |
92 | 141 | |
93 | 142 | p->ca_path = NULL; |
94 | p->num_templates = 0; | |
95 | p->url_templates = NULL; | |
96 | 143 | |
97 | 144 | p->key = NULL; |
98 | 145 | p->keylen = 0; |
99 | 146 | p->key_buf = NULL; |
100 | 147 | |
101 | memset(p->last_url, 0, sizeof(p->last_url)); | |
148 | memset (p->last_url, 0, sizeof (p->last_url)); | |
102 | 149 | |
103 | 150 | p->nonce = NULL; |
104 | 151 | p->nonce_supplied = 0; |
105 | 152 | |
106 | /* Verification of server signature can only be done if there is | |
107 | * an API key provided | |
153 | /* | |
154 | * Verification of server signature can only be done if there is | |
155 | * an API key provided | |
108 | 156 | */ |
109 | 157 | p->verify_signature = 0; |
110 | 158 | |
111 | 159 | *ykc = p; |
112 | 160 | |
161 | /* | |
162 | * Set the User-Agent string that will be used by the CURL | |
163 | * handles. | |
164 | */ | |
165 | p->user_agent = PACKAGE "/" PACKAGE_VERSION; | |
166 | ||
167 | /* | |
168 | * Set the default URLs (these can be overridden later) | |
169 | */ | |
170 | ykclient_set_url_templates (p, | |
171 | sizeof (default_url_templates) / | |
172 | sizeof (char *), default_url_templates); | |
173 | ||
113 | 174 | return YKCLIENT_OK; |
114 | 175 | } |
115 | 176 | |
177 | /** Frees a configuration structure allocated by ykclient_init | |
178 | * | |
179 | * Any handles created with ykclient_handle_init must be freed | |
180 | * separately with ykclient_handle_done. | |
181 | * | |
182 | * @param ykc configuration to free. | |
183 | */ | |
116 | 184 | void |
117 | 185 | ykclient_done (ykclient_t ** ykc) |
118 | 186 | { |
119 | 187 | if (ykc && *ykc) |
120 | 188 | { |
189 | if ((*ykc)->url_templates) | |
190 | { | |
191 | size_t i; | |
192 | for (i = 0; i < (*ykc)->num_templates; i++) | |
193 | { | |
194 | free ((*ykc)->url_templates[i]); | |
195 | } | |
196 | free ((*ykc)->url_templates); | |
197 | } | |
198 | ||
121 | 199 | free ((*ykc)->key_buf); |
122 | free ((*ykc)->url_templates); | |
123 | 200 | free (*ykc); |
124 | 201 | } |
125 | if (ykc) { | |
126 | *ykc = NULL; | |
127 | } | |
202 | ||
203 | if (ykc) | |
204 | { | |
205 | *ykc = NULL; | |
206 | } | |
207 | } | |
208 | ||
209 | /** Callback for processing CURL data received from the validation server | |
210 | * | |
211 | */ | |
212 | static size_t | |
213 | curl_callback (void *ptr, size_t size, size_t nmemb, void *data) | |
214 | { | |
215 | struct curl_data *curl_data = (struct curl_data *) data; | |
216 | size_t realsize = size * nmemb; | |
217 | char *p; | |
218 | ||
219 | if (curl_data->curl_chunk) | |
220 | { | |
221 | p = realloc (curl_data->curl_chunk, | |
222 | curl_data->curl_chunk_size + realsize + 1); | |
223 | } | |
224 | else | |
225 | { | |
226 | p = malloc (curl_data->curl_chunk_size + realsize + 1); | |
227 | } | |
228 | ||
229 | if (!p) | |
230 | { | |
231 | return 0; | |
232 | } | |
233 | ||
234 | curl_data->curl_chunk = p; | |
235 | ||
236 | memcpy (&(curl_data->curl_chunk[curl_data->curl_chunk_size]), ptr, | |
237 | realsize); | |
238 | curl_data->curl_chunk_size += realsize; | |
239 | curl_data->curl_chunk[curl_data->curl_chunk_size] = 0; | |
240 | ||
241 | return realsize; | |
242 | } | |
243 | ||
244 | /** Create a new handle | |
245 | * | |
246 | * These handles contain curl easy and multi handles required to | |
247 | * process a request. | |
248 | * | |
249 | * This must be called after configuring template URLs, and handles | |
250 | * MUST NOT be reused if new template URLs have been set. | |
251 | * | |
252 | * If new template URLs have been set all handles must be destroyed | |
253 | * with ykclient_handle_close and recreated with this function. | |
254 | * | |
255 | * Handles must be cleaned with ykclient_handle_cleanup between | |
256 | * requests, and closed with ykclient_handle_close when they are no | |
257 | * longer needed. | |
258 | * | |
259 | * @param ykc Yubikey client configuration. | |
260 | * @param[out] ykh where to write pointer to new handle. | |
261 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
262 | */ | |
263 | ykclient_rc | |
264 | ykclient_handle_init (ykclient_t * ykc, ykclient_handle_t ** ykh) | |
265 | { | |
266 | ykclient_handle_t *p; | |
267 | ||
268 | *ykh = NULL; | |
269 | ||
270 | p = malloc (sizeof (*p)); | |
271 | if (!p) | |
272 | { | |
273 | return YKCLIENT_OUT_OF_MEMORY; | |
274 | } | |
275 | memset (p, 0, (sizeof (*p))); | |
276 | ||
277 | p->multi = curl_multi_init (); | |
278 | if (!p->multi) | |
279 | { | |
280 | free (p); | |
281 | return YKCLIENT_CURL_INIT_ERROR; | |
282 | } | |
283 | ||
284 | p->easy = malloc (sizeof (CURL *) * ykc->num_templates); | |
285 | for (p->num_easy = 0; p->num_easy < ykc->num_templates; p->num_easy++) | |
286 | { | |
287 | CURL *easy; | |
288 | struct curl_data *data; | |
289 | ||
290 | data = malloc (sizeof (*data)); | |
291 | if (!data) | |
292 | { | |
293 | ykclient_handle_done (&p); | |
294 | return YKCLIENT_OUT_OF_MEMORY; | |
295 | } | |
296 | data->curl_chunk = NULL; | |
297 | data->curl_chunk_size = 0; | |
298 | ||
299 | easy = curl_easy_init (); | |
300 | if (!easy) | |
301 | { | |
302 | free (data); | |
303 | ykclient_handle_done (&p); | |
304 | return YKCLIENT_CURL_INIT_ERROR; | |
305 | } | |
306 | ||
307 | if (ykc->ca_path) | |
308 | { | |
309 | curl_easy_setopt (easy, CURLOPT_CAPATH, ykc->ca_path); | |
310 | } | |
311 | ||
312 | curl_easy_setopt (easy, CURLOPT_WRITEDATA, (void *) data); | |
313 | curl_easy_setopt (easy, CURLOPT_PRIVATE, (void *) data); | |
314 | curl_easy_setopt (easy, CURLOPT_WRITEFUNCTION, curl_callback); | |
315 | curl_easy_setopt (easy, CURLOPT_USERAGENT, ykc->user_agent); | |
316 | ||
317 | curl_multi_add_handle (p->multi, easy); | |
318 | p->easy[p->num_easy] = easy; | |
319 | } | |
320 | ||
321 | /* Take this opportunity to allocate the array for expanded URLs */ | |
322 | p->url_exp = malloc (sizeof (char *) * p->num_easy); | |
323 | if (!p->url_exp) | |
324 | { | |
325 | ykclient_handle_done (&p); | |
326 | return YKCLIENT_OUT_OF_MEMORY; | |
327 | } | |
328 | memset (p->url_exp, 0, (sizeof (char *) * p->num_easy)); | |
329 | ||
330 | *ykh = p; | |
331 | ||
332 | return YKCLIENT_OK; | |
333 | } | |
334 | ||
335 | /** Cleanup memory allocated for requests | |
336 | * | |
337 | * Cleans up any memory allocated and held by the handle for a | |
338 | * request. Must be called after each request. | |
339 | * | |
340 | * @param ykh to close. | |
341 | */ | |
342 | void | |
343 | ykclient_handle_cleanup (ykclient_handle_t * ykh) | |
344 | { | |
345 | size_t i; | |
346 | struct curl_data *data; | |
347 | int requests = 0; | |
348 | ||
349 | /* | |
350 | * Curl will not allow a connection to be re-used unless the | |
351 | * request finished, call curl_multi_perform one last time | |
352 | * to give libcurl an opportunity to mark the request as | |
353 | * complete. | |
354 | * | |
355 | * If the delay between yk_request_send and | |
356 | * ykclient_handle_cleanup is sufficient to allow the request | |
357 | * to complete, the connection can be re-used, else it will | |
358 | * be re-established on next yk_request_send. | |
359 | */ | |
360 | (void) curl_multi_perform (ykh->multi, &requests); | |
361 | ||
362 | for (i = 0; i < ykh->num_easy; i++) | |
363 | { | |
364 | free (ykh->url_exp[i]); | |
365 | ykh->url_exp[i] = NULL; | |
366 | ||
367 | curl_easy_getinfo (ykh->easy[i], CURLINFO_PRIVATE, (char **) &data); | |
368 | free (data->curl_chunk); | |
369 | data->curl_chunk = NULL; | |
370 | data->curl_chunk_size = 0; | |
371 | ||
372 | curl_multi_remove_handle (ykh->multi, ykh->easy[i]); | |
373 | curl_multi_add_handle (ykh->multi, ykh->easy[i]); | |
374 | } | |
375 | } | |
376 | ||
377 | /** Close a handle freeing memory and destroying connections | |
378 | * | |
379 | * Frees any memory allocated for the handle, and calls various CURL | |
380 | * functions to destroy all curl easy and multi handles created for | |
381 | * this handle. | |
382 | * | |
383 | * @param ykh to close. | |
384 | */ | |
385 | void | |
386 | ykclient_handle_done (ykclient_handle_t ** ykh) | |
387 | { | |
388 | struct curl_data *data; | |
389 | size_t i; | |
390 | ||
391 | if (ykh && *ykh) | |
392 | { | |
393 | ykclient_handle_cleanup (*ykh); | |
394 | ||
395 | for (i = 0; i < (*ykh)->num_easy; i++) | |
396 | { | |
397 | curl_easy_getinfo ((*ykh)->easy[i], CURLINFO_PRIVATE, | |
398 | (char **) &data); | |
399 | free (data); | |
400 | ||
401 | curl_multi_remove_handle ((*ykh)->multi, (*ykh)->easy[i]); | |
402 | curl_easy_cleanup ((*ykh)->easy[i]); | |
403 | } | |
404 | ||
405 | if ((*ykh)->multi) | |
406 | { | |
407 | curl_multi_cleanup ((*ykh)->multi); | |
408 | } | |
409 | ||
410 | free ((*ykh)->url_exp); | |
411 | free ((*ykh)->easy); | |
412 | free (*ykh); | |
413 | } | |
414 | ||
415 | if (ykh) | |
416 | { | |
417 | *ykh = NULL; | |
418 | } | |
128 | 419 | } |
129 | 420 | |
130 | 421 | void |
131 | 422 | ykclient_set_verify_signature (ykclient_t * ykc, int value) |
132 | 423 | { |
133 | 424 | if (ykc == NULL) |
134 | return; | |
425 | { | |
426 | return; | |
427 | } | |
428 | ||
135 | 429 | ykc->verify_signature = value; |
136 | 430 | } |
137 | 431 | |
144 | 438 | ykc->key = key; |
145 | 439 | } |
146 | 440 | |
147 | int | |
441 | ykclient_rc | |
148 | 442 | ykclient_set_client_hex (ykclient_t * ykc, |
149 | 443 | unsigned int client_id, const char *key) |
150 | 444 | { |
155 | 449 | ykc->client_id = client_id; |
156 | 450 | |
157 | 451 | if (key == NULL) |
158 | return YKCLIENT_OK; | |
452 | { | |
453 | return YKCLIENT_OK; | |
454 | } | |
159 | 455 | |
160 | 456 | key_len = strlen (key); |
161 | 457 | |
162 | 458 | if (key_len % 2 != 0) |
163 | return YKCLIENT_HEX_DECODE_ERROR; | |
459 | { | |
460 | return YKCLIENT_HEX_DECODE_ERROR; | |
461 | } | |
164 | 462 | |
165 | 463 | bin_len = key_len / 2; |
166 | 464 | |
167 | 465 | free (ykc->key_buf); |
466 | ||
168 | 467 | ykc->key_buf = malloc (bin_len); |
169 | 468 | if (!ykc->key_buf) |
170 | return YKCLIENT_OUT_OF_MEMORY; | |
469 | { | |
470 | return YKCLIENT_OUT_OF_MEMORY; | |
471 | } | |
171 | 472 | |
172 | 473 | for (i = 0; i < bin_len; i++) |
173 | 474 | { |
189 | 490 | return YKCLIENT_OK; |
190 | 491 | } |
191 | 492 | |
192 | int | |
493 | ykclient_rc | |
193 | 494 | ykclient_set_client_b64 (ykclient_t * ykc, |
194 | 495 | unsigned int client_id, const char *key) |
195 | 496 | { |
196 | 497 | size_t key_len; |
498 | ssize_t dec_len; | |
499 | ||
197 | 500 | base64_decodestate b64; |
198 | 501 | |
199 | 502 | ykc->client_id = client_id; |
200 | 503 | |
201 | 504 | if (key == NULL) |
202 | return YKCLIENT_OK; | |
505 | { | |
506 | return YKCLIENT_OK; | |
507 | } | |
203 | 508 | |
204 | 509 | key_len = strlen (key); |
205 | 510 | |
206 | 511 | free (ykc->key_buf); |
512 | ||
207 | 513 | ykc->key_buf = malloc (key_len + 1); |
208 | 514 | if (!ykc->key_buf) |
209 | return YKCLIENT_OUT_OF_MEMORY; | |
515 | { | |
516 | return YKCLIENT_OUT_OF_MEMORY; | |
517 | } | |
210 | 518 | |
211 | 519 | base64_init_decodestate (&b64); |
212 | ykc->keylen = base64_decode_block (key, key_len, ykc->key_buf, &b64); | |
520 | dec_len = (ssize_t) base64_decode_block (key, key_len, ykc->key_buf, &b64); | |
521 | if (dec_len < 0) | |
522 | { | |
523 | return YKCLIENT_BASE64_DECODE_ERROR; | |
524 | } | |
525 | ykc->keylen = (size_t) dec_len; | |
213 | 526 | ykc->key = ykc->key_buf; |
527 | ||
214 | 528 | /* Now that we have a key the sensible default is to verify signatures */ |
215 | 529 | ykc->verify_signature = 1; |
216 | 530 | |
217 | 531 | return YKCLIENT_OK; |
218 | 532 | } |
219 | 533 | |
534 | /** Set the CA path | |
535 | * | |
536 | * Must be called before creating handles. | |
537 | */ | |
220 | 538 | void |
221 | 539 | ykclient_set_ca_path (ykclient_t * ykc, const char *ca_path) |
222 | 540 | { |
223 | 541 | ykc->ca_path = ca_path; |
224 | 542 | } |
225 | 543 | |
226 | void | |
544 | /** Set a single URL template | |
545 | * | |
546 | * @param ykc Yubikey client configuration. | |
547 | * @param url_template to set. | |
548 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
549 | */ | |
550 | ykclient_rc | |
227 | 551 | ykclient_set_url_template (ykclient_t * ykc, const char *url_template) |
228 | 552 | { |
229 | ykclient_set_url_templates (ykc, 1, (const char **) &url_template); | |
230 | } | |
231 | ||
232 | int | |
553 | return ykclient_set_url_templates (ykc, 1, (const char **) &url_template); | |
554 | } | |
555 | ||
556 | /** Set the URLs of the YK validation servers | |
557 | * | |
558 | * The URL strings will be copied to the new buffers, so the | |
559 | * caller may free the original URL strings if they are no | |
560 | * longer needed. | |
561 | * | |
562 | * @note This function MUST be called before calling ykclient_handle_init | |
563 | * | |
564 | * @param ykc Yubikey client configuration. | |
565 | * @param num_templates Number of template URLs passed in url_templates. | |
566 | * @param url_templates Array of template URL strings. | |
567 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
568 | */ | |
569 | ykclient_rc | |
233 | 570 | ykclient_set_url_templates (ykclient_t * ykc, size_t num_templates, |
234 | 571 | const char **url_templates) |
235 | 572 | { |
236 | int i; | |
237 | if(num_templates > MAX_TEMPLATES) | |
238 | return YKCLIENT_BAD_INPUT; | |
239 | free(ykc->url_templates); | |
240 | ykc->url_templates = malloc(sizeof(char*) * num_templates); | |
241 | if(!ykc->url_templates) | |
242 | return YKCLIENT_OUT_OF_MEMORY; | |
243 | ykc->num_templates = num_templates; | |
244 | for(i = 0; i < num_templates; i++) { | |
245 | ykc->url_templates[i] = url_templates[i]; | |
246 | } | |
573 | size_t i; | |
574 | if (num_templates > MAX_TEMPLATES) | |
575 | { | |
576 | return YKCLIENT_BAD_INPUT; | |
577 | } | |
578 | ||
579 | /* Clean out any previously allocated templates */ | |
580 | if (ykc->url_templates) | |
581 | { | |
582 | for (i = 0; i < ykc->num_templates; i++) | |
583 | { | |
584 | free (ykc->url_templates[i]); | |
585 | } | |
586 | free (ykc->url_templates); | |
587 | } | |
588 | ||
589 | /* Reallocate the template array */ | |
590 | ykc->url_templates = malloc (sizeof (char *) * num_templates); | |
591 | if (!ykc->url_templates) | |
592 | { | |
593 | return YKCLIENT_OUT_OF_MEMORY; | |
594 | } | |
595 | memset (ykc->url_templates, 0, (sizeof (char *) * num_templates)); | |
596 | ||
597 | for (ykc->num_templates = 0; ykc->num_templates < num_templates; | |
598 | ykc->num_templates++) | |
599 | { | |
600 | ykc->url_templates[ykc->num_templates] = | |
601 | strdup (url_templates[ykc->num_templates]); | |
602 | ||
603 | if (!ykc->url_templates[ykc->num_templates]) | |
604 | { | |
605 | return YKCLIENT_OUT_OF_MEMORY; | |
606 | } | |
607 | } | |
247 | 608 | return YKCLIENT_OK; |
248 | 609 | } |
249 | 610 | |
250 | 611 | /* |
251 | * Set the nonce. A default nonce is generated in ykclient_init(), but | |
612 | * Set the nonce. A default nonce is generated in ykclient_init (), but | |
252 | 613 | * if you either want to specify your own nonce, or want to remove the |
253 | 614 | * nonce (needed to send signed requests to v1 validation servers), |
254 | 615 | * you must call this function. Set nonce to NULL to disable it. |
260 | 621 | ykc->nonce = nonce; |
261 | 622 | } |
262 | 623 | |
263 | /* | |
264 | * Simple API to validate an OTP (hexkey) using the YubiCloud validation | |
265 | * service. | |
266 | */ | |
267 | int | |
268 | ykclient_verify_otp (const char *yubikey_otp, | |
269 | unsigned int client_id, const char *hexkey) | |
270 | { | |
271 | return ykclient_verify_otp_v2 (NULL, | |
272 | yubikey_otp, | |
273 | client_id, hexkey, 0, NULL, NULL); | |
274 | } | |
275 | ||
276 | /* | |
277 | * Extended API to validate an OTP (hexkey) using either the YubiCloud | |
278 | * validation service, or any other validation service. | |
279 | * | |
280 | * Special CURL settings can be achieved by passing a non-null ykc_in. | |
281 | */ | |
282 | int | |
624 | /** Convert a ykclient_rc value to a string | |
625 | * | |
626 | * Returns a more verbose error message relating to the ykclient_rc | |
627 | * value passed as ret. | |
628 | * | |
629 | * @param ret the error code to convert. | |
630 | * @return verbose error string. | |
631 | */ | |
632 | const char * | |
633 | ykclient_strerror (ykclient_rc ret) | |
634 | { | |
635 | const char *p; | |
636 | ||
637 | switch (ret) | |
638 | { | |
639 | case YKCLIENT_OK: | |
640 | p = "Success"; | |
641 | break; | |
642 | ||
643 | case YKCLIENT_CURL_PERFORM_ERROR: | |
644 | p = "Error performing curl"; | |
645 | break; | |
646 | ||
647 | case YKCLIENT_BAD_OTP: | |
648 | p = "Yubikey OTP was bad (BAD_OTP)"; | |
649 | break; | |
650 | ||
651 | case YKCLIENT_REPLAYED_OTP: | |
652 | p = "Yubikey OTP was replayed (REPLAYED_OTP)"; | |
653 | break; | |
654 | ||
655 | case YKCLIENT_REPLAYED_REQUEST: | |
656 | p = "Yubikey request was replayed (REPLAYED_REQUEST)"; | |
657 | break; | |
658 | ||
659 | case YKCLIENT_BAD_SIGNATURE: | |
660 | p = "Request signature was invalid (BAD_SIGNATURE)"; | |
661 | break; | |
662 | ||
663 | case YKCLIENT_BAD_SERVER_SIGNATURE: | |
664 | p = "Server response signature was invalid (BAD_SERVER_SIGNATURE)"; | |
665 | break; | |
666 | ||
667 | case YKCLIENT_MISSING_PARAMETER: | |
668 | p = "Request was missing a parameter (MISSING_PARAMETER)"; | |
669 | break; | |
670 | ||
671 | case YKCLIENT_NO_SUCH_CLIENT: | |
672 | p = "Client identity does not exist (NO_SUCH_CLIENT)"; | |
673 | break; | |
674 | ||
675 | case YKCLIENT_OPERATION_NOT_ALLOWED: | |
676 | p = "Authorization denied (OPERATION_NOT_ALLOWED)"; | |
677 | break; | |
678 | ||
679 | case YKCLIENT_BACKEND_ERROR: | |
680 | p = "Internal server error (BACKEND_ERROR)"; | |
681 | break; | |
682 | ||
683 | case YKCLIENT_NOT_ENOUGH_ANSWERS: | |
684 | p = "Too few validation servers available (NOT_ENOUGH_ANSWERS)"; | |
685 | break; | |
686 | ||
687 | case YKCLIENT_OUT_OF_MEMORY: | |
688 | p = "Out of memory"; | |
689 | break; | |
690 | ||
691 | case YKCLIENT_PARSE_ERROR: | |
692 | p = "Could not parse server response"; | |
693 | break; | |
694 | ||
695 | case YKCLIENT_FORMAT_ERROR: | |
696 | p = "Internal printf format error"; | |
697 | break; | |
698 | ||
699 | case YKCLIENT_CURL_INIT_ERROR: | |
700 | p = "Error initializing curl"; | |
701 | break; | |
702 | ||
703 | case YKCLIENT_HMAC_ERROR: | |
704 | p = "HMAC signature validation/generation error"; | |
705 | break; | |
706 | ||
707 | case YKCLIENT_HEX_DECODE_ERROR: | |
708 | p = "Error decoding hex string"; | |
709 | break; | |
710 | ||
711 | case YKCLIENT_BASE64_DECODE_ERROR: | |
712 | p = "Error decoding base64 string"; | |
713 | break; | |
714 | ||
715 | case YKCLIENT_NOT_IMPLEMENTED: | |
716 | p = "Not implemented"; | |
717 | break; | |
718 | ||
719 | case YKCLIENT_HANDLE_NOT_REINIT: | |
720 | p = "Request template URLs modified without reinitialising handles"; | |
721 | break; | |
722 | ||
723 | case YKCLIENT_BAD_INPUT: | |
724 | p = "Passed invalid or incorrect number of parameters"; | |
725 | break; | |
726 | ||
727 | default: | |
728 | p = "Unknown error"; | |
729 | } | |
730 | ||
731 | return p; | |
732 | } | |
733 | ||
734 | /** Generates or duplicates an existing nonce value | |
735 | * | |
736 | * If a nonce value was set with ykclient_set_nonce, it will be duplicated | |
737 | * and a pointer to the memory returned in nonce. | |
738 | * | |
739 | * If a nonce value has not been set a new buffer will be allocated and a | |
740 | * random string of NONCE_LEN will be written to it. | |
741 | * | |
742 | * Memory pointed to by nonce must be freed by the called when it is no | |
743 | * longer requiest. | |
744 | * | |
745 | * @param ykc Yubikey client configuration. | |
746 | * @param[out] nonce where to write the pointer to the nonce value. | |
747 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
748 | */ | |
749 | static ykclient_rc | |
750 | ykclient_generate_nonce (ykclient_t * ykc, char **nonce) | |
751 | { | |
752 | *nonce = NULL; | |
753 | ||
754 | /* | |
755 | * If we were supplied with a static value just strdup, | |
756 | * makes memory management easier. | |
757 | */ | |
758 | if (ykc->nonce_supplied) | |
759 | { | |
760 | if (ykc->nonce) | |
761 | { | |
762 | *nonce = strdup (ykc->nonce); | |
763 | if (*nonce == NULL) | |
764 | return YKCLIENT_OUT_OF_MEMORY; | |
765 | } | |
766 | } | |
767 | /* | |
768 | * Generate a random 'nonce' value | |
769 | */ | |
770 | else | |
771 | { | |
772 | struct timeval tv; | |
773 | size_t i; | |
774 | char *p; | |
775 | ||
776 | p = malloc (NONCE_LEN + 1); | |
777 | if (!p) | |
778 | { | |
779 | return YKCLIENT_OUT_OF_MEMORY; | |
780 | } | |
781 | ||
782 | gettimeofday (&tv, 0); | |
783 | srandom (tv.tv_sec * tv.tv_usec); | |
784 | ||
785 | for (i = 0; i < NONCE_LEN; ++i) | |
786 | { | |
787 | p[i] = (random () % 26) + 'a'; | |
788 | } | |
789 | ||
790 | p[NONCE_LEN] = 0; | |
791 | ||
792 | *nonce = p; | |
793 | } | |
794 | ||
795 | return YKCLIENT_OK; | |
796 | } | |
797 | ||
798 | /** Expand URL templates specified with set_url_templates | |
799 | * | |
800 | * Expands placeholderss or inserts additional parameters for nonce, | |
801 | * OTP, and signing values into duplicates of URL templates. | |
802 | * | |
803 | * The memory allocated for these duplicates must be freed | |
804 | * by calling either ykclient_handle_done or ykclient_handle_cleanup | |
805 | * after they are no longer needed. | |
806 | * | |
807 | * @param ykc Yubikey client configuration. | |
808 | * @param ykh Yubikey client handle. | |
809 | * @param yubikey OTP string passed to the client. | |
810 | * @param nonce Random value included in the request and validated in the response. | |
811 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
812 | */ | |
813 | static ykclient_rc | |
814 | ykclient_expand_urls (ykclient_t * ykc, ykclient_handle_t * ykh, | |
815 | const char *yubikey, const char *nonce) | |
816 | { | |
817 | ykclient_rc out = YKCLIENT_OK; | |
818 | ||
819 | size_t i, j; | |
820 | ||
821 | char *signature = NULL; | |
822 | char *encoded_otp = NULL; | |
823 | ||
824 | /* The handle must have the same number of easy handles as we have templates */ | |
825 | if (ykc->num_templates != ykh->num_easy) | |
826 | { | |
827 | return YKCLIENT_HANDLE_NOT_REINIT; | |
828 | } | |
829 | ||
830 | /* URL-encode the OTP */ | |
831 | encoded_otp = curl_easy_escape (ykh->multi, yubikey, 0); | |
832 | ||
833 | for (i = 0; i < ykc->num_templates; i++) | |
834 | { | |
835 | { | |
836 | size_t len; | |
837 | ssize_t wrote; | |
838 | ||
839 | len = strlen (ykc->url_templates[i]) + strlen (encoded_otp) + 20; | |
840 | ykh->url_exp[i] = malloc (len); | |
841 | if (!ykh->url_exp[i]) | |
842 | { | |
843 | out = YKCLIENT_OUT_OF_MEMORY; | |
844 | goto finish; | |
845 | } | |
846 | ||
847 | wrote = snprintf (ykh->url_exp[i], len, ykc->url_templates[i], | |
848 | ykc->client_id, encoded_otp); | |
849 | if (wrote < 0 || (size_t) wrote > len) | |
850 | { | |
851 | out = YKCLIENT_FORMAT_ERROR; | |
852 | goto finish; | |
853 | } | |
854 | } | |
855 | ||
856 | if (nonce) | |
857 | { | |
858 | /* Create new URL with nonce in it. */ | |
859 | char *nonce_url, *otp_offset; | |
860 | size_t len; | |
861 | ssize_t wrote; | |
862 | ||
863 | #define ADD_NONCE "&nonce=" | |
864 | len = | |
865 | strlen (ykh->url_exp[i]) + strlen (ADD_NONCE) + strlen (nonce) + | |
866 | 1; | |
867 | nonce_url = malloc (len + 4); /* avoid valgrind complaint */ | |
868 | if (!nonce_url) | |
869 | { | |
870 | out = YKCLIENT_OUT_OF_MEMORY; | |
871 | goto finish; | |
872 | } | |
873 | ||
874 | /* Find the &otp= in url and insert ?nonce= before otp. Must get | |
875 | * sorted headers since we calculate HMAC on the result. | |
876 | * | |
877 | * XXX this will break if the validation protocol gets a parameter that | |
878 | * sorts in between "nonce" and "otp", because the headers we sign won't | |
879 | * be alphabetically sorted if we insert the nonce between "nz" and "otp". | |
880 | * Also, we assume that everyone will have at least one parameter ("id=") | |
881 | * before "otp" so there is no need to search for "?otp=". | |
882 | */ | |
883 | otp_offset = strstr (ykh->url_exp[i], "&otp="); | |
884 | if (otp_offset == NULL) | |
885 | { | |
886 | /* point at \0 at end of url in case there is no otp */ | |
887 | otp_offset = ykh->url_exp[i] + len; | |
888 | } | |
889 | ||
890 | /* break up ykc->url where we want to insert nonce */ | |
891 | *otp_offset = 0; | |
892 | ||
893 | wrote = | |
894 | snprintf (nonce_url, len, "%s" ADD_NONCE "%s&%s", ykh->url_exp[i], | |
895 | nonce, otp_offset + 1); | |
896 | if (wrote < 0 || (size_t) wrote + 1 != len) | |
897 | { | |
898 | free (nonce_url); | |
899 | ||
900 | out = YKCLIENT_FORMAT_ERROR; | |
901 | goto finish; | |
902 | } | |
903 | ||
904 | free (ykh->url_exp[i]); | |
905 | ykh->url_exp[i] = nonce_url; | |
906 | } | |
907 | ||
908 | if (ykc->key && ykc->keylen) | |
909 | { | |
910 | if (!signature) | |
911 | { | |
912 | char b64dig[3 * 4 * SHA1HashSize + 1]; | |
913 | uint8_t digest[USHAMaxHashSize]; | |
914 | base64_encodestate b64; | |
915 | char *text; | |
916 | int res, res2; | |
917 | ||
918 | /* Find parameters to sign. */ | |
919 | text = strchr (ykh->url_exp[i], '?'); | |
920 | if (!text) | |
921 | { | |
922 | out = YKCLIENT_PARSE_ERROR; | |
923 | goto finish; | |
924 | } | |
925 | text++; | |
926 | ||
927 | /* HMAC data. */ | |
928 | res = hmac (SHA1, (unsigned char *) text, strlen (text), | |
929 | (const unsigned char *) ykc->key, ykc->keylen, | |
930 | digest); | |
931 | if (res != shaSuccess) | |
932 | { | |
933 | out = YKCLIENT_HMAC_ERROR; | |
934 | goto finish; | |
935 | } | |
936 | ||
937 | /* Base64 signature. */ | |
938 | base64_init_encodestate (&b64); | |
939 | res = | |
940 | base64_encode_block ((char *) digest, SHA1HashSize, b64dig, | |
941 | &b64); | |
942 | res2 = base64_encode_blockend (&b64dig[res], &b64); | |
943 | b64dig[res + res2 - 1] = '\0'; | |
944 | ||
945 | signature = curl_easy_escape (ykh->multi, b64dig, 0); | |
946 | } | |
947 | ||
948 | /* Create new URL with signature ( h= ) appended to it . */ | |
949 | { | |
950 | char *sign_url; | |
951 | size_t len; | |
952 | ssize_t wrote; | |
953 | ||
954 | #define ADD_HASH "&h=" | |
955 | len = | |
956 | strlen (ykh->url_exp[i]) + strlen (ADD_HASH) + | |
957 | strlen (signature) + 1; | |
958 | sign_url = malloc (len); | |
959 | if (!sign_url) | |
960 | { | |
961 | free (sign_url); | |
962 | ||
963 | out = YKCLIENT_OUT_OF_MEMORY; | |
964 | goto finish; | |
965 | } | |
966 | ||
967 | wrote = | |
968 | snprintf (sign_url, len, "%s" ADD_HASH "%s", ykh->url_exp[i], | |
969 | signature); | |
970 | if (wrote < 0 || (size_t) wrote + 1 != len) | |
971 | { | |
972 | free (sign_url); | |
973 | ||
974 | out = YKCLIENT_FORMAT_ERROR; | |
975 | goto finish; | |
976 | } | |
977 | ||
978 | free (ykh->url_exp[i]); | |
979 | ykh->url_exp[i] = sign_url; | |
980 | } | |
981 | } | |
982 | ||
983 | curl_easy_setopt (ykh->easy[i], CURLOPT_URL, ykh->url_exp[i]); | |
984 | } | |
985 | ||
986 | finish: | |
987 | ||
988 | if (encoded_otp) | |
989 | { | |
990 | curl_free (encoded_otp); | |
991 | } | |
992 | ||
993 | if (signature) | |
994 | { | |
995 | curl_free (signature); | |
996 | } | |
997 | ||
998 | /* On error free any URLs we previously built */ | |
999 | if (out != YKCLIENT_OK) | |
1000 | { | |
1001 | for (j = 0; j < i; j++) | |
1002 | { | |
1003 | free (ykh->url_exp[j]); | |
1004 | ykh->url_exp[j] = NULL; | |
1005 | } | |
1006 | } | |
1007 | ||
1008 | return out; | |
1009 | } | |
1010 | ||
1011 | /** Convert the response from the validation server into a ykclient_rc | |
1012 | * | |
1013 | * @param status message from the validation server. | |
1014 | * @return one of the YKCLIENT_* values. | |
1015 | */ | |
1016 | static ykclient_rc | |
1017 | ykclient_parse_srv_error (const char *status) | |
1018 | { | |
1019 | if (strcmp (status, "OK") == 0) | |
1020 | { | |
1021 | return YKCLIENT_OK; | |
1022 | } | |
1023 | else if (strcmp (status, "BAD_OTP") == 0) | |
1024 | { | |
1025 | return YKCLIENT_BAD_OTP; | |
1026 | } | |
1027 | else if (strcmp (status, "REPLAYED_OTP") == 0) | |
1028 | { | |
1029 | return YKCLIENT_REPLAYED_OTP; | |
1030 | } | |
1031 | else if (strcmp (status, "REPLAYED_REQUEST") == 0) | |
1032 | { | |
1033 | return YKCLIENT_REPLAYED_REQUEST; | |
1034 | } | |
1035 | else if (strcmp (status, "BAD_SIGNATURE") == 0) | |
1036 | { | |
1037 | return YKCLIENT_BAD_SIGNATURE; | |
1038 | } | |
1039 | else if (strcmp (status, "MISSING_PARAMETER") == 0) | |
1040 | { | |
1041 | return YKCLIENT_MISSING_PARAMETER; | |
1042 | } | |
1043 | else if (strcmp (status, "NO_SUCH_CLIENT") == 0) | |
1044 | { | |
1045 | return YKCLIENT_NO_SUCH_CLIENT; | |
1046 | } | |
1047 | else if (strcmp (status, "OPERATION_NOT_ALLOWED") == 0) | |
1048 | { | |
1049 | return YKCLIENT_OPERATION_NOT_ALLOWED; | |
1050 | } | |
1051 | else if (strcmp (status, "BACKEND_ERROR") == 0) | |
1052 | { | |
1053 | return YKCLIENT_BACKEND_ERROR; | |
1054 | } | |
1055 | else if (strcmp (status, "NOT_ENOUGH_ANSWERS") == 0) | |
1056 | { | |
1057 | return YKCLIENT_NOT_ENOUGH_ANSWERS; | |
1058 | } | |
1059 | ||
1060 | return YKCLIENT_PARSE_ERROR; | |
1061 | } | |
1062 | ||
1063 | /** Send requests to one or more validation servers and processes the response | |
1064 | * | |
1065 | * @param ykc Yubikey client configuration. | |
1066 | * @param ykh Yubikey client handle. | |
1067 | * @param yubikey OTP string passed to the client. | |
1068 | * @param nonce Random value included in the request and validated in the response. | |
1069 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
1070 | */ | |
1071 | static ykclient_rc | |
1072 | ykclient_request_send (ykclient_t * ykc, ykclient_handle_t * ykh, | |
1073 | const char *yubikey, char *nonce) | |
1074 | { | |
1075 | ykclient_rc out = YKCLIENT_OK; | |
1076 | int requests; | |
1077 | ykclient_server_response_t *srv_response = NULL; | |
1078 | ||
1079 | if (!ykc->num_templates) | |
1080 | { | |
1081 | return YKCLIENT_MISSING_PARAMETER; | |
1082 | } | |
1083 | ||
1084 | /* The handle must have the same number of easy handles as we have templates */ | |
1085 | if (ykc->num_templates != ykh->num_easy) | |
1086 | { | |
1087 | return YKCLIENT_HANDLE_NOT_REINIT; | |
1088 | } | |
1089 | ||
1090 | memset (ykc->last_url, 0, sizeof (ykc->last_url)); | |
1091 | ||
1092 | /* Perform the request */ | |
1093 | do | |
1094 | { | |
1095 | int msgs = 1; | |
1096 | CURLMcode curl_ret = curl_multi_perform (ykh->multi, &requests); | |
1097 | struct timeval timeout; | |
1098 | ||
1099 | fd_set fdread; | |
1100 | fd_set fdwrite; | |
1101 | fd_set fdexcep; | |
1102 | int maxfd = -1; | |
1103 | ||
1104 | long curl_timeo = -1; | |
1105 | ||
1106 | /* curl before 7.20.0 can return CURLM_CALL_MULTI_PERFORM, continue so we | |
1107 | * call curl_multi_perform again. */ | |
1108 | if (curl_ret == CURLM_CALL_MULTI_PERFORM) | |
1109 | { | |
1110 | continue; | |
1111 | } | |
1112 | ||
1113 | if (curl_ret != CURLM_OK) | |
1114 | { | |
1115 | fprintf (stderr, "Error with curl: %s\n", | |
1116 | curl_multi_strerror (curl_ret)); | |
1117 | out = YKCLIENT_CURL_PERFORM_ERROR; | |
1118 | goto finish; | |
1119 | } | |
1120 | ||
1121 | FD_ZERO (&fdread); | |
1122 | FD_ZERO (&fdwrite); | |
1123 | FD_ZERO (&fdexcep); | |
1124 | ||
1125 | memset (&timeout, 0, sizeof (timeout)); | |
1126 | ||
1127 | timeout.tv_sec = 0; | |
1128 | timeout.tv_usec = 250000; | |
1129 | ||
1130 | curl_multi_timeout (ykh->multi, &curl_timeo); | |
1131 | if (curl_timeo >= 0) | |
1132 | { | |
1133 | timeout.tv_sec = curl_timeo / 1000; | |
1134 | if (timeout.tv_sec > 1) | |
1135 | { | |
1136 | timeout.tv_sec = 0; | |
1137 | timeout.tv_usec = 250000; | |
1138 | } | |
1139 | else | |
1140 | { | |
1141 | timeout.tv_usec = (curl_timeo % 1000) * 1000; | |
1142 | } | |
1143 | } | |
1144 | ||
1145 | curl_multi_fdset (ykh->multi, &fdread, &fdwrite, &fdexcep, &maxfd); | |
1146 | select (maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout); | |
1147 | ||
1148 | while (msgs) | |
1149 | { | |
1150 | CURL *curl_easy; | |
1151 | struct curl_data *data; | |
1152 | char *url_used; | |
1153 | char *status; | |
1154 | CURLMsg *msg; | |
1155 | ||
1156 | msg = curl_multi_info_read (ykh->multi, &msgs); | |
1157 | if (!msg || msg->msg != CURLMSG_DONE) | |
1158 | { | |
1159 | continue; | |
1160 | } | |
1161 | ||
1162 | curl_easy = msg->easy_handle; | |
1163 | ||
1164 | curl_easy_getinfo (curl_easy, CURLINFO_PRIVATE, (char **) &data); | |
1165 | ||
1166 | if (data == 0 || data->curl_chunk_size == 0 || | |
1167 | data->curl_chunk == NULL) | |
1168 | { | |
1169 | out = YKCLIENT_PARSE_ERROR; | |
1170 | goto finish; | |
1171 | } | |
1172 | ||
1173 | curl_easy_getinfo (curl_easy, CURLINFO_EFFECTIVE_URL, &url_used); | |
1174 | strncpy (ykc->last_url, url_used, sizeof (ykc->last_url)); | |
1175 | ||
1176 | srv_response = ykclient_server_response_init (); | |
1177 | if (srv_response == NULL) | |
1178 | { | |
1179 | out = YKCLIENT_PARSE_ERROR; | |
1180 | goto finish; | |
1181 | } | |
1182 | ||
1183 | out = ykclient_server_response_parse (data->curl_chunk, | |
1184 | srv_response); | |
1185 | if (out != YKCLIENT_OK) | |
1186 | { | |
1187 | goto finish; | |
1188 | } | |
1189 | ||
1190 | if (ykc->verify_signature != 0 && | |
1191 | ykclient_server_response_verify_signature (srv_response, | |
1192 | ykc->key, | |
1193 | ykc->keylen)) | |
1194 | { | |
1195 | out = YKCLIENT_BAD_SERVER_SIGNATURE; | |
1196 | goto finish; | |
1197 | } | |
1198 | ||
1199 | status = ykclient_server_response_get (srv_response, "status"); | |
1200 | if (!status) | |
1201 | { | |
1202 | out = YKCLIENT_PARSE_ERROR; | |
1203 | goto finish; | |
1204 | } | |
1205 | ||
1206 | out = ykclient_parse_srv_error (status); | |
1207 | if (out == YKCLIENT_OK) | |
1208 | { | |
1209 | char *server_otp; | |
1210 | ||
1211 | /* Verify that the OTP and nonce we put in our request is echoed | |
1212 | * in the response. | |
1213 | * | |
1214 | * This is to protect us from a man in the middle sending us a | |
1215 | * previously seen genuine response again (such as an status=OK | |
1216 | * response even though the real server will respond | |
1217 | * status=REPLAYED_OTP in a few milliseconds. | |
1218 | */ | |
1219 | if (nonce) | |
1220 | { | |
1221 | char *server_nonce = | |
1222 | ykclient_server_response_get (srv_response, | |
1223 | "nonce"); | |
1224 | if (server_nonce == NULL || strcmp (nonce, server_nonce)) | |
1225 | { | |
1226 | out = YKCLIENT_HMAC_ERROR; | |
1227 | goto finish; | |
1228 | } | |
1229 | } | |
1230 | ||
1231 | server_otp = ykclient_server_response_get (srv_response, "otp"); | |
1232 | if (server_otp == NULL || strcmp (yubikey, server_otp)) | |
1233 | { | |
1234 | out = YKCLIENT_HMAC_ERROR; | |
1235 | } | |
1236 | ||
1237 | goto finish; | |
1238 | } | |
1239 | else if ((out != YKCLIENT_PARSE_ERROR) && | |
1240 | (out != YKCLIENT_REPLAYED_REQUEST)) | |
1241 | { | |
1242 | goto finish; | |
1243 | } | |
1244 | ||
1245 | ykclient_server_response_free (srv_response); | |
1246 | srv_response = NULL; | |
1247 | } | |
1248 | } | |
1249 | while (requests); | |
1250 | finish: | |
1251 | if (srv_response) | |
1252 | { | |
1253 | ykclient_server_response_free (srv_response); | |
1254 | } | |
1255 | ||
1256 | return out; | |
1257 | } | |
1258 | ||
1259 | /** Returns the actual URL the request was sent to | |
1260 | * | |
1261 | * @param ykc Yubikey client configuration. | |
1262 | * @return the last URL a request was send to. | |
1263 | */ | |
1264 | const char * | |
1265 | ykclient_get_last_url (ykclient_t * ykc) | |
1266 | { | |
1267 | return ykc->last_url; | |
1268 | } | |
1269 | ||
1270 | /** Generates and send requests to one or more validation servers | |
1271 | * | |
1272 | * Sends a request to each of the servers specified by set_url_templates and | |
1273 | * validates the response. | |
1274 | * | |
1275 | * @param ykc Yubikey client configuration. | |
1276 | * @param yubikey OTP string passed to the client. | |
1277 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
1278 | */ | |
1279 | ykclient_rc | |
1280 | ykclient_request_process (ykclient_t * ykc, ykclient_handle_t * ykh, | |
1281 | const char *yubikey) | |
1282 | { | |
1283 | ykclient_rc out; | |
1284 | char *nonce = NULL; | |
1285 | ||
1286 | /* Generate nonce value */ | |
1287 | out = ykclient_generate_nonce (ykc, &nonce); | |
1288 | if (out != YKCLIENT_OK) | |
1289 | { | |
1290 | goto finish; | |
1291 | } | |
1292 | ||
1293 | /* Build request/template specific URLs */ | |
1294 | out = ykclient_expand_urls (ykc, ykh, yubikey, nonce); | |
1295 | if (out != YKCLIENT_OK) | |
1296 | { | |
1297 | goto finish; | |
1298 | } | |
1299 | ||
1300 | /* Send the request to the validation server */ | |
1301 | out = ykclient_request_send (ykc, ykh, yubikey, nonce); | |
1302 | ||
1303 | finish: | |
1304 | free (nonce); | |
1305 | ||
1306 | return out; | |
1307 | } | |
1308 | ||
1309 | /** Generates and send requests to one or more validation servers | |
1310 | * | |
1311 | * Constructs a throwaway Curl handle, and sends a request to each of the | |
1312 | * servers specified by set_url_templates. | |
1313 | * | |
1314 | * @note ykclient_request_process should be used for repeat requests as it | |
1315 | * @note supports connection caching. | |
1316 | * | |
1317 | * @param ykc Yubikey client configuration. | |
1318 | * @param yubikey OTP string passed to the client. | |
1319 | * @return one of the YKCLIENT_* values or YKCLIENT_OK on success. | |
1320 | */ | |
1321 | ykclient_rc | |
1322 | ykclient_request (ykclient_t * ykc, const char *yubikey) | |
1323 | { | |
1324 | ykclient_rc out; | |
1325 | ||
1326 | ykclient_handle_t *ykh; | |
1327 | ||
1328 | /* Initialise a throw away handle */ | |
1329 | out = ykclient_handle_init (ykc, &ykh); | |
1330 | if (out != YKCLIENT_OK) | |
1331 | { | |
1332 | return out; | |
1333 | } | |
1334 | ||
1335 | out = ykclient_request_process (ykc, ykh, yubikey); | |
1336 | ||
1337 | ykclient_handle_done (&ykh); | |
1338 | ||
1339 | return out; | |
1340 | } | |
1341 | ||
1342 | /** Extended API to validate an OTP (hexkey) | |
1343 | * | |
1344 | * Will default to YubiCloud validation service, but may be used | |
1345 | * with any service, if non-NULL ykc_in pointer is passed, and | |
1346 | * ykclient_set_url_templates is used to configure template URLs. | |
1347 | * | |
1348 | */ | |
1349 | ykclient_rc | |
283 | 1350 | ykclient_verify_otp_v2 (ykclient_t * ykc_in, |
284 | 1351 | const char *yubikey_otp, |
285 | 1352 | unsigned int client_id, |
287 | 1354 | size_t urlcount, |
288 | 1355 | const char **urls, const char *api_key) |
289 | 1356 | { |
1357 | ykclient_rc out; | |
290 | 1358 | ykclient_t *ykc; |
291 | int ret; | |
1359 | ||
292 | 1360 | |
293 | 1361 | if (ykc_in == NULL) |
294 | 1362 | { |
295 | ret = ykclient_init (&ykc); | |
296 | if (ret != YKCLIENT_OK) | |
297 | return ret; | |
1363 | out = ykclient_init (&ykc); | |
1364 | if (out != YKCLIENT_OK) | |
1365 | { | |
1366 | return out; | |
1367 | } | |
298 | 1368 | } |
299 | 1369 | else |
300 | 1370 | { |
305 | 1375 | |
306 | 1376 | if (urlcount != 0 && *urls != 0) |
307 | 1377 | { |
308 | ykclient_set_url_templates(ykc, urlcount, urls); | |
1378 | ykclient_set_url_templates (ykc, urlcount, urls); | |
309 | 1379 | } |
310 | 1380 | |
311 | 1381 | if (api_key) |
314 | 1384 | ykclient_set_client_b64 (ykc, client_id, api_key); |
315 | 1385 | } |
316 | 1386 | |
317 | ret = ykclient_request (ykc, yubikey_otp); | |
1387 | out = ykclient_request (ykc, yubikey_otp); | |
318 | 1388 | |
319 | 1389 | if (ykc_in == NULL) |
320 | ykclient_done (&ykc); | |
321 | ||
322 | return ret; | |
323 | } | |
324 | ||
325 | const char * | |
326 | ykclient_strerror (int ret) | |
327 | { | |
328 | const char *p; | |
329 | ||
330 | switch (ret) | |
331 | { | |
332 | case YKCLIENT_OK: | |
333 | p = "Success"; | |
334 | break; | |
335 | ||
336 | case YKCLIENT_CURL_PERFORM_ERROR: | |
337 | p = "Error performing curl"; | |
338 | break; | |
339 | ||
340 | case YKCLIENT_BAD_OTP: | |
341 | p = "Yubikey OTP was bad (BAD_OTP)"; | |
342 | break; | |
343 | ||
344 | case YKCLIENT_REPLAYED_OTP: | |
345 | p = "Yubikey OTP was replayed (REPLAYED_OTP)"; | |
346 | break; | |
347 | ||
348 | case YKCLIENT_REPLAYED_REQUEST: | |
349 | p = "Yubikey request was replayed (REPLAYED_REQUEST)"; | |
350 | break; | |
351 | ||
352 | case YKCLIENT_BAD_SIGNATURE: | |
353 | p = "Request signature was invalid (BAD_SIGNATURE)"; | |
354 | break; | |
355 | ||
356 | case YKCLIENT_BAD_SERVER_SIGNATURE: | |
357 | p = "Server response signature was invalid (BAD_SERVER_SIGNATURE)"; | |
358 | break; | |
359 | ||
360 | case YKCLIENT_MISSING_PARAMETER: | |
361 | p = "Request was missing a parameter (MISSING_PARAMETER)"; | |
362 | break; | |
363 | ||
364 | case YKCLIENT_NO_SUCH_CLIENT: | |
365 | p = "Client identity does not exist (NO_SUCH_CLIENT)"; | |
366 | break; | |
367 | ||
368 | case YKCLIENT_OPERATION_NOT_ALLOWED: | |
369 | p = "Authorization denied (OPERATION_NOT_ALLOWED)"; | |
370 | break; | |
371 | ||
372 | case YKCLIENT_BACKEND_ERROR: | |
373 | p = "Internal server error (BACKEND_ERROR)"; | |
374 | break; | |
375 | ||
376 | case YKCLIENT_NOT_ENOUGH_ANSWERS: | |
377 | p = "Too few validation servers available (NOT_ENOUGH_ANSWERS)"; | |
378 | break; | |
379 | ||
380 | case YKCLIENT_OUT_OF_MEMORY: | |
381 | p = "Out of memory"; | |
382 | break; | |
383 | ||
384 | case YKCLIENT_PARSE_ERROR: | |
385 | p = "Could not parse server response"; | |
386 | break; | |
387 | ||
388 | case YKCLIENT_FORMAT_ERROR: | |
389 | p = "Internal printf format error"; | |
390 | break; | |
391 | ||
392 | case YKCLIENT_CURL_INIT_ERROR: | |
393 | p = "Error initializing curl"; | |
394 | break; | |
395 | ||
396 | case YKCLIENT_HMAC_ERROR: | |
397 | p = "HMAC signature validation/generation error"; | |
398 | break; | |
399 | ||
400 | case YKCLIENT_HEX_DECODE_ERROR: | |
401 | p = "Error decoding hex string"; | |
402 | break; | |
403 | ||
404 | case YKCLIENT_NOT_IMPLEMENTED: | |
405 | p = "Not implemented"; | |
406 | break; | |
407 | ||
408 | default: | |
409 | p = "Unknown error"; | |
410 | break; | |
411 | } | |
412 | ||
413 | return p; | |
414 | } | |
415 | ||
416 | const char * | |
417 | ykclient_get_last_url (ykclient_t * ykc) | |
418 | { | |
419 | return ykc->last_url; | |
420 | } | |
421 | ||
422 | static size_t | |
423 | curl_callback (void *ptr, size_t size, size_t nmemb, void *data) | |
424 | { | |
425 | struct curl_data *curl_data = (struct curl_data*) data; | |
426 | size_t realsize = size * nmemb; | |
427 | char *p; | |
428 | ||
429 | if (curl_data->curl_chunk) | |
430 | p = realloc (curl_data->curl_chunk, curl_data->curl_chunk_size + realsize + 1); | |
431 | else | |
432 | p = malloc (curl_data->curl_chunk_size + realsize + 1); | |
433 | ||
434 | if (!p) | |
435 | return -1; | |
436 | ||
437 | curl_data->curl_chunk = p; | |
438 | ||
439 | memcpy (&(curl_data->curl_chunk[curl_data->curl_chunk_size]), ptr, realsize); | |
440 | curl_data->curl_chunk_size += realsize; | |
441 | curl_data->curl_chunk[curl_data->curl_chunk_size] = 0; | |
442 | ||
443 | return realsize; | |
444 | } | |
445 | ||
446 | int | |
447 | ykclient_request (ykclient_t * ykc, const char *yubikey) | |
448 | { | |
449 | const char **url_templates = ykc->url_templates; | |
450 | size_t num_templates = ykc->num_templates; | |
451 | char *user_agent = NULL; | |
452 | char *status; | |
453 | int out; | |
454 | char **urls; | |
455 | char *signature = NULL; | |
456 | int still_running; | |
457 | CURL **curls_list; | |
458 | char *encoded_otp; | |
459 | char *nonce; | |
460 | CURLM *curl = curl_multi_init (); | |
461 | ||
462 | if (!curl) | |
463 | { | |
464 | return YKCLIENT_CURL_INIT_ERROR; | |
465 | } | |
466 | ||
467 | if (!url_templates || *url_templates == 0) { | |
468 | url_templates = default_url_templates; | |
469 | num_templates = default_num_templates; | |
470 | } | |
471 | ||
472 | urls = malloc(sizeof(char*) * num_templates); | |
473 | if(!urls) | |
474 | return YKCLIENT_OUT_OF_MEMORY; | |
475 | ||
476 | curls_list = malloc(sizeof(CURL*) * num_templates); | |
477 | if (!curls_list) | |
478 | return YKCLIENT_OUT_OF_MEMORY; | |
479 | ||
480 | memset(ykc->last_url, 0, sizeof(ykc->last_url)); | |
481 | ||
482 | { | |
483 | size_t len = strlen (PACKAGE) + 1 + strlen (PACKAGE_VERSION) + 1; | |
484 | user_agent = malloc (len); | |
485 | if (!user_agent) | |
486 | return YKCLIENT_OUT_OF_MEMORY; | |
487 | snprintf (user_agent, len, "%s/%s", PACKAGE, PACKAGE_VERSION); | |
488 | } | |
489 | ||
490 | /* URL-encode the OTP */ | |
491 | encoded_otp = curl_easy_escape(curl, yubikey, 0); | |
492 | ||
493 | if(ykc->nonce_supplied) | |
494 | { | |
495 | nonce = ykc->nonce; | |
496 | } | |
497 | else | |
498 | { | |
499 | nonce = malloc (NONCE_LEN + 1); | |
500 | if(!nonce) | |
501 | return YKCLIENT_OUT_OF_MEMORY; | |
502 | ||
503 | /* Generate a random 'nonce' value */ | |
504 | int i = 0; | |
505 | struct timeval tv; | |
506 | ||
507 | gettimeofday (&tv, 0); | |
508 | srandom (tv.tv_sec * tv.tv_usec); | |
509 | ||
510 | for (i = 0; i < NONCE_LEN; ++i) | |
511 | { | |
512 | nonce[i] = (random () % 26) + 'a'; | |
513 | } | |
514 | ||
515 | nonce[NONCE_LEN] = 0; | |
516 | } | |
517 | ||
518 | int i = 0; | |
519 | for(; i < num_templates; i++) | |
520 | { | |
521 | char *url = NULL; | |
522 | { | |
523 | size_t len = strlen (url_templates[i]) + strlen (encoded_otp) + 20; | |
524 | size_t wrote; | |
525 | ||
526 | url = malloc(len); | |
527 | if (!url) | |
528 | return YKCLIENT_OUT_OF_MEMORY; | |
529 | wrote = snprintf (url, len, url_templates[i], ykc->client_id, encoded_otp); | |
530 | if (wrote < 0 || wrote > len) | |
531 | return YKCLIENT_FORMAT_ERROR; | |
532 | } | |
533 | ||
534 | if (nonce) | |
535 | { | |
536 | /* Create new URL with nonce in it. */ | |
537 | char *nonce_url, *otp_offset; | |
538 | size_t len; | |
539 | int wrote; | |
540 | ||
541 | #define ADD_NONCE "&nonce=" | |
542 | len = strlen (url) + strlen (ADD_NONCE) + strlen (nonce) + 1; | |
543 | nonce_url = malloc (len + 4); /* avoid valgrind complaint */ | |
544 | if (!nonce_url) | |
545 | return YKCLIENT_OUT_OF_MEMORY; | |
546 | ||
547 | /* Find the &otp= in url and insert ?nonce= before otp. Must get | |
548 | * sorted headers since we calculate HMAC on the result. | |
549 | * | |
550 | * XXX this will break if the validation protocol gets a parameter that | |
551 | * sorts in between "nonce" and "otp", because the headers we sign won't | |
552 | * be alphabetically sorted if we insert the nonce between "nz" and "otp". | |
553 | * Also, we assume that everyone will have at least one parameter ("id=") | |
554 | * before "otp" so there is no need to search for "?otp=". | |
555 | */ | |
556 | otp_offset = strstr (url, "&otp="); | |
557 | if (otp_offset == NULL) | |
558 | /* point at \0 at end of url in case there is no otp */ | |
559 | otp_offset = url + len; | |
560 | ||
561 | /* break up ykc->url where we want to insert nonce */ | |
562 | *otp_offset = 0; | |
563 | ||
564 | wrote = | |
565 | snprintf (nonce_url, len, "%s" ADD_NONCE "%s&%s", url, nonce, | |
566 | otp_offset + 1); | |
567 | if (wrote + 1 != len) | |
568 | return YKCLIENT_FORMAT_ERROR; | |
569 | ||
570 | free (url); | |
571 | url = nonce_url; | |
572 | } | |
573 | ||
574 | if (ykc->key && ykc->keylen) | |
575 | { | |
576 | if (!signature) | |
577 | { | |
578 | char b64dig[3 * 4 * SHA1HashSize + 1]; | |
579 | uint8_t digest[USHAMaxHashSize]; | |
580 | base64_encodestate b64; | |
581 | char *text; | |
582 | int res, res2; | |
583 | ||
584 | /* Find parameters to sign. */ | |
585 | text = strchr (url, '?'); | |
586 | if (!text) | |
587 | return YKCLIENT_PARSE_ERROR; | |
588 | text++; | |
589 | ||
590 | /* HMAC data. */ | |
591 | res = hmac (SHA1, (unsigned char *) text, strlen (text), | |
592 | (unsigned char *) ykc->key, ykc->keylen, digest); | |
593 | if (res != shaSuccess) | |
594 | return YKCLIENT_HMAC_ERROR; | |
595 | ||
596 | /* Base64 signature. */ | |
597 | base64_init_encodestate (&b64); | |
598 | res = base64_encode_block ((char *) digest, SHA1HashSize, b64dig, &b64); | |
599 | res2 = base64_encode_blockend (&b64dig[res], &b64); | |
600 | b64dig[res + res2 - 1] = '\0'; | |
601 | ||
602 | signature = curl_easy_escape(curl, b64dig, 0); | |
603 | } | |
604 | ||
605 | /* Create new URL with signature ( h= ) appended to it . */ | |
606 | { | |
607 | char *sign_url; | |
608 | size_t len; | |
609 | int wrote; | |
610 | ||
611 | ||
612 | #define ADD_HASH "&h=" | |
613 | len = strlen (url) + strlen (ADD_HASH) + strlen (signature) + 1; | |
614 | sign_url = malloc (len); | |
615 | if (!sign_url) | |
616 | return YKCLIENT_OUT_OF_MEMORY; | |
617 | ||
618 | wrote = snprintf (sign_url, len, "%s" ADD_HASH "%s", url, signature); | |
619 | if (wrote + 1 != len) | |
620 | return YKCLIENT_FORMAT_ERROR; | |
621 | free (url); | |
622 | url = sign_url; | |
623 | } | |
624 | } | |
625 | ||
626 | { | |
627 | CURL *curl_easy = curl_easy_init(); | |
628 | struct curl_data *data = malloc(sizeof(struct curl_data)); | |
629 | if (!data) { | |
630 | return YKCLIENT_OUT_OF_MEMORY; | |
631 | } | |
632 | data->curl_chunk = NULL; | |
633 | data->curl_chunk_size = 0; | |
634 | if (ykc->ca_path) | |
635 | { | |
636 | curl_easy_setopt (curl_easy, CURLOPT_CAPATH, ykc->ca_path); | |
637 | } | |
638 | curl_easy_setopt (curl_easy, CURLOPT_URL, url); | |
639 | curl_easy_setopt (curl_easy, CURLOPT_WRITEFUNCTION, curl_callback); | |
640 | curl_easy_setopt (curl_easy, CURLOPT_WRITEDATA, (void *) data); | |
641 | curl_easy_setopt (curl_easy, CURLOPT_PRIVATE, (void *) data); | |
642 | if(user_agent) | |
643 | { | |
644 | curl_easy_setopt (curl_easy, CURLOPT_USERAGENT, user_agent); | |
645 | } | |
646 | curl_multi_add_handle(curl, curl_easy); | |
647 | curls_list[i] = curl_easy; | |
648 | urls[i] = url; | |
649 | } | |
650 | } | |
651 | ||
652 | still_running = num_templates; | |
653 | while(still_running) { | |
654 | CURLcode curl_ret = curl_multi_perform (curl, &still_running); | |
655 | struct timeval timeout; | |
656 | ||
657 | fd_set fdread; | |
658 | fd_set fdwrite; | |
659 | fd_set fdexcep; | |
660 | int maxfd = -1; | |
661 | ||
662 | long curl_timeo = -1; | |
663 | ||
664 | /* curl before 7.20.0 can return CURLM_CALL_MULTI_PERFORM, continue so we | |
665 | * call curl_multi_perform again. */ | |
666 | if(curl_ret == CURLM_CALL_MULTI_PERFORM) { | |
667 | continue; | |
668 | } | |
669 | ||
670 | if (curl_ret != CURLE_OK) | |
671 | { | |
672 | fprintf(stderr, "Error with curl: %s\n", curl_multi_strerror(curl_ret)); | |
673 | out = YKCLIENT_CURL_PERFORM_ERROR; | |
674 | still_running = 0; | |
675 | break; | |
676 | } | |
677 | ||
678 | FD_ZERO(&fdread); | |
679 | FD_ZERO(&fdwrite); | |
680 | FD_ZERO(&fdexcep); | |
681 | ||
682 | timeout.tv_sec = 0; | |
683 | timeout.tv_usec = 250000; | |
684 | ||
685 | curl_multi_timeout(curl, &curl_timeo); | |
686 | if(curl_timeo >= 0) { | |
687 | timeout.tv_sec = curl_timeo / 1000; | |
688 | if(timeout.tv_sec > 1) { | |
689 | timeout.tv_sec = 0; | |
690 | timeout.tv_usec = 250000; | |
691 | } | |
692 | else | |
693 | timeout.tv_usec = (curl_timeo % 1000) * 1000; | |
694 | } | |
695 | ||
696 | curl_multi_fdset(curl, &fdread, &fdwrite, &fdexcep, &maxfd); | |
697 | ||
698 | select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); | |
699 | ||
700 | { | |
701 | int msgs_left = 1; | |
702 | while(msgs_left) { | |
703 | CURLMsg *msg = curl_multi_info_read(curl, &msgs_left); | |
704 | if(msg && msg->msg == CURLMSG_DONE) { | |
705 | CURL *curl_easy = msg->easy_handle; | |
706 | struct curl_data *data; | |
707 | char *url_used; | |
708 | int parse_ret; | |
709 | ||
710 | ykclient_server_response_t *serv_response = NULL; | |
711 | curl_easy_getinfo(curl_easy, CURLINFO_PRIVATE, (char **) &data); | |
712 | ||
713 | if (data == 0 || data->curl_chunk_size == 0 || data->curl_chunk == NULL) | |
714 | { | |
715 | out = YKCLIENT_PARSE_ERROR; | |
716 | goto done; | |
717 | } | |
718 | ||
719 | curl_easy_getinfo(curl_easy, CURLINFO_EFFECTIVE_URL, &url_used); | |
720 | strncpy(ykc->last_url, url_used, 200); | |
721 | ||
722 | serv_response = ykclient_server_response_init (); | |
723 | if (serv_response == NULL) | |
724 | { | |
725 | out = YKCLIENT_PARSE_ERROR; | |
726 | goto done; | |
727 | } | |
728 | parse_ret = ykclient_server_response_parse (data->curl_chunk, | |
729 | serv_response); | |
730 | if (parse_ret) | |
731 | { | |
732 | out = parse_ret; | |
733 | goto done; | |
734 | } | |
735 | ||
736 | if (ykc->verify_signature != 0 && | |
737 | ykclient_server_response_verify_signature (serv_response, | |
738 | ykc->key, ykc->keylen)) | |
739 | { | |
740 | out = YKCLIENT_BAD_SERVER_SIGNATURE; | |
741 | goto done; | |
742 | } | |
743 | ||
744 | status = ykclient_server_response_get (serv_response, "status"); | |
745 | if (!status) | |
746 | { | |
747 | out = YKCLIENT_PARSE_ERROR; | |
748 | goto done; | |
749 | } | |
750 | ||
751 | if (strcmp (status, "OK") == 0) | |
752 | { | |
753 | char *server_otp; | |
754 | ||
755 | /* Verify that the OTP and nonce we put in our request is echoed in the response. | |
756 | * | |
757 | * This is to protect us from a man in the middle sending us a previously | |
758 | * seen genuine response again (such as an status=OK response even though | |
759 | * the real server will respond status=REPLAYED_OTP in a few milliseconds. | |
760 | */ | |
761 | if (ykc->nonce) | |
762 | { | |
763 | char *server_nonce = | |
764 | ykclient_server_response_get (serv_response, "nonce"); | |
765 | if (server_nonce == NULL || strcmp (nonce, server_nonce)) | |
766 | { | |
767 | out = YKCLIENT_HMAC_ERROR; | |
768 | goto done; | |
769 | } | |
770 | } | |
771 | ||
772 | server_otp = ykclient_server_response_get (serv_response, "otp"); | |
773 | if (server_otp == NULL || strcmp (yubikey, server_otp)) | |
774 | { | |
775 | out = YKCLIENT_HMAC_ERROR; | |
776 | goto done; | |
777 | } | |
778 | ||
779 | out = YKCLIENT_OK; | |
780 | goto done; | |
781 | } | |
782 | else if (strcmp (status, "BAD_OTP") == 0) | |
783 | { | |
784 | out = YKCLIENT_BAD_OTP; | |
785 | goto done; | |
786 | } | |
787 | else if (strcmp (status, "REPLAYED_OTP") == 0) | |
788 | { | |
789 | out = YKCLIENT_REPLAYED_OTP; | |
790 | goto done; | |
791 | } | |
792 | else if (strcmp (status, "REPLAYED_REQUEST") == 0) | |
793 | { | |
794 | out = YKCLIENT_REPLAYED_REQUEST; | |
795 | goto done; | |
796 | } | |
797 | else if (strcmp (status, "BAD_SIGNATURE") == 0) | |
798 | { | |
799 | out = YKCLIENT_BAD_SIGNATURE; | |
800 | goto done; | |
801 | } | |
802 | else if (strcmp (status, "MISSING_PARAMETER") == 0) | |
803 | { | |
804 | out = YKCLIENT_MISSING_PARAMETER; | |
805 | goto done; | |
806 | } | |
807 | else if (strcmp (status, "NO_SUCH_CLIENT") == 0) | |
808 | { | |
809 | out = YKCLIENT_NO_SUCH_CLIENT; | |
810 | goto done; | |
811 | } | |
812 | else if (strcmp (status, "OPERATION_NOT_ALLOWED") == 0) | |
813 | { | |
814 | out = YKCLIENT_OPERATION_NOT_ALLOWED; | |
815 | goto done; | |
816 | } | |
817 | else if (strcmp (status, "BACKEND_ERROR") == 0) | |
818 | { | |
819 | out = YKCLIENT_BACKEND_ERROR; | |
820 | goto done; | |
821 | } | |
822 | else if (strcmp (status, "NOT_ENOUGH_ANSWERS") == 0) | |
823 | { | |
824 | out = YKCLIENT_NOT_ENOUGH_ANSWERS; | |
825 | goto done; | |
826 | } | |
827 | ||
828 | out = YKCLIENT_PARSE_ERROR; | |
829 | done: | |
830 | if (serv_response) | |
831 | ykclient_server_response_free (serv_response); | |
832 | /* if we got a valid response, get out of the loops */ | |
833 | if (out != YKCLIENT_PARSE_ERROR && out != YKCLIENT_REPLAYED_REQUEST) | |
834 | { | |
835 | still_running = 0; | |
836 | msgs_left = 0; | |
837 | } | |
838 | } | |
839 | } | |
840 | } | |
841 | } | |
842 | ||
843 | for(i = 0; i < num_templates; i++) | |
844 | { | |
845 | CURL *curlh = curls_list[i]; | |
846 | CURLMcode code = curl_multi_remove_handle(curl, curlh); | |
847 | ||
848 | struct curl_data *data; | |
849 | curl_easy_getinfo(curlh, CURLINFO_PRIVATE, (char **) &data); | |
850 | free(data->curl_chunk); | |
851 | free(data); | |
852 | ||
853 | curl_easy_cleanup(curlh); | |
854 | ||
855 | free(urls[i]); | |
856 | } | |
857 | ||
858 | /* if we allocated the nonce ourselves, free it */ | |
859 | if(!ykc->nonce_supplied) | |
860 | free(nonce); | |
861 | ||
862 | curl_free(encoded_otp); | |
863 | curl_free(signature); | |
864 | free (curls_list); | |
865 | free(urls); | |
866 | free (user_agent); | |
867 | curl_multi_cleanup (curl); | |
1390 | { | |
1391 | ykclient_done (&ykc); | |
1392 | } | |
868 | 1393 | |
869 | 1394 | return out; |
870 | 1395 | } |
1396 | ||
1397 | /** Simple API to validate an OTP (hexkey) using YubiCloud | |
1398 | */ | |
1399 | ykclient_rc | |
1400 | ykclient_verify_otp (const char *yubikey_otp, | |
1401 | unsigned int client_id, const char *hexkey) | |
1402 | { | |
1403 | return ykclient_verify_otp_v2 (NULL, | |
1404 | yubikey_otp, | |
1405 | client_id, hexkey, 0, NULL, NULL); | |
1406 | } |
0 | 0 | /* ykclient.h --- Prototypes for Yubikey OTP validation client library. |
1 | 1 | * |
2 | 2 | * Written by Simon Josefsson <simon@josefsson.org>. |
3 | * Copyright (c) 2006-2012 Yubico AB | |
3 | * Copyright (c) 2006-2013 Yubico AB | |
4 | 4 | * All rights reserved. |
5 | 5 | * |
6 | 6 | * Redistribution and use in source and binary forms, with or without |
35 | 35 | #include <stdint.h> |
36 | 36 | #include <string.h> |
37 | 37 | |
38 | # ifdef __cplusplus | |
38 | #include <ykclient_errors.h> | |
39 | #include <ykclient_version.h> | |
40 | ||
41 | #ifdef __cplusplus | |
39 | 42 | extern "C" |
40 | 43 | { |
41 | # endif | |
44 | #endif | |
42 | 45 | |
43 | typedef enum | |
44 | { | |
45 | /* Official yubikey client API errors. */ | |
46 | YKCLIENT_OK = 0, | |
47 | YKCLIENT_BAD_OTP, | |
48 | YKCLIENT_REPLAYED_OTP, | |
49 | YKCLIENT_BAD_SIGNATURE, | |
50 | YKCLIENT_MISSING_PARAMETER, | |
51 | YKCLIENT_NO_SUCH_CLIENT, | |
52 | YKCLIENT_OPERATION_NOT_ALLOWED, | |
53 | YKCLIENT_BACKEND_ERROR, | |
54 | YKCLIENT_NOT_ENOUGH_ANSWERS, | |
55 | YKCLIENT_REPLAYED_REQUEST, | |
56 | /* Other implementation specific errors. */ | |
57 | YKCLIENT_OUT_OF_MEMORY = 100, | |
58 | YKCLIENT_PARSE_ERROR, | |
59 | YKCLIENT_FORMAT_ERROR, | |
60 | YKCLIENT_CURL_INIT_ERROR, | |
61 | YKCLIENT_HMAC_ERROR, | |
62 | YKCLIENT_HEX_DECODE_ERROR, | |
63 | YKCLIENT_BAD_SERVER_SIGNATURE, | |
64 | YKCLIENT_NOT_IMPLEMENTED, | |
65 | YKCLIENT_CURL_PERFORM_ERROR, | |
66 | YKCLIENT_BAD_INPUT | |
67 | } ykclient_rc; | |
46 | /* Must be called successfully before using any other functions. */ | |
47 | extern ykclient_rc ykclient_global_init (void); | |
48 | extern void ykclient_global_done (void); | |
68 | 49 | |
69 | typedef struct ykclient_st ykclient_t; | |
50 | typedef struct ykclient_st ykclient_t; | |
70 | 51 | |
71 | extern int ykclient_init (ykclient_t ** ykc); | |
52 | typedef struct ykclient_handle_st ykclient_handle_t; | |
72 | 53 | |
73 | extern void ykclient_done (ykclient_t ** ykc); | |
54 | extern ykclient_rc ykclient_init (ykclient_t ** ykc); | |
55 | ||
56 | extern void ykclient_done (ykclient_t ** ykc); | |
57 | ||
58 | extern ykclient_rc ykclient_handle_init (ykclient_t * ykc, | |
59 | ykclient_handle_t ** ykh); | |
60 | ||
61 | extern void ykclient_handle_cleanup (ykclient_handle_t * ykh); | |
62 | ||
63 | extern void ykclient_handle_done (ykclient_handle_t ** ykh); | |
74 | 64 | |
75 | 65 | /* If value is 0 the authenticity of the signature returned by the |
76 | 66 | server in response to the request won't be verified. */ |
77 | extern void ykclient_set_verify_signature (ykclient_t * ykc, int value); | |
67 | extern void ykclient_set_verify_signature (ykclient_t * ykc, int value); | |
78 | 68 | |
79 | extern const char *ykclient_strerror (int ret); | |
69 | extern const char *ykclient_strerror (ykclient_rc ret); | |
80 | 70 | |
81 | extern void ykclient_set_client (ykclient_t * ykc, | |
82 | unsigned int client_id, | |
83 | size_t keylen, const char *key); | |
71 | extern void ykclient_set_client (ykclient_t * ykc, | |
72 | unsigned int client_id, | |
73 | size_t keylen, const char *key); | |
84 | 74 | |
85 | extern int ykclient_set_client_hex (ykclient_t * ykc, | |
86 | unsigned int client_id, const char *key); | |
75 | extern ykclient_rc ykclient_set_client_hex (ykclient_t * ykc, | |
76 | unsigned int client_id, | |
77 | const char *key); | |
87 | 78 | |
88 | extern int ykclient_set_client_b64 (ykclient_t * ykc, | |
89 | unsigned int client_id, const char *key); | |
79 | extern ykclient_rc ykclient_set_client_b64 (ykclient_t * ykc, | |
80 | unsigned int client_id, | |
81 | const char *key); | |
90 | 82 | |
91 | extern void ykclient_set_url_template (ykclient_t * ykc, | |
92 | const char *url_template); | |
83 | extern ykclient_rc ykclient_set_url_template (ykclient_t * ykc, | |
84 | const char *url_template); | |
93 | 85 | |
94 | extern int ykclient_set_url_templates (ykclient_t * ykc, | |
95 | size_t num_templates, const char **url_templates); | |
86 | extern ykclient_rc ykclient_set_url_templates (ykclient_t * ykc, | |
87 | size_t num_templates, | |
88 | const char **url_templates); | |
96 | 89 | |
97 | 90 | /* By default the signature returned by the server is verified (modify |
98 | 91 | this choice by calling ykclient_set_verify_signature()). */ |
99 | extern void ykclient_set_ca_path (ykclient_t * ykc, const char *ca_path); | |
92 | extern void ykclient_set_ca_path (ykclient_t * ykc, const char *ca_path); | |
100 | 93 | |
101 | 94 | /* |
102 | 95 | * Set the nonce. A default nonce is generated in ykclient_init(), but |
104 | 97 | * nonce (needed to send signed requests to v1 validation servers), |
105 | 98 | * you must call this function. Set nonce to NULL to disable it. |
106 | 99 | */ |
107 | extern void ykclient_set_nonce (ykclient_t * ykc, char *nonce); | |
100 | extern void ykclient_set_nonce (ykclient_t * ykc, char *nonce); | |
108 | 101 | |
109 | extern int ykclient_request (ykclient_t * ykc, const char *yubikey_otp); | |
110 | 102 | |
111 | extern const char *ykclient_get_last_url (ykclient_t * ykc); | |
103 | ||
104 | extern const char *ykclient_get_last_url (ykclient_t * ykc); | |
105 | ||
106 | extern ykclient_rc ykclient_request_process (ykclient_t * ykc, | |
107 | ykclient_handle_t * ykh, | |
108 | const char *yubikey); | |
109 | ||
110 | extern ykclient_rc ykclient_request (ykclient_t * ykc, | |
111 | const char *yubikey_otp); | |
112 | 112 | |
113 | 113 | /* One call interface for validation protocol 1.x, with default URL. */ |
114 | extern int ykclient_verify_otp (const char *yubikey_otp, | |
115 | unsigned int client_id, const char *hexkey); | |
114 | extern ykclient_rc ykclient_verify_otp (const char *yubikey_otp, | |
115 | unsigned int client_id, | |
116 | const char *hexkey); | |
116 | 117 | |
117 | 118 | /* One call interface for validation protocol 2.0 and/or non-default URL. */ |
118 | extern int ykclient_verify_otp_v2 (ykclient_t * ykc_in, | |
119 | const char *yubikey_otp, | |
120 | unsigned int client_id, | |
121 | const char *hexkey, | |
122 | size_t urlcount, | |
123 | const char **urls, const char *api_key); | |
119 | extern ykclient_rc ykclient_verify_otp_v2 (ykclient_t * ykc_in, | |
120 | const char *yubikey_otp, | |
121 | unsigned int client_id, | |
122 | const char *hexkey, | |
123 | size_t urlcount, | |
124 | const char **urls, | |
125 | const char *api_key); | |
124 | 126 | |
125 | # ifdef __cplusplus | |
127 | #ifdef __cplusplus | |
126 | 128 | } |
127 | # endif | |
129 | #endif | |
128 | 130 | |
129 | 131 | #endif |
0 | /* ykclient_errors.h --- Error codes used by ykclient. | |
1 | * | |
2 | * Written by Simon Josefsson <simon@josefsson.org>. | |
3 | * Copyright (c) 2006-2013 Yubico AB | |
4 | * All rights reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are | |
8 | * met: | |
9 | * | |
10 | * * Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * | |
13 | * * Redistributions in binary form must reproduce the above | |
14 | * copyright notice, this list of conditions and the following | |
15 | * disclaimer in the documentation and/or other materials provided | |
16 | * with the distribution. | |
17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | * | |
30 | */ | |
31 | ||
32 | #ifndef YKCLIENT_ERRORS_H | |
33 | #define YKCLIENT_ERRORS_H | |
34 | ||
35 | typedef enum | |
36 | { | |
37 | /* Official yubikey client API errors. */ | |
38 | YKCLIENT_OK = 0, | |
39 | YKCLIENT_BAD_OTP, | |
40 | YKCLIENT_REPLAYED_OTP, | |
41 | YKCLIENT_BAD_SIGNATURE, | |
42 | YKCLIENT_MISSING_PARAMETER, | |
43 | YKCLIENT_NO_SUCH_CLIENT, | |
44 | YKCLIENT_OPERATION_NOT_ALLOWED, | |
45 | YKCLIENT_BACKEND_ERROR, | |
46 | YKCLIENT_NOT_ENOUGH_ANSWERS, | |
47 | YKCLIENT_REPLAYED_REQUEST, | |
48 | /* Other implementation specific errors. */ | |
49 | YKCLIENT_OUT_OF_MEMORY = 100, | |
50 | YKCLIENT_PARSE_ERROR, | |
51 | YKCLIENT_FORMAT_ERROR, | |
52 | YKCLIENT_CURL_INIT_ERROR, | |
53 | YKCLIENT_HMAC_ERROR, | |
54 | YKCLIENT_HEX_DECODE_ERROR, | |
55 | YKCLIENT_BASE64_DECODE_ERROR, | |
56 | YKCLIENT_BAD_SERVER_SIGNATURE, | |
57 | YKCLIENT_NOT_IMPLEMENTED, | |
58 | YKCLIENT_CURL_PERFORM_ERROR, | |
59 | YKCLIENT_BAD_INPUT, | |
60 | YKCLIENT_HANDLE_NOT_REINIT | |
61 | } ykclient_rc; | |
62 | ||
63 | #endif |
68 | 68 | ykclient_parameters_t *new_node = malloc (sizeof (ykclient_parameters_t)); |
69 | 69 | if (new_node == NULL) |
70 | 70 | return; |
71 | memset(new_node, 0, (sizeof (ykclient_parameters_t))); | |
71 | memset (new_node, 0, (sizeof (ykclient_parameters_t))); | |
72 | 72 | |
73 | 73 | new_node->parameter = elem; |
74 | 74 | new_node->next = NULL; |
146 | 146 | /* Server's response functions */ |
147 | 147 | |
148 | 148 | ykclient_server_response_t * |
149 | ykclient_server_response_init () | |
149 | ykclient_server_response_init (void) | |
150 | 150 | { |
151 | 151 | ykclient_server_response_t *serv_response = |
152 | 152 | malloc (sizeof (ykclient_server_response_t)); |
153 | 153 | if (serv_response == NULL) |
154 | 154 | return NULL; |
155 | memset(serv_response, 0, (sizeof (ykclient_server_response_t))); | |
155 | memset (serv_response, 0, (sizeof (ykclient_server_response_t))); | |
156 | 156 | serv_response->signature = NULL; |
157 | 157 | serv_response->parameters = NULL; |
158 | 158 | return serv_response; |
205 | 205 | |
206 | 206 | /* Parses and builds the next parameter param from s, moves response's pointer |
207 | 207 | to the immediate right character. Returns 0 if it succeeds. */ |
208 | static int | |
208 | static ykclient_rc | |
209 | 209 | parse_next_parameter (char **s, ykclient_parameter_t * param) |
210 | 210 | { |
211 | 211 | if (s == NULL || *s == NULL || param == NULL) |
252 | 252 | return 0; |
253 | 253 | } |
254 | 254 | |
255 | int | |
255 | ykclient_rc | |
256 | 256 | ykclient_server_response_parse (char *response, |
257 | 257 | ykclient_server_response_t * serv_response) |
258 | 258 | { |
265 | 265 | ykclient_parameter_t *param = malloc (sizeof (ykclient_parameter_t)); |
266 | 266 | if (param == NULL) |
267 | 267 | return YKCLIENT_OUT_OF_MEMORY; |
268 | memset(param,0, (sizeof(ykclient_parameter_t))); | |
268 | memset (param, 0, (sizeof (ykclient_parameter_t))); | |
269 | 269 | int ret = parse_next_parameter (&response, param); |
270 | 270 | if (ret) |
271 | 271 | return ret; |
0 | /* ykclient_server_response.c --- Server response parsing and validation. | |
0 | /* ykclient_server_response.h --- Server response parsing and validation. | |
1 | 1 | * |
2 | 2 | * Written by Sebastien Martini <seb@dbzteam.org>. |
3 | * Copyright (c) 2011-2012 Yubico AB | |
3 | * Copyright (c) 2011-2013 Yubico AB | |
4 | 4 | * All rights reserved. |
5 | 5 | * |
6 | 6 | * Redistribution and use in source and binary forms, with or without |
32 | 32 | #ifndef YKCLIENT_SERVER_RESPONSE_H |
33 | 33 | #define YKCLIENT_SERVER_RESPONSE_H |
34 | 34 | |
35 | #include <ykclient_errors.h> | |
36 | ||
35 | 37 | /* Example: |
36 | 38 | key: status |
37 | 39 | value: OK |
56 | 58 | |
57 | 59 | |
58 | 60 | /* Returns NULL if it fails. */ |
59 | extern ykclient_server_response_t *ykclient_server_response_init (); | |
61 | extern ykclient_server_response_t *ykclient_server_response_init (void); | |
60 | 62 | |
61 | 63 | /* Frees allocated data structures. */ |
62 | 64 | extern void ykclient_server_response_free (ykclient_server_response_t |
63 | *response); | |
65 | * response); | |
64 | 66 | |
65 | 67 | /* Parses server's response and builds a list of parameters and isolates |
66 | 68 | the corresponding signature parameter. Returns 0 if it succeeds. */ |
67 | extern int | |
69 | extern ykclient_rc | |
68 | 70 | ykclient_server_response_parse (char *response, |
69 | ykclient_server_response_t *serv_response); | |
71 | ykclient_server_response_t * serv_response); | |
70 | 72 | |
71 | 73 | /* Iterates the parameters buils a HMAC-SHA1 and checks it matches the |
72 | 74 | signature returned by the server. This function returns 0 if the signature |
74 | 76 | extern int |
75 | 77 | ykclient_server_response_verify_signature (const ykclient_server_response_t |
76 | 78 | * serv_response, |
77 | const char *key, | |
78 | int key_length); | |
79 | const char *key, int key_length); | |
79 | 80 | |
80 | 81 | /* Returns value associated to key or NULL if unmatched. The caller doesn't |
81 | 82 | take ownership of the returned value. */ |
82 | extern char * | |
83 | ykclient_server_response_get (const ykclient_server_response_t *serv_response, | |
84 | const char *key); | |
83 | extern char *ykclient_server_response_get (const ykclient_server_response_t * | |
84 | serv_response, const char *key); | |
85 | 85 | |
86 | 86 | #endif /* YKCLIENT_SERVER_RESPONSE_H */ |
0 | /* | |
1 | * Copyright (c) 2012-2013 Yubico AB | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above | |
12 | * copyright notice, this list of conditions and the following | |
13 | * disclaimer in the documentation and/or other materials provided | |
14 | * with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
19 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
20 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #include <ykclient_version.h> | |
30 | #include <stddef.h> | |
31 | ||
32 | #define _GNU_SOURCE | |
33 | #include <string.h> | |
34 | ||
35 | /* From http://article.gmane.org/gmane.os.freebsd.devel.hackers/23606 */ | |
36 | int | |
37 | my_strverscmp (const char *s1, const char *s2) | |
38 | { | |
39 | static const char *digits = "0123456789"; | |
40 | int ret, lz1, lz2; | |
41 | size_t p1, p2; | |
42 | ||
43 | p1 = strcspn (s1, digits); | |
44 | p2 = strcspn (s2, digits); | |
45 | while (p1 == p2 && s1[p1] != '\0' && s2[p2] != '\0') | |
46 | { | |
47 | /* Different prefix */ | |
48 | if ((ret = strncmp (s1, s2, p1)) != 0) | |
49 | return ret; | |
50 | ||
51 | s1 += p1; | |
52 | s2 += p2; | |
53 | ||
54 | lz1 = lz2 = 0; | |
55 | if (*s1 == '0') | |
56 | lz1 = 1; | |
57 | if (*s2 == '0') | |
58 | lz2 = 1; | |
59 | ||
60 | if (lz1 > lz2) | |
61 | return -1; | |
62 | else if (lz1 < lz2) | |
63 | return 1; | |
64 | else if (lz1 == 1) | |
65 | { | |
66 | /* | |
67 | * If the common prefix for s1 and s2 consists only of zeros, then the | |
68 | * "longer" number has to compare less. Otherwise the comparison needs | |
69 | * to be numerical (just fallthrough). See | |
70 | * http://refspecs.freestandards.org/LSB_2.0.1/LSB-generic/ | |
71 | * LSB-generic/baselib-strverscmp.html | |
72 | */ | |
73 | while (*s1 == '0' && *s2 == '0') | |
74 | { | |
75 | ++s1; | |
76 | ++s2; | |
77 | } | |
78 | ||
79 | p1 = strspn (s1, digits); | |
80 | p2 = strspn (s2, digits); | |
81 | ||
82 | /* Catch empty strings */ | |
83 | if (p1 == 0 && p2 > 0) | |
84 | return 1; | |
85 | else if (p2 == 0 && p1 > 0) | |
86 | return -1; | |
87 | ||
88 | /* Prefixes are not same */ | |
89 | if (*s1 != *s2 && *s1 != '0' && *s2 != '0') | |
90 | { | |
91 | if (p1 < p2) | |
92 | return 1; | |
93 | else if (p1 > p2) | |
94 | return -1; | |
95 | } | |
96 | else | |
97 | { | |
98 | if (p1 < p2) | |
99 | ret = strncmp (s1, s2, p1); | |
100 | else if (p1 > p2) | |
101 | ret = strncmp (s1, s2, p2); | |
102 | if (ret != 0) | |
103 | return ret; | |
104 | } | |
105 | } | |
106 | ||
107 | p1 = strspn (s1, digits); | |
108 | p2 = strspn (s2, digits); | |
109 | ||
110 | if (p1 < p2) | |
111 | return -1; | |
112 | else if (p1 > p2) | |
113 | return 1; | |
114 | else if ((ret = strncmp (s1, s2, p1)) != 0) | |
115 | return ret; | |
116 | ||
117 | /* Numbers are equal or not present, try with next ones. */ | |
118 | s1 += p1; | |
119 | s2 += p2; | |
120 | p1 = strcspn (s1, digits); | |
121 | p2 = strcspn (s2, digits); | |
122 | } | |
123 | ||
124 | return strcmp (s1, s2); | |
125 | } | |
126 | ||
127 | const char * | |
128 | ykclient_check_version (const char *req_version) | |
129 | { | |
130 | if (!req_version | |
131 | || my_strverscmp (req_version, YKCLIENT_VERSION_STRING) <= 0) | |
132 | return YKCLIENT_VERSION_STRING; | |
133 | ||
134 | return NULL; | |
135 | } |
0 | /* | |
1 | * Copyright (c) 2013 Yubico AB | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above | |
12 | * copyright notice, this list of conditions and the following | |
13 | * disclaimer in the documentation and/or other materials provided | |
14 | * with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
19 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
20 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #ifndef YKCLIENT_VERSION_H | |
30 | #define YKCLIENT_VERSION_H | |
31 | ||
32 | #ifdef __cplusplus | |
33 | extern "C" | |
34 | { | |
35 | #endif | |
36 | ||
37 | /** | |
38 | * YKCLIENT_VERSION_STRING | |
39 | * | |
40 | * Pre-processor symbol with a string that describe the header file | |
41 | * version number. Used together with ykclient_check_version() to | |
42 | * verify header file and run-time library consistency. | |
43 | */ | |
44 | #define YKCLIENT_VERSION_STRING "2.10" | |
45 | ||
46 | /** | |
47 | * YKCLIENT_VERSION_NUMBER | |
48 | * | |
49 | * Pre-processor symbol with a hexadecimal value describing the header | |
50 | * file version number. For example, when the header version is 1.2.3 | |
51 | * this symbol will have the value 0x01020300. The last two digits | |
52 | * are only used between public releases, and will otherwise be 00. | |
53 | */ | |
54 | #define YKCLIENT_VERSION_NUMBER 0x020a00 | |
55 | ||
56 | /** | |
57 | * YKCLIENT_VERSION_MAJOR | |
58 | * | |
59 | * Pre-processor symbol with a decimal value that describe the major | |
60 | * level of the header file version number. For example, when the | |
61 | * header version is 1.2.3 this symbol will be 1. | |
62 | */ | |
63 | #define YKCLIENT_VERSION_MAJOR 2 | |
64 | ||
65 | /** | |
66 | * YKCLIENT_VERSION_MINOR | |
67 | * | |
68 | * Pre-processor symbol with a decimal value that describe the minor | |
69 | * level of the header file version number. For example, when the | |
70 | * header version is 1.2.3 this symbol will be 2. | |
71 | */ | |
72 | #define YKCLIENT_VERSION_MINOR 10 | |
73 | ||
74 | /** | |
75 | * YKCLIENT_VERSION_PATCH | |
76 | * | |
77 | * Pre-processor symbol with a decimal value that describe the patch | |
78 | * level of the header file version number. For example, when the | |
79 | * header version is 1.2.3 this symbol will be 3. | |
80 | */ | |
81 | #define YKCLIENT_VERSION_PATCH 0 | |
82 | ||
83 | const char *ykclient_check_version (const char *req_version); | |
84 | ||
85 | #ifdef __cplusplus | |
86 | } | |
87 | #endif | |
88 | ||
89 | #endif /* YKCLIENT_VERSION_H */ |
0 | /* | |
1 | * Copyright (c) 2013 Yubico AB | |
2 | * All rights reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions are | |
6 | * met: | |
7 | * | |
8 | * * Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * | |
11 | * * Redistributions in binary form must reproduce the above | |
12 | * copyright notice, this list of conditions and the following | |
13 | * disclaimer in the documentation and/or other materials provided | |
14 | * with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
19 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
20 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
21 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #ifndef YKCLIENT_VERSION_H | |
30 | #define YKCLIENT_VERSION_H | |
31 | ||
32 | #ifdef __cplusplus | |
33 | extern "C" | |
34 | { | |
35 | #endif | |
36 | ||
37 | /** | |
38 | * YKCLIENT_VERSION_STRING | |
39 | * | |
40 | * Pre-processor symbol with a string that describe the header file | |
41 | * version number. Used together with ykclient_check_version() to | |
42 | * verify header file and run-time library consistency. | |
43 | */ | |
44 | #define YKCLIENT_VERSION_STRING "@VERSION@" | |
45 | ||
46 | /** | |
47 | * YKCLIENT_VERSION_NUMBER | |
48 | * | |
49 | * Pre-processor symbol with a hexadecimal value describing the header | |
50 | * file version number. For example, when the header version is 1.2.3 | |
51 | * this symbol will have the value 0x01020300. The last two digits | |
52 | * are only used between public releases, and will otherwise be 00. | |
53 | */ | |
54 | #define YKCLIENT_VERSION_NUMBER @YKCLIENT_VERSION_NUMBER@ | |
55 | ||
56 | /** | |
57 | * YKCLIENT_VERSION_MAJOR | |
58 | * | |
59 | * Pre-processor symbol with a decimal value that describe the major | |
60 | * level of the header file version number. For example, when the | |
61 | * header version is 1.2.3 this symbol will be 1. | |
62 | */ | |
63 | #define YKCLIENT_VERSION_MAJOR @YKCLIENT_VERSION_MAJOR@ | |
64 | ||
65 | /** | |
66 | * YKCLIENT_VERSION_MINOR | |
67 | * | |
68 | * Pre-processor symbol with a decimal value that describe the minor | |
69 | * level of the header file version number. For example, when the | |
70 | * header version is 1.2.3 this symbol will be 2. | |
71 | */ | |
72 | #define YKCLIENT_VERSION_MINOR @YKCLIENT_VERSION_MINOR@ | |
73 | ||
74 | /** | |
75 | * YKCLIENT_VERSION_PATCH | |
76 | * | |
77 | * Pre-processor symbol with a decimal value that describe the patch | |
78 | * level of the header file version number. For example, when the | |
79 | * header version is 1.2.3 this symbol will be 3. | |
80 | */ | |
81 | #define YKCLIENT_VERSION_PATCH @YKCLIENT_VERSION_PATCH@ | |
82 | ||
83 | const char *ykclient_check_version (const char *req_version); | |
84 | ||
85 | #ifdef __cplusplus | |
86 | } | |
87 | #endif | |
88 | ||
89 | #endif /* YKCLIENT_VERSION_H */ |