Hello community, here is the log from the commit of package libu2f-host for openSUSE:Factory checked in at 2016-03-26 15:28:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libu2f-host (Old) and /work/SRC/openSUSE:Factory/.libu2f-host.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libu2f-host" Changes: -------- --- /work/SRC/openSUSE:Factory/libu2f-host/libu2f-host.changes 2016-02-22 08:58:04.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libu2f-host.new/libu2f-host.changes 2016-03-26 17:30:38.000000000 +0100 @@ -1,0 +2,17 @@ +Wed Mar 23 20:45:47 UTC 2016 - jeng...@inai.de + +- Avoid undesired blank lines at start of descriptions. + Expand description. Trim filelist. + +------------------------------------------------------------------- +Mon Mar 21 12:21:54 UTC 2016 - t.gru...@katodev.de + +- Version 1.1.1 (released 2016-03-14) + - Use correct index in u2fh_devs_discover() + - Fix an issue where we left the authenticate loop early. + - Fix an issue where authenticate remembered which devices to skip. + - Stop validating the scheme of the origin. + - Fixup a crash in u2fh_devs_discover() with closing unplugged devices. + - Documentation fixes. + +------------------------------------------------------------------- Old: ---- libu2f-host-1.1.0.tar.xz libu2f-host-1.1.0.tar.xz.sig New: ---- libu2f-host-1.1.1.tar.xz libu2f-host-1.1.1.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libu2f-host.spec ++++++ --- /var/tmp/diff_new_pack.L70dnn/_old 2016-03-26 17:30:39.000000000 +0100 +++ /var/tmp/diff_new_pack.L70dnn/_new 2016-03-26 17:30:39.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package libu2f-host # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,9 +16,9 @@ # -%define soname 0 +%define sover 0 Name: libu2f-host -Version: 1.1.0 +Version: 1.1.1 Release: 0 Summary: Yubico Universal 2nd Factor (U2F) Host C Library License: GPL-3.0+ @@ -40,11 +40,11 @@ the host-side of the U2F protocol. There are APIs to talk to a U2F device and perform the U2F Register and U2F Authenticate operations. -%package -n %{name}%{soname} +%package -n %{name}%{sover} Summary: Library for Universal 2nd Factor (U2F) Group: Productivity/Networking/Security -%description -n %{name}%{soname} +%description -n %{name}%{sover} Libu2f-host provide a C library that implements the host-side of the U2F protocol. There are APIs to talk to a U2F device and perform the U2F Register and U2F Authenticate operations. @@ -52,7 +52,7 @@ %package -n %{name}-devel Summary: Development files for Universal 2nd Factor (U2F) Group: Development/Libraries/C and C++ -Requires: %{name}%{soname} = %{version} +Requires: %{name}%{sover} = %{version} %description -n %{name}-devel This package contains the header file needed to develop applications that @@ -61,19 +61,17 @@ %package -n u2f-host Summary: Tool to support Yubico's Universal 2nd Factor (U2F) Group: Productivity/Networking/Security -Requires: %{name}%{soname} = %{version} +Requires: %{name}%{sover} = %{version} %description -n u2f-host - -Command line tool that implements the host-side of the Universal 2nd Factor (U2F) protocol +Command line tool that implements the host side of the Universal 2nd Factor (U2F) protocol. %package doc -Summary: Doc-files for U2F protocol +Summary: Documentation for the U2F protocol Group: Productivity/Networking/Security %description doc - -Doc-files for the host-side of the U2F protocol. +Documentation files for the host side of the U2F protocol. %prep %setup -q @@ -89,9 +87,9 @@ %post %{?udev_rules_update:%udev_rules_update} -%post -n %{name}%{soname} -p /sbin/ldconfig +%post -n %{name}%{sover} -p /sbin/ldconfig -%postun -n %{name}%{soname} -p /sbin/ldconfig +%postun -n %{name}%{sover} -p /sbin/ldconfig %files -n u2f-host %defattr(-,root,root) @@ -104,20 +102,16 @@ %defattr(-,root,root) %dir %{_datadir}/gtk-doc %dir %{_datadir}/gtk-doc/html -%dir %{_datadir}/gtk-doc/html/u2f-host -%{_datadir}/gtk-doc/html/u2f-host/* +%{_datadir}/gtk-doc/html/u2f-host/ -%files -n %{name}%{soname} +%files -n %{name}%{sover} %defattr(-,root,root) -%{_libdir}/%{name}.so.%{soname} -%{_libdir}/%{name}.so.%{soname}.1.0 +%{_libdir}/%{name}.so.%{sover} +%{_libdir}/%{name}.so.%{sover}.1.1 %files -n %{name}-devel %defattr(-,root,root) -%dir %{_includedir}/u2f-host -%{_includedir}/u2f-host/u2f-host.h -%{_includedir}/u2f-host/u2f-host-types.h -%{_includedir}/u2f-host/u2f-host-version.h +%{_includedir}/u2f-host/ %{_libdir}/%{name}.so %{_libdir}/pkgconfig/* ++++++ libu2f-host-1.1.0.tar.xz -> libu2f-host-1.1.1.tar.xz ++++++ ++++ 1638 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/ChangeLog new/libu2f-host-1.1.1/ChangeLog --- old/libu2f-host-1.1.0/ChangeLog 2016-02-15 10:03:11.000000000 +0100 +++ new/libu2f-host-1.1.1/ChangeLog 2016-03-14 10:47:33.000000000 +0100 @@ -1,3 +1,43 @@ +2016-03-14 Klas Lindfors <k...@yubico.com> + + * NEWS: NEWS for 1.1.1 + +2016-03-14 Klas Lindfors <k...@yubico.com> + + * README: libhidapi-dev is needed for building fixes #48 + +2016-03-14 Klas Lindfors <k...@yubico.com> + + * u2f-host/devs.c: refactor close_device() to be safer let it return a pointer to dev->next and use that in some places we + where unsafely iterating the list and removing entries in a for loop + +2016-03-14 Klas Lindfors <k...@yubico.com> + + * src/u2f-host.c: drop code validating the scheme of origin fixes #49 + +2016-03-14 Klas Lindfors <k...@yubico.com> + + * u2f-host/u2fmisc.c: fix indentation + +2016-03-11 Klas Lindfors <k...@yubico.com> + + * u2f-host/authenticate.c: authenticate increased iterations before + checking if it was 0 thus remembering which devices to skip from call to call + +2016-03-11 Klas Lindfors <k...@yubico.com> + + * u2f-host/authenticate.c: fix an issue where we left the + authenticate loop early on failure this only happens on multiple devices where a non-interesting device + is last in the list + +2016-03-07 Klas Lindfors <kl...@avm.se> + + * : Merge pull request #47 from jaym/fix-uninitialized Use index from u2fdevice struct + +2016-02-15 Klas Lindfors <k...@yubico.com> + + * NEWS, configure.ac: bump versions + 2016-02-15 Klas Lindfors <k...@yubico.com> * NEWS: NEWS for 1.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/NEWS new/libu2f-host-1.1.1/NEWS --- old/libu2f-host-1.1.0/NEWS 2016-02-15 10:01:43.000000000 +0100 +++ new/libu2f-host-1.1.1/NEWS 2016-03-14 10:35:40.000000000 +0100 @@ -1,5 +1,19 @@ Copyright (C) 2013-2015 Yubico AB. Licensed under GPLv3+ . -*- outline -*- +* Version 1.1.1 (released 2016-03-14) + +** Use correct index in u2fh_devs_discover() + +** Fix an issue where we left the authenticate loop early. + +** Fix an issue where authenticate remembered which devices to skip. + +** Stop validating the scheme of the origin. + +** Fixup a crash in u2fh_devs_discover() with closing unplugged devices. + +** Documentation fixes. + * Version 1.1.0 (released 2016-02-15) ** Add udev rules for more devices. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/README new/libu2f-host-1.1.1/README --- old/libu2f-host-1.1.0/README 2015-12-10 14:59:11.000000000 +0100 +++ new/libu2f-host-1.1.1/README 2016-03-14 10:19:19.000000000 +0100 @@ -117,7 +117,7 @@ All of the above can be installed in Debian via: - apt-get install pkg-config libjson0-dev libhidapi-hidraw0 + apt-get install pkg-config libjson0-dev libhidapi-hidraw0 libhidapi-dev === Instructions This project uses autoconf, automake and libtool to achieve @@ -145,7 +145,7 @@ handling. HIDAPI developer files are also required. All of the above can be installed in Debian via: - apt-get install gtk-doc-tools libhidapi-dev gengetopt help2man + apt-get install gtk-doc-tools gengetopt help2man Generate the build system using: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/configure.ac new/libu2f-host-1.1.1/configure.ac --- old/libu2f-host-1.1.0/configure.ac 2015-12-03 10:09:37.000000000 +0100 +++ new/libu2f-host-1.1.1/configure.ac 2016-02-15 10:15:36.000000000 +0100 @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -AC_INIT([libu2f-host], [1.1.0], [yubico-de...@googlegroups.com]) +AC_INIT([libu2f-host], [1.1.1], [yubico-de...@googlegroups.com]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) @@ -21,7 +21,7 @@ # http://www.gnu.org/s/libtool/manual/html_node/Updating-version-info.html AC_SUBST(LT_CURRENT, 1) # Interfaces removed: CURRENT++, AGE=0, REVISION=0 AC_SUBST(LT_AGE, 1) # Interfaces added: CURRENT++, AGE++, REVISION=0 -AC_SUBST(LT_REVISION, 0) # No interfaces changed: REVISION++ +AC_SUBST(LT_REVISION, 1) # No interfaces changed: REVISION++ AM_INIT_AUTOMAKE([gnits dist-xz no-dist-gzip std-options -Wall]) AM_SILENT_RULES([yes]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/gtk-doc/html/u2f-host-u2f-host-version.html new/libu2f-host-1.1.1/gtk-doc/html/u2f-host-u2f-host-version.html --- old/libu2f-host-1.1.0/gtk-doc/html/u2f-host-u2f-host-version.html 2016-02-15 10:03:14.000000000 +0100 +++ new/libu2f-host-1.1.1/gtk-doc/html/u2f-host-u2f-host-version.html 2016-03-14 10:47:36.000000000 +0100 @@ -120,7 +120,7 @@ <a name="u2f-host-u2f-host-version.other_details"></a><h2>Types and Values</h2> <div class="refsect2"> <a name="U2FH-VERSION-STRING:CAPS"></a><h3>U2FH_VERSION_STRING</h3> -<pre class="programlisting">#define U2FH_VERSION_STRING "1.0.1" +<pre class="programlisting">#define U2FH_VERSION_STRING "1.1.1" </pre> <p>Pre-processor symbol with a string that describe the header file version number. Used together with <a class="link" href="u2f-host-u2f-host-version.html#u2fh-check-version" title="u2fh_check_version ()"><code class="function">u2fh_check_version()</code></a> to verify @@ -129,7 +129,7 @@ <hr> <div class="refsect2"> <a name="U2FH-VERSION-NUMBER:CAPS"></a><h3>U2FH_VERSION_NUMBER</h3> -<pre class="programlisting">#define U2FH_VERSION_NUMBER 0x010001 +<pre class="programlisting">#define U2FH_VERSION_NUMBER 0x010101 </pre> <p>Pre-processor symbol with a hexadecimal value describing the header file version number. For example, when the header version is 1.2.3 @@ -148,7 +148,7 @@ <hr> <div class="refsect2"> <a name="U2FH-VERSION-MINOR:CAPS"></a><h3>U2FH_VERSION_MINOR</h3> -<pre class="programlisting">#define U2FH_VERSION_MINOR 0 +<pre class="programlisting">#define U2FH_VERSION_MINOR 1 </pre> <p>Pre-processor symbol with a decimal value that describe the minor level of the header file version number. For example, when the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/gtk-doc/html/u2f-host-u2f-host.html new/libu2f-host-1.1.1/gtk-doc/html/u2f-host-u2f-host.html --- old/libu2f-host-1.1.0/gtk-doc/html/u2f-host-u2f-host.html 2016-02-15 10:03:14.000000000 +0100 +++ new/libu2f-host-1.1.1/gtk-doc/html/u2f-host-u2f-host.html 2016-03-14 10:47:36.000000000 +0100 @@ -372,7 +372,7 @@ </tr> <tr> <td class="parameter_name"><p>response</p></td> -<td class="parameter_description"><p>pointer to output string with JSON data.</p></td> +<td class="parameter_description"><p>pointer to pointer for output data</p></td> <td class="parameter_annotations"> </td> </tr> <tr> @@ -425,7 +425,7 @@ </tr> <tr> <td class="parameter_name"><p>response</p></td> -<td class="parameter_description"><p>pointer to output string with JSON data.</p></td> +<td class="parameter_description"><p>pointer to pointer for output data</p></td> <td class="parameter_annotations"> </td> </tr> <tr> Files old/libu2f-host-1.1.0/gtk-doc/u2f-host.pdf and new/libu2f-host-1.1.1/gtk-doc/u2f-host.pdf differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/src/cmdline.c new/libu2f-host-1.1.1/src/cmdline.c --- old/libu2f-host-1.1.0/src/cmdline.c 2015-12-11 12:13:08.000000000 +0100 +++ new/libu2f-host-1.1.1/src/cmdline.c 2016-03-14 10:45:19.000000000 +0100 @@ -18,15 +18,14 @@ #include <string.h> #ifndef FIX_UNUSED -#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ +#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ #endif #include <getopt.h> #include "cmdline.h" -const char *gengetopt_args_info_purpose = - "Perform U2F host-side operations on the command line. Reads challenge from\nstandard input and writes a response to standard output."; +const char *gengetopt_args_info_purpose = "Perform U2F host-side operations on the command line. Reads challenge from\nstandard input and writes a response to standard output."; const char *gengetopt_args_info_usage = "Usage: u2f-host [OPTIONS]..."; @@ -42,45 +41,46 @@ " -t, --touch Invert user-presence flag (on by default)\n (default=off)", " -d, --debug Print debug information to standard error\n (default=off)", " -c, --command=STRING Command for sendrecv action", - 0 + 0 }; -typedef enum -{ ARG_NO, ARG_FLAG, ARG_STRING, ARG_ENUM +typedef enum {ARG_NO + , ARG_FLAG + , ARG_STRING + , ARG_ENUM } cmdline_parser_arg_type; -static void clear_given (struct gengetopt_args_info *args_info); -static void clear_args (struct gengetopt_args_info *args_info); +static +void clear_given (struct gengetopt_args_info *args_info); +static +void clear_args (struct gengetopt_args_info *args_info); static int -cmdline_parser_internal (int argc, char **argv, - struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params, - const char *additional_error); +cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, + struct cmdline_parser_params *params, const char *additional_error); static int -cmdline_parser_required2 (struct gengetopt_args_info *args_info, - const char *prog_name, - const char *additional_error); +cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); -const char *cmdline_parser_action_values[] = { "register", "authenticate", "sendrecv", 0 }; /*< Possible values for action. */ +const char *cmdline_parser_action_values[] = {"register", "authenticate", "sendrecv", 0}; /*< Possible values for action. */ -static char *gengetopt_strdup (const char *s); +static char * +gengetopt_strdup (const char *s); -static void -clear_given (struct gengetopt_args_info *args_info) +static +void clear_given (struct gengetopt_args_info *args_info) { - args_info->help_given = 0; - args_info->version_given = 0; - args_info->origin_given = 0; - args_info->action_given = 0; - args_info->touch_given = 0; - args_info->debug_given = 0; - args_info->command_given = 0; + args_info->help_given = 0 ; + args_info->version_given = 0 ; + args_info->origin_given = 0 ; + args_info->action_given = 0 ; + args_info->touch_given = 0 ; + args_info->debug_given = 0 ; + args_info->command_given = 0 ; } -static void -clear_args (struct gengetopt_args_info *args_info) +static +void clear_args (struct gengetopt_args_info *args_info) { FIX_UNUSED (args_info); args_info->origin_arg = NULL; @@ -91,59 +91,57 @@ args_info->debug_flag = 0; args_info->command_arg = NULL; args_info->command_orig = NULL; - + } -static void -init_args_info (struct gengetopt_args_info *args_info) +static +void init_args_info(struct gengetopt_args_info *args_info) { - args_info->help_help = gengetopt_args_info_help[0]; - args_info->version_help = gengetopt_args_info_help[1]; - args_info->origin_help = gengetopt_args_info_help[2]; - args_info->action_help = gengetopt_args_info_help[3]; - args_info->touch_help = gengetopt_args_info_help[4]; - args_info->debug_help = gengetopt_args_info_help[5]; - args_info->command_help = gengetopt_args_info_help[6]; - + args_info->help_help = gengetopt_args_info_help[0] ; + args_info->version_help = gengetopt_args_info_help[1] ; + args_info->origin_help = gengetopt_args_info_help[2] ; + args_info->action_help = gengetopt_args_info_help[3] ; + args_info->touch_help = gengetopt_args_info_help[4] ; + args_info->debug_help = gengetopt_args_info_help[5] ; + args_info->command_help = gengetopt_args_info_help[6] ; + } void cmdline_parser_print_version (void) { printf ("%s %s\n", - (strlen (CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME - : CMDLINE_PARSER_PACKAGE), CMDLINE_PARSER_VERSION); + (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), + CMDLINE_PARSER_VERSION); - if (strlen (gengetopt_args_info_versiontext) > 0) - printf ("\n%s\n", gengetopt_args_info_versiontext); + if (strlen(gengetopt_args_info_versiontext) > 0) + printf("\n%s\n", gengetopt_args_info_versiontext); } -static void -print_help_common (void) -{ +static void print_help_common(void) { cmdline_parser_print_version (); - if (strlen (gengetopt_args_info_purpose) > 0) - printf ("\n%s\n", gengetopt_args_info_purpose); + if (strlen(gengetopt_args_info_purpose) > 0) + printf("\n%s\n", gengetopt_args_info_purpose); - if (strlen (gengetopt_args_info_usage) > 0) - printf ("\n%s\n", gengetopt_args_info_usage); + if (strlen(gengetopt_args_info_usage) > 0) + printf("\n%s\n", gengetopt_args_info_usage); - printf ("\n"); + printf("\n"); - if (strlen (gengetopt_args_info_description) > 0) - printf ("%s\n\n", gengetopt_args_info_description); + if (strlen(gengetopt_args_info_description) > 0) + printf("%s\n\n", gengetopt_args_info_description); } void cmdline_parser_print_help (void) { int i = 0; - print_help_common (); + print_help_common(); while (gengetopt_args_info_help[i]) - printf ("%s\n", gengetopt_args_info_help[i++]); + printf("%s\n", gengetopt_args_info_help[i++]); } void @@ -155,10 +153,10 @@ } void -cmdline_parser_params_init (struct cmdline_parser_params *params) +cmdline_parser_params_init(struct cmdline_parser_params *params) { if (params) - { + { params->override = 0; params->initialize = 1; params->check_required = 1; @@ -168,12 +166,11 @@ } struct cmdline_parser_params * -cmdline_parser_params_create (void) +cmdline_parser_params_create(void) { - struct cmdline_parser_params *params = - (struct cmdline_parser_params *) - malloc (sizeof (struct cmdline_parser_params)); - cmdline_parser_params_init (params); + struct cmdline_parser_params *params = + (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params)); + cmdline_parser_params_init(params); return params; } @@ -197,8 +194,8 @@ free_string_field (&(args_info->action_orig)); free_string_field (&(args_info->command_arg)); free_string_field (&(args_info->command_orig)); - - + + clear_given (args_info); } @@ -211,107 +208,98 @@ * -2 if more than one value has matched */ static int -check_possible_values (const char *val, const char *values[]) +check_possible_values(const char *val, const char *values[]) { int i, found, last; size_t len; - if (!val) /* otherwise strlen() crashes below */ - return -1; /* -1 means no argument for the option */ + if (!val) /* otherwise strlen() crashes below */ + return -1; /* -1 means no argument for the option */ found = last = 0; - for (i = 0, len = strlen (val); values[i]; ++i) + for (i = 0, len = strlen(val); values[i]; ++i) { - if (strncmp (val, values[i], len) == 0) - { - ++found; - last = i; - if (strlen (values[i]) == len) - return i; /* exact macth no need to check more */ - } + if (strncmp(val, values[i], len) == 0) + { + ++found; + last = i; + if (strlen(values[i]) == len) + return i; /* exact macth no need to check more */ + } } - if (found == 1) /* one match: OK */ + if (found == 1) /* one match: OK */ return last; - return (found ? -2 : -1); /* return many values or none matched */ + return (found ? -2 : -1); /* return many values or none matched */ } static void -write_into_file (FILE * outfile, const char *opt, const char *arg, - const char *values[]) +write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) { int found = -1; - if (arg) - { - if (values) - { - found = check_possible_values (arg, values); - } - if (found >= 0) - fprintf (outfile, "%s=\"%s\" # %s\n", opt, arg, values[found]); - else - fprintf (outfile, "%s=\"%s\"\n", opt, arg); - } - else - { - fprintf (outfile, "%s\n", opt); - } + if (arg) { + if (values) { + found = check_possible_values(arg, values); + } + if (found >= 0) + fprintf(outfile, "%s=\"%s\" # %s\n", opt, arg, values[found]); + else + fprintf(outfile, "%s=\"%s\"\n", opt, arg); + } else { + fprintf(outfile, "%s\n", opt); + } } int -cmdline_parser_dump (FILE * outfile, struct gengetopt_args_info *args_info) +cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info) { int i = 0; if (!outfile) { - fprintf (stderr, "%s: cannot dump options to stream\n", - CMDLINE_PARSER_PACKAGE); + fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE); return EXIT_FAILURE; } if (args_info->help_given) - write_into_file (outfile, "help", 0, 0); + write_into_file(outfile, "help", 0, 0 ); if (args_info->version_given) - write_into_file (outfile, "version", 0, 0); + write_into_file(outfile, "version", 0, 0 ); if (args_info->origin_given) - write_into_file (outfile, "origin", args_info->origin_orig, 0); + write_into_file(outfile, "origin", args_info->origin_orig, 0); if (args_info->action_given) - write_into_file (outfile, "action", args_info->action_orig, - cmdline_parser_action_values); + write_into_file(outfile, "action", args_info->action_orig, cmdline_parser_action_values); if (args_info->touch_given) - write_into_file (outfile, "touch", 0, 0); + write_into_file(outfile, "touch", 0, 0 ); if (args_info->debug_given) - write_into_file (outfile, "debug", 0, 0); + write_into_file(outfile, "debug", 0, 0 ); if (args_info->command_given) - write_into_file (outfile, "command", args_info->command_orig, 0); - + write_into_file(outfile, "command", args_info->command_orig, 0); + i = EXIT_SUCCESS; return i; } int -cmdline_parser_file_save (const char *filename, - struct gengetopt_args_info *args_info) +cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) { FILE *outfile; int i = 0; - outfile = fopen (filename, "w"); + outfile = fopen(filename, "w"); if (!outfile) { - fprintf (stderr, "%s: cannot open file for writing: %s\n", - CMDLINE_PARSER_PACKAGE, filename); + fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); return EXIT_FAILURE; } - i = cmdline_parser_dump (outfile, args_info); + i = cmdline_parser_dump(outfile, args_info); fclose (outfile); return i; @@ -331,10 +319,10 @@ if (!s) return result; - result = (char *) malloc (strlen (s) + 1); - if (result == (char *) 0) - return (char *) 0; - strcpy (result, s); + result = (char*)malloc(strlen(s) + 1); + if (result == (char*)0) + return (char*)0; + strcpy(result, s); return result; } @@ -345,9 +333,8 @@ } int -cmdline_parser_ext (int argc, char **argv, - struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params) +cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, + struct cmdline_parser_params *params) { int result; result = cmdline_parser_internal (argc, argv, args_info, params, 0); @@ -357,17 +344,16 @@ cmdline_parser_free (args_info); exit (EXIT_FAILURE); } - + return result; } int -cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, - int override, int initialize, int check_required) +cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) { int result; struct cmdline_parser_params params; - + params.override = override; params.initialize = initialize; params.check_required = check_required; @@ -381,17 +367,16 @@ cmdline_parser_free (args_info); exit (EXIT_FAILURE); } - + return result; } int -cmdline_parser_required (struct gengetopt_args_info *args_info, - const char *prog_name) +cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) { int result = EXIT_SUCCESS; - if (cmdline_parser_required2 (args_info, prog_name, 0) > 0) + if (cmdline_parser_required2(args_info, prog_name, 0) > 0) result = EXIT_FAILURE; if (result == EXIT_FAILURE) @@ -399,26 +384,24 @@ cmdline_parser_free (args_info); exit (EXIT_FAILURE); } - + return result; } int -cmdline_parser_required2 (struct gengetopt_args_info *args_info, - const char *prog_name, const char *additional_error) +cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) { int error_occurred = 0; FIX_UNUSED (additional_error); /* checks for required options */ - if (!args_info->action_given) + if (! args_info->action_given) { - fprintf (stderr, "%s: '--action' ('-a') option required%s\n", prog_name, - (additional_error ? additional_error : "")); + fprintf (stderr, "%s: '--action' ('-a') option required%s\n", prog_name, (additional_error ? additional_error : "")); error_occurred = 1; } - - + + /* checks for dependences among options */ return error_occurred; @@ -445,16 +428,16 @@ * @param short_opt the corresponding short option (or '-' if none) * @param additional_error possible further error specification */ -static int -update_arg (void *field, char **orig_field, - unsigned int *field_given, unsigned int *prev_given, - char *value, const char *possible_values[], - const char *default_value, - cmdline_parser_arg_type arg_type, - int check_ambiguity, int override, - int no_free, int multiple_option, - const char *long_opt, char short_opt, - const char *additional_error) +static +int update_arg(void *field, char **orig_field, + unsigned int *field_given, unsigned int *prev_given, + char *value, const char *possible_values[], + const char *default_value, + cmdline_parser_arg_type arg_type, + int check_ambiguity, int override, + int no_free, int multiple_option, + const char *long_opt, char short_opt, + const char *additional_error) { char *stop_char = 0; const char *val = value; @@ -465,39 +448,33 @@ stop_char = 0; found = 0; - if (!multiple_option && prev_given - && (*prev_given || (check_ambiguity && *field_given))) + if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { if (short_opt != '-') - fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", - package_name, long_opt, short_opt, - (additional_error ? additional_error : "")); + fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n", + package_name, long_opt, short_opt, + (additional_error ? additional_error : "")); else - fprintf (stderr, "%s: `--%s' option given more than once%s\n", - package_name, long_opt, - (additional_error ? additional_error : "")); - return 1; /* failure */ + fprintf (stderr, "%s: `--%s' option given more than once%s\n", + package_name, long_opt, + (additional_error ? additional_error : "")); + return 1; /* failure */ } - if (possible_values - && (found = - check_possible_values ((value ? value : default_value), - possible_values)) < 0) + if (possible_values && (found = check_possible_values((value ? value : default_value), possible_values)) < 0) { if (short_opt != '-') - fprintf (stderr, - "%s: %s argument, \"%s\", for option `--%s' (`-%c')%s\n", - package_name, (found == -2) ? "ambiguous" : "invalid", value, - long_opt, short_opt, - (additional_error ? additional_error : "")); + fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s' (`-%c')%s\n", + package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, short_opt, + (additional_error ? additional_error : "")); else - fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s'%s\n", - package_name, (found == -2) ? "ambiguous" : "invalid", value, - long_opt, (additional_error ? additional_error : "")); - return 1; /* failure */ + fprintf (stderr, "%s: %s argument, \"%s\", for option `--%s'%s\n", + package_name, (found == -2) ? "ambiguous" : "invalid", value, long_opt, + (additional_error ? additional_error : "")); + return 1; /* failure */ } - - if (field_given && *field_given && !override) + + if (field_given && *field_given && ! override) return 0; if (prev_given) (*prev_given)++; @@ -506,73 +483,64 @@ if (possible_values) val = possible_values[found]; - switch (arg_type) - { - case ARG_FLAG: - *((int *) field) = !*((int *) field); - break; - case ARG_ENUM: - if (val) - *((int *) field) = found; - break; - case ARG_STRING: - if (val) - { - string_field = (char **) field; - if (!no_free && *string_field) - free (*string_field); /* free previous string */ - *string_field = gengetopt_strdup (val); - } - break; - default: - break; - }; + switch(arg_type) { + case ARG_FLAG: + *((int *)field) = !*((int *)field); + break; + case ARG_ENUM: + if (val) *((int *)field) = found; + break; + case ARG_STRING: + if (val) { + string_field = (char **)field; + if (!no_free && *string_field) + free (*string_field); /* free previous string */ + *string_field = gengetopt_strdup (val); + } + break; + default: + break; + }; /* store the original value */ - switch (arg_type) - { - case ARG_NO: - case ARG_FLAG: - break; - default: - if (value && orig_field) - { - if (no_free) - { - *orig_field = value; - } - else - { - if (*orig_field) - free (*orig_field); /* free previous string */ - *orig_field = gengetopt_strdup (value); - } - } - }; + switch(arg_type) { + case ARG_NO: + case ARG_FLAG: + break; + default: + if (value && orig_field) { + if (no_free) { + *orig_field = value; + } else { + if (*orig_field) + free (*orig_field); /* free previous string */ + *orig_field = gengetopt_strdup (value); + } + } + }; - return 0; /* OK */ + return 0; /* OK */ } int -cmdline_parser_internal (int argc, char **argv, - struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params, - const char *additional_error) +cmdline_parser_internal ( + int argc, char **argv, struct gengetopt_args_info *args_info, + struct cmdline_parser_params *params, const char *additional_error) { - int c; /* Character of the parsed option. */ + int c; /* Character of the parsed option. */ int error_occurred = 0; struct gengetopt_args_info local_args_info; - + int override; int initialize; int check_required; int check_ambiguity; - + package_name = argv[0]; - + override = params->override; initialize = params->initialize; check_required = params->check_required; @@ -593,131 +561,125 @@ int option_index = 0; static struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"version", 0, NULL, 'V'}, - {"origin", 1, NULL, 'o'}, - {"action", 1, NULL, 'a'}, - {"touch", 0, NULL, 't'}, - {"debug", 0, NULL, 'd'}, - {"command", 1, NULL, 'c'}, - {0, 0, 0, 0} + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + { "origin", 1, NULL, 'o' }, + { "action", 1, NULL, 'a' }, + { "touch", 0, NULL, 't' }, + { "debug", 0, NULL, 'd' }, + { "command", 1, NULL, 'c' }, + { 0, 0, 0, 0 } }; c = getopt_long (argc, argv, "hVo:a:tdc:", long_options, &option_index); - if (c == -1) - break; /* Exit from `while (1)' loop. */ + if (c == -1) break; /* Exit from `while (1)' loop. */ switch (c) - { - case 'h': /* Print help and exit. */ - - - if (update_arg (0, - 0, &(args_info->help_given), - &(local_args_info.help_given), optarg, 0, 0, ARG_NO, - check_ambiguity, override, 0, 0, - "help", 'h', additional_error)) - goto failure; - cmdline_parser_free (&local_args_info); - return 0; - - break; - case 'V': /* Print version and exit. */ - cmdline_parser_print_version (); - cmdline_parser_free (&local_args_info); - exit (EXIT_SUCCESS); - - case 'o': /* Origin URL to use.. */ - - - if (update_arg ((void *) &(args_info->origin_arg), - &(args_info->origin_orig), - &(args_info->origin_given), - &(local_args_info.origin_given), optarg, 0, 0, - ARG_STRING, check_ambiguity, override, 0, 0, - "origin", 'o', additional_error)) - goto failure; - - break; - case 'a': /* Action to take.. */ - - - if (update_arg ((void *) &(args_info->action_arg), - &(args_info->action_orig), - &(args_info->action_given), - &(local_args_info.action_given), optarg, - cmdline_parser_action_values, 0, ARG_ENUM, - check_ambiguity, override, 0, 0, "action", 'a', - additional_error)) - goto failure; - - break; - case 't': /* Invert user-presence flag (on by default). */ - - - if (update_arg - ((void *) &(args_info->touch_flag), 0, - &(args_info->touch_given), &(local_args_info.touch_given), - optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, - "touch", 't', additional_error)) - goto failure; - - break; - case 'd': /* Print debug information to standard error. */ - - - if (update_arg - ((void *) &(args_info->debug_flag), 0, - &(args_info->debug_given), &(local_args_info.debug_given), - optarg, 0, 0, ARG_FLAG, check_ambiguity, override, 1, 0, - "debug", 'd', additional_error)) - goto failure; - - break; - case 'c': /* Command for sendrecv action. */ - - - if (update_arg ((void *) &(args_info->command_arg), - &(args_info->command_orig), - &(args_info->command_given), - &(local_args_info.command_given), optarg, 0, 0, - ARG_STRING, check_ambiguity, override, 0, 0, - "command", 'c', additional_error)) - goto failure; - - break; - - case 0: /* Long option with no short option */ - case '?': /* Invalid option. */ - /* `getopt_long' already printed an error message. */ - goto failure; - - default: /* bug: option not considered. */ - fprintf (stderr, "%s: option unknown: %c%s\n", - CMDLINE_PARSER_PACKAGE, c, - (additional_error ? additional_error : "")); - abort (); - } /* switch */ - } /* while */ + { + case 'h': /* Print help and exit. */ + + + if (update_arg( 0 , + 0 , &(args_info->help_given), + &(local_args_info.help_given), optarg, 0, 0, ARG_NO, + check_ambiguity, override, 0, 0, + "help", 'h', + additional_error)) + goto failure; + cmdline_parser_free (&local_args_info); + return 0; + + break; + case 'V': /* Print version and exit. */ + cmdline_parser_print_version (); + cmdline_parser_free (&local_args_info); + exit (EXIT_SUCCESS); + + case 'o': /* Origin URL to use.. */ + + + if (update_arg( (void *)&(args_info->origin_arg), + &(args_info->origin_orig), &(args_info->origin_given), + &(local_args_info.origin_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "origin", 'o', + additional_error)) + goto failure; + + break; + case 'a': /* Action to take.. */ + + + if (update_arg( (void *)&(args_info->action_arg), + &(args_info->action_orig), &(args_info->action_given), + &(local_args_info.action_given), optarg, cmdline_parser_action_values, 0, ARG_ENUM, + check_ambiguity, override, 0, 0, + "action", 'a', + additional_error)) + goto failure; + + break; + case 't': /* Invert user-presence flag (on by default). */ + + + if (update_arg((void *)&(args_info->touch_flag), 0, &(args_info->touch_given), + &(local_args_info.touch_given), optarg, 0, 0, ARG_FLAG, + check_ambiguity, override, 1, 0, "touch", 't', + additional_error)) + goto failure; + + break; + case 'd': /* Print debug information to standard error. */ + + + if (update_arg((void *)&(args_info->debug_flag), 0, &(args_info->debug_given), + &(local_args_info.debug_given), optarg, 0, 0, ARG_FLAG, + check_ambiguity, override, 1, 0, "debug", 'd', + additional_error)) + goto failure; + + break; + case 'c': /* Command for sendrecv action. */ + + + if (update_arg( (void *)&(args_info->command_arg), + &(args_info->command_orig), &(args_info->command_given), + &(local_args_info.command_given), optarg, 0, 0, ARG_STRING, + check_ambiguity, override, 0, 0, + "command", 'c', + additional_error)) + goto failure; + + break; + + case 0: /* Long option with no short option */ + case '?': /* Invalid option. */ + /* `getopt_long' already printed an error message. */ + goto failure; + + default: /* bug: option not considered. */ + fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); + abort (); + } /* switch */ + } /* while */ if (check_required) { - error_occurred += - cmdline_parser_required2 (args_info, argv[0], additional_error); + error_occurred += cmdline_parser_required2 (args_info, argv[0], additional_error); } cmdline_parser_release (&local_args_info); - if (error_occurred) + if ( error_occurred ) return (EXIT_FAILURE); return 0; failure: - + cmdline_parser_release (&local_args_info); return (EXIT_FAILURE); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/src/cmdline.h new/libu2f-host-1.1.1/src/cmdline.h --- old/libu2f-host-1.1.0/src/cmdline.h 2015-12-11 12:13:08.000000000 +0100 +++ new/libu2f-host-1.1.1/src/cmdline.h 2016-03-14 10:45:19.000000000 +0100 @@ -13,12 +13,11 @@ #include "config.h" #endif -#include <stdio.h> /* for FILE */ +#include <stdio.h> /* for FILE */ #ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ +extern "C" { +#endif /* __cplusplus */ #ifndef CMDLINE_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ @@ -35,70 +34,55 @@ #define CMDLINE_PARSER_VERSION VERSION #endif - enum enum_action - { action__NULL = -1, action_arg_register = - 0, action_arg_authenticate, action_arg_sendrecv - }; +enum enum_action { action__NULL = -1, action_arg_register = 0, action_arg_authenticate, action_arg_sendrecv }; /** @brief Where the command line options are stored */ - struct gengetopt_args_info - { - const char *help_help; - /**< @brief Print help and exit help description. */ - const char *version_help; - /**< @brief Print version and exit help description. */ - char *origin_arg; /**< @brief Origin URL to use.. */ - char *origin_orig; /**< @brief Origin URL to use. original value given at command line. */ - const char *origin_help; - /**< @brief Origin URL to use. help description. */ - enum enum_action action_arg;/**< @brief Action to take.. */ - char *action_orig; /**< @brief Action to take. original value given at command line. */ - const char *action_help; - /**< @brief Action to take. help description. */ - int touch_flag; /**< @brief Invert user-presence flag (on by default) (default=off). */ - const char *touch_help; - /**< @brief Invert user-presence flag (on by default) help description. */ - int debug_flag; /**< @brief Print debug information to standard error (default=off). */ - const char *debug_help; - /**< @brief Print debug information to standard error help description. */ - char *command_arg; /**< @brief Command for sendrecv action. */ - char *command_orig; /**< @brief Command for sendrecv action original value given at command line. */ - const char *command_help; - /**< @brief Command for sendrecv action help description. */ - - unsigned int help_given; /**< @brief Whether help was given. */ - unsigned int version_given; /**< @brief Whether version was given. */ - unsigned int origin_given; /**< @brief Whether origin was given. */ - unsigned int action_given; /**< @brief Whether action was given. */ - unsigned int touch_given; /**< @brief Whether touch was given. */ - unsigned int debug_given; /**< @brief Whether debug was given. */ - unsigned int command_given; /**< @brief Whether command was given. */ +struct gengetopt_args_info +{ + const char *help_help; /**< @brief Print help and exit help description. */ + const char *version_help; /**< @brief Print version and exit help description. */ + char * origin_arg; /**< @brief Origin URL to use.. */ + char * origin_orig; /**< @brief Origin URL to use. original value given at command line. */ + const char *origin_help; /**< @brief Origin URL to use. help description. */ + enum enum_action action_arg; /**< @brief Action to take.. */ + char * action_orig; /**< @brief Action to take. original value given at command line. */ + const char *action_help; /**< @brief Action to take. help description. */ + int touch_flag; /**< @brief Invert user-presence flag (on by default) (default=off). */ + const char *touch_help; /**< @brief Invert user-presence flag (on by default) help description. */ + int debug_flag; /**< @brief Print debug information to standard error (default=off). */ + const char *debug_help; /**< @brief Print debug information to standard error help description. */ + char * command_arg; /**< @brief Command for sendrecv action. */ + char * command_orig; /**< @brief Command for sendrecv action original value given at command line. */ + const char *command_help; /**< @brief Command for sendrecv action help description. */ + + unsigned int help_given ; /**< @brief Whether help was given. */ + unsigned int version_given ; /**< @brief Whether version was given. */ + unsigned int origin_given ; /**< @brief Whether origin was given. */ + unsigned int action_given ; /**< @brief Whether action was given. */ + unsigned int touch_given ; /**< @brief Whether touch was given. */ + unsigned int debug_given ; /**< @brief Whether debug was given. */ + unsigned int command_given ; /**< @brief Whether command was given. */ - }; +} ; /** @brief The additional parameters to pass to parser functions */ - struct cmdline_parser_params - { - int override; - /**< @brief whether to override possibly already present options (default 0) */ - int initialize; - /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ - int check_required; - /**< @brief whether to check that all required options were provided (default 1) */ - int check_ambiguity; - /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ - int print_errors; - /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ - }; +struct cmdline_parser_params +{ + int override; /**< @brief whether to override possibly already present options (default 0) */ + int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ + int check_required; /**< @brief whether to check that all required options were provided (default 1) */ + int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ + int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ +} ; /** @brief the purpose string of the program */ - extern const char *gengetopt_args_info_purpose; +extern const char *gengetopt_args_info_purpose; /** @brief the usage string of the program */ - extern const char *gengetopt_args_info_usage; +extern const char *gengetopt_args_info_usage; /** @brief the description string of the program */ - extern const char *gengetopt_args_info_description; +extern const char *gengetopt_args_info_description; /** @brief all the lines making the help output */ - extern const char *gengetopt_args_info_help[]; +extern const char *gengetopt_args_info_help[]; /** * The command line parser @@ -107,8 +91,8 @@ * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ - int cmdline_parser (int argc, char **argv, - struct gengetopt_args_info *args_info); +int cmdline_parser (int argc, char **argv, + struct gengetopt_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) @@ -121,9 +105,9 @@ * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use cmdline_parser_ext() instead */ - int cmdline_parser2 (int argc, char **argv, - struct gengetopt_args_info *args_info, - int override, int initialize, int check_required); +int cmdline_parser2 (int argc, char **argv, + struct gengetopt_args_info *args_info, + int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) @@ -133,9 +117,9 @@ * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ - int cmdline_parser_ext (int argc, char **argv, - struct gengetopt_args_info *args_info, - struct cmdline_parser_params *params); +int cmdline_parser_ext (int argc, char **argv, + struct gengetopt_args_info *args_info, + struct cmdline_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. @@ -143,8 +127,8 @@ * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ - int cmdline_parser_dump (FILE * outfile, - struct gengetopt_args_info *args_info); +int cmdline_parser_dump(FILE *outfile, + struct gengetopt_args_info *args_info); /** * Save the contents of the option struct into a (text) file. @@ -153,44 +137,44 @@ * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ - int cmdline_parser_file_save (const char *filename, - struct gengetopt_args_info *args_info); +int cmdline_parser_file_save(const char *filename, + struct gengetopt_args_info *args_info); /** * Print the help */ - void cmdline_parser_print_help (void); +void cmdline_parser_print_help(void); /** * Print the version */ - void cmdline_parser_print_version (void); +void cmdline_parser_print_version(void); /** * Initializes all the fields a cmdline_parser_params structure * to their default values * @param params the structure to initialize */ - void cmdline_parser_params_init (struct cmdline_parser_params *params); +void cmdline_parser_params_init(struct cmdline_parser_params *params); /** * Allocates dynamically a cmdline_parser_params structure and initializes * all its fields to their default values * @return the created and initialized cmdline_parser_params structure */ - struct cmdline_parser_params *cmdline_parser_params_create (void); +struct cmdline_parser_params *cmdline_parser_params_create(void); /** * Initializes the passed gengetopt_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ - void cmdline_parser_init (struct gengetopt_args_info *args_info); +void cmdline_parser_init (struct gengetopt_args_info *args_info); /** * Deallocates the string fields of the gengetopt_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ - void cmdline_parser_free (struct gengetopt_args_info *args_info); +void cmdline_parser_free (struct gengetopt_args_info *args_info); /** * Checks that all the required options were specified @@ -199,13 +183,13 @@ * possible errors * @return */ - int cmdline_parser_required (struct gengetopt_args_info *args_info, - const char *prog_name); +int cmdline_parser_required (struct gengetopt_args_info *args_info, + const char *prog_name); - extern const char *cmdline_parser_action_values[];/**< @brief Possible values for action. */ +extern const char *cmdline_parser_action_values[]; /**< @brief Possible values for action. */ #ifdef __cplusplus } -#endif /* __cplusplus */ -#endif /* CMDLINE_H */ +#endif /* __cplusplus */ +#endif /* CMDLINE_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/src/u2f-host.1 new/libu2f-host-1.1.1/src/u2f-host.1 --- old/libu2f-host-1.1.0/src/u2f-host.1 2015-12-11 12:15:16.000000000 +0100 +++ new/libu2f-host-1.1.1/src/u2f-host.1 2016-03-14 10:35:51.000000000 +0100 @@ -1,12 +1,12 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.2. -.TH U2F-HOST "1" "December 2015" "u2f-host 1.1.0" "User Commands" +.TH U2F-HOST "1" "March 2016" "u2f-host 1.1.1" "User Commands" .SH NAME u2f-host \- Yubico Universal 2nd Factor (U2F) Host Tool .SH SYNOPSIS .B u2f-host [\fI\,OPTIONS\/\fR]... .SH DESCRIPTION -u2f\-host 1.1.0 +u2f\-host 1.1.1 .PP Perform U2F host\-side operations on the command line. Reads challenge from standard input and writes a response to standard output. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/src/u2f-host.c new/libu2f-host-1.1.1/src/u2f-host.c --- old/libu2f-host-1.1.0/src/u2f-host.c 2015-12-11 12:13:08.000000000 +0100 +++ new/libu2f-host-1.1.1/src/u2f-host.c 2016-03-14 10:20:41.000000000 +0100 @@ -89,13 +89,6 @@ fprintf (stderr, "error: origin URL empty, use -o to specify it\n"); exit (EXIT_FAILURE); } - else if (strncmp ("pam://", args_info.origin_arg, 6) != 0 - && strncmp ("http://", args_info.origin_arg, 7) != 0 - && strncmp ("https://", args_info.origin_arg, 8) != 0) - { - fprintf (stderr, "error: origin must be pam, http or https\n"); - exit (EXIT_FAILURE); - } if (args_info.action_arg == action_arg_register) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/u2f-host/authenticate.c new/libu2f-host-1.1.1/u2f-host/authenticate.c --- old/libu2f-host-1.1.0/u2f-host/authenticate.c 2016-02-15 10:01:43.000000000 +0100 +++ new/libu2f-host-1.1.1/u2f-host/authenticate.c 2016-03-14 10:20:41.000000000 +0100 @@ -171,10 +171,6 @@ do { struct u2fdevice *dev; - if (iterations++ > 15) - { - return U2FH_TIMEOUT_ERROR; - } for (dev = devs->first; dev != NULL; dev = dev->next) { unsigned char tmp_buf[MAXDATASIZE]; @@ -204,7 +200,14 @@ { dev->skipped = 1; } - memcpy (buf, tmp_buf, len); + else + { + memcpy (buf, tmp_buf, len); + } + } + if (iterations++ > 15) + { + return U2FH_TIMEOUT_ERROR; } if (len == 2 && memcmp (buf, NOTSATISFIED, 2) == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/u2f-host/devs.c new/libu2f-host-1.1.1/u2f-host/devs.c --- old/libu2f-host-1.1.0/u2f-host/devs.c 2016-01-19 15:14:23.000000000 +0100 +++ new/libu2f-host-1.1.1/u2f-host/devs.c 2016-03-14 10:20:41.000000000 +0100 @@ -147,22 +147,16 @@ #endif } -static void +static struct u2fdevice * close_device (u2fh_devs * devs, struct u2fdevice *dev) { + struct u2fdevice *next = dev->next; hid_close (dev->devh); free (dev->device_path); free (dev->device_string); if (dev == devs->first) { - if (dev->next) - { - devs->first = dev->next; - } - else - { - devs->first = NULL; - } + devs->first = next; free (dev); } else @@ -170,14 +164,15 @@ struct u2fdevice *d; for (d = devs->first; d != NULL; d = d->next) { - struct u2fdevice *next = d->next; - if (next && next == dev) + if (d->next == dev) { - dev->next = next->next; - free (next); + d->next = next; + free (dev); + break; } } } + return next; } struct u2fdevice * @@ -235,9 +230,7 @@ while (dev) { - struct u2fdevice *next = dev->next; - close_device (devs, dev); - dev = next; + dev = close_device (devs, dev); } } @@ -334,7 +327,6 @@ { struct hid_device_info *di, *cur_dev; u2fh_rc res = U2FH_NO_U2F_DEVICE; - unsigned index; struct u2fdevice *dev; di = hid_enumerate (0, 0); @@ -343,15 +335,15 @@ int found = 0; unsigned short usage_page = 0, usage = 0; + /* check if we already opened this device */ for (dev = devs->first; dev != NULL; dev = dev->next) { if (strcmp (dev->device_path, cur_dev->path) == 0) { - if (ping_device (devs, index) == U2FH_OK) + if (ping_device (devs, dev->id) == U2FH_OK) { found = 1; res = U2FH_OK; - break; } else { @@ -361,8 +353,8 @@ dev->device_path); } close_device (devs, dev); - break; } + break; } } if (found) @@ -421,7 +413,9 @@ } - for (dev = devs->first; dev != NULL; dev = dev->next) + /* loop through all open devices and make sure we find them in the enumeration */ + dev = devs->first; + while (dev) { int found = 0; @@ -430,6 +424,8 @@ if (strcmp (cur_dev->path, dev->device_path) == 0) { found = 1; + dev = dev->next; + break; } } if (!found) @@ -438,7 +434,7 @@ { fprintf (stderr, "device %s looks dead.\n", dev->device_path); } - close_device (devs, dev); + dev = close_device (devs, dev); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/u2f-host/u2f-host-version.h new/libu2f-host-1.1.1/u2f-host/u2f-host-version.h --- old/libu2f-host-1.1.0/u2f-host/u2f-host-version.h 2016-02-15 10:02:34.000000000 +0100 +++ new/libu2f-host-1.1.1/u2f-host/u2f-host-version.h 2016-03-14 10:36:09.000000000 +0100 @@ -30,7 +30,7 @@ * version number. Used together with u2fh_check_version() to verify * header file and run-time library consistency. */ -#define U2FH_VERSION_STRING "1.1.0" +#define U2FH_VERSION_STRING "1.1.1" /** * U2FH_VERSION_NUMBER @@ -40,7 +40,7 @@ * this symbol will have the value 0x01020300. The last two digits * are only used between public releases, and will otherwise be 00. */ -#define U2FH_VERSION_NUMBER 0x010100 +#define U2FH_VERSION_NUMBER 0x010101 /** * U2FH_VERSION_MAJOR @@ -67,7 +67,7 @@ * level of the header file version number. For example, when the * header version is 1.2.3 this symbol will be 3. */ -#define U2FH_VERSION_PATCH 0 +#define U2FH_VERSION_PATCH 1 const char *u2fh_check_version (const char *req_version); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libu2f-host-1.1.0/u2f-host/u2fmisc.c new/libu2f-host-1.1.1/u2f-host/u2fmisc.c --- old/libu2f-host-1.1.0/u2f-host/u2fmisc.c 2016-02-08 13:16:46.000000000 +0100 +++ new/libu2f-host-1.1.1/u2f-host/u2fmisc.c 2016-03-14 10:20:41.000000000 +0100 @@ -318,7 +318,7 @@ send_apdu (u2fh_devs * devs, int index, int cmd, const unsigned char *d, size_t dlen, int p1, unsigned char *out, size_t * outlen) { - unsigned char data[2048] = {0}; + unsigned char data[2048] = { 0 }; int rc; if (dlen > MAXDATASIZE)