From: Joerg Sonnenberger Date: Fri, 8 Jul 2005 15:42:01 +0000 (+0000) Subject: Build the PAM modules under lib/pam_module, since they are not X-Git-Tag: v2.0.1~6657 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/d800bad324d418b44503dbeceea493fda637be8f Build the PAM modules under lib/pam_module, since they are not directly related to libpam, other than using it. Use versioned module names and install them under /usr/lib/security. Copy pam_cleartext_pass_ok.c from lib/libpam/modules/pam_cleartext_pass_ok. --- diff --git a/lib/pam_module/Makefile b/lib/pam_module/Makefile new file mode 100644 index 0000000000..e3cbad004c --- /dev/null +++ b/lib/pam_module/Makefile @@ -0,0 +1,5 @@ +# $DragonFly: src/lib/pam_module/Makefile,v 1.1 2005/07/08 15:42:01 joerg Exp $ + +SUBDIR= pam_cleartext_pass_ok pam_deny pam_permit pam_unix + +.include diff --git a/lib/pam_module/Makefile.inc b/lib/pam_module/Makefile.inc new file mode 100644 index 0000000000..02161cf32a --- /dev/null +++ b/lib/pam_module/Makefile.inc @@ -0,0 +1,15 @@ +# $DragonFly: src/lib/pam_module/Makefile.inc,v 1.1 2005/07/08 15:42:01 joerg Exp $ + +SHLIB_NAME= ${LIB}.so.${MODULE_SHLIB_MAJOR} +SHLIB_MAJOR= ${MODULE_SHLIB_MAJOR} +NOINSTALLLIB= yes +NOPROFILE= yes + +LIBDIR= /usr/lib/security + +LDADD+= -lpam +DPADD+= ${LIBPAM} + +OPENPAM_DIR= ${.CURDIR}/../../../contrib/openpam + +.include "Makefile.shlib" diff --git a/lib/pam_module/Makefile.shlib b/lib/pam_module/Makefile.shlib new file mode 100644 index 0000000000..c9e448c5bd --- /dev/null +++ b/lib/pam_module/Makefile.shlib @@ -0,0 +1,3 @@ +# $DragonFly: src/lib/pam_module/Makefile.shlib,v 1.1 2005/07/08 15:42:01 joerg Exp $ + +MODULE_SHLIB_MAJOR= 1 \ No newline at end of file diff --git a/lib/pam_module/pam_cleartext_pass_ok/Makefile b/lib/pam_module/pam_cleartext_pass_ok/Makefile new file mode 100644 index 0000000000..23148be672 --- /dev/null +++ b/lib/pam_module/pam_cleartext_pass_ok/Makefile @@ -0,0 +1,12 @@ +# $DragonFly: src/lib/pam_module/pam_cleartext_pass_ok/Makefile,v 1.1 2005/07/08 15:42:01 joerg Exp $ + +LIB= pam_cleartext_pass_ok +SRCS= pam_cleartext_pass_ok.c +WARNS?= 6 +WARNS_NO_UNUSED_PARAMETERS= +NOMAN= + +DPADD= ${LIBSKEY} +LDADD= -lskey + +.include diff --git a/lib/pam_module/pam_cleartext_pass_ok/pam_cleartext_pass_ok.c b/lib/pam_module/pam_cleartext_pass_ok/pam_cleartext_pass_ok.c new file mode 100644 index 0000000000..ca9f4359eb --- /dev/null +++ b/lib/pam_module/pam_cleartext_pass_ok/pam_cleartext_pass_ok.c @@ -0,0 +1,69 @@ +/*- + * Copyright 1998 Juniper Networks, Inc. + * All rights reserved. + * + * 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. + * + * 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. + * + * $FreeBSD: src/lib/libpam/modules/pam_cleartext_pass_ok/pam_cleartext_pass_ok.c,v 1.2 1999/01/20 21:55:24 jdp Exp $ + * $DragonFly: src/lib/pam_module/pam_cleartext_pass_ok/pam_cleartext_pass_ok.c,v 1.1 2005/07/08 15:42:01 joerg Exp $ + */ + +#include +#include + +#define PAM_SM_AUTH +#include +#include + +PAM_EXTERN int +pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, + const char **argv) +{ + int retval; + const void *item; + const char *user; + const char *tty; + const char *rhost; + + if ((retval = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS) + return retval; + if ((retval = pam_get_item(pamh, PAM_TTY, &item)) != PAM_SUCCESS) + return retval; + tty = (const char *)item; + if ((retval = pam_get_item(pamh, PAM_RHOST, &item)) != PAM_SUCCESS) + return retval; + rhost = (const char *)item; + /* + * The cast in the next statement is necessary only because the + * declaration of skeyaccess is wrong. + */ + return skeyaccess(__DECONST(char *, user), tty, rhost, NULL) ? + PAM_SUCCESS : PAM_AUTH_ERR; +} + +PAM_EXTERN int +pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv) +{ + return PAM_SUCCESS; +} + +PAM_MODULE_ENTRY("pam_cleartext_pass_ok"); diff --git a/lib/pam_module/pam_deny/Makefile b/lib/pam_module/pam_deny/Makefile new file mode 100644 index 0000000000..7ed36bd9df --- /dev/null +++ b/lib/pam_module/pam_deny/Makefile @@ -0,0 +1,10 @@ +# $DragonFly: src/lib/pam_module/pam_deny/Makefile,v 1.1 2005/07/08 15:42:01 joerg Exp $ + +LIB= pam_deny +SRCS= pam_deny.c +WARNS?= 6 +WARNS_NO_UNUSED_PARAMETERS= + +.include + +.PATH: ${OPENPAM_DIR}/modules/pam_deny diff --git a/lib/pam_module/pam_permit/Makefile b/lib/pam_module/pam_permit/Makefile new file mode 100644 index 0000000000..f2389151d8 --- /dev/null +++ b/lib/pam_module/pam_permit/Makefile @@ -0,0 +1,10 @@ +# $DragonFly: src/lib/pam_module/pam_permit/Makefile,v 1.1 2005/07/08 15:42:01 joerg Exp $ + +LIB= pam_permit +SRCS= pam_permit.c +WARNS?= 2 +WARNS_NO_UNUSED_PARAMETERS= + +.include + +.PATH: ${OPENPAM_DIR}/modules/pam_permit diff --git a/lib/pam_module/pam_unix/Makefile b/lib/pam_module/pam_unix/Makefile new file mode 100644 index 0000000000..94502fdb6e --- /dev/null +++ b/lib/pam_module/pam_unix/Makefile @@ -0,0 +1,13 @@ +# $DragonFly: src/lib/pam_module/pam_unix/Makefile,v 1.1 2005/07/08 15:42:01 joerg Exp $ + +LIB= pam_unix +SRCS= pam_unix.c +WARNS?= 2 +WARNS_NO_UNUSED_PARAMETERS= + +LDADD= -lcrypt +DPADD= ${LIBCRYPT} + +.include + +.PATH: ${OPENPAM_DIR}/modules/pam_unix