Codebase list ykclient / 8636981
Imported Upstream version 2.10 Simon Josefsson 10 years ago
31 changed file(s) with 3865 addition(s) and 1172 deletion(s). Raw diff Collapse all Expand all
0 Author
1 ------
02 Simon Josefsson <simon@yubico.com>
13
24 For technical feedback, please consider using our forum:
35 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
0261 2012-08-07 Klas Lindfors <klas@yubico.com>
1262
2263 * simple.mk: add curl with LDLIBS instead of LDFLAGS
00 # Written by Simon Josefsson <simon@josefsson.org>.
1 # Copyright (c) 2008-2012 Yubico AB
1 # Copyright (c) 2008-2013 Yubico AB
22 # All rights reserved.
33 #
44 # Redistribution and use in source and binary forms, with or without
2929
3030 AM_CPPFLAGS = @LIBCURL_CPPFLAGS@
3131 ACLOCAL_AMFLAGS = -I m4
32 AM_CFLAGS = $(WARN_CFLAGS)
3233
3334 # The library.
3435
3536 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
3739
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
4045 libykclient_la_SOURCES += rfc4634/sha.h rfc4634/sha-private.h \
4146 rfc4634/hmac.c rfc4634/sha1.c rfc4634/usha.c \
4247 rfc4634/sha224-256.c rfc4634/sha384-512.c
5459 ykclient_SOURCES = tool.c
5560 ykclient_LDADD = ./libykclient.la
5661
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
5773 # Release
5874
59 EXTRA_DIST = simple.mk
75 indent:
76 indent *.c *.h *.h.in
77 indent *.c *.h *.h.in
6078
6179 ChangeLog:
6280 cd $(srcdir) && git2cl > ChangeLog
6482 PROJECT = yubico-c-client
6583
6684 release:
67 @if test -z "$(USER)" || test -z "$(KEYID)"; then \
85 @if test -z "$(KEYID)"; then \
6886 echo "Try this instead:"; \
69 echo " make release USER=[GOOGLEUSERNAME] KEYID=[PGPKEYID]"; \
87 echo " make release KEYID=[PGPKEYID]"; \
7088 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"; \
7395 exit 1; \
7496 fi
7597 @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)
7999 rm -f $(srcdir)/ChangeLog
80100 make ChangeLog distcheck
81101 gpg --detach-sign --default-key $(KEYID) $(PACKAGE)-$(VERSION).tar.gz
83103 cd $(srcdir) && git push
84104 cd $(srcdir) && git tag -u $(KEYID)! -m $(VERSION) $(PACKAGE)-$(VERSION)
85105 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.
11 # @configure_input@
22
33 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
1515 @SET_MAKE@
1616
1717 # Written by Simon Josefsson <simon@josefsson.org>.
18 # Copyright (c) 2008-2012 Yubico AB
18 # Copyright (c) 2008-2013 Yubico AB
1919 # All rights reserved.
2020 #
2121 # Redistribution and use in source and binary forms, with or without
4545
4646
4747 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 }
4865 pkgdatadir = $(datadir)/@PACKAGE@
4966 pkgincludedir = $(includedir)/@PACKAGE@
5067 pkglibdir = $(libdir)/@PACKAGE@
6582 host_triplet = @host@
6683 bin_PROGRAMS = ykclient$(EXEEXT)
6784 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
7290 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
7391 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
7492 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
7593 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
94 $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/warnings.m4 \
7695 $(top_srcdir)/configure.ac
7796 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
7897 $(ACLOCAL_M4)
7998 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
8099 configure.lineno config.status.lineno
81100 mkinstalldirs = $(install_sh) -d
82 CONFIG_CLEAN_FILES =
101 CONFIG_CLEAN_FILES = ykclient_version.h
83102 CONFIG_CLEAN_VPATH_FILES =
84103 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
85104 am__vpath_adj = case $$p in \
109128 $(am__cd) "$$dir" && rm -f $$files; }; \
110129 }
111130 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
112 "$(DESTDIR)$(includedir)"
131 "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(includedir)"
113132 LTLIBRARIES = $(lib_LTLIBRARIES)
114133 libykclient_la_DEPENDENCIES =
115134 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
118137 libykclient_la_OBJECTS = $(am_libykclient_la_OBJECTS)
119138 AM_V_lt = $(am__v_lt_@AM_V@)
120139 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
162181 install-pdf-recursive install-ps-recursive install-recursive \
163182 installcheck-recursive installdirs-recursive pdf-recursive \
164183 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)
165192 HEADERS = $(include_HEADERS)
166193 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
167194 distclean-recursive maintainer-clean-recursive
238265 EXEEXT = @EXEEXT@
239266 FGREP = @FGREP@
240267 GREP = @GREP@
268 HELP2MAN = @HELP2MAN@
241269 INSTALL = @INSTALL@
242270 INSTALL_DATA = @INSTALL_DATA@
243271 INSTALL_PROGRAM = @INSTALL_PROGRAM@
279307 SHELL = @SHELL@
280308 STRIP = @STRIP@
281309 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@
282315 _libcurl_config = @_libcurl_config@
283316 abs_builddir = @abs_builddir@
284317 abs_srcdir = @abs_srcdir@
335368 SUBDIRS = . tests
336369 AM_CPPFLAGS = @LIBCURL_CPPFLAGS@
337370 ACLOCAL_AMFLAGS = -I m4
371 AM_CFLAGS = $(WARN_CFLAGS)
338372
339373 # The library.
340374 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
342378 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 \
344381 rfc4634/sha-private.h rfc4634/hmac.c rfc4634/sha1.c \
345382 rfc4634/usha.c rfc4634/sha224-256.c rfc4634/sha384-512.c \
346383 b64/cencode.h b64/cencode.c b64/cdecode.h b64/cdecode.c
352389 ykclient_SOURCES = tool.c
353390 ykclient_LDADD = ./libykclient.la
354391
355 # Release
356 EXTRA_DIST = simple.mk
392 # Man page
393 dist_man_MANS = ykclient.1
394 DISTCLEANFILES = $(dist_man_MANS)
357395 PROJECT = yubico-c-client
358396 all: all-recursive
359397
393431 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
394432 $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
395433 $(am__aclocal_m4_deps):
434 ykclient_version.h: $(top_builddir)/config.status $(srcdir)/ykclient_version.h.in
435 cd $(top_builddir) && $(SHELL) ./config.status $@
396436 install-libLTLIBRARIES: $(lib_LTLIBRARIES)
397437 @$(NORMAL_INSTALL)
398 test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
399438 @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
400439 list2=; for p in $$list; do \
401440 if test -f $$p; then \
403442 else :; fi; \
404443 done; \
405444 test -z "$$list2" || { \
445 echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
446 $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
406447 echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
407448 $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
408449 }
428469 $(AM_V_CCLD)$(libykclient_la_LINK) -rpath $(libdir) $(libykclient_la_OBJECTS) $(libykclient_la_LIBADD) $(LIBS)
429470 install-binPROGRAMS: $(bin_PROGRAMS)
430471 @$(NORMAL_INSTALL)
431 test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
432472 @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; \
433477 for p in $$list; do echo "$$p $$p"; done | \
434478 sed 's/$(EXEEXT)$$//' | \
435479 while read p p1; do if test -f $$p || test -f $$p1; \
489533 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usha.Plo@am__quote@
490534 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ykclient.Plo@am__quote@
491535 @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@
492537
493538 .c.o:
494539 @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
568613
569614 distclean-libtool:
570615 -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)
571659 install-includeHEADERS: $(include_HEADERS)
572660 @$(NORMAL_INSTALL)
573 test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
574661 @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; \
575666 for p in $$list; do \
576667 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
577668 echo "$$d$$p"; \
723814 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
724815
725816 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
726830 $(am__remove_distdir)
727831 test -d "$(distdir)" || mkdir "$(distdir)"
728832 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
756860 done
757861 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
758862 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; \
766867 dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
767868 $(am__relativize); \
768869 new_distdir=$$reldir; \
848949 *.zip*) \
849950 unzip $(distdir).zip ;;\
850951 esac
851 chmod -R a-w $(distdir); chmod a+w $(distdir)
952 chmod -R a-w $(distdir); chmod u+w $(distdir)
852953 mkdir $(distdir)/_build
853954 mkdir $(distdir)/_inst
854955 chmod a-w $(distdir)
9141015 exit 1; } >&2
9151016 check-am: all-am
9161017 check: check-recursive
917 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
1018 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS)
9181019 install-binPROGRAMS: install-libLTLIBRARIES
9191020
9201021 installdirs: installdirs-recursive
9211022 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 \
9231024 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
9241025 done
9251026 install: install-recursive
9481049 distclean-generic:
9491050 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
9501051 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
1052 -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
9511053
9521054 maintainer-clean-generic:
9531055 @echo "This command is intended for maintainers to use"
9761078
9771079 info-am:
9781080
979 install-data-am: install-includeHEADERS
1081 install-data-am: install-includeHEADERS install-man
9801082
9811083 install-dvi: install-dvi-recursive
9821084
9921094
9931095 install-info-am:
9941096
995 install-man:
1097 install-man: install-man1
9961098
9971099 install-pdf: install-pdf-recursive
9981100
10251127 ps-am:
10261128
10271129 uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
1028 uninstall-libLTLIBRARIES
1130 uninstall-libLTLIBRARIES uninstall-man
1131
1132 uninstall-man: uninstall-man1
10291133
10301134 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
10311135 install-am install-strip tags-recursive
10421146 install-data-am install-dvi install-dvi-am install-exec \
10431147 install-exec-am install-html install-html-am \
10441148 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 \
10511155 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
10541170
10551171 ChangeLog:
10561172 cd $(srcdir) && git2cl > ChangeLog
10571173
10581174 release:
1059 @if test -z "$(USER)" || test -z "$(KEYID)"; then \
1175 @if test -z "$(KEYID)"; then \
10601176 echo "Try this instead:"; \
1061 echo " make release USER=[GOOGLEUSERNAME] KEYID=[PGPKEYID]"; \
1177 echo " make release KEYID=[PGPKEYID]"; \
10621178 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"; \
10651185 exit 1; \
10661186 fi
10671187 @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)
10711189 rm -f $(srcdir)/ChangeLog
10721190 make ChangeLog distcheck
10731191 gpg --detach-sign --default-key $(KEYID) $(PACKAGE)-$(VERSION).tar.gz
10751193 cd $(srcdir) && git push
10761194 cd $(srcdir) && git tag -u $(KEYID)! -m $(VERSION) $(PACKAGE)-$(VERSION)
10771195 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
10841203
10851204 # Tell versions [3.59,3.63) of GNU make to not export all variables.
10861205 # Otherwise a system limit (for SysV at least) may be exceeded.
00 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.
122
223 * Version 2.9 (released 2012-08-07)
324
1313 * tool.c: Source for command line tool "ykclient" to validate an OTP.
1414
1515 * selftest.c: Self tests of the library.
16
17 * simple.mk: Simple makefile to build the above parts.
1816
1917 * configure.ac, Makefile.am: Autoconf/Automake files.
2018
4644 $ cd yubico-c-client
4745 -----------
4846
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.
5049
5150 Generate the build system using:
5251
5352 -----------
5453 $ autoreconf --install
5554 -----------
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
6155
6256 Building
6357 --------
6862
6963 -----------
7064 $ ./configure
71 $ make check install
65 $ make check && sudo make install
7266 -----------
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
9367
9468 Command-line tools
9569 ------------------
0 # generated automatically by aclocal 1.11.3 -*- Autoconf -*-
0 # generated automatically by aclocal 1.11.6 -*- Autoconf -*-
11
22 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
33 # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
1313
1414 m4_ifndef([AC_AUTOCONF_VERSION],
1515 [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.
1818 You have another version of autoconf. It may work, but is not guaranteed to.
1919 If you have problems, you may need to regenerate the build system entirely.
2020 To do so, use the procedure documented by the package, typically `autoreconf'.])])
167167 _libcurl_save_libs=$LIBS
168168 LIBS="$LIBCURL $LIBS"
169169
170 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <curl/curl.h>],[
170 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[
171171 /* Try and use a few common options to force a failure if we are
172172 missing symbols or can't link. */
173173 int x;
178178 x=CURLOPT_ERRORBUFFER;
179179 x=CURLOPT_STDERR;
180180 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)
182183
183184 CPPFLAGS=$_libcurl_save_cppflags
184185 LIBS=$_libcurl_save_libs
288289 [am__api_version='1.11'
289290 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
290291 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], [],
292293 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
293294 ])
294295
304305 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
305306 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
306307 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
307 [AM_AUTOMAKE_VERSION([1.11.3])dnl
308 [AM_AUTOMAKE_VERSION([1.11.6])dnl
308309 m4_ifndef([AC_AUTOCONF_VERSION],
309310 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
310311 _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 ])
311373
312374 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
313375
12811343 m4_include([m4/ltsugar.m4])
12821344 m4_include([m4/ltversion.m4])
12831345 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
33 # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
44 # 2011, 2012 Free Software Foundation, Inc.
55
6 timestamp='2012-02-10'
6 timestamp='2012-04-18'
77
88 # This file is (in principle) common to ALL GNU software.
99 # The presence of a machine in this file suggests that SOME GNU software
223223 ;;
224224 -isc*)
225225 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
226 ;;
227 -lynx*178)
228 os=-lynxos178
229 ;;
230 -lynx*5)
231 os=-lynxos5
226232 ;;
227233 -lynx*)
228234 os=-lynxos
15361542 c4x-* | tic4x-*)
15371543 os=-coff
15381544 ;;
1545 hexagon-*)
1546 os=-elf
1547 ;;
15391548 tic54x-*)
15401549 os=-coff
15411550 ;;
00 #! /bin/sh
11 # 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.
33 #
44 # Report bugs to <yubico-devel@googlegroups.com>.
55 #
66 #
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.
108 #
119 #
1210 # This configure script is free software; the Free Software Foundation
135133 # CDPATH.
136134 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
137135
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;}
138161 if test "x$CONFIG_SHELL" = x; then
139162 as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
140163 emulate sh
168191 else
169192 exitcode=1; echo positional parameters were not saved.
170193 fi
171 test x\$exitcode = x0 || exit 1"
194 test x\$exitcode = x0 || exit 1
195 test -x / || exit 1"
172196 as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
173197 as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
174198 eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
221245
222246
223247 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
239267 fi
240268
241269 if test x$as_have_required = xno; then :
338366
339367
340368 } # 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
341377 # as_fn_append VAR VALUE
342378 # ----------------------
343379 # Append the text in VALUE to the end of the definition contained in VAR. Take
459495 chmod +x "$as_me.lineno" ||
460496 { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
461497
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
462502 # Don't try to exec as it changes $[0], causing all sort of problems
463503 # (the dirname of $[0] is not the place where we might find the
464504 # original and so on. Autoconf is especially sensitive to this).
493533 # ... but there are two gotchas:
494534 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
495535 # 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'.
497537 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'
499539 elif ln conf$$.file conf$$ 2>/dev/null; then
500540 as_ln_s=ln
501541 else
502 as_ln_s='cp -p'
542 as_ln_s='cp -pR'
503543 fi
504544 else
505 as_ln_s='cp -p'
545 as_ln_s='cp -pR'
506546 fi
507547 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
508548 rmdir conf$$.dir 2>/dev/null
514554 as_mkdir_p=false
515555 fi
516556
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
539559
540560 # Sed expression to map a string onto a valid CPP name.
541561 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
569589 # Identity of this package.
570590 PACKAGE_NAME='ykclient'
571591 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'
574594 PACKAGE_BUGREPORT='yubico-devel@googlegroups.com'
575595 PACKAGE_URL=''
576596
614634 am__EXEEXT_TRUE
615635 LTLIBOBJS
616636 LIBOBJS
637 YKCLIENT_VERSION_NUMBER
638 YKCLIENT_VERSION_PATCH
639 YKCLIENT_VERSION_MINOR
640 YKCLIENT_VERSION_MAJOR
641 WARN_CFLAGS
617642 LIBCURL
618643 LIBCURL_CPPFLAGS
619644 _libcurl_config
625650 DSYMUTIL
626651 MANIFEST_TOOL
627652 RANLIB
628 ac_ct_AR
629 AR
630653 LN_S
631654 NM
632655 ac_ct_DUMPBIN
648671 build_vendor
649672 build_cpu
650673 build
674 HELP2MAN
675 ac_ct_AR
676 AR
651677 am__fastdepCC_FALSE
652678 am__fastdepCC_TRUE
653679 CCDEPMODE
746772 with_sysroot
747773 enable_libtool_lock
748774 with_libcurl
775 enable_gcc_warnings
749776 '
750777 ac_precious_vars='build_alias
751778 host_alias
12111238 if test "x$host_alias" != x; then
12121239 if test "x$build_alias" = x; then
12131240 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
12161241 elif test "x$build_alias" != "x$host_alias"; then
12171242 cross_compiling=yes
12181243 fi
12981323 # Omit some internal or obsolete options to make the list less imposing.
12991324 # This message is too long to be a string in the A/UX 3.1 sh.
13001325 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.
13021327
13031328 Usage: $0 [OPTION]... [VAR=VALUE]...
13041329
13681393
13691394 if test -n "$ac_init_help"; then
13701395 case $ac_init_help in
1371 short | recursive ) echo "Configuration of ykclient 2.9:";;
1396 short | recursive ) echo "Configuration of ykclient 2.10:";;
13721397 esac
13731398 cat <<\_ACEOF
13741399
13851410 --enable-fast-install[=PKGS]
13861411 optimize for fast installation [default=yes]
13871412 --disable-libtool-lock avoid locking (might break parallel builds)
1413 --enable-gcc-warnings turn on lots of GCC warnings (for developers)
13881414
13891415 Optional Packages:
13901416 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
14731499 test -n "$ac_init_help" && exit $ac_status
14741500 if $ac_init_version; then
14751501 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.
14801506 This configure script is free software; the Free Software Foundation
14811507 gives unlimited permission to copy, distribute and modify it.
14821508 _ACEOF
15521578 test ! -s conftest.err
15531579 } && test -s conftest$ac_exeext && {
15541580 test "$cross_compiling" = yes ||
1555 $as_test_x conftest$ac_exeext
1581 test -x conftest$ac_exeext
15561582 }; then :
15571583 ac_retval=0
15581584 else
17511777 This file contains any messages produced by compilers while
17521778 running configure, to aid debugging if configure makes a mistake.
17531779
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
17561782
17571783 $ $0 $@
17581784
21052131 # Interfaces changed/added/removed: CURRENT++ REVISION=0
21062132 # Interfaces added: AGE++
21072133 # 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
21132139
21142140
21152141 am__api_version='1.11'
21802206 # by default.
21812207 for ac_prog in ginstall scoinst install; do
21822208 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
21842210 if test $ac_prog = install &&
21852211 grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
21862212 # AIX install. It has an incompatible calling convention.
23492375 IFS=$as_save_IFS
23502376 test -z "$as_dir" && as_dir=.
23512377 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
23532379 ac_cv_prog_STRIP="${ac_tool_prefix}strip"
23542380 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
23552381 break 2
23892415 IFS=$as_save_IFS
23902416 test -z "$as_dir" && as_dir=.
23912417 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
23932419 ac_cv_prog_ac_ct_STRIP="strip"
23942420 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
23952421 break 2
24402466 test -z "$as_dir" && as_dir=.
24412467 for ac_prog in mkdir gmkdir; do
24422468 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
24442470 case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
24452471 'mkdir (GNU coreutils) '* | \
24462472 'mkdir (coreutils) '* | \
24932519 IFS=$as_save_IFS
24942520 test -z "$as_dir" && as_dir=.
24952521 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
24972523 ac_cv_prog_AWK="$ac_prog"
24982524 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
24992525 break 2
25792605
25802606 # Define the identity of the package.
25812607 PACKAGE='ykclient'
2582 VERSION='2.9'
2608 VERSION='2.10'
25832609
25842610
25852611 cat >>confdefs.h <<_ACEOF
26802706 IFS=$as_save_IFS
26812707 test -z "$as_dir" && as_dir=.
26822708 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
26842710 ac_cv_prog_CC="${ac_tool_prefix}gcc"
26852711 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
26862712 break 2
27202746 IFS=$as_save_IFS
27212747 test -z "$as_dir" && as_dir=.
27222748 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
27242750 ac_cv_prog_ac_ct_CC="gcc"
27252751 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
27262752 break 2
27732799 IFS=$as_save_IFS
27742800 test -z "$as_dir" && as_dir=.
27752801 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
27772803 ac_cv_prog_CC="${ac_tool_prefix}cc"
27782804 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
27792805 break 2
28142840 IFS=$as_save_IFS
28152841 test -z "$as_dir" && as_dir=.
28162842 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
28182844 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
28192845 ac_prog_rejected=yes
28202846 continue
28722898 IFS=$as_save_IFS
28732899 test -z "$as_dir" && as_dir=.
28742900 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
28762902 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
28772903 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
28782904 break 2
29162942 IFS=$as_save_IFS
29172943 test -z "$as_dir" && as_dir=.
29182944 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
29202946 ac_cv_prog_ac_ct_CC="$ac_prog"
29212947 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
29222948 break 2
33623388 /* end confdefs.h. */
33633389 #include <stdarg.h>
33643390 #include <stdio.h>
3365 #include <sys/types.h>
3366 #include <sys/stat.h>
3391 struct stat;
33673392 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
33683393 struct buf { int x; };
33693394 FILE * (*rcsopen) (struct buf *, struct stat *, int);
36393664 fi
36403665
36413666
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
36423833 # Make sure we can run config.sub.
36433834 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
36443835 as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
37313922 IFS=$as_save_IFS
37323923 test -z "$as_dir" && as_dir=.
37333924 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
37353926 ac_cv_prog_AS="${ac_tool_prefix}as"
37363927 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
37373928 break 2
37713962 IFS=$as_save_IFS
37723963 test -z "$as_dir" && as_dir=.
37733964 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
37753966 ac_cv_prog_ac_ct_AS="as"
37763967 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
37773968 break 2
38234014 IFS=$as_save_IFS
38244015 test -z "$as_dir" && as_dir=.
38254016 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
38274018 ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
38284019 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
38294020 break 2
38634054 IFS=$as_save_IFS
38644055 test -z "$as_dir" && as_dir=.
38654056 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
38674058 ac_cv_prog_ac_ct_DLLTOOL="dlltool"
38684059 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
38694060 break 2
39154106 IFS=$as_save_IFS
39164107 test -z "$as_dir" && as_dir=.
39174108 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
39194110 ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
39204111 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
39214112 break 2
39554146 IFS=$as_save_IFS
39564147 test -z "$as_dir" && as_dir=.
39574148 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
39594150 ac_cv_prog_ac_ct_OBJDUMP="objdump"
39604151 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
39614152 break 2
41294320 for ac_prog in sed gsed; do
41304321 for ac_exec_ext in '' $ac_executable_extensions; do
41314322 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
41334324 # Check for GNU ac_path_SED and select it if it is found.
41344325 # Check for GNU $ac_path_SED
41354326 case `"$ac_path_SED" --version 2>&1` in
42054396 for ac_prog in grep ggrep; do
42064397 for ac_exec_ext in '' $ac_executable_extensions; do
42074398 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
42094400 # Check for GNU ac_path_GREP and select it if it is found.
42104401 # Check for GNU $ac_path_GREP
42114402 case `"$ac_path_GREP" --version 2>&1` in
42714462 for ac_prog in egrep; do
42724463 for ac_exec_ext in '' $ac_executable_extensions; do
42734464 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
42754466 # Check for GNU ac_path_EGREP and select it if it is found.
42764467 # Check for GNU $ac_path_EGREP
42774468 case `"$ac_path_EGREP" --version 2>&1` in
43384529 for ac_prog in fgrep; do
43394530 for ac_exec_ext in '' $ac_executable_extensions; do
43404531 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
43424533 # Check for GNU ac_path_FGREP and select it if it is found.
43434534 # Check for GNU $ac_path_FGREP
43444535 case `"$ac_path_FGREP" --version 2>&1` in
45944785 IFS=$as_save_IFS
45954786 test -z "$as_dir" && as_dir=.
45964787 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
45984789 ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
45994790 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
46004791 break 2
46384829 IFS=$as_save_IFS
46394830 test -z "$as_dir" && as_dir=.
46404831 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
46424833 ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
46434834 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
46444835 break 2
50625253 IFS=$as_save_IFS
50635254 test -z "$as_dir" && as_dir=.
50645255 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
50665257 ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
50675258 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
50685259 break 2
51025293 IFS=$as_save_IFS
51035294 test -z "$as_dir" && as_dir=.
51045295 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
51065297 ac_cv_prog_ac_ct_OBJDUMP="objdump"
51075298 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
51085299 break 2
52235414 else
52245415 lt_cv_deplibs_check_method=pass_all
52255416 fi
5226 ;;
5227
5228 gnu*)
5229 lt_cv_deplibs_check_method=pass_all
52305417 ;;
52315418
52325419 haiku*)
52675454 ;;
52685455
52695456 # This must be glibc/ELF.
5270 linux* | k*bsd*-gnu | kopensolaris*-gnu)
5457 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
52715458 lt_cv_deplibs_check_method=pass_all
52725459 ;;
52735460
54055592 IFS=$as_save_IFS
54065593 test -z "$as_dir" && as_dir=.
54075594 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
54095596 ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
54105597 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
54115598 break 2
54455632 IFS=$as_save_IFS
54465633 test -z "$as_dir" && as_dir=.
54475634 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
54495636 ac_cv_prog_ac_ct_DLLTOOL="dlltool"
54505637 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
54515638 break 2
55265713
55275714
55285715
5529
55305716 if test -n "$ac_tool_prefix"; then
55315717 for ac_prog in ar
55325718 do
55465732 IFS=$as_save_IFS
55475733 test -z "$as_dir" && as_dir=.
55485734 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
55505736 ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
55515737 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
55525738 break 2
55905776 IFS=$as_save_IFS
55915777 test -z "$as_dir" && as_dir=.
55925778 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
55945780 ac_cv_prog_ac_ct_AR="$ac_prog"
55955781 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
55965782 break 2
57155901 IFS=$as_save_IFS
57165902 test -z "$as_dir" && as_dir=.
57175903 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
57195905 ac_cv_prog_STRIP="${ac_tool_prefix}strip"
57205906 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
57215907 break 2
57555941 IFS=$as_save_IFS
57565942 test -z "$as_dir" && as_dir=.
57575943 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
57595945 ac_cv_prog_ac_ct_STRIP="strip"
57605946 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
57615947 break 2
58146000 IFS=$as_save_IFS
58156001 test -z "$as_dir" && as_dir=.
58166002 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
58186004 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
58196005 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
58206006 break 2
58546040 IFS=$as_save_IFS
58556041 test -z "$as_dir" && as_dir=.
58566042 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
58586044 ac_cv_prog_ac_ct_RANLIB="ranlib"
58596045 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
58606046 break 2
65036689 IFS=$as_save_IFS
65046690 test -z "$as_dir" && as_dir=.
65056691 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
65076693 ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
65086694 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
65096695 break 2
65436729 IFS=$as_save_IFS
65446730 test -z "$as_dir" && as_dir=.
65456731 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
65476733 ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
65486734 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
65496735 break 2
66236809 IFS=$as_save_IFS
66246810 test -z "$as_dir" && as_dir=.
66256811 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
66276813 ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
66286814 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
66296815 break 2
66636849 IFS=$as_save_IFS
66646850 test -z "$as_dir" && as_dir=.
66656851 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
66676853 ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
66686854 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
66696855 break 2
67156901 IFS=$as_save_IFS
67166902 test -z "$as_dir" && as_dir=.
67176903 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
67196905 ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
67206906 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
67216907 break 2
67556941 IFS=$as_save_IFS
67566942 test -z "$as_dir" && as_dir=.
67576943 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
67596945 ac_cv_prog_ac_ct_NMEDIT="nmedit"
67606946 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
67616947 break 2
68076993 IFS=$as_save_IFS
68086994 test -z "$as_dir" && as_dir=.
68096995 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
68116997 ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
68126998 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
68136999 break 2
68477033 IFS=$as_save_IFS
68487034 test -z "$as_dir" && as_dir=.
68497035 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
68517037 ac_cv_prog_ac_ct_LIPO="lipo"
68527038 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
68537039 break 2
68997085 IFS=$as_save_IFS
69007086 test -z "$as_dir" && as_dir=.
69017087 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
69037089 ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
69047090 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
69057091 break 2
69397125 IFS=$as_save_IFS
69407126 test -z "$as_dir" && as_dir=.
69417127 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
69437129 ac_cv_prog_ac_ct_OTOOL="otool"
69447130 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
69457131 break 2
69917177 IFS=$as_save_IFS
69927178 test -z "$as_dir" && as_dir=.
69937179 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
69957181 ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
69967182 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
69977183 break 2
70317217 IFS=$as_save_IFS
70327218 test -z "$as_dir" && as_dir=.
70337219 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
70357221 ac_cv_prog_ac_ct_OTOOL64="otool64"
70367222 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
70377223 break 2
81898375 lt_prog_compiler_static='-non_shared'
81908376 ;;
81918377
8192 linux* | k*bsd*-gnu | kopensolaris*-gnu)
8378 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
81938379 case $cc_basename in
81948380 # old Intel for x86_64 which still supported -KPIC.
81958381 ecc*)
1035910545 esac
1036010546 ;;
1036110547
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
1037310548 haiku*)
1037410549 version_type=linux # correct to gnu/linux during the next big refactor
1037510550 need_lib_prefix=no
1048610661 ;;
1048710662
1048810663 # This must be glibc/ELF.
10489 linux* | k*bsd*-gnu | kopensolaris*-gnu)
10664 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
1049010665 version_type=linux # correct to gnu/linux during the next big refactor
1049110666 need_lib_prefix=no
1049210667 need_version=no
1158611761 IFS=$as_save_IFS
1158711762 test -z "$as_dir" && as_dir=.
1158811763 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
1159011765 ac_cv_prog_AWK="$ac_prog"
1159111766 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1159211767 break 2
1163611811 IFS=$as_save_IFS
1163711812 test -z "$as_dir" && as_dir=.
1163811813 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
1164011815 ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
1164111816 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1164211817 break 2
1167711852 IFS=$as_save_IFS
1167811853 test -z "$as_dir" && as_dir=.
1167911854 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
1168111856 ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
1168211857 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
1168311858 break 2
1179811973 x=CURLOPT_ERRORBUFFER;
1179911974 x=CURLOPT_STDERR;
1180011975 x=CURLOPT_VERBOSE;
11976 if (x) ;
1180111977
1180211978 ;
1180311979 return 0;
1191812094 unset _libcurl_with
1191912095
1192012096
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"
1192212398
1192312399 cat >confcache <<\_ACEOF
1192412400 # This file is a shell script that caches the results of configure
1237912855 # ... but there are two gotchas:
1238012856 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
1238112857 # 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'.
1238312859 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'
1238512861 elif ln conf$$.file conf$$ 2>/dev/null; then
1238612862 as_ln_s=ln
1238712863 else
12388 as_ln_s='cp -p'
12864 as_ln_s='cp -pR'
1238912865 fi
1239012866 else
12391 as_ln_s='cp -p'
12867 as_ln_s='cp -pR'
1239212868 fi
1239312869 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
1239412870 rmdir conf$$.dir 2>/dev/null
1244812924 as_mkdir_p=false
1244912925 fi
1245012926
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
1247312937
1247412938 # Sed expression to map a string onto a valid CPP name.
1247512939 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
1249012954 # report actual input values of CONFIG_FILES etc. instead of their
1249112955 # values after options handling.
1249212956 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
1249512959
1249612960 CONFIG_FILES = $CONFIG_FILES
1249712961 CONFIG_HEADERS = $CONFIG_HEADERS
1254713011 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1254813012 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1254913013 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,
1255213016 with options \\"\$ac_cs_config\\"
1255313017
12554 Copyright (C) 2010 Free Software Foundation, Inc.
13018 Copyright (C) 2012 Free Software Foundation, Inc.
1255513019 This config.status script is free software; the Free Software Foundation
1255613020 gives unlimited permission to copy, distribute and modify it."
1255713021
1263113095 _ACEOF
1263213096 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1263313097 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
1263513099 shift
1263613100 \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
1263713101 CONFIG_SHELL='$SHELL'
1294713411 "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
1294813412 "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
1294913413 "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
13414 "ykclient_version.h") CONFIG_FILES="$CONFIG_FILES ykclient_version.h" ;;
1295013415 "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
1295113416
1295213417 *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
1414314608 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
1414414609 fi
1414514610
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;}
00 # Written by Simon Josefsson <simon@josefsson.org>.
1 # Copyright (c) 2008-2012 Yubico AB
1 # Copyright (c) 2008-2013 Yubico AB
22 # All rights reserved.
33 #
44 # Redistribution and use in source and binary forms, with or without
2525 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
28 AC_INIT([ykclient], [2.9], [yubico-devel@googlegroups.com])
28 AC_INIT([ykclient], [2.10], [yubico-devel@googlegroups.com])
2929 AC_CONFIG_MACRO_DIR([m4])
3030
3131 # Library code modified: REVISION++
3232 # Interfaces changed/added/removed: CURRENT++ REVISION=0
3333 # Interfaces added: AGE++
3434 # 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)
3838
39 AM_INIT_AUTOMAKE([1.10 -Wall -Werror])
39 AM_INIT_AUTOMAKE([1.11 -Wall -Werror])
4040 AM_SILENT_RULES([yes])
4141 AC_PROG_CC
42
43 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
44
45 AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
4246 AC_LIBTOOL_WIN32_DLL
4347 AC_PROG_LIBTOOL
4448
4549 LIBCURL_CHECK_CONFIG([yes], [], [], [
4650 AC_MSG_ERROR([[Libcurl header files not found, install libcurl-dev.]])])
4751
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
4886 AC_CONFIG_FILES([
49 Makefile
50 tests/Makefile
87 Makefile
88 ykclient_version.h
89 tests/Makefile
5190 ])
5291 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 ])
00 #! /bin/sh
11 # depcomp - compile a program generating dependencies as side-effects
22
3 scriptversion=2011-12-04.11; # UTC
3 scriptversion=2012-03-27.16; # UTC
44
55 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
6 # 2011 Free Software Foundation, Inc.
6 # 2011, 2012 Free Software Foundation, Inc.
77
88 # This program is free software; you can redistribute it and/or modify
99 # it under the terms of the GNU General Public License as published by
2727
2828 case $1 in
2929 '')
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
3131 exit 1;
3232 ;;
3333 -h | --h*)
3939
4040 Environment variables:
4141 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'.
4444 DEPDIR directory where to store dependencies.
4545 depfile Dependency file to output.
4646 tmpdepfile Temporary file to use when outputting dependencies.
5656 ;;
5757 esac
5858
59 # A tabulation character.
60 tab=' '
61 # A newline character.
62 nl='
63 '
64
5965 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
6066 echo "depcomp: Variables source, object and depmode must be set" 1>&2
6167 exit 1
99105 # slashes to satisfy depend.m4
100106 cygpath_u='sed s,\\\\,/,g'
101107 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
102114 fi
103115
104116 case "$depmode" in
155167 ## The second -e expression handles DOS-style file names with drive letters.
156168 sed -e 's/^[^:]*: / /' \
157169 -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.
159171 ## The problem is that when a header file which appears in a .P file
160172 ## is deleted, the dependency causes make to die (because there is
161173 ## typically no way to rebuild the header). We avoid this by adding
162174 ## dummy dependencies for each header file. Too bad gcc doesn't do
163175 ## 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
167178 ## that the space means something, we add a space to the output as
168179 ## well. hp depmode also adds that space, but also prefixes the VPATH
169180 ## to the object. Take care to not repeat it in the output.
202213 # clever and replace this with sed code, as IRIX sed won't handle
203214 # lines with more than a fixed number of characters (4096 in
204215 # 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
206217 # dependency line.
207 tr ' ' '
208 ' < "$tmpdepfile" \
218 tr ' ' "$nl" < "$tmpdepfile" \
209219 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
210 tr '
211 ' ' ' >> "$depfile"
220 tr "$nl" ' ' >> "$depfile"
212221 echo >> "$depfile"
213222
214223 # The second pass generates a dummy entry for each header file.
215 tr ' ' '
216 ' < "$tmpdepfile" \
224 tr ' ' "$nl" < "$tmpdepfile" \
217225 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
218226 >> "$depfile"
219227 else
225233 rm -f "$tmpdepfile"
226234 ;;
227235
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
228243 aix)
229244 # The C for AIX Compiler uses -M and outputs the dependencies
230245 # 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
232247 # start of each line; $object doesn't have directory information.
233248 # Version 6 uses the directory in both cases.
234249 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
258273 test -f "$tmpdepfile" && break
259274 done
260275 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'.
262277 # 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:'.
264279 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"
267281 else
268282 # The sourcefile does not contain any dependencies, so just
269283 # store a dummy comment line, to avoid errors with the Makefile
274288 ;;
275289
276290 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
279294 # ICC 7.0 will fill foo.d with something like
280295 # foo.o: sub/foo.c
281296 # foo.o: sub/foo.h
282 # which is wrong. We want:
297 # which is wrong. We want
283298 # sub/foo.o: sub/foo.c
284299 # sub/foo.o: sub/foo.h
285300 # sub/foo.c:
286301 # sub/foo.h:
287302 # ICC 7.1 will output
288303 # foo.o: sub/foo.c sub/foo.h
289 # and will wrap long lines using \ :
304 # and will wrap long lines using '\':
290305 # foo.o: sub/foo.c ... \
291306 # sub/foo.h ... \
292307 # ...
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.
294311 "$@" -MD -MF "$tmpdepfile"
295312 stat=$?
296313 if test $stat -eq 0; then :
299316 exit $stat
300317 fi
301318 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 \'.
304321 # 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"
311334 rm -f "$tmpdepfile"
312335 ;;
313336
343366 done
344367 if test -f "$tmpdepfile"; then
345368 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
346 # Add `dependent.h:' lines.
369 # Add 'dependent.h:' lines.
347370 sed -ne '2,${
348371 s/^ *//
349372 s/ \\*$//
358381
359382 tru64)
360383 # 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'.
362385 # 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.
364387 # Subdirectories are respected.
365388 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
366389 test "x$dir" = "x$object" && dir=
406429 done
407430 if test -f "$tmpdepfile"; then
408431 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"
411433 else
412434 echo "#dummy" > "$depfile"
413435 fi
442464 p
443465 }' | $cygpath_u | sort -u | sed -n '
444466 s/ /\\ /g
445 s/\(.*\)/ \1 \\/p
467 s/\(.*\)/'"$tab"'\1 \\/p
446468 s/.\(.*\) \\/\1:/
447469 H
448470 $ {
449 s/.*/ /
471 s/.*/'"$tab"'/
450472 G
451473 p
452474 }' >> "$depfile"
477499 shift
478500 fi
479501
480 # Remove `-o $object'.
502 # Remove '-o $object'.
481503 IFS=" "
482504 for arg
483505 do
497519 done
498520
499521 test -z "$dashmflag" && dashmflag=-M
500 # Require at least two characters before searching for `:'
522 # Require at least two characters before searching for ':'
501523 # 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.
503525 "$@" $dashmflag |
504 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
526 sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
505527 rm -f "$depfile"
506528 cat < "$tmpdepfile" > "$depfile"
507 tr ' ' '
508 ' < "$tmpdepfile" | \
529 tr ' ' "$nl" < "$tmpdepfile" | \
509530 ## Some versions of the HPUX 10.20 sed can't process this invocation
510531 ## correctly. Breaking it into two sed invocations is a workaround.
511532 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
561582 # makedepend may prepend the VPATH from the source file name to the object.
562583 # No need to regex-escape $object, excess matching of '.' is harmless.
563584 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
564 sed '1,2d' "$tmpdepfile" | tr ' ' '
565 ' | \
585 sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
566586 ## Some versions of the HPUX 10.20 sed can't process this invocation
567587 ## correctly. Breaking it into two sed invocations is a workaround.
568588 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
582602 shift
583603 fi
584604
585 # Remove `-o $object'.
605 # Remove '-o $object'.
586606 IFS=" "
587607 for arg
588608 do
651671 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
652672 rm -f "$depfile"
653673 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"
656676 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
657677 rm -f "$tmpdepfile"
658678 ;;
00 #!/bin/sh
11 # install - install a program, script, or datafile
22
3 scriptversion=2009-04-28.21; # UTC
3 scriptversion=2011-01-19.21; # UTC
44
55 # This originates from X11R5 (mit/util/scripts/install.sh), which was
66 # later released in X11R6 (xc/config/util/install.sh) with the
155155 -s) stripcmd=$stripprog;;
156156
157157 -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
158162 shift;;
159163
160164 -T) no_target_directory=true;;
185189 fi
186190 shift # arg
187191 dst_arg=$arg
192 # Protect names problematic for `test' and other utilities.
193 case $dst_arg in
194 -* | [=\(\)!]) dst_arg=./$dst_arg;;
195 esac
188196 done
189197 fi
190198
199207 fi
200208
201209 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
203215
204216 # Set umask so as not to create temps with too-generous modes.
205217 # However, 'strip' requires both read and write access to temps.
227239
228240 for src
229241 do
230 # Protect names starting with `-'.
242 # Protect names problematic for `test' and other utilities.
231243 case $src in
232 -*) src=./$src;;
244 -* | [=\(\)!]) src=./$src;;
233245 esac
234246
235247 if test -n "$dir_arg"; then
251263 echo "$0: no destination specified." >&2
252264 exit 1
253265 fi
254
255266 dst=$dst_arg
256 # Protect names starting with `-'.
257 case $dst in
258 -*) dst=./$dst;;
259 esac
260267
261268 # If destination is a directory, append the input filename; won't work
262269 # if double slashes aren't ignored.
384391
385392 case $dstdir in
386393 /*) prefix='/';;
387 -*) prefix='./';;
394 [-=\(\)!]*) prefix='./';;
388395 *) prefix='';;
389396 esac
390397
402409
403410 for d
404411 do
405 test -z "$d" && continue
412 test X"$d" = X && continue
406413
407414 prefix=$prefix$d
408415 if test -d "$prefix"; then
6969 # compiler: $LTCC
7070 # compiler flags: $LTCFLAGS
7171 # 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
7373 # automake: $automake_version
7474 # autoconf: $autoconf_version
7575 #
7979
8080 PROGRAM=libtool
8181 PACKAGE=libtool
82 VERSION="2.4.2 Debian-2.4.2-1ubuntu1"
82 VERSION="2.4.2 Debian-2.4.2-1.1"
8383 TIMESTAMP=""
8484 package_revision=1.3337
8585
25112511 esac
25122512 ;;
25132513
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
25252514 haiku*)
25262515 version_type=linux # correct to gnu/linux during the next big refactor
25272516 need_lib_prefix=no
26382627 ;;
26392628
26402629 # This must be glibc/ELF.
2641 linux* | k*bsd*-gnu | kopensolaris*-gnu)
2630 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
26422631 version_type=linux # correct to gnu/linux during the next big refactor
26432632 need_lib_prefix=no
26442633 need_version=no
32543243 fi
32553244 ;;
32563245
3257 gnu*)
3258 lt_cv_deplibs_check_method=pass_all
3259 ;;
3260
32613246 haiku*)
32623247 lt_cv_deplibs_check_method=pass_all
32633248 ;;
32963281 ;;
32973282
32983283 # This must be glibc/ELF.
3299 linux* | k*bsd*-gnu | kopensolaris*-gnu)
3284 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
33003285 lt_cv_deplibs_check_method=pass_all
33013286 ;;
33023287
40484033 ;;
40494034 esac
40504035 ;;
4051 linux* | k*bsd*-gnu | kopensolaris*-gnu)
4036 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
40524037 case $cc_basename in
40534038 KCC*)
40544039 # KAI C++ Compiler
43474332 _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
43484333 ;;
43494334
4350 linux* | k*bsd*-gnu | kopensolaris*-gnu)
4335 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
43514336 case $cc_basename in
43524337 # old Intel for x86_64 which still supported -KPIC.
43534338 ecc*)
62406225 _LT_TAGVAR(ld_shlibs, $1)=yes
62416226 ;;
62426227
6243 gnu*)
6244 ;;
6245
62466228 haiku*)
62476229 _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
62486230 _LT_TAGVAR(link_all_deplibs, $1)=yes
64046386 _LT_TAGVAR(inherit_rpath, $1)=yes
64056387 ;;
64066388
6407 linux* | k*bsd*-gnu | kopensolaris*-gnu)
6389 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
64086390 case $cc_basename in
64096391 KCC*)
64106392 # 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
-58
simple.mk less more
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
3131 AM_LDFLAGS = -no-install
3232 AM_CFLAGS=-I$(srcdir)/..
3333 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
3537
3638 check_PROGRAMS = selftest
3739 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.
11 # @configure_input@
22
33 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4444
4545 # Self tests.
4646 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 }
4764 pkgdatadir = $(datadir)/@PACKAGE@
4865 pkgincludedir = $(includedir)/@PACKAGE@
4966 pkglibdir = $(libdir)/@PACKAGE@
6986 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
7087 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
7188 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
89 $(top_srcdir)/m4/manywarnings.m4 $(top_srcdir)/m4/warnings.m4 \
7290 $(top_srcdir)/configure.ac
7391 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
7492 $(ACLOCAL_M4)
7694 CONFIG_CLEAN_FILES =
7795 CONFIG_CLEAN_VPATH_FILES =
7896 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)
8099 selftest_OBJECTS = $(am_selftest_OBJECTS)
81100 selftest_LDADD = $(LDADD)
82101 selftest_DEPENDENCIES = ../libykclient.la
111130 am__v_GEN_0 = @echo " GEN " $@;
112131 SOURCES = $(selftest_SOURCES)
113132 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
114138 ETAGS = etags
115139 CTAGS = ctags
116140 am__tty_colors = \
143167 EXEEXT = @EXEEXT@
144168 FGREP = @FGREP@
145169 GREP = @GREP@
170 HELP2MAN = @HELP2MAN@
146171 INSTALL = @INSTALL@
147172 INSTALL_DATA = @INSTALL_DATA@
148173 INSTALL_PROGRAM = @INSTALL_PROGRAM@
184209 SHELL = @SHELL@
185210 STRIP = @STRIP@
186211 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@
187217 _libcurl_config = @_libcurl_config@
188218 abs_builddir = @abs_builddir@
189219 abs_srcdir = @abs_srcdir@
241271 AM_LDFLAGS = -no-install
242272 AM_CFLAGS = -I$(srcdir)/..
243273 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
245278 TESTS = $(check_PROGRAMS)
246279 all: all-am
247280
298331
299332 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdecode.Po@am__quote@
300333 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cencode.Po@am__quote@
334 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hmac.Po@am__quote@
301335 @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@
302340
303341 .c.o:
304342 @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
348386 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../b64/cdecode.c' object='cdecode.obj' libtool=no @AMDEPBACKSLASH@
349387 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
350388 @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`
351459
352460 mostlyclean-libtool:
353461 -rm -f *.lo
00 /* selftest.c --- Self-tests for Yubico client library.
11 *
22 * Written by Simon Josefsson <simon@josefsson.org>.
3 * Copyright (c) 2006-2012 Yubico AB
3 * Copyright (c) 2006-2013 Yubico AB
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
3333 #include <stdio.h>
3434 #include <assert.h>
3535
36 #include <curl/curl.h>
37
3836 #include "b64/cencode.h"
3937 #include "b64/cdecode.h"
38
39 #include "rfc4634/sha.h"
4040
4141 #define TEST(xX) printf ("\nTest %s:%d (%s): ", __FILE__, __LINE__, __FUNCTION__); \
4242 printf xX; \
116116 ret = strcmp(buf, "blahonga");
117117 assert(ret == 0);
118118 }
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
119198
120199 int
121200 main (void)
130209 ykclient_t *ykc;
131210 int ret;
132211
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);
134236
135237 TEST(("init self"));
136238 ret = ykclient_init (&ykc);
337439
338440 test_base64();
339441
442 test_hmac();
443
340444 printf ("All tests passed\n");
341445
342 curl_global_cleanup();
446 ykclient_global_done();
343447
344448 return 0;
345449 }
00 /* tool.c --- Command line interface to libykclient.
11 *
2 * Copyright (c) 2006-2012 Yubico AB
2 * Copyright (c) 2006-2013 Yubico AB
33 * Copyright (c) 2012 Secure Mission Solutions
44 * All rights reserved.
55 *
3939 #include <getopt.h>
4040
4141 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"
4545 "\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";
5060
5161 static struct option long_options[] = {
5262 {"url", 1, 0, 'u'},
5363 {"ca", 1, 0, 'c'},
5464 {"apikey", 1, 0, 'a'},
65 {"debug", 0, 0, 'd'},
66 {"help", 0, 0, 'h'},
67 {"version", 0, 0, 'V'},
5568 {0, 0, 0, 0}
5669 };
5770
5871 /* Parse command line parameters. */
59 void
72 static void
6073 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)
6276 {
6377 while (1)
6478 {
8094 }
8195 *api_key = optarg;
8296 break;
97
98 case 'd':
99 *debug = 1;
100 break;
101
83102 case 'u':
84103 if (strncmp ("http://", optarg, 7) != 0
85104 && strncmp ("https://", optarg, 8) != 0)
89108 }
90109 *url = optarg;
91110 break;
111
92112 case 'c':
93113 if (strlen (optarg) < 1)
94114 {
95 fprintf (stderr, "error: must give a valid directory containing CAs");
115 fprintf (stderr,
116 "error: must give a valid directory containing CAs");
96117 exit (EXIT_FAILURE);
97118 }
98119 *ca = optarg;
99120 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;
100131 }
101132 }
102133
103134 if (argc - optind != 2)
104135 {
105 fprintf (stderr, "%s", usage);
106 exit (EXIT_FAILURE);
136 printf ("%s", usage);
137 exit (EXIT_SUCCESS);
107138 }
108139
109140 /* Now get mandatory numeric client_id */
110 *client_id = atoi (argv[optind++]);
141 *client_id = strtoul (argv[optind++], NULL, 10);
111142
112143 if (*client_id <= 0)
113144 {
128159 int
129160 main (int argc, char *argv[])
130161 {
131 int client_id;
162 unsigned int client_id;
132163 char *token, *url = NULL, *ca = NULL, *api_key = NULL;
133 int ret;
164 int debug = 0;
165 ykclient_rc ret;
134166 ykclient_t *ykc = NULL;
135167
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);
137169
138170 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;
166202
167203 return EXIT_SUCCESS;
168204 }
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>.
00 /* ykclient.c --- Implementation of Yubikey OTP validation client library.
11 *
22 * Written by Simon Josefsson <simon@josefsson.org>.
3 * Copyright (c) 2006-2012 Yubico AB
3 * Copyright (c) 2006-2013 Yubico AB
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
5151 {
5252 const char *ca_path;
5353 size_t num_templates;
54 const char **url_templates;
54 char **url_templates;
5555 char last_url[256];
5656 unsigned int client_id;
5757 size_t keylen;
6060 char *nonce;
6161 char nonce_supplied;
6262 int verify_signature;
63 const char *user_agent;
6364 };
6465
6566 struct curl_data
6667 {
6768 char *curl_chunk;
6869 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;
6979 };
7080
7181 const char *default_url_templates[] = {
7888
7989 const size_t default_num_templates = 5;
8090
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
82129 ykclient_init (ykclient_t ** ykc)
83130 {
84131 ykclient_t *p;
86133 p = malloc (sizeof (*p));
87134
88135 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)));
92141
93142 p->ca_path = NULL;
94 p->num_templates = 0;
95 p->url_templates = NULL;
96143
97144 p->key = NULL;
98145 p->keylen = 0;
99146 p->key_buf = NULL;
100147
101 memset(p->last_url, 0, sizeof(p->last_url));
148 memset (p->last_url, 0, sizeof (p->last_url));
102149
103150 p->nonce = NULL;
104151 p->nonce_supplied = 0;
105152
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
108156 */
109157 p->verify_signature = 0;
110158
111159 *ykc = p;
112160
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
113174 return YKCLIENT_OK;
114175 }
115176
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 */
116184 void
117185 ykclient_done (ykclient_t ** ykc)
118186 {
119187 if (ykc && *ykc)
120188 {
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
121199 free ((*ykc)->key_buf);
122 free ((*ykc)->url_templates);
123200 free (*ykc);
124201 }
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 }
128419 }
129420
130421 void
131422 ykclient_set_verify_signature (ykclient_t * ykc, int value)
132423 {
133424 if (ykc == NULL)
134 return;
425 {
426 return;
427 }
428
135429 ykc->verify_signature = value;
136430 }
137431
144438 ykc->key = key;
145439 }
146440
147 int
441 ykclient_rc
148442 ykclient_set_client_hex (ykclient_t * ykc,
149443 unsigned int client_id, const char *key)
150444 {
155449 ykc->client_id = client_id;
156450
157451 if (key == NULL)
158 return YKCLIENT_OK;
452 {
453 return YKCLIENT_OK;
454 }
159455
160456 key_len = strlen (key);
161457
162458 if (key_len % 2 != 0)
163 return YKCLIENT_HEX_DECODE_ERROR;
459 {
460 return YKCLIENT_HEX_DECODE_ERROR;
461 }
164462
165463 bin_len = key_len / 2;
166464
167465 free (ykc->key_buf);
466
168467 ykc->key_buf = malloc (bin_len);
169468 if (!ykc->key_buf)
170 return YKCLIENT_OUT_OF_MEMORY;
469 {
470 return YKCLIENT_OUT_OF_MEMORY;
471 }
171472
172473 for (i = 0; i < bin_len; i++)
173474 {
189490 return YKCLIENT_OK;
190491 }
191492
192 int
493 ykclient_rc
193494 ykclient_set_client_b64 (ykclient_t * ykc,
194495 unsigned int client_id, const char *key)
195496 {
196497 size_t key_len;
498 ssize_t dec_len;
499
197500 base64_decodestate b64;
198501
199502 ykc->client_id = client_id;
200503
201504 if (key == NULL)
202 return YKCLIENT_OK;
505 {
506 return YKCLIENT_OK;
507 }
203508
204509 key_len = strlen (key);
205510
206511 free (ykc->key_buf);
512
207513 ykc->key_buf = malloc (key_len + 1);
208514 if (!ykc->key_buf)
209 return YKCLIENT_OUT_OF_MEMORY;
515 {
516 return YKCLIENT_OUT_OF_MEMORY;
517 }
210518
211519 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;
213526 ykc->key = ykc->key_buf;
527
214528 /* Now that we have a key the sensible default is to verify signatures */
215529 ykc->verify_signature = 1;
216530
217531 return YKCLIENT_OK;
218532 }
219533
534 /** Set the CA path
535 *
536 * Must be called before creating handles.
537 */
220538 void
221539 ykclient_set_ca_path (ykclient_t * ykc, const char *ca_path)
222540 {
223541 ykc->ca_path = ca_path;
224542 }
225543
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
227551 ykclient_set_url_template (ykclient_t * ykc, const char *url_template)
228552 {
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
233570 ykclient_set_url_templates (ykclient_t * ykc, size_t num_templates,
234571 const char **url_templates)
235572 {
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 }
247608 return YKCLIENT_OK;
248609 }
249610
250611 /*
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
252613 * if you either want to specify your own nonce, or want to remove the
253614 * nonce (needed to send signed requests to v1 validation servers),
254615 * you must call this function. Set nonce to NULL to disable it.
260621 ykc->nonce = nonce;
261622 }
262623
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
2831350 ykclient_verify_otp_v2 (ykclient_t * ykc_in,
2841351 const char *yubikey_otp,
2851352 unsigned int client_id,
2871354 size_t urlcount,
2881355 const char **urls, const char *api_key)
2891356 {
1357 ykclient_rc out;
2901358 ykclient_t *ykc;
291 int ret;
1359
2921360
2931361 if (ykc_in == NULL)
2941362 {
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 }
2981368 }
2991369 else
3001370 {
3051375
3061376 if (urlcount != 0 && *urls != 0)
3071377 {
308 ykclient_set_url_templates(ykc, urlcount, urls);
1378 ykclient_set_url_templates (ykc, urlcount, urls);
3091379 }
3101380
3111381 if (api_key)
3141384 ykclient_set_client_b64 (ykc, client_id, api_key);
3151385 }
3161386
317 ret = ykclient_request (ykc, yubikey_otp);
1387 out = ykclient_request (ykc, yubikey_otp);
3181388
3191389 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 }
8681393
8691394 return out;
8701395 }
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 }
00 /* ykclient.h --- Prototypes for Yubikey OTP validation client library.
11 *
22 * Written by Simon Josefsson <simon@josefsson.org>.
3 * Copyright (c) 2006-2012 Yubico AB
3 * Copyright (c) 2006-2013 Yubico AB
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
3535 #include <stdint.h>
3636 #include <string.h>
3737
38 # ifdef __cplusplus
38 #include <ykclient_errors.h>
39 #include <ykclient_version.h>
40
41 #ifdef __cplusplus
3942 extern "C"
4043 {
41 # endif
44 #endif
4245
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);
6849
69 typedef struct ykclient_st ykclient_t;
50 typedef struct ykclient_st ykclient_t;
7051
71 extern int ykclient_init (ykclient_t ** ykc);
52 typedef struct ykclient_handle_st ykclient_handle_t;
7253
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);
7464
7565 /* If value is 0 the authenticity of the signature returned by the
7666 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);
7868
79 extern const char *ykclient_strerror (int ret);
69 extern const char *ykclient_strerror (ykclient_rc ret);
8070
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);
8474
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);
8778
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);
9082
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);
9385
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);
9689
9790 /* By default the signature returned by the server is verified (modify
9891 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);
10093
10194 /*
10295 * Set the nonce. A default nonce is generated in ykclient_init(), but
10497 * nonce (needed to send signed requests to v1 validation servers),
10598 * you must call this function. Set nonce to NULL to disable it.
10699 */
107 extern void ykclient_set_nonce (ykclient_t * ykc, char *nonce);
100 extern void ykclient_set_nonce (ykclient_t * ykc, char *nonce);
108101
109 extern int ykclient_request (ykclient_t * ykc, const char *yubikey_otp);
110102
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);
112112
113113 /* 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);
116117
117118 /* 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);
124126
125 # ifdef __cplusplus
127 #ifdef __cplusplus
126128 }
127 # endif
129 #endif
128130
129131 #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
6868 ykclient_parameters_t *new_node = malloc (sizeof (ykclient_parameters_t));
6969 if (new_node == NULL)
7070 return;
71 memset(new_node, 0, (sizeof (ykclient_parameters_t)));
71 memset (new_node, 0, (sizeof (ykclient_parameters_t)));
7272
7373 new_node->parameter = elem;
7474 new_node->next = NULL;
146146 /* Server's response functions */
147147
148148 ykclient_server_response_t *
149 ykclient_server_response_init ()
149 ykclient_server_response_init (void)
150150 {
151151 ykclient_server_response_t *serv_response =
152152 malloc (sizeof (ykclient_server_response_t));
153153 if (serv_response == NULL)
154154 return NULL;
155 memset(serv_response, 0, (sizeof (ykclient_server_response_t)));
155 memset (serv_response, 0, (sizeof (ykclient_server_response_t)));
156156 serv_response->signature = NULL;
157157 serv_response->parameters = NULL;
158158 return serv_response;
205205
206206 /* Parses and builds the next parameter param from s, moves response's pointer
207207 to the immediate right character. Returns 0 if it succeeds. */
208 static int
208 static ykclient_rc
209209 parse_next_parameter (char **s, ykclient_parameter_t * param)
210210 {
211211 if (s == NULL || *s == NULL || param == NULL)
252252 return 0;
253253 }
254254
255 int
255 ykclient_rc
256256 ykclient_server_response_parse (char *response,
257257 ykclient_server_response_t * serv_response)
258258 {
265265 ykclient_parameter_t *param = malloc (sizeof (ykclient_parameter_t));
266266 if (param == NULL)
267267 return YKCLIENT_OUT_OF_MEMORY;
268 memset(param,0, (sizeof(ykclient_parameter_t)));
268 memset (param, 0, (sizeof (ykclient_parameter_t)));
269269 int ret = parse_next_parameter (&response, param);
270270 if (ret)
271271 return ret;
0 /* ykclient_server_response.c --- Server response parsing and validation.
0 /* ykclient_server_response.h --- Server response parsing and validation.
11 *
22 * Written by Sebastien Martini <seb@dbzteam.org>.
3 * Copyright (c) 2011-2012 Yubico AB
3 * Copyright (c) 2011-2013 Yubico AB
44 * All rights reserved.
55 *
66 * Redistribution and use in source and binary forms, with or without
3232 #ifndef YKCLIENT_SERVER_RESPONSE_H
3333 #define YKCLIENT_SERVER_RESPONSE_H
3434
35 #include <ykclient_errors.h>
36
3537 /* Example:
3638 key: status
3739 value: OK
5658
5759
5860 /* 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);
6062
6163 /* Frees allocated data structures. */
6264 extern void ykclient_server_response_free (ykclient_server_response_t
63 *response);
65 * response);
6466
6567 /* Parses server's response and builds a list of parameters and isolates
6668 the corresponding signature parameter. Returns 0 if it succeeds. */
67 extern int
69 extern ykclient_rc
6870 ykclient_server_response_parse (char *response,
69 ykclient_server_response_t *serv_response);
71 ykclient_server_response_t * serv_response);
7072
7173 /* Iterates the parameters buils a HMAC-SHA1 and checks it matches the
7274 signature returned by the server. This function returns 0 if the signature
7476 extern int
7577 ykclient_server_response_verify_signature (const ykclient_server_response_t
7678 * serv_response,
77 const char *key,
78 int key_length);
79 const char *key, int key_length);
7980
8081 /* Returns value associated to key or NULL if unmatched. The caller doesn't
8182 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);
8585
8686 #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 */