aboutsummaryrefslogtreecommitdiff
path: root/include/security
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2008-12-13 22:45:22 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2008-12-13 22:45:22 +0000
commit57392877a2cbbe4289dc4f56701baf55a0d5c56d (patch)
tree9151e2f3daf5644596ed8a0e176d5e719b780a10 /include/security
parentbb9740d80ee20034bd9cc0fb30e973231e060360 (diff)
Notes
Diffstat (limited to 'include/security')
-rw-r--r--include/security/Makefile.am12
-rw-r--r--include/security/Makefile.in419
-rw-r--r--include/security/openpam.h349
-rw-r--r--include/security/openpam_attr.h28
-rw-r--r--include/security/openpam_version.h48
-rw-r--r--include/security/pam_appl.h198
-rw-r--r--include/security/pam_constants.h136
-rw-r--r--include/security/pam_modules.h161
-rw-r--r--include/security/pam_types.h88
9 files changed, 1439 insertions, 0 deletions
diff --git a/include/security/Makefile.am b/include/security/Makefile.am
new file mode 100644
index 000000000000..f31b3a0ded59
--- /dev/null
+++ b/include/security/Makefile.am
@@ -0,0 +1,12 @@
+# $Id: Makefile.am 405 2007-12-19 11:38:27Z des $
+
+openpamdir = $(includedir)/security
+
+openpam_HEADERS = \
+ openpam.h \
+ openpam_attr.h \
+ openpam_version.h \
+ pam_appl.h \
+ pam_constants.h \
+ pam_modules.h \
+ pam_types.h
diff --git a/include/security/Makefile.in b/include/security/Makefile.in
new file mode 100644
index 000000000000..e6af56a0655f
--- /dev/null
+++ b/include/security/Makefile.in
@@ -0,0 +1,419 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# $Id: Makefile.am 405 2007-12-19 11:38:27Z des $
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = include/security
+DIST_COMMON = $(openpam_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(openpamdir)"
+openpamHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(openpam_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CRYPT_LIBS = @CRYPT_LIBS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DL_LIBS = @DL_LIBS@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAJ = @LIB_MAJ@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OPENPAM_MODULES_DIR = @OPENPAM_MODULES_DIR@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WITH_DOC_FALSE = @WITH_DOC_FALSE@
+WITH_DOC_TRUE = @WITH_DOC_TRUE@
+WITH_PAM_UNIX_FALSE = @WITH_PAM_UNIX_FALSE@
+WITH_PAM_UNIX_TRUE = @WITH_PAM_UNIX_TRUE@
+WITH_SU_FALSE = @WITH_SU_FALSE@
+WITH_SU_TRUE = @WITH_SU_TRUE@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+openpamdir = $(includedir)/security
+openpam_HEADERS = \
+ openpam.h \
+ openpam_attr.h \
+ openpam_version.h \
+ pam_appl.h \
+ pam_constants.h \
+ pam_modules.h \
+ pam_types.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/security/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/security/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+install-openpamHEADERS: $(openpam_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(openpamdir)" || $(mkdir_p) "$(DESTDIR)$(openpamdir)"
+ @list='$(openpam_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(openpamHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(openpamdir)/$$f'"; \
+ $(openpamHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(openpamdir)/$$f"; \
+ done
+
+uninstall-openpamHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(openpam_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(openpamdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(openpamdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(openpamdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-openpamHEADERS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-openpamHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool ctags distclean distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-openpamHEADERS \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-openpamHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/include/security/openpam.h b/include/security/openpam.h
new file mode 100644
index 000000000000..3361d625139c
--- /dev/null
+++ b/include/security/openpam.h
@@ -0,0 +1,349 @@
+/*-
+ * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
+ * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by ThinkSec AS and
+ * Network Associates Laboratories, the Security Research Division of
+ * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: openpam.h 408 2007-12-21 11:36:24Z des $
+ */
+
+#ifndef SECURITY_OPENPAM_H_INCLUDED
+#define SECURITY_OPENPAM_H_INCLUDED
+
+/*
+ * Annoying but necessary header pollution
+ */
+#include <stdarg.h>
+
+#include <security/openpam_attr.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct passwd;
+
+/*
+ * API extensions
+ */
+int
+openpam_borrow_cred(pam_handle_t *_pamh,
+ const struct passwd *_pwd)
+ OPENPAM_NONNULL((1,2));
+
+void
+openpam_free_data(pam_handle_t *_pamh,
+ void *_data,
+ int _status);
+
+void
+openpam_free_envlist(char **_envlist);
+
+const char *
+openpam_get_option(pam_handle_t *_pamh,
+ const char *_option);
+
+int
+openpam_restore_cred(pam_handle_t *_pamh)
+ OPENPAM_NONNULL((1));
+
+int
+openpam_set_option(pam_handle_t *_pamh,
+ const char *_option,
+ const char *_value);
+
+int
+pam_error(const pam_handle_t *_pamh,
+ const char *_fmt,
+ ...)
+ OPENPAM_FORMAT ((__printf__, 2, 3))
+ OPENPAM_NONNULL((1,2));
+
+int
+pam_get_authtok(pam_handle_t *_pamh,
+ int _item,
+ const char **_authtok,
+ const char *_prompt)
+ OPENPAM_NONNULL((1,3));
+
+int
+pam_info(const pam_handle_t *_pamh,
+ const char *_fmt,
+ ...)
+ OPENPAM_FORMAT ((__printf__, 2, 3))
+ OPENPAM_NONNULL((1,2));
+
+int
+pam_prompt(const pam_handle_t *_pamh,
+ int _style,
+ char **_resp,
+ const char *_fmt,
+ ...)
+ OPENPAM_FORMAT ((__printf__, 4, 5))
+ OPENPAM_NONNULL((1,4));
+
+int
+pam_setenv(pam_handle_t *_pamh,
+ const char *_name,
+ const char *_value,
+ int _overwrite)
+ OPENPAM_NONNULL((1,2,3));
+
+int
+pam_vinfo(const pam_handle_t *_pamh,
+ const char *_fmt,
+ va_list _ap)
+ OPENPAM_FORMAT ((__printf__, 2, 0))
+ OPENPAM_NONNULL((1,2));
+
+int
+pam_verror(const pam_handle_t *_pamh,
+ const char *_fmt,
+ va_list _ap)
+ OPENPAM_FORMAT ((__printf__, 2, 0))
+ OPENPAM_NONNULL((1,2));
+
+int
+pam_vprompt(const pam_handle_t *_pamh,
+ int _style,
+ char **_resp,
+ const char *_fmt,
+ va_list _ap)
+ OPENPAM_FORMAT ((__printf__, 4, 0))
+ OPENPAM_NONNULL((1,4));
+
+/*
+ * Read cooked lines.
+ * Checking for _IOFBF is a fairly reliable way to detect the presence
+ * of <stdio.h>, as SUSv3 requires it to be defined there.
+ */
+#ifdef _IOFBF
+char *
+openpam_readline(FILE *_f,
+ int *_lineno,
+ size_t *_lenp)
+ OPENPAM_NONNULL((1));
+#endif
+
+/*
+ * Log levels
+ */
+enum {
+ PAM_LOG_DEBUG,
+ PAM_LOG_VERBOSE,
+ PAM_LOG_NOTICE,
+ PAM_LOG_ERROR
+};
+
+/*
+ * Log to syslog
+ */
+void
+_openpam_log(int _level,
+ const char *_func,
+ const char *_fmt,
+ ...)
+ OPENPAM_FORMAT ((__printf__, 3, 4))
+ OPENPAM_NONNULL((3));
+
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+#define openpam_log(lvl, ...) \
+ _openpam_log((lvl), __func__, __VA_ARGS__)
+#elif defined(__GNUC__) && (__GNUC__ >= 3)
+#define openpam_log(lvl, ...) \
+ _openpam_log((lvl), __func__, __VA_ARGS__)
+#elif defined(__GNUC__) && (__GNUC__ >= 2) && (__GNUC_MINOR__ >= 95)
+#define openpam_log(lvl, fmt...) \
+ _openpam_log((lvl), __func__, ##fmt)
+#elif defined(__GNUC__) && defined(__FUNCTION__)
+#define openpam_log(lvl, fmt...) \
+ _openpam_log((lvl), __FUNCTION__, ##fmt)
+#else
+void
+openpam_log(int _level,
+ const char *_format,
+ ...)
+ OPENPAM_FORMAT ((__printf__, 2, 3))
+ OPENPAM_NONNULL((2));
+#endif
+
+/*
+ * Generic conversation function
+ */
+struct pam_message;
+struct pam_response;
+int openpam_ttyconv(int _n,
+ const struct pam_message **_msg,
+ struct pam_response **_resp,
+ void *_data);
+
+extern int openpam_ttyconv_timeout;
+
+/*
+ * Null conversation function
+ */
+int openpam_nullconv(int _n,
+ const struct pam_message **_msg,
+ struct pam_response **_resp,
+ void *_data);
+
+/*
+ * PAM primitives
+ */
+enum {
+ PAM_SM_AUTHENTICATE,
+ PAM_SM_SETCRED,
+ PAM_SM_ACCT_MGMT,
+ PAM_SM_OPEN_SESSION,
+ PAM_SM_CLOSE_SESSION,
+ PAM_SM_CHAUTHTOK,
+ /* keep this last */
+ PAM_NUM_PRIMITIVES
+};
+
+/*
+ * Dummy service module function
+ */
+#define PAM_SM_DUMMY(type) \
+PAM_EXTERN int \
+pam_sm_##type(pam_handle_t *pamh, int flags, \
+ int argc, const char *argv[]) \
+{ \
+ \
+ (void)pamh; \
+ (void)flags; \
+ (void)argc; \
+ (void)argv; \
+ return (PAM_IGNORE); \
+}
+
+/*
+ * PAM service module functions match this typedef
+ */
+struct pam_handle;
+typedef int (*pam_func_t)(struct pam_handle *, int, int, const char **);
+
+/*
+ * A struct that describes a module.
+ */
+typedef struct pam_module pam_module_t;
+struct pam_module {
+ char *path;
+ pam_func_t func[PAM_NUM_PRIMITIVES];
+ void *dlh;
+};
+
+/*
+ * Source-code compatibility with Linux-PAM modules
+ */
+#if defined(PAM_SM_AUTH) || defined(PAM_SM_ACCOUNT) || \
+ defined(PAM_SM_SESSION) || defined(PAM_SM_PASSWORD)
+# define LINUX_PAM_MODULE
+#endif
+
+#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_AUTH)
+# define _PAM_SM_AUTHENTICATE 0
+# define _PAM_SM_SETCRED 0
+#else
+# undef PAM_SM_AUTH
+# define PAM_SM_AUTH
+# define _PAM_SM_AUTHENTICATE pam_sm_authenticate
+# define _PAM_SM_SETCRED pam_sm_setcred
+#endif
+
+#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_ACCOUNT)
+# define _PAM_SM_ACCT_MGMT 0
+#else
+# undef PAM_SM_ACCOUNT
+# define PAM_SM_ACCOUNT
+# define _PAM_SM_ACCT_MGMT pam_sm_acct_mgmt
+#endif
+
+#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_SESSION)
+# define _PAM_SM_OPEN_SESSION 0
+# define _PAM_SM_CLOSE_SESSION 0
+#else
+# undef PAM_SM_SESSION
+# define PAM_SM_SESSION
+# define _PAM_SM_OPEN_SESSION pam_sm_open_session
+# define _PAM_SM_CLOSE_SESSION pam_sm_close_session
+#endif
+
+#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_PASSWORD)
+# define _PAM_SM_CHAUTHTOK 0
+#else
+# undef PAM_SM_PASSWORD
+# define PAM_SM_PASSWORD
+# define _PAM_SM_CHAUTHTOK pam_sm_chauthtok
+#endif
+
+/*
+ * Infrastructure for static modules using GCC linker sets.
+ * You are not expected to understand this.
+ */
+#if defined(__FreeBSD__)
+# define PAM_SOEXT ".so"
+#else
+# undef NO_STATIC_MODULES
+# define NO_STATIC_MODULES
+#endif
+
+#if defined(__GNUC__) && !defined(__PIC__) && !defined(NO_STATIC_MODULES)
+/* gcc, static linking */
+# include <sys/cdefs.h>
+# include <linker_set.h>
+# define OPENPAM_STATIC_MODULES
+# define PAM_EXTERN static
+# define PAM_MODULE_ENTRY(name) \
+ static char _pam_name[] = name PAM_SOEXT; \
+ static struct pam_module _pam_module = { \
+ .path = _pam_name, \
+ .func = { \
+ [PAM_SM_AUTHENTICATE] = _PAM_SM_AUTHENTICATE, \
+ [PAM_SM_SETCRED] = _PAM_SM_SETCRED, \
+ [PAM_SM_ACCT_MGMT] = _PAM_SM_ACCT_MGMT, \
+ [PAM_SM_OPEN_SESSION] = _PAM_SM_OPEN_SESSION, \
+ [PAM_SM_CLOSE_SESSION] = _PAM_SM_CLOSE_SESSION, \
+ [PAM_SM_CHAUTHTOK] = _PAM_SM_CHAUTHTOK \
+ }, \
+ }; \
+ DATA_SET(_openpam_static_modules, _pam_module)
+#else
+/* normal case */
+# define PAM_EXTERN
+# define PAM_MODULE_ENTRY(name)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !SECURITY_OPENPAM_H_INCLUDED */
diff --git a/include/security/openpam_attr.h b/include/security/openpam_attr.h
new file mode 100644
index 000000000000..aada5cc8832c
--- /dev/null
+++ b/include/security/openpam_attr.h
@@ -0,0 +1,28 @@
+/*
+ * $Id: openpam_attr.h 405 2007-12-19 11:38:27Z des $
+ */
+
+#ifndef SECURITY_PAM_ATTRIBUTES_H_INCLUDED
+#define SECURITY_PAM_ATTRIBUTES_H_INCLUDED
+
+/* GCC attributes */
+#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__STRICT_ANSI__)
+# define OPENPAM_GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+# define OPENPAM_GNUC_PREREQ(maj, min) 0
+#endif
+
+#if OPENPAM_GNUC_PREREQ(2,5)
+# define OPENPAM_FORMAT(params) __attribute__((__format__ params))
+#else
+# define OPENPAM_FORMAT(params)
+#endif
+
+#if OPENPAM_GNUC_PREREQ(3,3)
+# define OPENPAM_NONNULL(params) __attribute__((__nonnull__ params))
+#else
+# define OPENPAM_NONNULL(params)
+#endif
+
+#endif /* !SECURITY_PAM_ATTRIBUTES_H_INCLUDED */
diff --git a/include/security/openpam_version.h b/include/security/openpam_version.h
new file mode 100644
index 000000000000..5f9d0f23b54d
--- /dev/null
+++ b/include/security/openpam_version.h
@@ -0,0 +1,48 @@
+/*-
+ * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
+ * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by ThinkSec AS and
+ * Network Associates Laboratories, the Security Research Division of
+ * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: openpam_version.h 412 2008-01-29 19:31:46Z des $
+ */
+
+#ifndef SECURITY_OPENPAM_VERSION_H_INCLUDED
+#define SECURITY_OPENPAM_VERSION_H_INCLUDED
+
+#define OPENPAM
+#define OPENPAM_VERSION 20071221
+#define OPENPAM_RELEASE "Hydrangea"
+
+/* violates reserved namespace, but can't be removed for legacy reasons */
+#define _OPENPAM
+
+#endif /* !SECURITY_OPENPAM_VERSION_H_INCLUDED */
diff --git a/include/security/pam_appl.h b/include/security/pam_appl.h
new file mode 100644
index 000000000000..8316c68ab02a
--- /dev/null
+++ b/include/security/pam_appl.h
@@ -0,0 +1,198 @@
+/*-
+ * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
+ * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by ThinkSec AS and
+ * Network Associates Laboratories, the Security Research Division of
+ * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: pam_appl.h 408 2007-12-21 11:36:24Z des $
+ */
+
+#ifndef SECURITY_PAM_APPL_H_INCLUDED
+#define SECURITY_PAM_APPL_H_INCLUDED
+
+#include <security/pam_types.h>
+#include <security/pam_constants.h>
+#include <security/openpam_attr.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * XSSO 4.2.1, 6
+ */
+
+int
+pam_acct_mgmt(pam_handle_t *_pamh,
+ int _flags)
+ OPENPAM_NONNULL((1));
+
+int
+pam_authenticate(pam_handle_t *_pamh,
+ int _flags)
+ OPENPAM_NONNULL((1));
+
+int
+pam_chauthtok(pam_handle_t *_pamh,
+ int _flags)
+ OPENPAM_NONNULL((1));
+
+int
+pam_close_session(pam_handle_t *_pamh,
+ int _flags)
+ OPENPAM_NONNULL((1));
+
+int
+pam_end(pam_handle_t *_pamh,
+ int _status)
+ OPENPAM_NONNULL((1));
+
+int
+pam_get_data(const pam_handle_t *_pamh,
+ const char *_module_data_name,
+ const void **_data)
+ OPENPAM_NONNULL((1,2,3));
+
+int
+pam_get_item(const pam_handle_t *_pamh,
+ int _item_type,
+ const void **_item)
+ OPENPAM_NONNULL((1,3));
+
+int
+pam_get_user(pam_handle_t *_pamh,
+ const char **_user,
+ const char *_prompt)
+ OPENPAM_NONNULL((1,2));
+
+const char *
+pam_getenv(pam_handle_t *_pamh,
+ const char *_name)
+ OPENPAM_NONNULL((1,2));
+
+char **
+pam_getenvlist(pam_handle_t *_pamh)
+ OPENPAM_NONNULL((1));
+
+int
+pam_open_session(pam_handle_t *_pamh,
+ int _flags)
+ OPENPAM_NONNULL((1));
+
+int
+pam_putenv(pam_handle_t *_pamh,
+ const char *_namevalue)
+ OPENPAM_NONNULL((1,2));
+
+int
+pam_set_data(pam_handle_t *_pamh,
+ const char *_module_data_name,
+ void *_data,
+ void (*_cleanup)(pam_handle_t *_pamh,
+ void *_data,
+ int _pam_end_status))
+ OPENPAM_NONNULL((1,2));
+
+int
+pam_set_item(pam_handle_t *_pamh,
+ int _item_type,
+ const void *_item)
+ OPENPAM_NONNULL((1));
+
+int
+pam_setcred(pam_handle_t *_pamh,
+ int _flags)
+ OPENPAM_NONNULL((1));
+
+int
+pam_start(const char *_service,
+ const char *_user,
+ const struct pam_conv *_pam_conv,
+ pam_handle_t **_pamh)
+ OPENPAM_NONNULL((4));
+
+const char *
+pam_strerror(const pam_handle_t *_pamh,
+ int _error_number);
+
+/*
+ * Single Sign-On extensions
+ */
+#if 0
+int
+pam_authenticate_secondary(pam_handle_t *_pamh,
+ char *_target_username,
+ char *_target_module_type,
+ char *_target_authn_domain,
+ char *_target_supp_data,
+ char *_target_module_authtok,
+ int _flags);
+
+int
+pam_get_mapped_authtok(pam_handle_t *_pamh,
+ const char *_target_module_username,
+ const char *_target_module_type,
+ const char *_target_authn_domain,
+ size_t *_target_authtok_len,
+ unsigned char **_target_module_authtok);
+
+int
+pam_get_mapped_username(pam_handle_t *_pamh,
+ const char *_src_username,
+ const char *_src_module_type,
+ const char *_src_authn_domain,
+ const char *_target_module_type,
+ const char *_target_authn_domain,
+ char **_target_module_username);
+
+int
+pam_set_mapped_authtok(pam_handle_t *_pamh,
+ const char *_target_module_username,
+ size_t _target_authtok_len,
+ unsigned char *_target_module_authtok,
+ const char *_target_module_type,
+ const char *_target_authn_domain);
+
+int
+pam_set_mapped_username(pam_handle_t *_pamh,
+ char *_src_username,
+ char *_src_module_type,
+ char *_src_authn_domain,
+ char *_target_module_username,
+ char *_target_module_type,
+ char *_target_authn_domain);
+#endif /* 0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !SECURITY_PAM_APPL_H_INCLUDED */
diff --git a/include/security/pam_constants.h b/include/security/pam_constants.h
new file mode 100644
index 000000000000..b005c7f4f892
--- /dev/null
+++ b/include/security/pam_constants.h
@@ -0,0 +1,136 @@
+/*-
+ * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
+ * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by ThinkSec AS and
+ * Network Associates Laboratories, the Security Research Division of
+ * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: pam_constants.h 408 2007-12-21 11:36:24Z des $
+ */
+
+#ifndef SECURITY_PAM_CONSTANTS_H_INCLUDED
+#define SECURITY_PAM_CONSTANTS_H_INCLUDED
+
+#include <security/openpam_version.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * XSSO 5.2
+ */
+enum {
+ PAM_SUCCESS = 0,
+ PAM_OPEN_ERR = 1,
+ PAM_SYMBOL_ERR = 2,
+ PAM_SERVICE_ERR = 3,
+ PAM_SYSTEM_ERR = 4,
+ PAM_BUF_ERR = 5,
+ PAM_CONV_ERR = 6,
+ PAM_PERM_DENIED = 7,
+ PAM_MAXTRIES = 8,
+ PAM_AUTH_ERR = 9,
+ PAM_NEW_AUTHTOK_REQD = 10,
+ PAM_CRED_INSUFFICIENT = 11,
+ PAM_AUTHINFO_UNAVAIL = 12,
+ PAM_USER_UNKNOWN = 13,
+ PAM_CRED_UNAVAIL = 14,
+ PAM_CRED_EXPIRED = 15,
+ PAM_CRED_ERR = 16,
+ PAM_ACCT_EXPIRED = 17,
+ PAM_AUTHTOK_EXPIRED = 18,
+ PAM_SESSION_ERR = 19,
+ PAM_AUTHTOK_ERR = 20,
+ PAM_AUTHTOK_RECOVERY_ERR = 21,
+ PAM_AUTHTOK_LOCK_BUSY = 22,
+ PAM_AUTHTOK_DISABLE_AGING = 23,
+ PAM_NO_MODULE_DATA = 24,
+ PAM_IGNORE = 25,
+ PAM_ABORT = 26,
+ PAM_TRY_AGAIN = 27,
+ PAM_MODULE_UNKNOWN = 28,
+ PAM_DOMAIN_UNKNOWN = 29,
+ PAM_NUM_ERRORS /* OpenPAM extension */
+};
+
+/*
+ * XSSO 5.3
+ */
+enum {
+ PAM_PROMPT_ECHO_OFF = 1,
+ PAM_PROMPT_ECHO_ON = 2,
+ PAM_ERROR_MSG = 3,
+ PAM_TEXT_INFO = 4,
+ PAM_MAX_NUM_MSG = 32,
+ PAM_MAX_MSG_SIZE = 512,
+ PAM_MAX_RESP_SIZE = 512
+};
+
+/*
+ * XSSO 5.4
+ */
+enum {
+ /* some compilers promote 0x8000000 to long */
+ PAM_SILENT = (-0x7fffffff - 1),
+ PAM_DISALLOW_NULL_AUTHTOK = 0x1,
+ PAM_ESTABLISH_CRED = 0x1,
+ PAM_DELETE_CRED = 0x2,
+ PAM_REINITIALIZE_CRED = 0x4,
+ PAM_REFRESH_CRED = 0x8,
+ PAM_PRELIM_CHECK = 0x1,
+ PAM_UPDATE_AUTHTOK = 0x2,
+ PAM_CHANGE_EXPIRED_AUTHTOK = 0x4
+};
+
+/*
+ * XSSO 5.5
+ */
+enum {
+ PAM_SERVICE = 1,
+ PAM_USER = 2,
+ PAM_TTY = 3,
+ PAM_RHOST = 4,
+ PAM_CONV = 5,
+ PAM_AUTHTOK = 6,
+ PAM_OLDAUTHTOK = 7,
+ PAM_RUSER = 8,
+ PAM_USER_PROMPT = 9,
+ PAM_REPOSITORY = 10,
+ PAM_AUTHTOK_PROMPT = 11, /* OpenPAM extension */
+ PAM_OLDAUTHTOK_PROMPT = 12, /* OpenPAM extension */
+ PAM_NUM_ITEMS /* OpenPAM extension */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !SECURITY_PAM_CONSTANTS_H_INCLUDED */
diff --git a/include/security/pam_modules.h b/include/security/pam_modules.h
new file mode 100644
index 000000000000..539f662a0459
--- /dev/null
+++ b/include/security/pam_modules.h
@@ -0,0 +1,161 @@
+/*-
+ * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
+ * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by ThinkSec AS and
+ * Network Associates Laboratories, the Security Research Division of
+ * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: pam_modules.h 408 2007-12-21 11:36:24Z des $
+ */
+
+#ifndef SECURITY_PAM_MODULES_H_INCLUDED
+#define SECURITY_PAM_MODULES_H_INCLUDED
+
+#include <security/pam_types.h>
+#include <security/pam_constants.h>
+#include <security/openpam.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * XSSO 4.2.2, 6
+ */
+
+#if defined(PAM_SM_ACCOUNT)
+PAM_EXTERN int
+pam_sm_acct_mgmt(pam_handle_t *_pamh,
+ int _flags,
+ int _argc,
+ const char **_argv);
+#endif
+
+#if defined(PAM_SM_AUTH)
+PAM_EXTERN int
+pam_sm_authenticate(pam_handle_t *_pamh,
+ int _flags,
+ int _argc,
+ const char **_argv);
+#endif
+
+#if defined(PAM_SM_PASSWORD)
+PAM_EXTERN int
+pam_sm_chauthtok(pam_handle_t *_pamh,
+ int _flags,
+ int _argc,
+ const char **_argv);
+#endif
+
+#if defined(PAM_SM_SESSION)
+PAM_EXTERN int
+pam_sm_close_session(pam_handle_t *_pamh,
+ int _flags,
+ int _args,
+ const char **_argv);
+#endif
+
+#if defined(PAM_SM_SESSION)
+PAM_EXTERN int
+pam_sm_open_session(pam_handle_t *_pamh,
+ int _flags,
+ int _argc,
+ const char **_argv);
+#endif
+
+#if defined(PAM_SM_AUTH)
+PAM_EXTERN int
+pam_sm_setcred(pam_handle_t *_pamh,
+ int _flags,
+ int _argc,
+ const char **_argv);
+#endif
+
+/*
+ * Single Sign-On extensions
+ */
+#if 0
+PAM_EXTERN int
+pam_sm_authenticate_secondary(pam_handle_t *_pamh,
+ char *_target_username,
+ char *_target_module_type,
+ char *_target_authn_domain,
+ char *_target_supp_data,
+ unsigned char *_target_module_authtok,
+ int _flags,
+ int _argc,
+ const char **_argv);
+
+PAM_EXTERN int
+pam_sm_get_mapped_authtok(pam_handle_t *_pamh,
+ char *_target_module_username,
+ char *_target_module_type,
+ char *_target_authn_domain,
+ size_t *_target_authtok_len,
+ unsigned char **_target_module_authtok,
+ int _argc,
+ char *_argv);
+
+PAM_EXTERN int
+pam_sm_get_mapped_username(pam_handle_t *_pamh,
+ char *_src_username,
+ char *_src_module_type,
+ char *_src_authn_domain,
+ char *_target_module_type,
+ char *_target_authn_domain,
+ char **_target_module_username,
+ int _argc,
+ const char **_argv);
+
+PAM_EXTERN int
+pam_sm_set_mapped_authtok(pam_handle_t *_pamh,
+ char *_target_module_username,
+ size_t _target_authtok_len,
+ unsigned char *_target_module_authtok,
+ char *_target_module_type,
+ char *_target_authn_domain,
+ int _argc,
+ const char *_argv);
+
+PAM_EXTERN int
+pam_sm_set_mapped_username(pam_handle_t *_pamh,
+ char *_target_module_username,
+ char *_target_module_type,
+ char *_target_authn_domain,
+ int _argc,
+ const char **_argv);
+
+#endif /* 0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !SECURITY_PAM_MODULES_H_INCLUDED */
diff --git a/include/security/pam_types.h b/include/security/pam_types.h
new file mode 100644
index 000000000000..0209bc8a6259
--- /dev/null
+++ b/include/security/pam_types.h
@@ -0,0 +1,88 @@
+/*-
+ * Copyright (c) 2002-2003 Networks Associates Technology, Inc.
+ * Copyright (c) 2004-2007 Dag-Erling Smørgrav
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by ThinkSec AS and
+ * Network Associates Laboratories, the Security Research Division of
+ * Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
+ * ("CBOSS"), as part of the DARPA CHATS research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: pam_types.h 408 2007-12-21 11:36:24Z des $
+ */
+
+#ifndef SECURITY_PAM_TYPES_H_INCLUDED
+#define SECURITY_PAM_TYPES_H_INCLUDED
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * XSSO 5.1.1
+ */
+struct pam_message {
+ int msg_style;
+ char *msg;
+};
+
+struct pam_response {
+ char *resp;
+ int resp_retcode;
+};
+
+/*
+ * XSSO 5.1.2
+ */
+struct pam_conv {
+ int (*conv)(int, const struct pam_message **,
+ struct pam_response **, void *);
+ void *appdata_ptr;
+};
+
+/*
+ * XSSO 5.1.3
+ */
+struct pam_handle;
+typedef struct pam_handle pam_handle_t;
+
+/*
+ * Solaris 9
+ */
+typedef struct pam_repository {
+ char *type;
+ void *scope;
+ size_t scope_len;
+} pam_repository_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !SECURITY_PAM_TYPES_H_INCLUDED */