diff options
-rw-r--r-- | BUILD.txt | 20 | ||||
-rw-r--r-- | COPYING | 167 | ||||
-rw-r--r-- | Makefile.am | 188 | ||||
-rw-r--r-- | build_macros.m4 | 21 | ||||
-rw-r--r-- | conf_macros.m4 | 58 | ||||
-rw-r--r-- | configure.ac | 108 | ||||
-rw-r--r-- | contrib/gssntlmssp.spec.in | 70 | ||||
-rw-r--r-- | examples/mech.ntlmssp.in | 7 | ||||
-rw-r--r-- | external/ax_pthread.m4 | 309 | ||||
-rw-r--r-- | external/docbook.m4 | 35 | ||||
-rw-r--r-- | external/pkg.m4 | 156 | ||||
-rw-r--r-- | external/platform.m4 | 48 | ||||
-rw-r--r-- | external/sizes.m4 | 44 | ||||
-rw-r--r-- | man/Makefile.am | 167 | ||||
-rw-r--r-- | man/gssntlmssp.8.xml | 48 | ||||
-rw-r--r-- | src/gss_ntlmssp.c | 25 | ||||
-rw-r--r-- | src/gss_ntlmssp.h | 23 | ||||
-rw-r--r-- | tests/ntlmssptest.c | 25 | ||||
-rwxr-xr-x | tests/scripts/dlopen.sh | 76 | ||||
-rw-r--r-- | version.m4 | 7 |
20 files changed, 1602 insertions, 0 deletions
diff --git a/BUILD.txt b/BUILD.txt new file mode 100644 index 0000000..b2c9487 --- /dev/null +++ b/BUILD.txt @@ -0,0 +1,20 @@ + +First off, run: +# autoreconf -f -i + +Then the usual ./configure and make + +In order to build gss-ntlmssp the following development packages are needed: + + autoconf + automake + docbook-style-xsl + doxygen + findutils + krb5-devel + libtool + libxml2 + libxslt + m4 + pkgconfig + @@ -0,0 +1,167 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..ca89f7d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,188 @@ +SUBDIRS = +#SUBDIRS += po + +if HAVE_MANPAGES +SUBDIRS += man +endif + +# Some old versions of automake don't define builddir +builddir ?= . + +DOXYGEN = @DOXYGEN@ + +DISTSETUPOPTS = +if HAVE_DEBIAN +DISTSETUPOPTS += --install-layout=deb +endif + +gssconfdir = $(sysconfdir)/gss +gssntlmsspdir = $(libdir)/gssntlmssp +localedir = @localedir@ + +pkgconfigdir = $(libdir)/pkgconfig + +AM_CFLAGS = +if WANT_AUX_INFO + AM_CFLAGS += -aux-info $@.X +endif +if HAVE_GCC + AM_CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \ + -Wcast-qual -Wcast-align -Wwrite-strings \ + -Werror-implicit-function-declaration \ + -fno-strict-aliasing +endif + +dist_pkgconfig_DATA = + +ACLOCAL_AMFLAGS = -I m4 -I . + +check_PROGRAMS = \ + ntlmssptest + +gssntlmssp_LTLIBRARIES = \ + gssntlmssp.la + +dist_noinst_SCRIPTS = tests/scripts/dlopen.sh + +dist_noinst_DATA = + +############################### +# Global compilation settings # +############################### + +AM_CPPFLAGS = \ + -Wall \ + -Iinclude \ + -I.. \ + -I$(srcdir)/include \ + -I$(srcdir) \ + -Iinclude \ + -I. \ + -DLIBDIR=\"$(libdir)\" \ + -DVARDIR=\"$(localstatedir)\" \ + -DSHLIBEXT=\"$(SHLIBEXT)\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -DLOCALEDIR=\"$(localedir)\" + +EXTRA_DIST = build/config.rpath + +GSS_NTLM_LIBS = $(GSSAPI_LIBS) + +GN_MECHGLUE_OBJ = \ + src/gss_ntlmssp.c + +dist_noinst_HEADERS = \ + src/gss_ntlmssp.h + +#################### +# Program Binaries # +#################### + +gssntlmssp_la_SOURCES = \ + $(GN_MECHGLUE_OBJ) +gssntlmssp_la_CFLAGS = \ + $(AM_FLAGS) +gssntlmssp_la_LDFLAGS = \ + -avoid-version \ + -module + +ntlmssptest_SOURCES = \ + tests/ntlmssptest.c + +dist_noinst_DATA += \ + m4 + +noinst_PROGRAMS = ntlmssptest + +################ +# TRANSLATIONS # +################ +update-po: +if HAVE_MANPAGES + $(MAKE) -C man update-po +endif +# $(MAKE) -C po update-po + +####################### +# Installation Extras # +####################### + +installgssntlmsspdirs:: + mkdir -p \ + $(DESTDIR)$(libdir)/gssntlmssp \ + $(DESTDIR)$(mandir) + +if HAVE_DOXYGEN +docs: + $(DOXYGEN) doxy.config +else +docs: + @echo "Doxygen not installed, cannot generate documentation" + @exit 1 +endif + +install-exec-hook: installgssntlmsspdirs + mkdir -p doc $(DESTDIR)/$(docdir); cp -a doc $(DESTDIR)/$(docdir)/ + +clean-local: + rm -Rf doc + +CLEANFILES = *.X */*.X */*/*.X + +tests: all $(check_PROGRAMS) + +# RPM-related tasks + +RPMBUILD ?= $(PWD)/rpmbuild + +dist_noinst_DATA += \ + m4 \ + contrib/gssntlmssp.spec.in \ + BUILD.txt \ + COPYING + +rpmroot: + mkdir -p $(RPMBUILD)/BUILD + mkdir -p $(RPMBUILD)/RPMS + mkdir -p $(RPMBUILD)/SOURCES + mkdir -p $(RPMBUILD)/SPECS + mkdir -p $(RPMBUILD)/SRPMS + +rpms: dist-gzip rpmroot + cp $(builddir)/contrib/gssntlmssp.spec $(RPMBUILD)/SPECS + cp $(distdir).tar.gz $(RPMBUILD)/SOURCES + cd $(RPMBUILD); \ + rpmbuild --define "_topdir $(RPMBUILD)" -ba SPECS/gssntlmssp.spec + +if GIT_CHECKOUT +prerelease-rpms: + cp $(srcdir)/version.m4 $(srcdir)/version.m4.orig + sed -e "s/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.*\])/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.`date +%Y%m%d.%H%M`.git`git log -1 --pretty=format:%h`\])/" < $(srcdir)/version.m4.orig > $(srcdir)/version.m4 + $(MAKE) rpms + mv $(srcdir)/version.m4.orig $(srcdir)/version.m4 +endif + +# make srpms will use the old digest algorithm to be compatible +# with RHEL5 +srpm: dist-gzip rpmroot + cp $(builddir)/contrib/gssntlmssp.spec $(RPMBUILD)/SPECS + cp $(distdir).tar.gz $(RPMBUILD)/SOURCES + cd $(RPMBUILD); \ + rpmbuild --define "_topdir $(RPMBUILD)" \ + --define _source_filedigest_algorithm=1 \ + -bs SPECS/gssntlmssp.spec + +if GIT_CHECKOUT +prerelease-srpm: + cp $(srcdir)/version.m4 $(srcdir)/version.m4.orig + sed -e "s/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.*\])/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.`date +%Y%m%d.%H%M`.git`git log -1 --pretty=format:%h`\])/" < $(srcdir)/version.m4.orig > $(srcdir)/version.m4 + $(MAKE) srpm + mv $(srcdir)/version.m4.orig $(srcdir)/version.m4 +endif + +#################### +# Testing # +#################### + +test_gssntlmssp: + TMPDIR=tests/scripts/ ./tests/scripts/dlopen.sh ./.libs/gssntlmssp.so || exit 1 diff --git a/build_macros.m4 b/build_macros.m4 new file mode 100644 index 0000000..37d9643 --- /dev/null +++ b/build_macros.m4 @@ -0,0 +1,21 @@ +AC_DEFUN([BUILD_WITH_SHARED_BUILD_DIR], + [ AC_ARG_WITH([shared-build-dir], + [AC_HELP_STRING([--with-shared-build-dir=DIR], + [temporary build directory where libraries are installed [$srcdir/sharedbuild]])]) + + sharedbuilddir="$srcdir/sharedbuild" + if test x"$with_shared_build_dir" != x; then + sharedbuilddir=$with_shared_build_dir + CFLAGS="$CFLAGS -I$with_shared_build_dir/include" + CPPFLAGS="$CPPFLAGS -I$with_shared_build_dir/include" + LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib" + fi + AC_SUBST(sharedbuilddir) + ]) + +AC_DEFUN([BUILD_WITH_AUX_INFO], + [ AC_ARG_WITH([aux-info], + [AC_HELP_STRING([--with-aux-info], + [Build with -aux-info output])]) + ]) +AM_CONDITIONAL([WANT_AUX_INFO], [test x$with_aux_info = xyes]) diff --git a/conf_macros.m4 b/conf_macros.m4 new file mode 100644 index 0000000..a979f56 --- /dev/null +++ b/conf_macros.m4 @@ -0,0 +1,58 @@ +AC_DEFUN([WITH_DISTRO_VERSION], + [ AC_ARG_WITH([distro-version], + [AC_HELP_STRING([--with-distro-version=VERSION], + [Distro version number []] + ) + ] + ) + AC_DEFINE_UNQUOTED(DISTRO_VERSION, "$with_distro_version", + [Distro version number]) + ]) + +AC_DEFUN([WITH_MANPAGES], + [ AC_ARG_WITH([manpages], + [AC_HELP_STRING([--with-manpages], + [Whether to regenerate man pages from DocBook sources [yes]] + ) + ], + [], + with_manpages=yes + ) + if test x"$with_manpages" = xyes; then + HAVE_MANPAGES=1 + AC_SUBST(HAVE_MANPAGES) + fi + ]) +AM_CONDITIONAL([BUILD_MANPAGES], [test x$with_manpages = xyes]) + +AC_DEFUN([WITH_XML_CATALOG], + [ AC_ARG_WITH([xml-catalog-path], + [AC_HELP_STRING([--with-xml-catalog-path=PATH], + [Where to look for XML catalog [/etc/xml/catalog]] + ) + ] + ) + SGML_CATALOG_FILES="/etc/xml/catalog" + if test x"$with_xml_catalog_path" != x; then + SGML_CATALOG_FILES="$with_xml_catalog_path" + fi + AC_SUBST([SGML_CATALOG_FILES]) + ]) + +AC_DEFUN([WITH_TEST_DIR], + [ AC_ARG_WITH([test-dir], + [AC_HELP_STRING([--with-test-dir=PATH], + [Directory used for make check temporary files [$builddir]] + ) + ] + ) + TEST_DIR=$with_test_dir + AC_SUBST(TEST_DIR) + AC_DEFINE_UNQUOTED(TEST_DIR, "$with_test_dir", [Directory used for 'make check' temporary files]) + ]) + +AC_ARG_ENABLE([all-experimental-features], + [AS_HELP_STRING([--enable-all-experimental-features], + [build all experimental features])], + [build_all_experimental_features=$enableval], + [build_all_experimental_features=no]) diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..e3a6887 --- /dev/null +++ b/configure.ac @@ -0,0 +1,108 @@ +AC_PREREQ(2.59) + +m4_include([version.m4]) +AC_INIT([gssntlmssp], + VERSION_NUMBER, + [simo@samba.org]) + +m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], + [AC_USE_SYSTEM_EXTENSIONS], + [AC_GNU_SOURCE]) + +CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" + +AC_CONFIG_SRCDIR([BUILD.txt]) +AC_CONFIG_AUX_DIR([build]) + +AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax]) +AM_PROG_CC_C_O +AM_PROG_AR +AC_PROG_INSTALL +LT_INIT([disable-static]) +AC_CONFIG_MACRO_DIR([m4]) + +AC_SUBST([PRERELEASE_VERSION], + PRERELEASE_VERSION_NUMBER) + +AC_DEFINE([PRERELEASE_VERSION], "PRERELEASE_VERSION_NUMBER", + [Prerelease version number of package]) + +AM_CONDITIONAL([GIT_CHECKOUT], [git log -1 &>/dev/null]) + +m4_pattern_allow([AM_SILENT_RULES]) +AM_SILENT_RULES + +AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes]) + +AC_CHECK_HEADERS(stdint.h dlfcn.h) +AC_CONFIG_HEADER(config.h) + +AC_CHECK_TYPES([errno_t], [], [], [[#include <errno.h>]]) + +m4_include([build_macros.m4]) +BUILD_WITH_SHARED_BUILD_DIR + +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <pthread.h>]], + [[pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;]])], + [AC_DEFINE([HAVE_PTHREAD], [1], [Pthread mutexes available.])], + [AC_MSG_WARN([Pthread library not found! Clients will not be thread safe...])]) + +#Include here cause WITH_INIT_DIR requires $osname set in platform.m4 +m4_include([external/platform.m4]) + +m4_include(conf_macros.m4) +WITH_DISTRO_VERSION +WITH_TEST_DIR +WITH_MANPAGES +WITH_XML_CATALOG + +m4_include([external/pkg.m4]) +m4_include([external/docbook.m4]) +m4_include([external/sizes.m4]) +m4_include([external/ax_pthread.m4]) + +AX_PTHREAD(,[AC_MSG_ERROR([Could not find Pthreads support])]) + +LIBS="$PTHREAD_LIBS $LIBS" +LIBS="$PTHREAD_CFLAGS $CFLAGS" +CC="$PTHREAD_CC" + +AC_CHECK_HEADERS([gssapi/gssapi.h],,[AC_MSG_ERROR([Could not find GSSAPI headers])]) +AC_PATH_PROG(KRB5_CONFIG, krb5-config, failed) +if test x$KRB5_CONFIG = xfailed; then + AC_MSG_ERROR([Could not find GSSAPI development libraries]) +else + GSSAPI_CFLAGS="`$KRB5_CONFIG --cflags gssapi`" + GSSAPI_LIBS="`$KRB5_CONFIG --libs gssapi`" +fi +AC_CHECK_LIB(gssapi_krb5, gss_import_cred,, + [AC_MSG_ERROR([GSSAPI library does not support gss_import_cred])], + [$GSSAPI_LIBS]) +AC_CHECK_LIB(gssapi_krb5, gss_export_cred,, + [AC_MSG_ERROR([GSSAPI library does not support gss_export_cred])], + [$GSSAPI_LIBS]) + +AC_SUBST([GSSAPI_CFLAGS]) +AC_SUBST([GSSAPI_LIBS]) + +if test x$HAVE_MANPAGES != x; then + CHECK_XML_TOOLS + CHECK_STYLESHEET([$SGML_CATALOG_FILES], + [http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl], + [Docbook XSL templates]) + AC_CHECK_PROG([PO4A],[po4a],[po4a],[no]) +fi +AM_CONDITIONAL([HAVE_MANPAGES], [test "x$HAVE_MANPAGES" != "x"]) +AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A" != "xno"]) + +AC_PATH_PROG([DOXYGEN], [doxygen], [false]) +AM_CONDITIONAL([HAVE_DOXYGEN], [test x$DOXYGEN != xfalse ]) + +abs_build_dir=`pwd` +AC_DEFINE_UNQUOTED([ABS_BUILD_DIR], ["$abs_build_dir"], [Absolute path to the build directory]) +AC_SUBST([abs_builddir], $abs_build_dir) + +AC_CONFIG_FILES([Makefile man/Makefile + contrib/gssntlmssp.spec examples/mech.ntlmssp]) +AC_OUTPUT diff --git a/contrib/gssntlmssp.spec.in b/contrib/gssntlmssp.spec.in new file mode 100644 index 0000000..00eeb53 --- /dev/null +++ b/contrib/gssntlmssp.spec.in @@ -0,0 +1,70 @@ +Name: @PACKAGE_NAME@ +Version: @PACKAGE_VERSION@ +Release: 0@PRERELEASE_VERSION@%{?dist} +Summary: GSSAPI NTLMSSP Mechanism + +Group: System Environment/Libraries +License: MIT +URL: http://ssimo.org/gss-ntlm +Source0: http://ssimo.org/gss-ntlm/%{name}-%{version}.tar.gz +BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) + +### Patches ### + +### Dependencies ### + +Requires: krb5-libs >= 1.11.2 + +### Build Dependencies ### + +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool +BuildRequires: m4 +BuildRequires: libxslt +BuildRequires: libxml2 +BuildRequires: docbook-style-xsl +BuildRequires: doxygen +BuildRequires: gettext-devel +BuildRequires: pkgconfig +BuildRequires: krb5-devel >= 1.11.2 +BuildRequires: findutils + + +%description +A GSSAPI Mechanism that implements NTLMSSP + +%prep +%setup -q + + +%build +autoreconf -f -i +%configure \ + --disable-static \ + --disable-rpath + +make %{?_smp_mflags} all +make test_gssntlmssp + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} +rm -f %{buildroot}%{_libdir}/gssntlmssp/gssntlmssp.la +install -d -m755 %{buildroot}%{_sysconfdir}/gss +install -m644 examples/mech.ntlmssp %{buildroot}%{_sysconfdir}/gss/mech.ntlmssp + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%attr(0644,root,root) %config(noreplace) /%{_sysconfdir}/gss/mech.ntlmssp +%{_libdir}/gssntlmssp/gssntlmssp.so +%{_mandir}/man8/gssntlmssp.8* + +%changelog +* Sat Jun 22 2013 Simo Sorce <simo@samba.org> - @PACKAGE_VERSION@-0@PRERELEASE_VERSION@ +- Start + diff --git a/examples/mech.ntlmssp.in b/examples/mech.ntlmssp.in new file mode 100644 index 0000000..a16f5bf --- /dev/null +++ b/examples/mech.ntlmssp.in @@ -0,0 +1,7 @@ +# GSS-API mechanism plugins +# +# NOTE: copy the content of this file in /etc/gss/mech to activate the NTLM SSP +# mechanism +# +# Mechanism Name Object Identifier Shared Library Path Other Options +gssntlmssp_v1 1.3.6.1.4.1.311.2.2.10 @libdir@/gssntlmssp/gssntlmssp.so diff --git a/external/ax_pthread.m4 b/external/ax_pthread.m4 new file mode 100644 index 0000000..e20a388 --- /dev/null +++ b/external/ax_pthread.m4 @@ -0,0 +1,309 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. e.g. you should link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threads programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> +# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG> +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see <http://www.gnu.org/licenses/>. +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 17 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes) + AC_MSG_RESULT($ax_pthread_ok) + if test x"$ax_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + ;; + + *-darwin*) + ax_pthread_flags="-pthread $ax_pthread_flags" + ;; +esac + +if test x"$ax_pthread_ok" = xno; then +for flag in $ax_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no) + if test x"$ax_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($ax_pthread_ok) + if test "x$ax_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], + [int attr = $attr; return attr /* ; */])], + [attr_name=$attr; break], + []) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *-osf* | *-hpux*) flag="-D_REENTRANT";; + *solaris*) + if test "$GCC" = "yes"; then + flag="-D_REENTRANT" + else + flag="-mt -D_REENTRANT" + fi + ;; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + ax_cv_PTHREAD_PRIO_INHERIT, [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], + AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.])) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) + else + PTHREAD_CC=$CC + fi +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/external/docbook.m4 b/external/docbook.m4 new file mode 100644 index 0000000..cae89fe --- /dev/null +++ b/external/docbook.m4 @@ -0,0 +1,35 @@ +dnl Checks for tools needed to generate manual pages +AC_DEFUN([CHECK_XML_TOOLS], +[ + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test ! -x "$XSLTPROC"; then + AC_MSG_ERROR([Could not find xsltproc]) + fi + + AC_PATH_PROG([XMLLINT], [xmllint]) + if test ! -x "$XMLLINT"; then + AC_MSG_ERROR([Could not find xmllint]) + fi + + AC_PATH_PROG([XMLCATALOG], [xmlcatalog]) + if test ! -x "$XMLCATALOG"; then + AC_MSG_ERROR([Could not find xmlcatalog]) + fi +]) + +dnl Usage: +dnl CHECK_STYLESHEET_URI(FILE, URI, [FRIENDLY-NAME]) +dnl Checks if the XML catalog given by FILE exists and +dnl if a particular URI appears in the XML catalog +AC_DEFUN([CHECK_STYLESHEET], +[ + AC_CHECK_FILE($1, [], [AC_MSG_ERROR([could not find XML catalog])]) + + AC_MSG_CHECKING([for ifelse([$3],,[$2],[$3]) in XML catalog]) + if AC_RUN_LOG([$XMLCATALOG --noout "$1" "$2" >&2]); then + AC_MSG_RESULT([yes]) + else + AC_MSG_ERROR([could not find ifelse([$3],,[$2],[$3]) in XML catalog]) + fi +]) + diff --git a/external/pkg.m4 b/external/pkg.m4 new file mode 100644 index 0000000..a8b3d06 --- /dev/null +++ b/external/pkg.m4 @@ -0,0 +1,156 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES diff --git a/external/platform.m4 b/external/platform.m4 new file mode 100644 index 0000000..2ac2cc4 --- /dev/null +++ b/external/platform.m4 @@ -0,0 +1,48 @@ +AC_ARG_WITH([os], + [AC_HELP_STRING([--with-os=OS_TYPE], [Type of your operation system (fedora|redhat|suse|gentoo)])] + ) +osname="" +if test x"$with_os" != x ; then + if test x"$with_os" = xfedora || \ + test x"$with_os" = xredhat || \ + test x"$with_os" = xsuse || \ + test x"$with_os" = xgentoo || \ + test x"$with_os" = xdebian ; then + osname=$with_os + else + AC_MSG_ERROR([Illegal value -$with_os- for option --with-os]) + fi +fi + +if test x"$osname" = x ; then + if test -f /etc/fedora-release ; then + osname="fedora" + elif test -f /etc/redhat-release ; then + osname="redhat" + elif test -f /etc/SuSE-release ; then + osname="suse" + elif test -f /etc/debian_version ; then + osname="debian" + elif test -f /etc/gentoo-release ; then + osname="gentoo" + fi + + AC_MSG_NOTICE([Detected operating system type: $osname]) +fi + +AM_CONDITIONAL([HAVE_FEDORA], [test x"$osname" = xfedora]) +AM_CONDITIONAL([HAVE_REDHAT], [test x"$osname" = xredhat]) +AM_CONDITIONAL([HAVE_SUSE], [test x"$osname" = xsuse]) +AM_CONDITIONAL([HAVE_DEBIAN], [test x"$osname" = xdebian]) +AM_CONDITIONAL([HAVE_GENTOO], [test x"$osname" = xgentoo]) + +AC_CHECK_MEMBERS([struct ucred.pid, struct ucred.uid, struct ucred.gid], , , + [[#include <sys/socket.h>]]) + +if test x"$ac_cv_member_struct_ucred_pid" = xyes -a \ + x"$ac_cv_member_struct_ucred_uid" = xyes -a \ + x"$ac_cv_member_struct_ucred_gid" = xyes ; then + AC_DEFINE([HAVE_UCRED], [1], [Define if struct ucred is available]) +else + AC_MSG_ERROR([struct ucred is not available]) +fi diff --git a/external/sizes.m4 b/external/sizes.m4 new file mode 100644 index 0000000..53df61d --- /dev/null +++ b/external/sizes.m4 @@ -0,0 +1,44 @@ +# Solaris needs HAVE_LONG_LONG defined +AC_CHECK_TYPES(long long) + +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) + +if test $ac_cv_sizeof_long_long -lt 8 ; then +AC_MSG_ERROR([SSSD requires long long of 64-bits]) +fi + +AC_CHECK_TYPE(uint_t, unsigned int) +AC_CHECK_TYPE(int8_t, char) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(uint16_t, unsigned short) + +if test $ac_cv_sizeof_int -eq 4 ; then +AC_CHECK_TYPE(int32_t, int) +AC_CHECK_TYPE(uint32_t, unsigned int) +elif test $ac_cv_size_long -eq 4 ; then +AC_CHECK_TYPE(int32_t, long) +AC_CHECK_TYPE(uint32_t, unsigned long) +else +AC_MSG_ERROR([LIBREPLACE no 32-bit type found]) +fi + +AC_CHECK_TYPE(int64_t, long long) +AC_CHECK_TYPE(uint64_t, unsigned long long) + +AC_CHECK_TYPE(size_t, unsigned int) +AC_CHECK_TYPE(ssize_t, int) + +AC_CHECK_SIZEOF(off_t) +AC_CHECK_SIZEOF(size_t) +AC_CHECK_SIZEOF(ssize_t) + +AC_CHECK_TYPE(intptr_t, long long) +AC_CHECK_TYPE(uintptr_t, unsigned long long) +AC_CHECK_TYPE(ptrdiff_t, unsigned long long) + + diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..05251c1 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,167 @@ +# The following variable is dependent on placement of this file +top_builddir = .. + +############ +# MANPAGES # +############ + +#Special Rules: +export SGML_CATALOG_FILES +DOCBOOK_XSLT = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl +XMLLINT_FLAGS = --catalogs --postvalid --nonet --xinclude --noout +XSLTPROC_FLAGS = --catalogs --xinclude --nonet + +man_MANS = \ + gssntlmssp.8 + +EXTRA_DIST = $(man_MANS:%=%.xml) $(wildcard $(srcdir)/include/*.xml) + +SUFFIXES = .1.xml .1 .3.xml .3 .5.xml .5 .8.xml .8 +.1.xml.1: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + +.3.xml.3: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + +.5.xml.5: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + +.8.xml.8: + $(XMLLINT) $(XMLLINT_FLAGS) $< + $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(DOCBOOK_XSLT) $< + +clean-local: + rm -f $(man_MANS) + +######################## +# MANPAGE TRANSLATIONS # +######################## +# +#PO4A=@PO4A@ +#SED=@SED@ +# +#PACKAGE_DOC=gssproxy-docs +# +#POTFILE = po/$(PACKAGE_DOC).pot +#PO4A_CONFIG = po/po4a.cfg +# +## Extract the list of languages from the po4a config file. +#LINGUAS_DIST = `$(SED) -ne 's/^.*\[po4a_langs\] \(.*\)$$/\1/p' $(srcdir)/$(PO4A_CONFIG)` +# +## If the user has not defined it let's use the default. +#LINGUAS ?= $(LINGUAS_DIST) +# +#PO4A_COMMON_OPTS = --option doctype=docbook \ +# --package-name $(PACKAGE_DOC) \ +# --variable builddir=$(CURDIR) \ +# --package-version $(PACKAGE_VERSION) \ +# --msgid-bugs-address simo@samba.org \ +# --copyright-holder "Simo Sorce`" +# +#PO4A_BUILD_OPTS = $(PO4A_COMMON_OPTS) --no-backups +# +#EXTRA_DIST += \ +# $(POTFILE)\ +# $(PO4A_CONFIG) +# +#XML_DOC = $(wildcard $(srcdir)/*.xml) $(wildcard $(srcdir)/include/*.xml) +# +#if HAVE_PO4A +# +## FIXME: Use a stamp file until po4a supports them internally. +#man.stamp: $(XML_DOC) $(POTFILE) $(PO4A_CONFIG) +# cd $(srcdir) && \ +# $(PO4A) $(PO4A_BUILD_OPTS) $(PO4A_CONFIG) +# touch $@ +# +#update-po: +# cd $(srcdir) && \ +# $(PO4A) $(PO4A_BUILD_OPTS) --force $(PO4A_CONFIG) +# +#dist-hook: man.stamp +# if [ -f man.stamp ]; then \ +# cp man.stamp $(distdir); \ +# for lang in $(LINGUAS_DIST); do \ +# cp $(srcdir)/po/$$lang.po $(distdir)/po; \ +# $(mkdir_p) $(distdir)/$$lang; \ +# cp -r $(builddir)/$$lang $(distdir)/; \ +# done; \ +# else \ +# cp $(srcdir)/man.stamp $(distdir); \ +# for lang in $(LINGUAS_DIST); do \ +# cp $(srcdir)/po/$$lang.po $(distdir)/po; \ +# $(mkdir_p) $(distdir)/$$lang; \ +# cp -r $(srcdir)/$$lang $(distdir)/; \ +# done; \ +# fi +# +# +#clean-local-no: +#clean-local-yes: +# for lang in $(LINGUAS); do \ +# if [ -d $$lang ]; then \ +# rm -rf $$lang; \ +# fi \ +# done +# rm -f $(man_MANS) +# rm -f man.stamp +# +#else +# +#man.stamp: $(XML_DOC) +# touch $@ +# +#clean-local-no: +#clean-local-yes: +# rm -f $(man_MANS) +# rm -f man.stamp +# +#endif +# +#clean-local: clean-local-@USE_NLS@ +#distclean-local: clean-local-@USE_NLS@ +#mostlyclean-local: clean-local-@USE_NLS@ +#maintainer-clean-local: clean-local-@USE_NLS@ +# +## Generate translated manual pages +#all-local: all-local-@USE_NLS@ +#all-local-no: +#all-local-yes: man.stamp +# if [ -z $$recursion ]; then \ +# for lang in $(LINGUAS); do \ +# if [ -d $$lang ]; then \ +# sources=$$(ls -1 $$lang/*.xml); \ +# manpages=$$(echo $$sources | $(SED) 's/\.xml//g'); \ +# $(MAKE) recursion=1 man_MANS="$$manpages"; \ +# fi \ +# done \ +# fi +# +#install-data-local: install-data-local-@USE_NLS@ +#install-data-local-no: +#install-data-local-yes: +# for lang in $(LINGUAS); do \ +# if [ -d $$lang ]; then \ +# sources=$$(ls -1 $$lang/*.xml); \ +# manpages=$$(echo $$sources | $(SED) 's/\.xml//g'); \ +# $(MAKE) install-man \ +# mandir="$(mandir)/$$lang" \ +# man_MANS="$$manpages"; \ +# fi \ +# done +# +#uninstall-local: uninstall-local-@USE_NLS@ +#uninstall-local-no: +#uninstall-local-yes: +# for lang in $(LINGUAS); do \ +# if [ -d $$lang ]; then \ +# sources=$$(ls -1 $$lang/*.xml); \ +# manpages=$$(echo $$sources | $(SED) 's/\.xml//g'); \ +# $(MAKE) uninstall-man \ +# mandir="$(mandir)/$$lang" \ +# man_MANS="$$manpages"; \ +# fi \ +# done diff --git a/man/gssntlmssp.8.xml b/man/gssntlmssp.8.xml new file mode 100644 index 0000000..0cbbe7d --- /dev/null +++ b/man/gssntlmssp.8.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE reference PUBLIC "-//OASIS//DTD DocBook V4.4//EN" +"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"> +<reference> +<title>GSSAPI NTLM mechanism manual page</title> +<refentry> + <refentryinfo> + <productname>GSS-NTLMSSP</productname> + <orgname>GSS-NTLMSSP - http://ssimo.org/gss-ntlmssp</orgname> + </refentryinfo> + + <refmeta> + <refentrytitle>gssntlmssp</refentrytitle> + <manvolnum>8</manvolnum> + </refmeta> + + <refnamediv id='name'> + <refname>gssntlmssp</refname> + <refpurpose>GSSAPI NTLM Security Service Provider mechanism</refpurpose> + </refnamediv> + + <refsynopsisdiv id='synopsis'> + <cmdsynopsis> + <command>gssntlmssp_v1 2.16.840.1.113730.3.8.15.X /usr/lib64/gssntlmssp/gssntlmssp.so </command> + <arg choice='opt'> + <replaceable>options</replaceable> + </arg> + </cmdsynopsis> + </refsynopsisdiv> + + <refsect1 id='description'> + <title>DESCRIPTION</title> + <para> + A GSSAPI NTLM mechanism that allows to perform NTLM authentication + in GSSAPI programs. + </para> + </refsect1> + + <refsect1 id='see_also'> + <title>SEE ALSO</title> + <para> + <citerefentry> + <refentrytitle>gssapi</refentrytitle><manvolnum>8</manvolnum> + </citerefentry>. + </para> + </refsect1> +</refentry> +</reference> diff --git a/src/gss_ntlmssp.c b/src/gss_ntlmssp.c new file mode 100644 index 0000000..7762b23 --- /dev/null +++ b/src/gss_ntlmssp.c @@ -0,0 +1,25 @@ +/* + Copyright (C) 2013 Simo Sorce <simo@samba.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "gss_ntlmssp.h" + +/* 1.3.6.1.4.1.311.2.2.10 */ +const gss_OID_desc gss_ntlm_oid = { + .length = 10, + .elements = "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a" +}; + diff --git a/src/gss_ntlmssp.h b/src/gss_ntlmssp.h new file mode 100644 index 0000000..f7164a9 --- /dev/null +++ b/src/gss_ntlmssp.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2013 Simo Sorce <simo@samba.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef _GSS_NTLMSSP_H_ +#define _GSS_NTLMSSP_H_ + +#include <gssapi/gssapi.h> + +#endif /* _GSS_NTLMSSP_H_ */ diff --git a/tests/ntlmssptest.c b/tests/ntlmssptest.c new file mode 100644 index 0000000..f5785d6 --- /dev/null +++ b/tests/ntlmssptest.c @@ -0,0 +1,25 @@ +/* + GSS-NTLM + + Copyright (C) 2013 Simo Sorce <simo@samba.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "config.h" + +int main(int argc, const char *argv[]) +{ + return 0; +} diff --git a/tests/scripts/dlopen.sh b/tests/scripts/dlopen.sh new file mode 100755 index 0000000..890cc39 --- /dev/null +++ b/tests/scripts/dlopen.sh @@ -0,0 +1,76 @@ +#!/bin/sh + +test -n "$TMPDIR" || exit 1 +tempdir="$TMPDIR/dlopentest" +mkdir -p $tempdir +cat >> $tempdir/dlopen.c << _EOF +#include <dlfcn.h> +#include <stdio.h> +#include <limits.h> +#include <sys/stat.h> +/* Simple program to see if dlopen() would succeed. */ +int main(int argc, char **argv) +{ + int i; + struct stat st; + char buf[PATH_MAX]; + for (i = 1; i < argc; i++) { + if (dlopen(argv[i], RTLD_NOW)) { + fprintf(stdout, "dlopen() of \"%s\" succeeded.\n", + argv[i]); + } else { + snprintf(buf, sizeof(buf), "./%s", argv[i]); + if ((stat(buf, &st) == 0) && dlopen(buf, RTLD_NOW)) { + fprintf(stdout, "dlopen() of \"./%s\" " + "succeeded.\n", argv[i]); + } else { + fprintf(stdout, "dlopen() of \"%s\" failed: " + "%s\n", argv[i], dlerror()); + return 1; + } + } + } + return 0; +} +_EOF + +for arg in $@ ; do + case "$arg" in + "") + ;; + -I*|-D*|-f*|-m*|-g*|-O*|-W*) + cflags="$cflags $arg" + ;; + -l*|-L*) + ldflags="$ldflags $arg" + ;; + /*) + modules="$modules $arg" + ;; + *) + modules="$modules $arg" + ;; + esac +done + +${CC:-gcc} $RPM_OPT_FLAGS $CFLAGS -o $tempdir/dlopen $cflags $tempdir/dlopen.c $ldflags -ldl + +retval=0 +for module in $modules ; do + case "$module" in + "") + ;; + /*) + $tempdir/dlopen "$module" + retval=$? + ;; + *) + $tempdir/dlopen ./"$module" + retval=$? + ;; + esac +done + +rm -f $tempdir/dlopen $tempdir/dlopen.c +rmdir $tempdir +exit $retval diff --git a/version.m4 b/version.m4 new file mode 100644 index 0000000..e720c0d --- /dev/null +++ b/version.m4 @@ -0,0 +1,7 @@ +# Primary version number +m4_define([VERSION_NUMBER], [0.0.1]) + +# If the PRERELEASE_VERSION_NUMBER is set, we'll append +# it to the release tag when creating an RPM or SRPM +m4_define([PRERELEASE_VERSION_NUMBER], []) + |