From 3b59856f3caaa1695d9f61c64e1e9bf5b514801f Mon Sep 17 00:00:00 2001 From: des Date: Thu, 2 May 2002 04:40:21 +0000 Subject: [PATCH] Vendor import of OpenPAM Cinnamon. --- contrib/openpam/HISTORY | 28 +++++++- contrib/openpam/MANIFEST | 3 +- contrib/openpam/RELNOTES | 8 +-- contrib/openpam/doc/man/openpam_borrow_cred.3 | 5 +- contrib/openpam/doc/man/openpam_free_data.3 | 5 +- contrib/openpam/doc/man/openpam_get_option.3 | 5 +- contrib/openpam/doc/man/openpam_log.3 | 5 +- .../openpam/doc/man/openpam_restore_cred.3 | 5 +- contrib/openpam/doc/man/openpam_set_option.3 | 5 +- contrib/openpam/doc/man/openpam_ttyconv.3 | 5 +- contrib/openpam/doc/man/pam.3 | 4 +- contrib/openpam/doc/man/pam_acct_mgmt.3 | 4 +- contrib/openpam/doc/man/pam_authenticate.3 | 4 +- contrib/openpam/doc/man/pam_chauthtok.3 | 4 +- contrib/openpam/doc/man/pam_close_session.3 | 4 +- contrib/openpam/doc/man/pam_end.3 | 4 +- contrib/openpam/doc/man/pam_error.3 | 4 +- contrib/openpam/doc/man/pam_get_authtok.3 | 4 +- contrib/openpam/doc/man/pam_get_data.3 | 4 +- contrib/openpam/doc/man/pam_get_item.3 | 4 +- contrib/openpam/doc/man/pam_get_user.3 | 4 +- contrib/openpam/doc/man/pam_getenv.3 | 4 +- contrib/openpam/doc/man/pam_getenvlist.3 | 4 +- contrib/openpam/doc/man/pam_info.3 | 4 +- contrib/openpam/doc/man/pam_open_session.3 | 4 +- contrib/openpam/doc/man/pam_prompt.3 | 4 +- contrib/openpam/doc/man/pam_putenv.3 | 4 +- contrib/openpam/doc/man/pam_set_data.3 | 4 +- contrib/openpam/doc/man/pam_set_item.3 | 4 +- contrib/openpam/doc/man/pam_setcred.3 | 4 +- contrib/openpam/doc/man/pam_setenv.3 | 4 +- contrib/openpam/doc/man/pam_sm_acct_mgmt.3 | 4 +- contrib/openpam/doc/man/pam_sm_authenticate.3 | 4 +- contrib/openpam/doc/man/pam_sm_chauthtok.3 | 4 +- .../openpam/doc/man/pam_sm_close_session.3 | 4 +- contrib/openpam/doc/man/pam_sm_open_session.3 | 4 +- contrib/openpam/doc/man/pam_sm_setcred.3 | 4 +- contrib/openpam/doc/man/pam_start.3 | 4 +- contrib/openpam/doc/man/pam_strerror.3 | 4 +- contrib/openpam/doc/man/pam_verror.3 | 4 +- contrib/openpam/doc/man/pam_vinfo.3 | 4 +- contrib/openpam/doc/man/pam_vprompt.3 | 4 +- contrib/openpam/include/security/openpam.h | 10 ++- contrib/openpam/lib/Makefile | 3 +- contrib/openpam/lib/openpam_configure.c | 70 ++++++++++++++----- contrib/openpam/lib/openpam_dynamic.c | 4 +- contrib/openpam/lib/openpam_impl.h | 6 +- contrib/openpam/lib/openpam_load.c | 12 ++-- contrib/openpam/lib/openpam_nullconv.c | 68 ++++++++++++++++++ contrib/openpam/lib/pam_end.c | 4 +- contrib/openpam/lib/pam_get_authtok.c | 6 +- contrib/openpam/lib/pam_start.c | 4 +- contrib/openpam/misc/gendoc.pl | 25 +++++-- 53 files changed, 283 insertions(+), 131 deletions(-) create mode 100644 contrib/openpam/lib/openpam_nullconv.c diff --git a/contrib/openpam/HISTORY b/contrib/openpam/HISTORY index 98f78d0b3088..2b1f44f07d3c 100644 --- a/contrib/openpam/HISTORY +++ b/contrib/openpam/HISTORY @@ -1,13 +1,37 @@ ============================================================================ +OpenPAM Cinnamon 2002-05-02 + + - ENHANCE: Add a null conversation function, openpam_nullconv(). + + - BUGFIX: Various markup bugs in the documentation. + + - BUGFIX: Document . + + - BUGFIX: Duplicate expansion of openpam_log() macro arguments. + + - ENHANCE: Restructure the policy-loading code and align our use of + the "other" policy with Solaris and Linux-PAM. + + - ENHANCE: Log dlopen() and dlsym() failures. + + - ENHANCE: In openpam_ttyconv(), emit a newline after error and info + messages unless the message contains one already. + + - BUGFIX: In pam_vprompt(), initialize the response pointer to NULL + so we can detect whether the conversation function touched it. +============================================================================ OpenPAM Cineraria 2002-04-14 + - BUGFIX: Fix confusion between token and prompt in + pam_get_authtok(3). + - ENHANCE: Improved documentation. - ENHANCE: Adopt the same preprocessor tricks that were used in FreeBSD's version of Linux-PAM to simplify static linking without requiring dummy primitives. - - ENHANCE: move the policy-loading code out of pam_start.c. + - ENHANCE: Move the policy-loading code out of pam_start.c. - BUGFIX: Fix typo in one of the versions of the openpam_log macro. @@ -128,4 +152,4 @@ OpenPAM Calamite 2002-02-09 First (beta) release. ============================================================================ -$P4: //depot/projects/openpam/HISTORY#9 $ +$P4: //depot/projects/openpam/HISTORY#11 $ diff --git a/contrib/openpam/MANIFEST b/contrib/openpam/MANIFEST index 84b608eb7b7a..857ffd301689 100644 --- a/contrib/openpam/MANIFEST +++ b/contrib/openpam/MANIFEST @@ -1,5 +1,5 @@ # -# $P4: //depot/projects/openpam/MANIFEST#7 $ +# $P4: //depot/projects/openpam/MANIFEST#8 $ # CREDITS HISTORY @@ -70,6 +70,7 @@ lib/openpam_get_option.c lib/openpam_impl.h lib/openpam_load.c lib/openpam_log.c +lib/openpam_nullconv.c lib/openpam_restore_cred.c lib/openpam_set_option.c lib/openpam_static.c diff --git a/contrib/openpam/RELNOTES b/contrib/openpam/RELNOTES index b81156bf1e8e..315cc592c378 100644 --- a/contrib/openpam/RELNOTES +++ b/contrib/openpam/RELNOTES @@ -1,12 +1,12 @@ - Release notes for OpenPAM Cineraria - =================================== + Release notes for OpenPAM Cinnamon + ================================== The library itself is complete. Documentation exists in the form of man pages for the library functions, though a few pages are still incomplete. -This release is incorporated into FreeBSD-CURRENT as of 2002-04-14. +This release is incorporated into FreeBSD-CURRENT as of 2002-05-02. It has also been successfully built on NetBSD, and should build with minimal or no changes on OpenBSD. It has not been tested on any other OS. @@ -15,4 +15,4 @@ Known issues: - The documentation is still incomplete. -$P4: //depot/projects/openpam/RELNOTES#9 $ +$P4: //depot/projects/openpam/RELNOTES#10 $ diff --git a/contrib/openpam/doc/man/openpam_borrow_cred.3 b/contrib/openpam/doc/man/openpam_borrow_cred.3 index ce4f81617e1a..d8b2dc7de27c 100644 --- a/contrib/openpam/doc/man/openpam_borrow_cred.3 +++ b/contrib/openpam/doc/man/openpam_borrow_cred.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/openpam_borrow_cred.3#2 $ +.\" $P4: //depot/projects/openpam/doc/man/openpam_borrow_cred.3#4 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt OPENPAM_BORROW_CRED 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Lb libpam .Sh SYNOPSIS .In security/pam_appl.h +.In security/openpam.h .Ft int .Fn openpam_borrow_cred "pam_handle_t *pamh" "const struct passwd *pwd" .Sh DESCRIPTION diff --git a/contrib/openpam/doc/man/openpam_free_data.3 b/contrib/openpam/doc/man/openpam_free_data.3 index 6ee68fb124d3..f777f651af81 100644 --- a/contrib/openpam/doc/man/openpam_free_data.3 +++ b/contrib/openpam/doc/man/openpam_free_data.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/openpam_free_data.3#2 $ +.\" $P4: //depot/projects/openpam/doc/man/openpam_free_data.3#4 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt OPENPAM_FREE_DATA 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Lb libpam .Sh SYNOPSIS .In security/pam_appl.h +.In security/openpam.h .Ft void .Fn openpam_free_data "pam_handle_t *pamh" "void *data" "int status" .Sh DESCRIPTION diff --git a/contrib/openpam/doc/man/openpam_get_option.3 b/contrib/openpam/doc/man/openpam_get_option.3 index d3d0b0fb5870..ee49900b4840 100644 --- a/contrib/openpam/doc/man/openpam_get_option.3 +++ b/contrib/openpam/doc/man/openpam_get_option.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/openpam_get_option.3#6 $ +.\" $P4: //depot/projects/openpam/doc/man/openpam_get_option.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt OPENPAM_GET_OPTION 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Lb libpam .Sh SYNOPSIS .In security/pam_appl.h +.In security/openpam.h .Ft const char * .Fn openpam_get_option "pam_handle_t *pamh" "const char *option" .Sh DESCRIPTION diff --git a/contrib/openpam/doc/man/openpam_log.3 b/contrib/openpam/doc/man/openpam_log.3 index 43994ea80f60..2148ec2cf4bc 100644 --- a/contrib/openpam/doc/man/openpam_log.3 +++ b/contrib/openpam/doc/man/openpam_log.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/openpam_log.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/openpam_log.3#9 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt OPENPAM_LOG 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Lb libpam .Sh SYNOPSIS .In security/pam_appl.h +.In security/openpam.h .Ft void .Fn openpam_log "int level" "const char *fmt" "..." .Sh DESCRIPTION diff --git a/contrib/openpam/doc/man/openpam_restore_cred.3 b/contrib/openpam/doc/man/openpam_restore_cred.3 index 21cdf3ad0e40..97f3c57833ea 100644 --- a/contrib/openpam/doc/man/openpam_restore_cred.3 +++ b/contrib/openpam/doc/man/openpam_restore_cred.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/openpam_restore_cred.3#2 $ +.\" $P4: //depot/projects/openpam/doc/man/openpam_restore_cred.3#4 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt OPENPAM_RESTORE_CRED 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Lb libpam .Sh SYNOPSIS .In security/pam_appl.h +.In security/openpam.h .Ft int .Fn openpam_restore_cred "pam_handle_t *pamh" .Sh DESCRIPTION diff --git a/contrib/openpam/doc/man/openpam_set_option.3 b/contrib/openpam/doc/man/openpam_set_option.3 index e9cf8ffd712d..c21ef46bf57a 100644 --- a/contrib/openpam/doc/man/openpam_set_option.3 +++ b/contrib/openpam/doc/man/openpam_set_option.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/openpam_set_option.3#6 $ +.\" $P4: //depot/projects/openpam/doc/man/openpam_set_option.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt OPENPAM_SET_OPTION 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Lb libpam .Sh SYNOPSIS .In security/pam_appl.h +.In security/openpam.h .Ft int .Fn openpam_set_option "pam_handle_t *pamh" "const char *option" "const char *value" .Sh DESCRIPTION diff --git a/contrib/openpam/doc/man/openpam_ttyconv.3 b/contrib/openpam/doc/man/openpam_ttyconv.3 index 8b29d3df0524..df303f8e5465 100644 --- a/contrib/openpam/doc/man/openpam_ttyconv.3 +++ b/contrib/openpam/doc/man/openpam_ttyconv.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/openpam_ttyconv.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/openpam_ttyconv.3#9 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt OPENPAM_TTYCONV 3 .Os .Sh NAME @@ -43,6 +43,7 @@ .Lb libpam .Sh SYNOPSIS .In security/pam_appl.h +.In security/openpam.h .Ft int .Fn openpam_ttyconv "int n" "const struct pam_message **msg" "struct pam_response **resp" "void *data" .Sh DESCRIPTION diff --git a/contrib/openpam/doc/man/pam.3 b/contrib/openpam/doc/man/pam.3 index 82d7567fda3d..1d34f469da52 100644 --- a/contrib/openpam/doc/man/pam.3 +++ b/contrib/openpam/doc/man/pam.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam.3#13 $ +.\" $P4: //depot/projects/openpam/doc/man/pam.3#14 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_acct_mgmt.3 b/contrib/openpam/doc/man/pam_acct_mgmt.3 index a3bb2947cc39..2673c2e08fa8 100644 --- a/contrib/openpam/doc/man/pam_acct_mgmt.3 +++ b/contrib/openpam/doc/man/pam_acct_mgmt.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_acct_mgmt.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_acct_mgmt.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_ACCT_MGMT 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_authenticate.3 b/contrib/openpam/doc/man/pam_authenticate.3 index 20808b855c44..ea3f098622e5 100644 --- a/contrib/openpam/doc/man/pam_authenticate.3 +++ b/contrib/openpam/doc/man/pam_authenticate.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_authenticate.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_authenticate.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_AUTHENTICATE 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_chauthtok.3 b/contrib/openpam/doc/man/pam_chauthtok.3 index 61a0e95be3ea..dd417b5a1b3c 100644 --- a/contrib/openpam/doc/man/pam_chauthtok.3 +++ b/contrib/openpam/doc/man/pam_chauthtok.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_chauthtok.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_chauthtok.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_CHAUTHTOK 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_close_session.3 b/contrib/openpam/doc/man/pam_close_session.3 index 484eb871592b..5a68f78eb2eb 100644 --- a/contrib/openpam/doc/man/pam_close_session.3 +++ b/contrib/openpam/doc/man/pam_close_session.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_close_session.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_close_session.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_CLOSE_SESSION 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_end.3 b/contrib/openpam/doc/man/pam_end.3 index 8c6638022edc..631e3df320a8 100644 --- a/contrib/openpam/doc/man/pam_end.3 +++ b/contrib/openpam/doc/man/pam_end.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_end.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_end.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_END 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_error.3 b/contrib/openpam/doc/man/pam_error.3 index 40fb8e1b045b..e7227453dfa8 100644 --- a/contrib/openpam/doc/man/pam_error.3 +++ b/contrib/openpam/doc/man/pam_error.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_error.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_error.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_ERROR 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_get_authtok.3 b/contrib/openpam/doc/man/pam_get_authtok.3 index 43f59d2d6d79..8f5a702fa743 100644 --- a/contrib/openpam/doc/man/pam_get_authtok.3 +++ b/contrib/openpam/doc/man/pam_get_authtok.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_get_authtok.3#13 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_get_authtok.3#14 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_GET_AUTHTOK 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_get_data.3 b/contrib/openpam/doc/man/pam_get_data.3 index 1e69979f09f8..b083524c2a64 100644 --- a/contrib/openpam/doc/man/pam_get_data.3 +++ b/contrib/openpam/doc/man/pam_get_data.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_get_data.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_get_data.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_GET_DATA 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_get_item.3 b/contrib/openpam/doc/man/pam_get_item.3 index 6d08728b25b8..81f5e04ac40b 100644 --- a/contrib/openpam/doc/man/pam_get_item.3 +++ b/contrib/openpam/doc/man/pam_get_item.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_get_item.3#12 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_get_item.3#13 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_GET_ITEM 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_get_user.3 b/contrib/openpam/doc/man/pam_get_user.3 index 6bf718e936c0..2d9af19efc0a 100644 --- a/contrib/openpam/doc/man/pam_get_user.3 +++ b/contrib/openpam/doc/man/pam_get_user.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_get_user.3#12 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_get_user.3#13 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_GET_USER 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_getenv.3 b/contrib/openpam/doc/man/pam_getenv.3 index f612010a4d93..8210ecca467f 100644 --- a/contrib/openpam/doc/man/pam_getenv.3 +++ b/contrib/openpam/doc/man/pam_getenv.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_getenv.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_getenv.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_GETENV 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_getenvlist.3 b/contrib/openpam/doc/man/pam_getenvlist.3 index a6c1cef6c4bd..baab41d4fbbc 100644 --- a/contrib/openpam/doc/man/pam_getenvlist.3 +++ b/contrib/openpam/doc/man/pam_getenvlist.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_getenvlist.3#12 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_getenvlist.3#13 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_GETENVLIST 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_info.3 b/contrib/openpam/doc/man/pam_info.3 index 33598f80e5b2..66faf7bb8e12 100644 --- a/contrib/openpam/doc/man/pam_info.3 +++ b/contrib/openpam/doc/man/pam_info.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_info.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_info.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_INFO 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_open_session.3 b/contrib/openpam/doc/man/pam_open_session.3 index 4904dfdb69bc..7a0fd5bec556 100644 --- a/contrib/openpam/doc/man/pam_open_session.3 +++ b/contrib/openpam/doc/man/pam_open_session.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_open_session.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_open_session.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_OPEN_SESSION 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_prompt.3 b/contrib/openpam/doc/man/pam_prompt.3 index 9e144843aac1..ec9219ec19e7 100644 --- a/contrib/openpam/doc/man/pam_prompt.3 +++ b/contrib/openpam/doc/man/pam_prompt.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_prompt.3#12 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_prompt.3#13 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_PROMPT 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_putenv.3 b/contrib/openpam/doc/man/pam_putenv.3 index 6743b1c09429..020cdfc98af5 100644 --- a/contrib/openpam/doc/man/pam_putenv.3 +++ b/contrib/openpam/doc/man/pam_putenv.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_putenv.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_putenv.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_PUTENV 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_set_data.3 b/contrib/openpam/doc/man/pam_set_data.3 index 2697ebebd495..d95818a4cba2 100644 --- a/contrib/openpam/doc/man/pam_set_data.3 +++ b/contrib/openpam/doc/man/pam_set_data.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_set_data.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_set_data.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SET_DATA 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_set_item.3 b/contrib/openpam/doc/man/pam_set_item.3 index 9e9c2eff353a..f6dc95eafa92 100644 --- a/contrib/openpam/doc/man/pam_set_item.3 +++ b/contrib/openpam/doc/man/pam_set_item.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_set_item.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_set_item.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SET_ITEM 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_setcred.3 b/contrib/openpam/doc/man/pam_setcred.3 index b948432ed062..c0cedc6bc4fd 100644 --- a/contrib/openpam/doc/man/pam_setcred.3 +++ b/contrib/openpam/doc/man/pam_setcred.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_setcred.3#12 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_setcred.3#13 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SETCRED 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_setenv.3 b/contrib/openpam/doc/man/pam_setenv.3 index 6db7b5a4d1df..f94ecb76bb7b 100644 --- a/contrib/openpam/doc/man/pam_setenv.3 +++ b/contrib/openpam/doc/man/pam_setenv.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_setenv.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_setenv.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SETENV 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_sm_acct_mgmt.3 b/contrib/openpam/doc/man/pam_sm_acct_mgmt.3 index b4aaf1dd384e..6fd07c3bcf48 100644 --- a/contrib/openpam/doc/man/pam_sm_acct_mgmt.3 +++ b/contrib/openpam/doc/man/pam_sm_acct_mgmt.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_sm_acct_mgmt.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_sm_acct_mgmt.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SM_ACCT_MGMT 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_sm_authenticate.3 b/contrib/openpam/doc/man/pam_sm_authenticate.3 index edf9929a8e0a..c56d7a864374 100644 --- a/contrib/openpam/doc/man/pam_sm_authenticate.3 +++ b/contrib/openpam/doc/man/pam_sm_authenticate.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_sm_authenticate.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_sm_authenticate.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SM_AUTHENTICATE 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_sm_chauthtok.3 b/contrib/openpam/doc/man/pam_sm_chauthtok.3 index 6141b57e04f1..7a2d165736d5 100644 --- a/contrib/openpam/doc/man/pam_sm_chauthtok.3 +++ b/contrib/openpam/doc/man/pam_sm_chauthtok.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_sm_chauthtok.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_sm_chauthtok.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SM_CHAUTHTOK 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_sm_close_session.3 b/contrib/openpam/doc/man/pam_sm_close_session.3 index c6291940653a..7411198af77c 100644 --- a/contrib/openpam/doc/man/pam_sm_close_session.3 +++ b/contrib/openpam/doc/man/pam_sm_close_session.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_sm_close_session.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_sm_close_session.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SM_CLOSE_SESSION 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_sm_open_session.3 b/contrib/openpam/doc/man/pam_sm_open_session.3 index 669ac4c326cf..df85873148d4 100644 --- a/contrib/openpam/doc/man/pam_sm_open_session.3 +++ b/contrib/openpam/doc/man/pam_sm_open_session.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_sm_open_session.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_sm_open_session.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SM_OPEN_SESSION 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_sm_setcred.3 b/contrib/openpam/doc/man/pam_sm_setcred.3 index e9c8808fe0fb..66c05eed9dcc 100644 --- a/contrib/openpam/doc/man/pam_sm_setcred.3 +++ b/contrib/openpam/doc/man/pam_sm_setcred.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_sm_setcred.3#7 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_sm_setcred.3#8 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_SM_SETCRED 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_start.3 b/contrib/openpam/doc/man/pam_start.3 index c34892d91c94..2284a7eb61c0 100644 --- a/contrib/openpam/doc/man/pam_start.3 +++ b/contrib/openpam/doc/man/pam_start.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_start.3#12 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_start.3#13 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_START 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_strerror.3 b/contrib/openpam/doc/man/pam_strerror.3 index 39eb0b716ac9..c093f0bbd694 100644 --- a/contrib/openpam/doc/man/pam_strerror.3 +++ b/contrib/openpam/doc/man/pam_strerror.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_strerror.3#11 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_strerror.3#12 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_STRERROR 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_verror.3 b/contrib/openpam/doc/man/pam_verror.3 index b773219c79d6..940b3fceccc0 100644 --- a/contrib/openpam/doc/man/pam_verror.3 +++ b/contrib/openpam/doc/man/pam_verror.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_verror.3#9 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_verror.3#10 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_VERROR 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_vinfo.3 b/contrib/openpam/doc/man/pam_vinfo.3 index e0ddce9d7a95..2bae513a60bd 100644 --- a/contrib/openpam/doc/man/pam_vinfo.3 +++ b/contrib/openpam/doc/man/pam_vinfo.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_vinfo.3#9 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_vinfo.3#10 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_VINFO 3 .Os .Sh NAME diff --git a/contrib/openpam/doc/man/pam_vprompt.3 b/contrib/openpam/doc/man/pam_vprompt.3 index 073cf5b8e5fb..ae2909e9d875 100644 --- a/contrib/openpam/doc/man/pam_vprompt.3 +++ b/contrib/openpam/doc/man/pam_vprompt.3 @@ -31,9 +31,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $P4: //depot/projects/openpam/doc/man/pam_vprompt.3#9 $ +.\" $P4: //depot/projects/openpam/doc/man/pam_vprompt.3#10 $ .\" -.Dd April 14, 2002 +.Dd May 2, 2002 .Dt PAM_VPROMPT 3 .Os .Sh NAME diff --git a/contrib/openpam/include/security/openpam.h b/contrib/openpam/include/security/openpam.h index 0efa8cb09e97..e7bd8cb7d2b6 100644 --- a/contrib/openpam/include/security/openpam.h +++ b/contrib/openpam/include/security/openpam.h @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/include/security/openpam.h#18 $ + * $P4: //depot/projects/openpam/include/security/openpam.h#19 $ */ #ifndef _SECURITY_OPENPAM_H_INCLUDED @@ -163,6 +163,14 @@ int openpam_ttyconv(int _n, struct pam_response **_resp, void *_data); +/* + * Null conversation function + */ +int openpam_nullconv(int _n, + const struct pam_message **_msg, + struct pam_response **_resp, + void *_data); + /* * PAM primitives */ diff --git a/contrib/openpam/lib/Makefile b/contrib/openpam/lib/Makefile index eb7f2424e28c..8549d8efaf5d 100644 --- a/contrib/openpam/lib/Makefile +++ b/contrib/openpam/lib/Makefile @@ -31,7 +31,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $P4: //depot/projects/openpam/lib/Makefile#14 $ +# $P4: //depot/projects/openpam/lib/Makefile#15 $ # LIB = pam @@ -53,6 +53,7 @@ SRCS += openpam_free_data.c SRCS += openpam_get_option.c SRCS += openpam_load.c SRCS += openpam_log.c +SRCS += openpam_nullconv.c SRCS += openpam_restore_cred.c SRCS += openpam_set_option.c SRCS += openpam_static.c diff --git a/contrib/openpam/lib/openpam_configure.c b/contrib/openpam/lib/openpam_configure.c index 8c12e10b71d7..a66f8239b76a 100644 --- a/contrib/openpam/lib/openpam_configure.c +++ b/contrib/openpam/lib/openpam_configure.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/openpam_configure.c#1 $ + * $P4: //depot/projects/openpam/lib/openpam_configure.c#2 $ */ #include @@ -50,7 +50,7 @@ #define MAX_OPTIONS 256 static int -openpam_read_policy_file(pam_handle_t *pamh, +openpam_read_policy_file(pam_chain_t *policy[], const char *service, const char *filename, int style) @@ -186,7 +186,7 @@ openpam_read_policy_file(pam_handle_t *pamh, * Finally, add the module at the end of the * appropriate chain and bump the counter. */ - r = openpam_add_module(pamh, chain, flag, p, optc, optv); + r = openpam_add_module(policy, chain, flag, p, optc, optv); if (r != PAM_SUCCESS) return (-r); ++n; @@ -214,14 +214,8 @@ static const char *openpam_policy_path[] = { NULL }; -/* - * OpenPAM internal - * - * Configure a service - */ - -int -openpam_configure(pam_handle_t *pamh, +static int +openpam_load_policy(pam_chain_t *policy[], const char *service) { const char **path; @@ -235,24 +229,62 @@ openpam_configure(pam_handle_t *pamh, filename = malloc(len + strlen(service) + 1); if (filename == NULL) { openpam_log(PAM_LOG_ERROR, "malloc(): %m"); - return (PAM_BUF_ERR); + return (-PAM_BUF_ERR); } strcpy(filename, *path); strcat(filename, service); - r = openpam_read_policy_file(pamh, + r = openpam_read_policy_file(policy, service, filename, PAM_D_STYLE); free(filename); } else { - r = openpam_read_policy_file(pamh, + r = openpam_read_policy_file(policy, service, *path, PAM_CONF_STYLE); } - if (r < 0) - return (-r); - if (r > 0) - return (PAM_SUCCESS); + if (r != 0) + return (r); } - return (PAM_SYSTEM_ERR); + return (0); +} + +/* + * OpenPAM internal + * + * Configure a service + */ + +int +openpam_configure(pam_handle_t *pamh, + const char *service) +{ + pam_chain_t *other[PAM_NUM_CHAINS]; + int i, n, r; + + /* try own configuration first */ + r = openpam_load_policy(pamh->chains, service); + if (r < 0) + return (-r); + for (i = n = 0; i < PAM_NUM_CHAINS; ++i) { + if (pamh->chains[i] != NULL) + ++n; + } + if (n == PAM_NUM_CHAINS) + return (PAM_SUCCESS); + + /* fill in the blanks with "other" */ + openpam_load_policy(other, PAM_OTHER); + if (r < 0) + return (-r); + for (i = n = 0; i < PAM_NUM_CHAINS; ++i) { + if (pamh->chains[i] == NULL) { + pamh->chains[i] = other[i]; + other[i] = NULL; + } + if (pamh->chains[i] != NULL) + ++n; + } + openpam_clear_chains(other); + return (n > 0 ? PAM_SUCCESS : PAM_SYSTEM_ERR); } /* diff --git a/contrib/openpam/lib/openpam_dynamic.c b/contrib/openpam/lib/openpam_dynamic.c index d7e05b8c953d..e012a496b5ec 100644 --- a/contrib/openpam/lib/openpam_dynamic.c +++ b/contrib/openpam/lib/openpam_dynamic.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#4 $ + * $P4: //depot/projects/openpam/lib/openpam_dynamic.c#5 $ */ #include @@ -80,7 +80,7 @@ openpam_dynamic(const char *path) module->func[i] = dlsym(dlh, _pam_sm_func_name[i]); if (module->func[i] == NULL) openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s", - vpath, _pam_sm_func_name[i], dlerror()); + path, _pam_sm_func_name[i], dlerror()); } return (module); buf_err: diff --git a/contrib/openpam/lib/openpam_impl.h b/contrib/openpam/lib/openpam_impl.h index 1fc018472f02..446af169c555 100644 --- a/contrib/openpam/lib/openpam_impl.h +++ b/contrib/openpam/lib/openpam_impl.h @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/openpam_impl.h#13 $ + * $P4: //depot/projects/openpam/lib/openpam_impl.h#14 $ */ #ifndef _OPENPAM_IMPL_H_INCLUDED @@ -108,9 +108,9 @@ struct pam_saved_cred { int openpam_configure(pam_handle_t *, const char *); int openpam_dispatch(pam_handle_t *, int, int); int openpam_findenv(pam_handle_t *, const char *, size_t); -int openpam_add_module(pam_handle_t *, int, int, +int openpam_add_module(pam_chain_t **, int, int, const char *, int, const char **); -void openpam_clear_chains(pam_handle_t *); +void openpam_clear_chains(pam_chain_t **); #ifdef OPENPAM_STATIC_MODULES pam_module_t *openpam_static(const char *); diff --git a/contrib/openpam/lib/openpam_load.c b/contrib/openpam/lib/openpam_load.c index 2b88087dac35..abbc491ec67e 100644 --- a/contrib/openpam/lib/openpam_load.c +++ b/contrib/openpam/lib/openpam_load.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/openpam_load.c#12 $ + * $P4: //depot/projects/openpam/lib/openpam_load.c#13 $ */ #include @@ -156,7 +156,7 @@ openpam_destroy_chain(pam_chain_t *chain) */ int -openpam_add_module(pam_handle_t *pamh, +openpam_add_module(pam_chain_t *policy[], int chain, int flag, const char *modpath, @@ -178,12 +178,12 @@ openpam_add_module(pam_handle_t *pamh, openpam_destroy_chain(new); return (PAM_OPEN_ERR); } - if ((iterator = pamh->chains[chain]) != NULL) { + if ((iterator = policy[chain]) != NULL) { while (iterator->next != NULL) iterator = iterator->next; iterator->next = new; } else { - pamh->chains[chain] = new; + policy[chain] = new; } return (PAM_SUCCESS); @@ -199,12 +199,12 @@ openpam_add_module(pam_handle_t *pamh, */ void -openpam_clear_chains(pam_handle_t *pamh) +openpam_clear_chains(pam_chain_t *policy[]) { int i; for (i = 0; i < PAM_NUM_CHAINS; ++i) - openpam_destroy_chain(pamh->chains[i]); + openpam_destroy_chain(policy[i]); } /* diff --git a/contrib/openpam/lib/openpam_nullconv.c b/contrib/openpam/lib/openpam_nullconv.c new file mode 100644 index 000000000000..6534c11fd89d --- /dev/null +++ b/contrib/openpam/lib/openpam_nullconv.c @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2002 Networks Associates Technology, Inc. + * All rights reserved. + * + * This software was developed for the FreeBSD Project by ThinkSec AS and + * NAI Labs, 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. + * + * $P4: //depot/projects/openpam/lib/openpam_nullconv.c#1 $ + */ + +#include + +#include +#include + +/* + * OpenPAM extension + * + * Null conversation function + */ + +int +openpam_nullconv(int n, + const struct pam_message **msg, + struct pam_response **resp, + void *data) +{ + + (void)n; + (void)msg; + (void)resp; + (void)data; + return (PAM_CONV_ERR); +} + +/* + * NOLIST + * + * Error codes: + * + * PAM_CONV_ERR + */ diff --git a/contrib/openpam/lib/pam_end.c b/contrib/openpam/lib/pam_end.c index 21d5a1afb440..8fb9c295f313 100644 --- a/contrib/openpam/lib/pam_end.c +++ b/contrib/openpam/lib/pam_end.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/pam_end.c#8 $ + * $P4: //depot/projects/openpam/lib/pam_end.c#9 $ */ #include @@ -72,7 +72,7 @@ pam_end(pam_handle_t *pamh, free(pamh->env); /* clear chains */ - openpam_clear_chains(pamh); + openpam_clear_chains(pamh->chains); /* clear items */ for (i = 0; i < PAM_NUM_ITEMS; ++i) diff --git a/contrib/openpam/lib/pam_get_authtok.c b/contrib/openpam/lib/pam_get_authtok.c index 5719d697f50e..8a447c3a32d6 100644 --- a/contrib/openpam/lib/pam_get_authtok.c +++ b/contrib/openpam/lib/pam_get_authtok.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/pam_get_authtok.c#16 $ + * $P4: //depot/projects/openpam/lib/pam_get_authtok.c#17 $ */ #include @@ -145,10 +145,10 @@ pam_get_authtok(pam_handle_t *pamh, * * The =item argument must have one of the following values: * - * =PAM_AUTHTOK + * =PAM_AUTHTOK: * Returns the current authentication token, or the new token * when changing authentication tokens. - * =PAM_OLDAUTHTOK + * =PAM_OLDAUTHTOK: * Returns the previous authentication token when changing * authentication tokens. * diff --git a/contrib/openpam/lib/pam_start.c b/contrib/openpam/lib/pam_start.c index 49976b4194d4..c1b301d4f773 100644 --- a/contrib/openpam/lib/pam_start.c +++ b/contrib/openpam/lib/pam_start.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/openpam/lib/pam_start.c#13 $ + * $P4: //depot/projects/openpam/lib/pam_start.c#14 $ */ #include @@ -66,8 +66,6 @@ pam_start(const char *service, goto fail; r = openpam_configure(ph, service); - if (r != PAM_SUCCESS && r != PAM_BUF_ERR) - r = openpam_configure(ph, PAM_OTHER); if (r != PAM_SUCCESS) goto fail; diff --git a/contrib/openpam/misc/gendoc.pl b/contrib/openpam/misc/gendoc.pl index 60c710c0b09c..e2501e3cd5f9 100644 --- a/contrib/openpam/misc/gendoc.pl +++ b/contrib/openpam/misc/gendoc.pl @@ -32,7 +32,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $P4: //depot/projects/openpam/misc/gendoc.pl#10 $ +# $P4: //depot/projects/openpam/misc/gendoc.pl#13 $ # use strict; @@ -139,6 +139,7 @@ sub parse_source($) { $argnames =~ s/([\|\[\]\(\)\.\*\+\?])/\\$1/g; $argnames =~ s/\" \"/|/g; $argnames =~ s/^\"(.*)\"$/($1)/; + $inliteral = $inlist = 0; foreach (split("\n", $source)) { s/\s*$//; if (!defined($man)) { @@ -185,7 +186,7 @@ sub parse_source($) { $inlist = 0; } elsif ($inliteral && m/^\S/) { $man .= ".Ed\n"; - $inlist = 0; + $inliteral = 0; } elsif ($inliteral) { $man .= "$_\n"; next; @@ -211,10 +212,17 @@ sub parse_source($) { $man .= "$_\n"; } if (defined($man)) { + if ($inlist) { + $man .= ".El\n"; + } + if ($inliteral) { + $man .= ".Ed\n"; + } $man =~ s/(\n\.[A-Z][a-z] [\w ]+)\n([\.,:;-]\S*)\s*/$1 $2\n/gs; $man =~ s/\s*$/\n/gm; $man =~ s/\n+/\n/gs; $man =~ s/\0//gs; + $man =~ s/\n\n\./\n\./gs; chomp($man); } else { $man = "No description available."; @@ -307,6 +315,9 @@ sub gendoc($) { if ($func->{'name'} =~ m/_sm_/) { $mdoc .= ".In security/pam_modules.h\n" } + if ($func->{'name'} =~ m/openpam/) { + $mdoc .= ".In security/openpam.h\n" + } $mdoc .= ".Ft $func->{'type'} .Fn $func->{'name'} $func->{'args'} .Sh DESCRIPTION @@ -366,10 +377,12 @@ as part of the DARPA CHATS research program. "; $fn = "$func->{'name'}.3"; - sysopen(FILE, $fn, O_RDWR|O_CREAT|O_TRUNC) - or die("$fn: open(): $!\n"); - print(FILE $mdoc); - close(FILE); + if (sysopen(FILE, $fn, O_RDWR|O_CREAT|O_TRUNC)) { + print(FILE $mdoc); + close(FILE); + } else { + warn("$fn: open(): $!\n"); + } } sub gensummary() {