Build the PAM modules under lib/pam_module, since they are not
authorJoerg Sonnenberger <joerg@dragonflybsd.org>
Fri, 8 Jul 2005 15:42:01 +0000 (15:42 +0000)
committerJoerg Sonnenberger <joerg@dragonflybsd.org>
Fri, 8 Jul 2005 15:42:01 +0000 (15:42 +0000)
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.

lib/pam_module/Makefile [new file with mode: 0644]
lib/pam_module/Makefile.inc [new file with mode: 0644]
lib/pam_module/Makefile.shlib [new file with mode: 0644]
lib/pam_module/pam_cleartext_pass_ok/Makefile [new file with mode: 0644]
lib/pam_module/pam_cleartext_pass_ok/pam_cleartext_pass_ok.c [new file with mode: 0644]
lib/pam_module/pam_deny/Makefile [new file with mode: 0644]
lib/pam_module/pam_permit/Makefile [new file with mode: 0644]
lib/pam_module/pam_unix/Makefile [new file with mode: 0644]

diff --git a/lib/pam_module/Makefile b/lib/pam_module/Makefile
new file mode 100644 (file)
index 0000000..e3cbad0
--- /dev/null
@@ -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 <bsd.subdir.mk>
diff --git a/lib/pam_module/Makefile.inc b/lib/pam_module/Makefile.inc
new file mode 100644 (file)
index 0000000..02161cf
--- /dev/null
@@ -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 (file)
index 0000000..c9e448c
--- /dev/null
@@ -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 (file)
index 0000000..23148be
--- /dev/null
@@ -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 <bsd.lib.mk>
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 (file)
index 0000000..ca9f435
--- /dev/null
@@ -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 <stdio.h>
+#include <skey.h>
+
+#define PAM_SM_AUTH
+#include <security/pam_appl.h>
+#include <security/pam_modules.h>
+
+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 (file)
index 0000000..7ed36bd
--- /dev/null
@@ -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 <bsd.lib.mk>
+
+.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 (file)
index 0000000..f238915
--- /dev/null
@@ -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 <bsd.lib.mk>
+
+.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 (file)
index 0000000..94502fd
--- /dev/null
@@ -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 <bsd.lib.mk>
+
+.PATH: ${OPENPAM_DIR}/modules/pam_unix