#49589 merge svrcore into 389-ds-base
Merged 2 years ago by firstyear. Opened 2 years ago by firstyear.
firstyear/389-ds-base 49369-svrcore  into  master

file modified
+38 -14

@@ -26,7 +26,6 @@ 

  PROFILING_DEFINES = @profiling_defs@

  NSPR_INCLUDES = @nspr_inc@

  

- SVRCORE_INCLUDES = @svrcore_inc@

  SASL_INCLUDES = @sasl_inc@

  EVENT_INCLUDES = @event_inc@

  

@@ -70,6 +69,8 @@ 

  NUNCSTANS_INCLUDES = -I$(srcdir)/src/nunc-stans/include/

  NUNC_STANS_ON = 1

  

+ SVRCORE_INCLUDES = -I$(srcdir)/src/svrcore/src/

+ 

  # the -U undefines these symbols - should use the corresponding DS_ ones instead - see configure.ac

  DS_DEFINES = -DBUILD_NUM=$(BUILDNUM) -DVENDOR="\"$(vendor)\"" -DBRAND="\"$(brand)\"" -DCAPBRAND="\"$(capbrand)\"" \

  	-UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT

@@ -142,7 +143,6 @@ 

  

  DB_LINK = @db_lib@ -ldb-@db_libver@

  SASL_LINK = @sasl_lib@ -lsasl2

- SVRCORE_LINK = @svrcore_lib@ -lsvrcore

  ICU_LINK = @icu_lib@ -licui18n -licuuc -licudata

  PCRE_LINK = @pcre_lib@ -lpcre

  NETSNMP_LINK = @netsnmp_lib@ @netsnmp_link@

@@ -331,6 +331,7 @@ 

  

  server_LTLIBRARIES = libsds.la libnunc-stans.la libldaputil.la libslapd.la libns-dshttpd.la

  

+ lib_LTLIBRARIES = libsvrcore.la

  

  # this is how to add optional plugins

  if enable_pam_passthru

@@ -934,7 +935,8 @@ 

  

  pkgconfig_DATA = src/pkgconfig/dirsrv.pc \

  	src/pkgconfig/libsds.pc \

- 	src/pkgconfig/nunc-stans.pc

+ 	src/pkgconfig/nunc-stans.pc \

+ 	src/pkgconfig/svrcore.pc

  

  #------------------------

  # header files

@@ -946,6 +948,8 @@ 

  	src/nunc-stans/include/nunc-stans.h \

  	src/libsds/include/sds.h

  

+ include_HEADERS = src/svrcore/src/svrcore.h

+ 

  #------------------------

  # man pages

  #------------------------

@@ -1118,6 +1122,26 @@ 

  #////////////////////////////////////////////////////////////////

  

  #------------------------

+ # libsvrcore

+ #------------------------

+ libsvrcore_la_SOURCES = \

+ 	src/svrcore/src/alt.c \

+ 	src/svrcore/src/cache.c \

+ 	src/svrcore/src/errors.c \

+ 	src/svrcore/src/file.c \

+ 	src/svrcore/src/ntgetpin.c \

+ 	src/svrcore/src/ntresource.h \

+ 	src/svrcore/src/pin.c \

+ 	src/svrcore/src/pk11.c \

+ 	src/svrcore/src/std.c \

+ 	src/svrcore/src/systemd-ask-pass.c \

+ 	src/svrcore/src/std-systemd.c \

+ 	src/svrcore/src/user.c

+ 

+ libsvrcore_la_LDFLAGS = $(AM_LDFLAGS)

+ libsvrcore_la_CPPFLAGS = $(AM_CPPFLAGS) $(SVRCORE_INCLUDES) $(DSPLUGIN_CPPFLAGS)

+ 

+ #------------------------

  # libsds

  #------------------------

  libsds_la_SOURCES = src/libsds/sds/core/utils.c \

@@ -1363,8 +1387,8 @@ 

  	ldap/servers/slapd/slapi_pal.c \

  	$(libavl_a_SOURCES)

  

- libslapd_la_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_INCLUDES) @db_inc@ $(SVRCORE_INCLUDES) @kerberos_inc@ @pcre_inc@ $(SDS_CPPFLAGS)

- libslapd_la_LIBADD = $(LDAPSDK_LINK) $(SASL_LINK) $(SVRCORE_LINK) $(NSS_LINK) $(NSPR_LINK) $(KERBEROS_LINK) $(PCRE_LINK) $(THREADLIB) $(SYSTEMD_LINK) libsds.la

+ libslapd_la_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_INCLUDES) @db_inc@ @kerberos_inc@ @pcre_inc@ $(SDS_CPPFLAGS) $(SVRCORE_INCLUDES)

+ libslapd_la_LIBADD = $(LDAPSDK_LINK) $(SASL_LINK) $(NSS_LINK) $(NSPR_LINK) $(KERBEROS_LINK) $(PCRE_LINK) $(THREADLIB) $(SYSTEMD_LINK) libsds.la libsvrcore.la

  libslapd_la_LDFLAGS = $(AM_LDFLAGS) $(SLAPD_LDFLAGS)

  

  

@@ -1616,7 +1640,7 @@ 

  	ldap/servers/plugins/rever/rever.c

  

  libpbe_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SVRCORE_INCLUDES)

- libpbe_plugin_la_LIBADD = libslapd.la $(NSS_LINK)

+ libpbe_plugin_la_LIBADD = libslapd.la libsvrcore.la $(NSS_LINK)

  libpbe_plugin_la_DEPENDENCIES = libslapd.la

  libpbe_plugin_la_LDFLAGS = -avoid-version

  

@@ -2006,7 +2030,7 @@ 

  migratecred_SOURCES = ldap/servers/slapd/tools/migratecred.c

  

  migratecred_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS)

- migratecred_LDADD = libslapd.la $(NSPR_LINK) $(NSS_LINK) $(SVRCORE_LINK) $(LDAPSDK_LINK) $(SASL_LINK)

+ migratecred_LDADD = libslapd.la libsvrcore.la $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)

  migratecred_DEPENDENCIES = libslapd.la

  

  #------------------------

@@ -2015,7 +2039,7 @@ 

  mmldif_SOURCES = ldap/servers/slapd/tools/mmldif.c

  

  mmldif_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS)

- mmldif_LDADD = libslapd.la $(NSPR_LINK) $(NSS_LINK) $(SVRCORE_LINK) $(LDAPSDK_LINK_NOTHR) $(SASL_LINK)

+ mmldif_LDADD = libslapd.la libsvrcore.la $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK_NOTHR) $(SASL_LINK)

  mmldif_DEPENDENCIES = libslapd.la

  

  #------------------------

@@ -2067,8 +2091,8 @@ 

  	$(GETSOCKETPEER)

  

  ns_slapd_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_INCLUDES) $(SVRCORE_INCLUDES)

- ns_slapd_LDADD = libnunc-stans.la libslapd.la libldaputil.la $(LDAPSDK_LINK) $(NSS_LINK) $(LIBADD_DL) \

- 	$(NSPR_LINK) $(SASL_LINK) $(SVRCORE_LINK) $(LIBNSL) $(LIBSOCKET) $(THREADLIB) $(SYSTEMD_LINK) $(EVENT_LINK)

+ ns_slapd_LDADD = libnunc-stans.la libslapd.la libldaputil.la libsvrcore.la $(LDAPSDK_LINK) $(NSS_LINK) $(LIBADD_DL) \

+ 	$(NSPR_LINK) $(SASL_LINK) $(LIBNSL) $(LIBSOCKET) $(THREADLIB) $(SYSTEMD_LINK) $(EVENT_LINK)

  ns_slapd_DEPENDENCIES = libslapd.la libnunc-stans.la

  # We need to link ns-slapd with the C++ compiler on HP-UX since we load

  # some C++ shared libraries (such as icu).

@@ -2084,7 +2108,7 @@ 

  pwdhash_SOURCES = ldap/servers/slapd/tools/pwenc.c

  

  pwdhash_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS)

- pwdhash_LDADD = libslapd.la $(NSPR_LINK) $(NSS_LINK) $(SVRCORE_LINK) $(LDAPSDK_LINK) $(SASL_LINK)

+ pwdhash_LDADD = libslapd.la libsvrcore.la $(NSPR_LINK) $(NSS_LINK) $(LDAPSDK_LINK) $(SASL_LINK)

  pwdhash_DEPENDENCIES = libslapd.la

  

  #------------------------

@@ -2128,14 +2152,14 @@ 

  	test/plugins/pwdstorage/pbkdf2.c

  

  # We need to link a lot of plugins for this test.

- test_slapd_LDADD = 	libslapd.la \

+ test_slapd_LDADD =	libslapd.la \

  					libpwdstorage-plugin.la \

  					$(NSS_LINK) $(NSPR_LINK)

  test_slapd_LDFLAGS = $(AM_CPPFLAGS) $(CMOCKA_LINKS)

  ### WARNING: Slap.h needs cert.h, which requires the -I/lib/ldaputil!!!

  ### WARNING: Slap.h pulls ssl.h, which requires nss!!!!

  # We need to pull in plugin header paths too:

- test_slapd_CPPFLAGS = 	$(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(DSINTERNAL_CPPFLAGS) \

+ test_slapd_CPPFLAGS =	$(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(DSINTERNAL_CPPFLAGS) \

  						-I$(srcdir)/ldap/servers/plugins/pwdstorage

  

  test_libsds_SOURCES =  src/libsds/test/test_sds.c \

@@ -2388,7 +2412,7 @@ 

  srpm: rpmbrprep

  	cd $(RPMBUILD); \

  	rpmbuild --define "_topdir $(RPMBUILD)" \

- 	         -bs SPECS/389-ds-base.spec

+ 			 -bs SPECS/389-ds-base.spec

  

  if HAVE_DOXYGEN

  

file modified
+1 -2

@@ -802,7 +802,6 @@ 

  m4_include(m4/mozldap.m4)

  m4_include(m4/db.m4)

  m4_include(m4/sasl.m4)

- m4_include(m4/svrcore.m4)

  m4_include(m4/icu.m4)

  m4_include(m4/netsnmp.m4)

  m4_include(m4/kerberos.m4)

@@ -863,7 +862,7 @@ 

  

  # AC_CONFIG_FILES([ldap/admin/src/defaults.inf])

  

- AC_CONFIG_FILES([src/pkgconfig/dirsrv.pc src/pkgconfig/nunc-stans.pc src/pkgconfig/libsds.pc])

+ AC_CONFIG_FILES([src/pkgconfig/dirsrv.pc src/pkgconfig/nunc-stans.pc src/pkgconfig/libsds.pc src/pkgconfig/svrcore.pc])

  

  AC_CONFIG_FILES([Makefile rpm/389-ds-base.spec  ])

  

file removed
-112

@@ -1,112 +0,0 @@ 

- # BEGIN COPYRIGHT BLOCK

- # Copyright (C) 2007 Red Hat, Inc.

- # All rights reserved.

- #

- # License: GPL (version 3 or any later version).

- # See LICENSE for details. 

- # END COPYRIGHT BLOCK

- #

- # Configure paths for SVRCORE

- 

- AC_CHECKING(for SVRCORE)

- 

- AC_MSG_CHECKING(for --with-svrcore)

- AC_ARG_WITH(svrcore,

-     AS_HELP_STRING([--with-svrcore@<:@=PATH@:>@],[Use system installed SVRCORE - optional path for SVRCORE]),

-     dnl = Look in the standard system locations

-     [

-       if test "$withval" = "yes"; then

-         AC_MSG_RESULT(yes)

- 

-       elif test "$withval" = "no"; then

-         AC_MSG_RESULT(no)

-         AC_MSG_ERROR([SVRCORE is required.])

- 

-       dnl = Check the user provided location

-       elif test -d "$withval" -a -d "$withval/lib" -a -d "$withval/include" ; then

-         AC_MSG_RESULT([using $withval])

- 

-         if test -f "$withval/include/svrcore.h"; then

-           svrcore_inc="-I$withval/include"

-         else

-           AC_MSG_ERROR(svrcore.h not found)

-         fi

- 

-         svrcore_lib="-L$withval/lib"

-       else

-         AC_MSG_RESULT(yes)

-         AC_MSG_ERROR([SVRCORE not found in $withval])

-       fi

-     ],

-     AC_MSG_RESULT(yes))

- 

- AC_MSG_CHECKING(for --with-svrcore-inc)

- AC_ARG_WITH(svrcore-inc,

-     AS_HELP_STRING([--with-svrcore-inc=PATH],[SVRCORE include file directory]),

-     [

-       if test -f "$withval"/svrcore.h; then

-         AC_MSG_RESULT([using $withval])

-         svrcore_inc="-I$withval"

-       else

-         echo

-         AC_MSG_ERROR([$withval/svrcore.h not found])

-       fi

-     ],

-     AC_MSG_RESULT(no))

- 

- AC_MSG_CHECKING(for --with-svrcore-lib)

- AC_ARG_WITH(svrcore-lib,

-     AS_HELP_STRING([--with-svrcore-lib=PATH],[SVRCORE library directory]),

-     [

-       if test -d "$withval"; then

-         AC_MSG_RESULT([using $withval])

-         svrcore_lib="-L$withval"

-       else

-         echo

-         AC_MSG_ERROR([$withval not found])

-       fi

-     ],

-     AC_MSG_RESULT(no))

- 

- dnl svrcore not given - look for pkg-config

- if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then

-   AC_PATH_PROG(PKG_CONFIG, pkg-config)

-   AC_MSG_CHECKING(for SVRCORE with pkg-config)

-   if test -n "$PKG_CONFIG"; then

-     if $PKG_CONFIG --exists svrcore; then

-       svrcore_inc=`$PKG_CONFIG --cflags-only-I svrcore`

-       svrcore_lib=`$PKG_CONFIG --libs-only-L svrcore`

-       AC_MSG_RESULT([using system svrcore])

-     fi

-   fi

- fi

- 

- if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then

- dnl just see if SVRCORE is already a system library

-   AC_CHECK_LIB([svrcore], [SVRCORE_GetRegisteredPinObj], [havesvrcore=1],

- 	       [], [$nss_inc $nspr_inc $nss_lib -lnss3 -lsoftokn3 $nspr_lib -lplds4 -lplc4 -lnspr4])

-   if test -n "$havesvrcore" ; then

- dnl just see if SVRCORE is already a system header file

-     save_cppflags="$CPPFLAGS"

-     CPPFLAGS="$nss_inc $nspr_inc"

-     AC_CHECK_HEADER([svrcore.h], [havesvrcore=1], [havesvrcore=])

-     CPPFLAGS="$save_cppflags"

-   fi

- dnl for SVRCORE to be present, both the library and the header must exist

-   if test -z "$havesvrcore" ; then

-     AC_MSG_ERROR([SVRCORE not found, specify with --with-svrcore.])

-   fi

- fi

- 

- dnl = Check for svrcore.h in the normal locations

- if test -z "$svrcore_inc" -o -z "$svrcore_lib"; then

-   if test -f /usr/include/svrcore.h; then

-     svrcore_inc="-I/usr/include"

-     svrcore_lib="-L/usr/lib"

-   else

-     AC_MSG_ERROR([SVRCORE not found, specify with --with-svrcore.])

-   fi

- fi

- 

- AC_SUBST(svrcore_inc)

- AC_SUBST(svrcore_lib)

file modified
+21 -4

@@ -22,6 +22,9 @@ 

  

  %global use_perl __PERL_ON__

  

+ %define nspr_version 4.6

+ %define nss_version 3.11

+ 

  %if %{use_asan}

  %global use_tcmalloc 0

  %global variant base-asan

@@ -64,7 +67,6 @@ 

  # Attach the buildrequires to the top level package:

  BuildRequires:    nspr-devel

  BuildRequires:    nss-devel

- BuildRequires:    svrcore-devel >= 4.1.2

  BuildRequires:    openldap-devel

  BuildRequires:    libdb-devel

  BuildRequires:    cyrus-sasl-devel

@@ -95,6 +97,8 @@ 

  BuildRequires: cargo

  BuildRequires: rust

  %endif

+ BuildRequires:    pkgconfig

+ BuildRequires:    pkgconfig(systemd)

  # Needed to support regeneration of the autotool artifacts.

  BuildRequires:    autoconf

  BuildRequires:    automake

@@ -180,6 +184,9 @@ 

  %package          libs

  Summary:          Core libraries for 389 Directory Server (%{variant})

  Group:            System Environment/Daemons

+ Provides:         svrcore = 4.1.4

+ Obsoletes:        svrcore <= 4.1.3

+ Conflicts:        svrcore

  # You can work this out by running LDD on libslapd.so to see what it needs in

  # isolation.

  Requires:         nss

@@ -205,11 +212,13 @@ 

  %package          devel

  Summary:          Development libraries for 389 Directory Server (%{variant})

  Group:            Development/Libraries

+ Provides:         svrcore-devel = 4.1.4

+ Obsoletes:        svrcore-devel <= 4.1.3

+ Conflicts:        svrcore-devel

  Requires:         %{name}-libs = %{version}-%{release}

  Requires:         pkgconfig

  Requires:         nspr-devel

  Requires:         nss-devel

- Requires:         svrcore-devel

  Requires:         openldap-devel

  # systemd-libs contains the headers iirc.

  Requires:         systemd-libs

@@ -277,7 +286,7 @@ 

  

  %{?with_tmpfiles_d: TMPFILES_FLAG="--with-tmpfiles-d=%{with_tmpfiles_d}"}

  # hack hack hack https://bugzilla.redhat.com/show_bug.cgi?id=833529

- NSSARGS="--with-svrcore-inc=%{_includedir} --with-svrcore-lib=%{_libdir} --with-nss-lib=%{_libdir} --with-nss-inc=%{_includedir}/nss3"

+ NSSARGS="--with-nss-lib=%{_libdir} --with-nss-inc=%{_includedir}/nss3"

  

  %if %{use_asan} && !%{use_rust}

  ASAN_FLAGS="--enable-asan --enable-debug"

@@ -354,6 +363,8 @@ 

  rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/*.la

  rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.a

  rm -f $RPM_BUILD_ROOT%{_libdir}/%{pkgname}/plugins/*.la

+ rm -f $RPM_BUILD_ROOT%{_libdir}/libsvrcore.a

+ rm -f $RPM_BUILD_ROOT%{_libdir}/libsvrcore.la

  

  

  %if %{use_perl}

@@ -564,18 +575,24 @@ 

  %defattr(-,root,root,-)

  %doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel

  %{_mandir}/man3/*

+ %{_includedir}/svrcore.h

  %{_includedir}/%{pkgname}

+ %{_libdir}/libsvrcore.so

  %{_libdir}/%{pkgname}/libslapd.so

  %{_libdir}/%{pkgname}/libns-dshttpd.so

  %{_libdir}/%{pkgname}/libnunc-stans.so

  %{_libdir}/%{pkgname}/libsds.so

  %{_libdir}/%{pkgname}/libldaputil.so

- %{_libdir}/pkgconfig/*

+ %{_libdir}/pkgconfig/svrcore.pc

+ %{_libdir}/pkgconfig/dirsrv.pc

+ %{_libdir}/pkgconfig/libsds.pc

+ %{_libdir}/pkgconfig/nunc-stans.pc

  

  %files libs

  %defattr(-,root,root,-)

  %doc LICENSE LICENSE.GPLv3+ LICENSE.openssl README.devel

  %dir %{_libdir}/%{pkgname}

+ %{_libdir}/libsvrcore.so.*

  %{_libdir}/%{pkgname}/libslapd.so.*

  %{_libdir}/%{pkgname}/libns-dshttpd-*.so

  %{_libdir}/%{pkgname}/libnunc-stans.so.*

@@ -0,0 +1,11 @@ 

+ prefix=@prefix@

+ exec_prefix=@exec_prefix@

+ libdir=@libdir@

+ includedir=@includedir@

+ 

+ Name: svrcore

+ Description: Svrcore - Secure PIN handling using NSS crypto

+ Version: @PACKAGE_VERSION@

+ Requires: nspr, nss

+ Libs: -lsvrcore

+ Cflags: -I${includedir}

file added
+3

@@ -0,0 +1,3 @@ 

+ 

+ 2016 William Brown <wibrown@redhat.com>

+ 

file added
+2

@@ -0,0 +1,2 @@ 

+ This file intentionally left empty.  Do not use the one generated

+ by autoreconf.  See LICENSE for license information.

empty or binary file added
file added
+370

@@ -0,0 +1,370 @@ 

+ Installation Instructions

+ *************************

+ 

+ Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,

+ Inc.

+ 

+    Copying and distribution of this file, with or without modification,

+ are permitted in any medium without royalty provided the copyright

+ notice and this notice are preserved.  This file is offered as-is,

+ without warranty of any kind.

+ 

+ Basic Installation

+ ==================

+ 

+    Briefly, the shell command `./configure && make && make install'

+ should configure, build, and install this package.  The following

+ more-detailed instructions are generic; see the `README' file for

+ instructions specific to this package.  Some packages provide this

+ `INSTALL' file but do not implement all of the features documented

+ below.  The lack of an optional feature in a given package is not

+ necessarily a bug.  More recommendations for GNU packages can be found

+ in *note Makefile Conventions: (standards)Makefile Conventions.

+ 

+    The `configure' shell script attempts to guess correct values for

+ various system-dependent variables used during compilation.  It uses

+ those values to create a `Makefile' in each directory of the package.

+ It may also create one or more `.h' files containing system-dependent

+ definitions.  Finally, it creates a shell script `config.status' that

+ you can run in the future to recreate the current configuration, and a

+ file `config.log' containing compiler output (useful mainly for

+ debugging `configure').

+ 

+    It can also use an optional file (typically called `config.cache'

+ and enabled with `--cache-file=config.cache' or simply `-C') that saves

+ the results of its tests to speed up reconfiguring.  Caching is

+ disabled by default to prevent problems with accidental use of stale

+ cache files.

+ 

+    If you need to do unusual things to compile the package, please try

+ to figure out how `configure' could check whether to do them, and mail

+ diffs or instructions to the address given in the `README' so they can

+ be considered for the next release.  If you are using the cache, and at

+ some point `config.cache' contains results you don't want to keep, you

+ may remove or edit it.

+ 

+    The file `configure.ac' (or `configure.in') is used to create

+ `configure' by a program called `autoconf'.  You need `configure.ac' if

+ you want to change it or regenerate `configure' using a newer version

+ of `autoconf'.

+ 

+    The simplest way to compile this package is:

+ 

+   1. `cd' to the directory containing the package's source code and type

+      `./configure' to configure the package for your system.

+ 

+      Running `configure' might take a while.  While running, it prints

+      some messages telling which features it is checking for.

+ 

+   2. Type `make' to compile the package.

+ 

+   3. Optionally, type `make check' to run any self-tests that come with

+      the package, generally using the just-built uninstalled binaries.

+ 

+   4. Type `make install' to install the programs and any data files and

+      documentation.  When installing into a prefix owned by root, it is

+      recommended that the package be configured and built as a regular

+      user, and only the `make install' phase executed with root

+      privileges.

+ 

+   5. Optionally, type `make installcheck' to repeat any self-tests, but

+      this time using the binaries in their final installed location.

+      This target does not install anything.  Running this target as a

+      regular user, particularly if the prior `make install' required

+      root privileges, verifies that the installation completed

+      correctly.

+ 

+   6. You can remove the program binaries and object files from the

+      source code directory by typing `make clean'.  To also remove the

+      files that `configure' created (so you can compile the package for

+      a different kind of computer), type `make distclean'.  There is

+      also a `make maintainer-clean' target, but that is intended mainly

+      for the package's developers.  If you use it, you may have to get

+      all sorts of other programs in order to regenerate files that came

+      with the distribution.

+ 

+   7. Often, you can also type `make uninstall' to remove the installed

+      files again.  In practice, not all packages have tested that

+      uninstallation works correctly, even though it is required by the

+      GNU Coding Standards.

+ 

+   8. Some packages, particularly those that use Automake, provide `make

+      distcheck', which can by used by developers to test that all other

+      targets like `make install' and `make uninstall' work correctly.

+      This target is generally not run by end users.

+ 

+ Compilers and Options

+ =====================

+ 

+    Some systems require unusual options for compilation or linking that

+ the `configure' script does not know about.  Run `./configure --help'

+ for details on some of the pertinent environment variables.

+ 

+    You can give `configure' initial values for configuration parameters

+ by setting variables in the command line or in the environment.  Here

+ is an example:

+ 

+      ./configure CC=c99 CFLAGS=-g LIBS=-lposix

+ 

+    *Note Defining Variables::, for more details.

+ 

+ Compiling For Multiple Architectures

+ ====================================

+ 

+    You can compile the package for more than one kind of computer at the

+ same time, by placing the object files for each architecture in their

+ own directory.  To do this, you can use GNU `make'.  `cd' to the

+ directory where you want the object files and executables to go and run

+ the `configure' script.  `configure' automatically checks for the

+ source code in the directory that `configure' is in and in `..'.  This

+ is known as a "VPATH" build.

+ 

+    With a non-GNU `make', it is safer to compile the package for one

+ architecture at a time in the source code directory.  After you have

+ installed the package for one architecture, use `make distclean' before

+ reconfiguring for another architecture.

+ 

+    On MacOS X 10.5 and later systems, you can create libraries and

+ executables that work on multiple system types--known as "fat" or

+ "universal" binaries--by specifying multiple `-arch' options to the

+ compiler but only a single `-arch' option to the preprocessor.  Like

+ this:

+ 

+      ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \

+                  CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \

+                  CPP="gcc -E" CXXCPP="g++ -E"

+ 

+    This is not guaranteed to produce working output in all cases, you

+ may have to build one architecture at a time and combine the results

+ using the `lipo' tool if you have problems.

+ 

+ Installation Names

+ ==================

+ 

+    By default, `make install' installs the package's commands under

+ `/usr/local/bin', include files under `/usr/local/include', etc.  You

+ can specify an installation prefix other than `/usr/local' by giving

+ `configure' the option `--prefix=PREFIX', where PREFIX must be an

+ absolute file name.

+ 

+    You can specify separate installation prefixes for

+ architecture-specific files and architecture-independent files.  If you

+ pass the option `--exec-prefix=PREFIX' to `configure', the package uses

+ PREFIX as the prefix for installing programs and libraries.

+ Documentation and other data files still use the regular prefix.

+ 

+    In addition, if you use an unusual directory layout you can give

+ options like `--bindir=DIR' to specify different values for particular

+ kinds of files.  Run `configure --help' for a list of the directories

+ you can set and what kinds of files go in them.  In general, the

+ default for these options is expressed in terms of `${prefix}', so that

+ specifying just `--prefix' will affect all of the other directory

+ specifications that were not explicitly provided.

+ 

+    The most portable way to affect installation locations is to pass the

+ correct locations to `configure'; however, many packages provide one or

+ both of the following shortcuts of passing variable assignments to the

+ `make install' command line to change installation locations without

+ having to reconfigure or recompile.

+ 

+    The first method involves providing an override variable for each

+ affected directory.  For example, `make install

+ prefix=/alternate/directory' will choose an alternate location for all

+ directory configuration variables that were expressed in terms of

+ `${prefix}'.  Any directories that were specified during `configure',

+ but not in terms of `${prefix}', must each be overridden at install

+ time for the entire installation to be relocated.  The approach of

+ makefile variable overrides for each directory variable is required by

+ the GNU Coding Standards, and ideally causes no recompilation.

+ However, some platforms have known limitations with the semantics of

+ shared libraries that end up requiring recompilation when using this

+ method, particularly noticeable in packages that use GNU Libtool.

+ 

+    The second method involves providing the `DESTDIR' variable.  For

+ example, `make install DESTDIR=/alternate/directory' will prepend

+ `/alternate/directory' before all installation names.  The approach of

+ `DESTDIR' overrides is not required by the GNU Coding Standards, and

+ does not work on platforms that have drive letters.  On the other hand,

+ it does better at avoiding recompilation issues, and works well even

+ when some directory options were not specified in terms of `${prefix}'

+ at `configure' time.

+ 

+ Optional Features

+ =================

+ 

+    If the package supports it, you can cause programs to be installed

+ with an extra prefix or suffix on their names by giving `configure' the

+ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.

+ 

+    Some packages pay attention to `--enable-FEATURE' options to

+ `configure', where FEATURE indicates an optional part of the package.

+ They may also pay attention to `--with-PACKAGE' options, where PACKAGE

+ is something like `gnu-as' or `x' (for the X Window System).  The

+ `README' should mention any `--enable-' and `--with-' options that the

+ package recognizes.

+ 

+    For packages that use the X Window System, `configure' can usually

+ find the X include and library files automatically, but if it doesn't,

+ you can use the `configure' options `--x-includes=DIR' and

+ `--x-libraries=DIR' to specify their locations.

+ 

+    Some packages offer the ability to configure how verbose the

+ execution of `make' will be.  For these packages, running `./configure

+ --enable-silent-rules' sets the default to minimal output, which can be

+ overridden with `make V=1'; while running `./configure

+ --disable-silent-rules' sets the default to verbose, which can be

+ overridden with `make V=0'.

+ 

+ Particular systems

+ ==================

+ 

+    On HP-UX, the default C compiler is not ANSI C compatible.  If GNU

+ CC is not installed, it is recommended to use the following options in

+ order to use an ANSI C compiler:

+ 

+      ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"

+ 

+ and if that doesn't work, install pre-built binaries of GCC for HP-UX.

+ 

+    HP-UX `make' updates targets which have the same time stamps as

+ their prerequisites, which makes it generally unusable when shipped

+ generated files such as `configure' are involved.  Use GNU `make'

+ instead.

+ 

+    On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot

+ parse its `<wchar.h>' header file.  The option `-nodtk' can be used as

+ a workaround.  If GNU CC is not installed, it is therefore recommended

+ to try

+ 

+      ./configure CC="cc"

+ 

+ and if that doesn't work, try

+ 

+      ./configure CC="cc -nodtk"

+ 

+    On Solaris, don't put `/usr/ucb' early in your `PATH'.  This

+ directory contains several dysfunctional programs; working variants of

+ these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'

+ in your `PATH', put it _after_ `/usr/bin'.

+ 

+    On Haiku, software installed for all users goes in `/boot/common',

+ not `/usr/local'.  It is recommended to use the following options:

+ 

+      ./configure --prefix=/boot/common

+ 

+ Specifying the System Type

+ ==========================

+ 

+    There may be some features `configure' cannot figure out

+ automatically, but needs to determine by the type of machine the package

+ will run on.  Usually, assuming the package is built to be run on the

+ _same_ architectures, `configure' can figure that out, but if it prints

+ a message saying it cannot guess the machine type, give it the

+ `--build=TYPE' option.  TYPE can either be a short name for the system

+ type, such as `sun4', or a canonical name which has the form:

+ 

+      CPU-COMPANY-SYSTEM

+ 

+ where SYSTEM can have one of these forms:

+ 

+      OS

+      KERNEL-OS

+ 

+    See the file `config.sub' for the possible values of each field.  If

+ `config.sub' isn't included in this package, then this package doesn't

+ need to know the machine type.

+ 

+    If you are _building_ compiler tools for cross-compiling, you should

+ use the option `--target=TYPE' to select the type of system they will

+ produce code for.

+ 

+    If you want to _use_ a cross compiler, that generates code for a

+ platform different from the build platform, you should specify the

+ "host" platform (i.e., that on which the generated programs will

+ eventually be run) with `--host=TYPE'.

+ 

+ Sharing Defaults

+ ================

+ 

+    If you want to set default values for `configure' scripts to share,

+ you can create a site shell script called `config.site' that gives

+ default values for variables like `CC', `cache_file', and `prefix'.

+ `configure' looks for `PREFIX/share/config.site' if it exists, then

+ `PREFIX/etc/config.site' if it exists.  Or, you can set the

+ `CONFIG_SITE' environment variable to the location of the site script.

+ A warning: not all `configure' scripts look for a site script.

+ 

+ Defining Variables

+ ==================

+ 

+    Variables not defined in a site shell script can be set in the

+ environment passed to `configure'.  However, some packages may run

+ configure again during the build, and the customized values of these

+ variables may be lost.  In order to avoid this problem, you should set

+ them in the `configure' command line, using `VAR=value'.  For example:

+ 

+      ./configure CC=/usr/local2/bin/gcc

+ 

+ causes the specified `gcc' to be used as the C compiler (unless it is

+ overridden in the site shell script).

+ 

+ Unfortunately, this technique does not work for `CONFIG_SHELL' due to

+ an Autoconf limitation.  Until the limitation is lifted, you can use

+ this workaround:

+ 

+      CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash

+ 

+ `configure' Invocation

+ ======================

+ 

+    `configure' recognizes the following options to control how it

+ operates.

+ 

+ `--help'

+ `-h'

+      Print a summary of all of the options to `configure', and exit.

+ 

+ `--help=short'

+ `--help=recursive'

+      Print a summary of the options unique to this package's

+      `configure', and exit.  The `short' variant lists options used

+      only in the top level, while the `recursive' variant lists options

+      also present in any nested packages.

+ 

+ `--version'

+ `-V'

+      Print the version of Autoconf used to generate the `configure'

+      script, and exit.

+ 

+ `--cache-file=FILE'

+      Enable the cache: use and save the results of the tests in FILE,

+      traditionally `config.cache'.  FILE defaults to `/dev/null' to

+      disable caching.

+ 

+ `--config-cache'

+ `-C'

+      Alias for `--cache-file=config.cache'.

+ 

+ `--quiet'

+ `--silent'

+ `-q'

+      Do not print messages saying which checks are being made.  To

+      suppress all normal output, redirect it to `/dev/null' (any error

+      messages will still be shown).

+ 

+ `--srcdir=DIR'

+      Look for the package's source code in directory DIR.  Usually

+      `configure' can determine that directory automatically.

+ 

+ `--prefix=DIR'

+      Use DIR as the installation prefix.  *note Installation Names::

+      for more details, including other options available for fine-tuning

+      the installation locations.

+ 

+ `--no-create'

+ `-n'

+      Run the configure checks, but stop before creating any output

+      files.

+ 

+ `configure' also accepts some other, not widely useful, options.  Run

+ `configure --help' for more details.

@@ -0,0 +1,77 @@ 

+ Building:

+ 

+ If you are not doing an "in-tree" build, you will need to set the environment variables NSPR_INCLUDE_DIR, NSPR_LIB_DIR, NSS_INCLUDE_DIR, and NSS_LIB_DIR to point to the appropriate places.  On Windows, if you are using the build method described below (cygwin + MSVC), you should use the "mixed" style path e.g.

+ export NSPR_INCLUDE_DIR=`cygpath -m $HOME/nspr-4.6.1/include`

+ etc.

+ The MSVC compiler (cl.exe) will barf on paths like /cygdrive/c/foo/bar.

+ 

+ Unix:

+ See INSTALL for the usual configure + make + make install

+ 

+ Windows:

+ Windows has now (as of 2006/2/1) released free versions of their compiler and platform SDKs - everything you need to build svrcore.

+ 

+ Prerequisites:

+ First, you must install 3 packages downloaded from Microsoft.  If the links don't work, just go to www.microsoft.com and search for their names until you get to the download links for them.

+ Second, install CygWin - www.cygwin.com

+ Third, you need nsinstall.exe from the MozTools wintools package (you don't need anything else) - http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip - just unpack the zip file, extract nsinstall.exe, and place in your PATH

+ 

+ * Microsoft Visual C++ Toolkit 2003

+ ** http://msdn.microsoft.com/visualc/vctoolkit2003/ - follow the link to download

+ 

+ * Microsoft Windows Platform SDK

+ ** http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

+ ** Minimum install:

+ *** Choose Custom

+ *** Choose Windows Core SDK - omit any 64 bit options (unless you need 64 bit binaries) and omit source code (unless you really want it)

+ *** You can omit everything else (unless you just want to fill up your disk)

+ ** Full Install (if you have lots of disk space, network bandwidth, and time)

+ 

+ * Microsoft .NET Framework SDK

+ ** http://www.microsoft.com/downloads/details.aspx?familyid=9b3a2ca6-3647-4070-9f41-a333c6b9181d&displaylang=en

+ 

+ * CygWin

+ ** www.cygwin.com

+ *** Download and run setup

+ *** Setup allows you to choose which packages you want to install.

+ *** Minimal Install

+ **** Archive - tar, zip, unzip

+ **** Base - most everything here

+ **** Database - nothing - postgres and bdb are selected by default - deselect them

+ **** Devel - you really only need binutils, make, and mktemp, but cvs is good to have, and you may be interested in some of the others as well

+ **** Doc - whatever the defaults are

+ **** Editors - you probably want some sort of text editor if you don't already have one and don't want to use Notepad/Wordpad

+ **** Games, Gnome, Graphics - Defaults

+ **** Interpreters - gawk, perl

+ **** KDE, Libs, Mail, Math, MinGW, Net, Perl, Publishing, Python - Defaults

+ **** Shells - ash and bash

+ **** System - Defaults

+ **** Text - less

+ **** Utils - Defaults + patch

+ **** Web, X11 - Defaults

+ ** After installation is complete, you can have it create a cygwin desktop icon that you launch the cygwin environment from

+ 

+ Newer versions of the MS VC tools work as well - I've had success using

+ MS Visual C++ 2005 Express Edition.

+ 

+ * Setting up your build environment

+ The first time you launch the cygwin shell, it should create a $HOME/.bash_profile.  To set up your PATH, it is easiest to just call vcvars32.bat (provided)

+ by the MSVC tools) in a batch file that starts up bash.  If you would

+ rather set your PATH manually, add the following to $HOME/.bash_profile:

+ export INCLUDE="c:\Program Files\Microsoft Visual C++ Toolkit 2003\include;c:\Program Files\Microsoft Platform SDK\Include;c:\Program Files\Microsoft Platform SDK\Include\mfc"

+ export LIB="c:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;c:\Program Files\Microsoft Platform SDK\Lib;c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib"

+ export ANONMOZCVSROOT=:pserver:anonymous@cvvs-mirror.mozilla.org:/cvsroot

+ export CVSROOT=$ANONMOZCVSROOT

+ export PATH="$HOME/bin:/cygdrive/c/Program Files/Microsoft Visual C++ Toolkit 2003/bin:/cygdrive/c/Program Files/Microsoft Platform SDK/Bin:$PATH"

+ 

+ I've put my nsinstall.exe in my $HOME/bin directory and put that first in my PATH.  This assumes you've used the default paths for all of the MS and cygwin installs.  If not, change the paths accordingly.  In order for the changes to take effect, re-source your file or logout and login again.

+ 

+ * Building

+ 

+  cd mozilla/security/svrcore/src

+  make -f Makefile.win

+ If that barfs, that it cannot find lib.exe, or it is using the wrong

+ version of lib.exe (e.g. the cygwin one), do the following:

+  make -f Makefile.win AR='link /lib -nologo -out:"$@"

+ 

+ And that's it.  The svrcore.lib will be found in mozilla/dist/*.OBJ/lib and svrcore.h will be found in mozilla/dist/public/svrcore.  When you go to build the mozilla ldap c sdk that you have checked out into the same source tree, it will automatically find the files it needs when you use configure --with-svrcore ...

file added
+27

@@ -0,0 +1,27 @@ 

+ ***** BEGIN LICENSE BLOCK *****

+ Version: MPL 2.0

+ 

+ This Source Code Form is subject to the terms of the Mozilla Public

+ License, v. 2.0. If a copy of the MPL was not distributed with this

+ file, You can obtain one at https://mozilla.org/MPL/2.0/.

+ 

+ Software distributed under the License is distributed on an "AS IS" basis,

+ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License

+ for the specific language governing rights and limitations under the

+ License.

+ 

+ The Original Code is the Netscape svrcore library.

+ 

+ The Initial Developer of the Original Code is

+ Netscape Communications Corporation.

+ Portions created by the Initial Developer are Copyright (C) 1998

+ the Initial Developer. All Rights Reserved.

+ 

+ Contributor(s): Terry Hayes (Netscape/AOL) was the primary contributor

+ 

+ Copyright 2016 Red Hat, Inc. and/or its affiliates.

+ 

+ Contributor(s): Rich Megginson (Red Hat)

+                 William Brown (Red Hat) <wibrown@redhat.com>

+ 

+ ***** END LICENSE BLOCK *****

@@ -0,0 +1,54 @@ 

+ SUBDIRS=src

+ PACKAGE_VERSION = @PACKAGE_VERSION@

+ 

+ EXTRA_DIST=	LICENSE \

+ 		svrcore.spec \

+ 		svrcore.pc.in \

+ 		autogen.sh \

+ 		INSTALL.win

+ 

+ pkgconfigdir= $(libdir)/pkgconfig

+ pkgconfig_DATA= svrcore.pc

+ 

+ # if distdir is a git tag, use that for the git archive tag, else

+ # just assume a developer build and use HEAD

+ git-archive:

+ 	if [ -n "$(SRCDISTDIR)" -a -d "$(SRCDISTDIR)" ] ; then \

+ 			srcdistdir=$(SRCDISTDIR) ; \

+ 	else \

+ 			srcdistdir=`pwd` ; \

+ 	fi ; \

+ 	cd $(srcdir) ; \

+ 	if git show-ref --tags -q $(distdir) ; then \

+ 			gittag=$(distdir) ; \

+ 	else \

+ 			gittag=HEAD ; \

+ 	fi ; \

+ 	git archive --prefix=$(distdir)/ $$gittag | bzip2 > $$srcdistdir/$(distdir).tar.bz2

+ 

+ RPMBUILD ?= $(abs_builddir)/rpmbuild

+ 

+ rpmroot:

+ 	$(MKDIR_P) $(RPMBUILD)/BUILD

+ 	$(MKDIR_P) $(RPMBUILD)/RPMS

+ 	$(MKDIR_P) $(RPMBUILD)/SOURCES

+ 	$(MKDIR_P) $(RPMBUILD)/SPECS

+ 	$(MKDIR_P) $(RPMBUILD)/SRPMS

+ 

+ rpmbrprep: git-archive rpmroot

+ 	cp $(distdir).tar.bz2 $(RPMBUILD)/SOURCES

+ 	sed -e "s/__VERSION__/$(PACKAGE_VERSION)/" < $(srcdir)/svrcore.spec > $(RPMBUILD)/SPECS/svrcore.spec

+ 

+ # Requires rpmdevtools. Consider making this a dependancy of rpms.

+ rpmsources: rpmbrprep

+ 	spectool -g -S -C $(RPMBUILD)/SOURCES $(RPMBUILD)/SPECS/svrcore.spec

+ 

+ rpms: rpmbrprep

+ 	cd $(RPMBUILD); \

+ 	rpmbuild --define "_topdir $(RPMBUILD)" -ba SPECS/svrcore.spec

+ 

+ srpm: rpmbrprep

+ 	cd $(RPMBUILD); \

+ 	rpmbuild --define "_topdir $(RPMBUILD)" \

+ 			 -bs SPECS/svrcore.spec

+ 

file added
+31

@@ -0,0 +1,31 @@ 

+ svrcore 4.1.3

+ =============

+ * Code quality fixes.

+ 

+ svrcore 4.1.2

+ =============

+ * Code quality fixes.

+ 

+ svrcore 4.1.1

+ =============

+ * Code quality and stability fixes.

+ * Improvements to rpm tooling and spec file.

+ 

+ svrcore 4.1.0

+ =============

+ * Add support for systemd-ask-pass integration

+ 

+ svrcore 4.0.4

+ =============

+ * Removed some files generated by autoconf which were

+ * GPL only

+ 

+ svrcore 4.0.3.01

+ ================

+ * Moved Makefile to src/Makefile.win for Windows build

+ * Added support for --with-nspr and --with-nss

+ * Use PK11_TokenKeyGenWithFlags instead of PK11_KeyGen

+ 

+ svrcore 4.0.2.02

+ ================

+ * Autotooled the build.

file added
+58

@@ -0,0 +1,58 @@ 

+ The Netscape svrcore library

+ 

+ Terry Hayes wrote the Netscape svrcore library in 1998.

+ Valerie Chu wrote the ntgetpin.c and related files.

+ 

+ William Brown wrote systemd integration and related parts.

+ 

+ svrcore used to contain two major parts.

+ 

+ The first part is what we released on mozilla.  It is a kind of

+ object-oriented package for handling PIN requests from NSS. The

+ idea was to provide a standard way for servers to allow PIN input

+ from a file or from the terminal.  There is also a PIN handler

+ that caches the PIN in memory after encrypting it with a key on

+ a device (such as a Fortezza card). This allowed a server to

+ restart without having to reenter the PIN. However since the PIN

+ is encrypted, a core dump would not expose it.  In addition,

+ removing the device would also make the PIN inaccessible.

+ 

+ The files are:

+ 

+ svrcore.h - API definition

+ alt.c - allows two possible PIN request methods to be used (say

+         file and then terminal)

+ cache.c - caches the result from another PIN request method

+ errors.c - error text

+ file.c - reads the PIN from a specified file

+ ntgetpin.c - Windows version of a user prompt for PIN

+ ntgetpin.rc - Windows resource script for ntgetpin.c

+ ntresource.h - a generated include file used by ntgetpin.rc

+ key.ico - an icon used by ntgetpin.rc

+ logo.ico - an icon used by ntgetpin.rc

+ pin.c - functions to register a PIN request object with NSS

+ pk11.c - implementation of the encrypted in-memory caching

+ std.c - a "standard" PIN object that satisfies requests from a

+         file or the terminal and allows caching if desired.

+ std-systemd.c - a "standard" PIN object that satisfies requests from a

+         file or the terminal, or systemd-ask-pass, and allows caching 

+         if desired.

+ systemd-ask-pass.c - a PIN object that can request pins from the systemd

+         ask password api.

+ user.c - prompts the user for the PIN

+ 

+ Note: the pk11.c file (secure PIN store) is a pretty good example

+ of how to encrypt/decrypt with NSS.

+ 

+ There was a second component of svrcore that handled export policy

+ configuration.  It allowed patching of a single executable (single

+ program build) to create the export and domestic versions of a

+ server.  This code was discontinued after the export policy changes.

+ 

+ The LDAP C SDK tools use svrcore.  They also implemented their

+ own PIN object to allow command line PIN entry.  The directory

+ server also implemented its own PIN object to allow a watchdog

+ process to cache the PIN and restart the server.

+ 

+ See INSTALL for build instructions

+ See INSTALL.win for Windows build instructions

file added
+3

@@ -0,0 +1,3 @@ 

+ * configure.ac: Change bug address

+ * FIll in NEWS AUTHORS ChangeLog

+ * Dal with Windows builds

@@ -0,0 +1,92 @@ 

+ #!/bin/sh

+ 

+ # set required versions of tools here

+ # the version is dotted integers like X.Y.Z where

+ # X, Y, and Z are integers

+ # comparisons are done using shell -lt, -gt, etc.

+ # this works if the numbers are zero filled as well

+ # so 06 == 6

+ 

+ # autoconf version required

+ # need 2.69 or later

+ ac_need_maj=2

+ ac_need_min=69

+ # automake version required

+ # need 1.13.4 or later

+ am_need_maj=1

+ am_need_min=13

+ am_need_rev=4

+ # libtool version required

+ # need 2.4.2 or later

+ lt_need_maj=2

+ lt_need_min=4

+ lt_need_rev=2

+ # should never have to touch anything below this line unless there is a bug

+ ###########################################################################

+ 

+ # input

+ #  arg1 - version string in the form "X.Y[.Z]" - the .Z is optional

+ #  args remaining - the needed X, Y, and Z to match

+ # output

+ #  return 0 - success - the version string is >= the required X.Y.Z

+ #  return 1 - failure - the version string is < the required X.Y.Z

+ # NOTE: All input must be integers, otherwise you will see shell errors

+ checkvers() {

+     vers="$1"; shift

+     needmaj="$1"; shift

+     needmin="$1"; shift

+     needrev="$1"; shift

+     verslist=`echo $vers | tr '.' ' '`

+     set $verslist

+     maj=$1; shift

+     min=$1; shift

+     rev=$1; shift

+     if [ "$maj" -gt "$needmaj" ] ; then return 0; fi

+     if [ "$maj" -lt "$needmaj" ] ; then return 1; fi

+     # if we got here, maj == needmaj

+     if [ -z "$needmin" ] ; then return 0; fi

+     if [ "$min" -gt "$needmin" ] ; then return 0; fi

+     if [ "$min" -lt "$needmin" ] ; then return 1; fi

+     # if we got here, min == needmin

+     if [ -z "$needrev" ] ; then return 0; fi

+     if [ "$rev" -gt "$needrev" ] ; then return 0; fi

+     if [ "$rev" -lt "$needrev" ] ; then return 1; fi

+     # if we got here, rev == needrev

+     return 0

+ }

+ 

+ # Check autoconf version

+ AC_VERSION=`autoconf --version | sed '/^autoconf/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`

+ if checkvers "$AC_VERSION" $ac_need_maj $ac_need_min ; then

+     echo Found valid autoconf version $AC_VERSION

+ else

+     echo "You must have autoconf version $ac_need_maj.$ac_need_min or later installed (found version $AC_VERSION)."

+     exit 1

+ fi

+ 

+ # Check automake version

+ AM_VERSION=`automake --version | sed '/^automake/ {s/^.* \([1-9][0-9.]*\)$/\1/; q}'`

+ if checkvers "$AM_VERSION" $am_need_maj $am_need_min $am_need_rev ; then

+     echo Found valid automake version $AM_VERSION

+ else

+     echo "You must have automake version $am_need_maj.$am_need_min.$am_need_rev or later installed (found version $AM_VERSION)."

+     exit 1

+ fi

+ 

+ # Check libtool version

+ # NOTE: some libtool versions report a letter at the end e.g. on RHEL6

+ # the version is 2.2.6b - for comparison purposes, just strip off the

+ # letter - note that the shell -lt and -gt comparisons will fail with

+ # test: 6b: integer expression expected if the number to compare

+ # contains a non-digit

+ LT_VERSION=`libtool --version | sed '/GNU libtool/ {s/^.* \([1-9][0-9a-zA-Z.]*\)$/\1/; s/[a-zA-Z]//g; q}'`

+ if checkvers "$LT_VERSION" $lt_need_maj $lt_need_min $lt_need_rev ; then

+     echo Found valid libtool version $LT_VERSION

+ else

+     echo "You must have libtool version $lt_need_maj.$lt_need_min.$lt_need_rev or later installed (found version $LT_VERSION)."

+     exit 1

+ fi

+ 

+ # Run autoreconf

+ echo "Running autoreconf -fvi"

+ autoreconf -fvi

@@ -0,0 +1,69 @@ 

+ #                                               -*- Autoconf -*-

+ # Process this file with autoconf to produce a configure script.

+ 

+ AC_PREREQ(2.59)

+ AC_INIT(svrcore, 4.1.3, [wibrown@redhat.com, rmeggins@redhat.com], svrcore)

+ AM_INIT_AUTOMAKE([gnu check-news dist-bzip2])

+ AM_MAINTAINER_MODE

+ AC_CONFIG_SRCDIR([src/svrcore.h])

+ AC_CONFIG_HEADER([config.h])

+ 

+ AC_PROG_CC

+ AC_PROG_LIBTOOL

+ 

+ # Checks for header files.

+ AC_HEADER_STDC

+ AC_CHECK_HEADER([string.h],,[AC_ERROR([We need string.h in order to build])])

+ AC_CHECK_HEADER([termios.h],,[AC_ERROR([We need termios.h in order to build])])

+ AC_CHECK_HEADER([unistd.h],,[AC_ERROR([We need unistd.h in order to build])])

+ AC_PROG_CC_STDC

+ 

+ # Checks for typedefs, structures, and compiler characteristics.

+ AC_C_CONST

+ 

+ # Checks for library functions.

+ AC_FUNC_MALLOC

+ AC_CHECK_FUNCS([memset strchr strdup])

+ 

+ # Check for library dependencies

+ m4_include(m4/nss.m4)

+ m4_include(m4/nspr.m4)

+ m4_include(m4/systemd.m4)

+ 

+ AC_MSG_CHECKING(for --enable-debug)

+ AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]),

+ [

+   AC_MSG_RESULT(yes)

+   debug_defs="-g3 -DDEBUG"

+ ],

+ [

+   AC_MSG_RESULT(no)

+   debug_defs=""

+ ])

+ AC_SUBST([debug_defs])

+ 

+ AC_MSG_CHECKING(for --enable-asan)

+ AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc address sanitizer options (default: no)]),

+ [

+   AC_MSG_RESULT(yes)

+   asan_defs="-fsanitize=address -fno-omit-frame-pointer"

+ ],

+ [

+   AC_MSG_RESULT(no)

+   asan_defs=""

+ ])

+ AC_SUBST([asan_defs])

+ 

+ AC_SUBST([NSPR_CFLAGS])

+ AC_SUBST([NSPR_LIBS])

+ AC_SUBST([NSPR_MIN_VER])

+ AC_SUBST([NSPR_NAME])

+ AC_SUBST([NSS_CFLAGS])

+ AC_SUBST([NSS_LIBS])

+ AC_SUBST([NSS_MIN_VER])

+ AC_SUBST([NSS_NAME])

+ AC_SUBST([SYSTEMD_CFLAGS])

+ AC_SUBST([PACKAGE_VERSION])

+ 

+ AC_CONFIG_FILES([src/Makefile Makefile svrcore.pc])

+ AC_OUTPUT

@@ -0,0 +1,140 @@ 

+ //

+ // BEGIN COPYRIGHT BLOCK

+ // Copyright (C) 2016 Red Hat, Inc.

+ // All rights reserved.

+ //

+ // License: GPL (version 3 or any later version).

+ // See LICENSE for details. 

+ // END COPYRIGHT BLOCK

+ //

+ // Author: William Brown <wibrown@redhat.com>

+ //

+ 

+ // Build with gcc -g3 -o svrcore_driver `pkg-config --libs --cflags nspr` `PKG_CONFIG_PATH=/opt/svrcore/lib/pkgconfig pkg-config --cflags --libs svrcore` -L`PKG_CONFIG_PATH=/opt/svrcore/lib/pkgconfig pkg-config --variable=libdir svrcore` svrcore_driver.c

+ 

+ #include <stdio.h>

+ #include <nspr.h>

+ #include <svrcore.h>

+ 

+ int

+ svrcore_systemd_setup()

+ {

+     PRErrorCode errorCode;

+     SVRCORESystemdPinObj *StdPinObj;

+ 

+     StdPinObj = (SVRCORESystemdPinObj *)SVRCORE_GetRegisteredPinObj();

+ 

+     if (StdPinObj) {

+         // This means it's already registered?

+         return 0;

+     }

+     if (SVRCORE_CreateSystemdPinObj(&StdPinObj, 60) != SVRCORE_Success) {

+         errorCode = PR_GetError();

+         printf("Unable to create pin %d\n", errorCode);

+         return -1;

+     }

+     SVRCORE_RegisterPinObj((SVRCOREPinObj *)StdPinObj);

+     return 0;

+ }

+ 

+ int

+ svrcore_systemd_get_token()

+ {

+     //Actually get the password

+     // Get the pinobj

+     SVRCORESystemdPinObj *StdPinObj;

+     char *pw = NULL;

+     char *token = NULL;

+     SVRCOREError err = SVRCORE_Success;

+ 

+     StdPinObj = (SVRCORESystemdPinObj *)SVRCORE_GetRegisteredPinObj();

+     // Are we interactive?

+     // SVRCORE_SetStdPinInteractive((SVRCOREStdPinObj *) StdPinObj , PR_TRUE);

+     // what is token?

+     token = "internal (software)";

+     pw = SVRCORE_GetPin( (SVRCOREPinObj *)StdPinObj, token , PR_FALSE);

+     if ( err != SVRCORE_Success || pw == NULL) {

+         printf("Couldn't get pin %d \n", err);

+     } else {

+         printf("%s\n", pw);

+         free(pw);

+     }

+     // Should set a password into &pw

+ 

+     // Cleanup

+     SVRCORE_DestroyRegisteredPinObj();

+ 

+     return 0;

+ }

+ 

+ int

+ svrcore_stdsystemd_setup()

+ {

+     PRErrorCode errorCode;

+     SVRCOREStdSystemdPinObj *StdSysPinObj;

+     char *filename = "/tmp/pin.txt";

+ 

+     StdSysPinObj = (SVRCOREStdSystemdPinObj *)SVRCORE_GetRegisteredPinObj();

+ 

+     if (StdSysPinObj) {

+         // This means it's already registered?

+         return 0;

+     }

+     if (SVRCORE_CreateStdSystemdPinObj(&StdSysPinObj, filename, PR_FALSE, PR_TRUE, 60) != SVRCORE_Success) {

+         errorCode = PR_GetError();

+         printf("Unable to create std systemd pin %d\n", errorCode);

+         return -1;

+     }

+     SVRCORE_RegisterPinObj((SVRCOREPinObj *)StdSysPinObj);

+     return 0;

+ }

+ 

+ int

+ svrcore_stdsystemd_get_token()

+ {

+     //Actually get the password

+     // Get the pinobj

+     SVRCOREStdSystemdPinObj *StdSysPinObj;

+     char *pw = NULL;

+     char *token = NULL;

+     SVRCOREError err = SVRCORE_Success;

+ 

+     StdSysPinObj = (SVRCOREStdSystemdPinObj *)SVRCORE_GetRegisteredPinObj();

+     // Are we interactive?

+     // SVRCORE_SetStdPinInteractive((SVRCOREStdPinObj *) StdPinObj , PR_TRUE);

+     // what is token?

+     token = "internal (software)";

+     pw = SVRCORE_GetPin( (SVRCOREPinObj *)StdSysPinObj, token , PR_FALSE);

+     if ( err != SVRCORE_Success || pw == NULL) {

+         printf("Couldn't get pin %d \n", err);

+     } else {

+         printf("%s\n", pw);

+         free(pw);

+     }

+     // Should set a password into &pw

+ 

+     // Cleanup

+     SVRCORE_DestroyRegisteredPinObj();

+ 

+     return 0;

+ }

+ 

+ int

+ main(int argc, char **argv)

+ {

+ 

+     int result = 0;

+ 

+     result = svrcore_systemd_setup();

+     if (result == 0) {

+         svrcore_systemd_get_token();

+     }

+ 

+     result = svrcore_stdsystemd_setup();

+     if (result == 0) {

+         svrcore_stdsystemd_get_token();

+     }

+     return 0;

+ }

+ 

+ 

file added
+110

@@ -0,0 +1,110 @@ 

+ # -*- tab-width: 4; -*-

+ # Configure paths for NSPR

+ # Public domain - Rich Megginson <richm@stanfordalumni.org> 2007-03-08

+ # Based on other Mozilla m4 work by Chris Seawood <cls@seawood.org> 2001-04-05

+ 

+ AC_CHECKING(for NSPR)

+ 

+ # check for --with-nspr

+ AC_MSG_CHECKING(for --with-nspr)

+ AC_ARG_WITH(nspr, [  --with-nspr=PATH        Netscape Portable Runtime (NSPR) directory],

+ [

+   if test -e "$withval"/include/nspr.h -a -d "$withval"/lib

+   then

+     AC_MSG_RESULT([using $withval])

+     NSPRDIR=$withval

+     nspr_inc="-I$NSPRDIR/include"

+     nspr_lib="-L$NSPRDIR/lib"

+   else

+     echo

+     AC_MSG_ERROR([$withval not found])

+   fi

+ ],

+ AC_MSG_RESULT(no))

+ 

+ # check for --with-nspr-inc

+ AC_MSG_CHECKING(for --with-nspr-inc)

+ AC_ARG_WITH(nspr-inc, [  --with-nspr-inc=PATH        Netscape Portable Runtime (NSPR) include file directory],

+ [

+   if test -e "$withval"/nspr.h

+   then

+     AC_MSG_RESULT([using $withval])

+     nspr_inc="-I$withval"

+   else

+     echo

+     AC_MSG_ERROR([$withval not found])

+   fi

+ ],

+ AC_MSG_RESULT(no))

+ 

+ # check for --with-nspr-lib

+ AC_MSG_CHECKING(for --with-nspr-lib)

+ AC_ARG_WITH(nspr-lib, [  --with-nspr-lib=PATH        Netscape Portable Runtime (NSPR) library directory],

+ [

+   if test -d "$withval"

+   then

+     AC_MSG_RESULT([using $withval])

+     nspr_lib="-L$withval"

+   else

+     echo

+     AC_MSG_ERROR([$withval not found])

+   fi

+ ],

+ AC_MSG_RESULT(no))

+ 

+ # see if we are doing an "in-tree" build with the other

+ # mozilla components

+ if test -z "$nspr_inc" -o -z "$nspr_lib" ; then

+     for nsprpath in "../../dist" "../../dist/*.OBJ" ; do

+         savedir=`pwd`

+         cd $nsprpath

+         abs_nsprpath=`pwd`

+         cd $savedir

+         if test -f "$abs_nsprpath/include/nspr/nspr.h" ; then

+             nspr_inc="-I$abs_nsprpath/include/nspr"

+         elif test -f "$abs_nsprpath/include/nspr.h" ; then

+             nspr_inc="-I$abs_nsprpath/include"

+         fi

+         if test -d "$abs_nsprpath/lib" ; then

+             nspr_lib="-L$abs_nsprpath/lib"

+         fi

+         if test -n "$nspr_inc" -a -n "$nspr_lib" ; then

+             break

+         fi

+     done

+ fi

+ 

+ # if NSPR is not found yet, try pkg-config

+ # last resort

+ if test -z "$nspr_inc" -o -z "$nspr_lib" ; then

+   AC_MSG_CHECKING(for nspr with pkg-config)

+   AC_PATH_PROG(PKG_CONFIG, pkg-config)

+   if test -n "$PKG_CONFIG"; then

+     if $PKG_CONFIG --exists nspr; then

+       nspr_inc=`$PKG_CONFIG --cflags-only-I nspr`

+       nspr_lib=`$PKG_CONFIG --libs-only-L nspr`

+       nspr_ver=`$PKG_CONFIG --modversion nspr`

+       nspr_name=nspr

+       AC_MSG_RESULT([using system NSPR])

+     elif $PKG_CONFIG --exists dirsec-nspr; then

+       nspr_inc=`$PKG_CONFIG --cflags-only-I dirsec-nspr`

+       nspr_lib=`$PKG_CONFIG --libs-only-L dirsec-nspr`

+       nspr_ver=`$PKG_CONFIG --modversion dirsec-nspr`

+       nspr_name=dirsec-nspr

+       AC_MSG_RESULT([using system dirsec NSPR])

+     else

+       AC_MSG_ERROR([NSPR not found, specify with --with-nspr.])

+     fi

+   fi

+ fi

+ 

+ NSPR_CFLAGS="$nspr_inc"

+ NSPR_LIBS="$nspr_lib -lplds4 -lplc4 -lnspr4"

+ if test -z "$nspr_ver" ; then

+ 	nspr_ver=4.6.4

+ fi

+ NSPR_MIN_VER="$nspr_ver"

+ if test -z "$nspr_name" ; then

+ 	nspr_name=nspr

+ fi

+ NSPR_NAME="$nspr_name"

file added
+114

@@ -0,0 +1,114 @@ 

+ # -*- tab-width: 4; -*-

+ # Configure paths for NSPR

+ # Public domain - Rich Megginson <richm@stanfordalumni.org> 2007-03-08

+ # Based on other Mozilla m4 work by Chris Seawood <cls@seawood.org> 2001-04-05

+ 

+ AC_CHECKING(for NSS)

+ 

+ # check for --with-nss

+ AC_MSG_CHECKING(for --with-nss)

+ AC_ARG_WITH(nss, [  --with-nss=PATH         Network Security Services (NSS) directory],

+ [

+   if test -e "$withval"/include/nss.h -a -d "$withval"/lib

+   then

+     AC_MSG_RESULT([using $withval])

+     NSSDIR=$withval

+     nss_inc="-I$NSSDIR/include"

+     nss_lib="-L$NSSDIR/lib"

+   else

+     echo

+     AC_MSG_ERROR([$withval not found])

+   fi

+ ],

+ AC_MSG_RESULT(no))

+ 

+ # check for --with-nss-inc

+ AC_MSG_CHECKING(for --with-nss-inc)

+ AC_ARG_WITH(nss-inc, [  --with-nss-inc=PATH         Network Security Services (NSS) include directory],

+ [

+   if test -e "$withval"/nss.h

+   then

+     AC_MSG_RESULT([using $withval])

+     nss_inc="-I$withval"

+   else

+     echo

+     AC_MSG_ERROR([$withval not found])

+   fi

+ ],

+ AC_MSG_RESULT(no))

+ 

+ # check for --with-nss-lib

+ AC_MSG_CHECKING(for --with-nss-lib)

+ AC_ARG_WITH(nss-lib, [  --with-nss-lib=PATH         Network Security Services (NSS) library directory],

+ [

+   if test -d "$withval"

+   then

+     AC_MSG_RESULT([using $withval])

+     nss_lib="-L$withval"

+   else

+     echo

+     AC_MSG_ERROR([$withval not found])

+   fi

+ ],

+ AC_MSG_RESULT(no))

+ 

+ # see if we are building "in tree" with the

+ # other mozilla components

+ if test -z "$nss_inc" -o -z "$nss_lib"; then

+     nsslibpath=`echo ../../dist/*.OBJ/lib | cut -f1 -d' '`

+     savedir=`pwd`

+     cd $nsslibpath

+     abs_nsslibpath=`pwd`

+     cd $savedir

+     nssincpath=../../dist/public/nss

+     savedir=`pwd`

+     cd $nssincpath

+     abs_nssincpath=`pwd`

+     cd $savedir

+     if test -f "$abs_nssincpath/nss.h" ; then

+         nss_inc="-I$abs_nssincpath"

+     fi

+     if test -d "$abs_nsslibpath" ; then

+         nss_lib="-L$abs_nsslibpath"

+     fi