Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/pam-u2f/bin/pamu2fcfg Add build glue



details:   https://anonhg.NetBSD.org/src/rev/bca0c58dc940
branches:  trunk
changeset: 969853:bca0c58dc940
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 03 03:10:32 2020 +0000

description:
Add build glue

diffstat:

 external/bsd/pam-u2f/bin/pamu2fcfg/Makefile  |   27 +
 external/bsd/pam-u2f/bin/pamu2fcfg/cmdline.c |  731 +++++++++++++++++++++++++++
 external/bsd/pam-u2f/bin/pamu2fcfg/cmdline.h |  214 +++++++
 3 files changed, 972 insertions(+), 0 deletions(-)

diffs (truncated from 984 to 300 lines):

diff -r 1746a751c962 -r bca0c58dc940 external/bsd/pam-u2f/bin/pamu2fcfg/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile       Tue Mar 03 03:10:32 2020 +0000
@@ -0,0 +1,27 @@
+# $NetBSD: Makefile,v 1.1 2020/03/03 03:10:32 christos Exp $
+
+NOMAN=
+
+.include <bsd.own.mk>
+
+DIST=${NETBSDSRCDIR}/external/bsd/pam-u2f/dist
+
+.PATH: ${DIST} ${DIST}/pamu2fcfg
+
+CFFILE=${DIST}/configure.ac
+PACKAGE!= ${TOOL_SED} -ne 's/AC_INIT(\[\([a-zA-Z0-9_-]*\)\].*/\1/p' ${CFFILE}
+VERSION!= ${TOOL_SED} -ne 's/AC_INIT(\[[a-zA-Z0-9_-]*\], \[\([0-9.]*\)\].*/\1/p' ${CFFILE}
+
+CPPFLAGS+= -I${DIST} -I${.CURDIR}
+CPPFLAGS+= -DPACKAGE='"${PACKAGE}"' -DVERSION='"${VERSION}"'
+CPPFLAGS+= -DHAVE_UNISTD_H
+
+BINDIR=/usr/bin
+PROG=pamu2fcfg
+SRCS=pamu2fcfg.c cmdline.c b64.c readpassphrase.c explicit_bzero.c util.c
+COPTS.util.c += -Wno-error=stack-protector
+
+LDADD+=-lpam -lfido2 -lcbor -lusbhid -lcrypto
+DPADD+=${LIBPAM} ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO}
+
+.include <bsd.prog.mk>
diff -r 1746a751c962 -r bca0c58dc940 external/bsd/pam-u2f/bin/pamu2fcfg/cmdline.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/pam-u2f/bin/pamu2fcfg/cmdline.c      Tue Mar 03 03:10:32 2020 +0000
@@ -0,0 +1,731 @@
+/*
+  File autogenerated by gengetopt version 2.22.6
+  generated with the following command:
+  gengetopt --no-handle-help --input cmdline.ggo Makefile.am 
+
+  The developers of gengetopt consider the fixed text that goes in all
+  gengetopt output files to be in the public domain:
+  we make no copyright claims on it.
+*/
+
+/* If we use autoconf.  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef FIX_UNUSED
+#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 a U2F registration operation and print a configuration line that can be\nused with the pam_u2f module.";
+
+const char *gengetopt_args_info_usage = "Usage: " CMDLINE_PARSER_PACKAGE " [OPTIONS]...";
+
+const char *gengetopt_args_info_versiontext = "";
+
+const char *gengetopt_args_info_description = "";
+
+const char *gengetopt_args_info_help[] = {
+  "  -h, --help               Print help and exit",
+  "      --version            Print version and exit",
+  "  -o, --origin=STRING      Origin URL to use during registration. Defaults to\n                             pam://hostname",
+  "  -i, --appid=STRING       Application ID to use during registration. Defaults\n                             to pam://hostname",
+  "  -t, --type=STRING        COSE type to use during registration (ES256 or\n                             RS256). Defaults to ES256.",
+  "  -r, --resident           Generate a resident credential  (default=off)",
+  "  -P, --no-user-presence   Allow the credential to be used without ensuring the\n                             user's presence  (default=off)",
+  "  -N, --pin-verification   Require PIN verification during authentication\n                             (default=off)",
+  "  -V, --user-verification  Require user verification during authentication\n                             (default=off)",
+  "  -d, --debug              Print debug information (highly verbose)\n                             (default=off)",
+  "  -v, --verbose            Print information about chosen origin and appid\n                             (default=off)",
+  "\n Group: user",
+  "  -u, --username=STRING    The name of the user registering the device.\n                             Defaults to the current user name",
+  "  -n, --nouser             Print only registration information (keyHandle and\n                             public key). Useful for appending",
+    0
+};
+
+typedef enum {ARG_NO
+  , ARG_FLAG
+  , ARG_STRING
+} 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 int
+cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
+                        struct cmdline_parser_params *params, const char *additional_error);
+
+
+static char *
+gengetopt_strdup (const char *s);
+
+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->appid_given = 0 ;
+  args_info->type_given = 0 ;
+  args_info->resident_given = 0 ;
+  args_info->no_user_presence_given = 0 ;
+  args_info->pin_verification_given = 0 ;
+  args_info->user_verification_given = 0 ;
+  args_info->debug_given = 0 ;
+  args_info->verbose_given = 0 ;
+  args_info->username_given = 0 ;
+  args_info->nouser_given = 0 ;
+  args_info->user_group_counter = 0 ;
+}
+
+static
+void clear_args (struct gengetopt_args_info *args_info)
+{
+  FIX_UNUSED (args_info);
+  args_info->origin_arg = NULL;
+  args_info->origin_orig = NULL;
+  args_info->appid_arg = NULL;
+  args_info->appid_orig = NULL;
+  args_info->type_arg = NULL;
+  args_info->type_orig = NULL;
+  args_info->resident_flag = 0;
+  args_info->no_user_presence_flag = 0;
+  args_info->pin_verification_flag = 0;
+  args_info->user_verification_flag = 0;
+  args_info->debug_flag = 0;
+  args_info->verbose_flag = 0;
+  args_info->username_arg = NULL;
+  args_info->username_orig = NULL;
+  
+}
+
+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->appid_help = gengetopt_args_info_help[3] ;
+  args_info->type_help = gengetopt_args_info_help[4] ;
+  args_info->resident_help = gengetopt_args_info_help[5] ;
+  args_info->no_user_presence_help = gengetopt_args_info_help[6] ;
+  args_info->pin_verification_help = gengetopt_args_info_help[7] ;
+  args_info->user_verification_help = gengetopt_args_info_help[8] ;
+  args_info->debug_help = gengetopt_args_info_help[9] ;
+  args_info->verbose_help = gengetopt_args_info_help[10] ;
+  args_info->username_help = gengetopt_args_info_help[12] ;
+  args_info->nouser_help = gengetopt_args_info_help[13] ;
+  
+}
+
+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);
+
+  if (strlen(gengetopt_args_info_versiontext) > 0)
+    printf("\n%s\n", gengetopt_args_info_versiontext);
+}
+
+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_usage) > 0)
+    printf("\n%s\n", gengetopt_args_info_usage);
+
+  printf("\n");
+
+  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();
+  while (gengetopt_args_info_help[i])
+    printf("%s\n", gengetopt_args_info_help[i++]);
+}
+
+void
+cmdline_parser_init (struct gengetopt_args_info *args_info)
+{
+  clear_given (args_info);
+  clear_args (args_info);
+  init_args_info (args_info);
+}
+
+void
+cmdline_parser_params_init(struct cmdline_parser_params *params)
+{
+  if (params)
+    { 
+      params->override = 0;
+      params->initialize = 1;
+      params->check_required = 1;
+      params->check_ambiguity = 0;
+      params->print_errors = 1;
+    }
+}
+
+struct cmdline_parser_params *
+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);  
+  return params;
+}
+
+static void
+free_string_field (char **s)
+{
+  if (*s)
+    {
+      free (*s);
+      *s = 0;
+    }
+}
+
+
+static void
+cmdline_parser_release (struct gengetopt_args_info *args_info)
+{
+
+  free_string_field (&(args_info->origin_arg));
+  free_string_field (&(args_info->origin_orig));
+  free_string_field (&(args_info->appid_arg));
+  free_string_field (&(args_info->appid_orig));
+  free_string_field (&(args_info->type_arg));
+  free_string_field (&(args_info->type_orig));
+  free_string_field (&(args_info->username_arg));
+  free_string_field (&(args_info->username_orig));
+  
+  
+
+  clear_given (args_info);
+}
+
+
+static void
+write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
+{
+  FIX_UNUSED (values);
+  if (arg) {
+    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)
+{
+  int i = 0;
+
+  if (!outfile)
+    {
+      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 );
+  if (args_info->version_given)
+    write_into_file(outfile, "version", 0, 0 );
+  if (args_info->origin_given)
+    write_into_file(outfile, "origin", args_info->origin_orig, 0);
+  if (args_info->appid_given)
+    write_into_file(outfile, "appid", args_info->appid_orig, 0);
+  if (args_info->type_given)
+    write_into_file(outfile, "type", args_info->type_orig, 0);
+  if (args_info->resident_given)
+    write_into_file(outfile, "resident", 0, 0 );
+  if (args_info->no_user_presence_given)
+    write_into_file(outfile, "no-user-presence", 0, 0 );
+  if (args_info->pin_verification_given)



Home | Main Index | Thread Index | Old Index