summaryrefslogtreecommitdiffstats
path: root/contrib/openpam/modules
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-06-30 21:30:05 +0000
committerdes <des@FreeBSD.org>2002-06-30 21:30:05 +0000
commitcb0022693cf46a76bd076baf9798db6247f14231 (patch)
tree2c63cca871bbf88cf51089438f4c6f0ced34d4ee /contrib/openpam/modules
parent658709f5bc0aa7ef8c87276699c29189ed3948cc (diff)
downloadFreeBSD-src-cb0022693cf46a76bd076baf9798db6247f14231.zip
FreeBSD-src-cb0022693cf46a76bd076baf9798db6247f14231.tar.gz
Vendor import of OpenPAM Citronella.
Diffstat (limited to 'contrib/openpam/modules')
-rw-r--r--contrib/openpam/modules/Makefile9
-rw-r--r--contrib/openpam/modules/pam_deny/Makefile8
-rw-r--r--contrib/openpam/modules/pam_deny/pam_deny.c8
-rw-r--r--contrib/openpam/modules/pam_dummy/Makefile8
-rw-r--r--contrib/openpam/modules/pam_dummy/pam_dummy.c8
-rw-r--r--contrib/openpam/modules/pam_permit/Makefile8
-rw-r--r--contrib/openpam/modules/pam_permit/pam_permit.c8
-rw-r--r--contrib/openpam/modules/pam_unix/Makefile44
-rw-r--r--contrib/openpam/modules/pam_unix/pam_unix.c163
9 files changed, 236 insertions, 28 deletions
diff --git a/contrib/openpam/modules/Makefile b/contrib/openpam/modules/Makefile
index ef49c2d..e14652b 100644
--- a/contrib/openpam/modules/Makefile
+++ b/contrib/openpam/modules/Makefile
@@ -3,9 +3,9 @@
# 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.
+# 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
@@ -31,12 +31,13 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $P4: //depot/projects/openpam/modules/Makefile#5 $
+# $P4: //depot/projects/openpam/modules/Makefile#7 $
#
SUBDIR =
SUBDIR += pam_deny
SUBDIR += pam_dummy
SUBDIR += pam_permit
+SUBDIR += pam_unix
.include <bsd.subdir.mk>
diff --git a/contrib/openpam/modules/pam_deny/Makefile b/contrib/openpam/modules/pam_deny/Makefile
index 2a160e8..502fc8b 100644
--- a/contrib/openpam/modules/pam_deny/Makefile
+++ b/contrib/openpam/modules/pam_deny/Makefile
@@ -3,9 +3,9 @@
# 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.
+# 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
@@ -31,7 +31,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $P4: //depot/projects/openpam/modules/pam_deny/Makefile#4 $
+# $P4: //depot/projects/openpam/modules/pam_deny/Makefile#5 $
#
LIB = pam_deny
diff --git a/contrib/openpam/modules/pam_deny/pam_deny.c b/contrib/openpam/modules/pam_deny/pam_deny.c
index 9ee3a5a..1f83ca5 100644
--- a/contrib/openpam/modules/pam_deny/pam_deny.c
+++ b/contrib/openpam/modules/pam_deny/pam_deny.c
@@ -3,9 +3,9 @@
* 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.
+ * 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
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/openpam/modules/pam_deny/pam_deny.c#6 $
+ * $P4: //depot/projects/openpam/modules/pam_deny/pam_deny.c#7 $
*/
#include <sys/param.h>
diff --git a/contrib/openpam/modules/pam_dummy/Makefile b/contrib/openpam/modules/pam_dummy/Makefile
index 76d4c98..9032408 100644
--- a/contrib/openpam/modules/pam_dummy/Makefile
+++ b/contrib/openpam/modules/pam_dummy/Makefile
@@ -3,9 +3,9 @@
# 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.
+# 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
@@ -31,7 +31,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $P4: //depot/projects/openpam/modules/pam_dummy/Makefile#3 $
+# $P4: //depot/projects/openpam/modules/pam_dummy/Makefile#4 $
#
LIB = pam_dummy
diff --git a/contrib/openpam/modules/pam_dummy/pam_dummy.c b/contrib/openpam/modules/pam_dummy/pam_dummy.c
index a83f2b9..61b03f3 100644
--- a/contrib/openpam/modules/pam_dummy/pam_dummy.c
+++ b/contrib/openpam/modules/pam_dummy/pam_dummy.c
@@ -3,9 +3,9 @@
* 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.
+ * 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
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/openpam/modules/pam_dummy/pam_dummy.c#4 $
+ * $P4: //depot/projects/openpam/modules/pam_dummy/pam_dummy.c#5 $
*/
#include <sys/param.h>
diff --git a/contrib/openpam/modules/pam_permit/Makefile b/contrib/openpam/modules/pam_permit/Makefile
index b265f52..08038c4 100644
--- a/contrib/openpam/modules/pam_permit/Makefile
+++ b/contrib/openpam/modules/pam_permit/Makefile
@@ -3,9 +3,9 @@
# 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.
+# 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
@@ -31,7 +31,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $P4: //depot/projects/openpam/modules/pam_permit/Makefile#4 $
+# $P4: //depot/projects/openpam/modules/pam_permit/Makefile#5 $
#
LIB = pam_permit
diff --git a/contrib/openpam/modules/pam_permit/pam_permit.c b/contrib/openpam/modules/pam_permit/pam_permit.c
index ad7e56c..2a974e7 100644
--- a/contrib/openpam/modules/pam_permit/pam_permit.c
+++ b/contrib/openpam/modules/pam_permit/pam_permit.c
@@ -3,9 +3,9 @@
* 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.
+ * 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
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/openpam/modules/pam_permit/pam_permit.c#6 $
+ * $P4: //depot/projects/openpam/modules/pam_permit/pam_permit.c#7 $
*/
#include <sys/param.h>
diff --git a/contrib/openpam/modules/pam_unix/Makefile b/contrib/openpam/modules/pam_unix/Makefile
new file mode 100644
index 0000000..0352b32
--- /dev/null
+++ b/contrib/openpam/modules/pam_unix/Makefile
@@ -0,0 +1,44 @@
+#-
+# Copyright (c) 2002 Networks Associates Technology, Inc.
+# 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.
+#
+# $P4: //depot/projects/openpam/modules/pam_unix/Makefile#2 $
+#
+
+LIB = pam_unix
+SHLIB_NAME = pam_unix.so
+SRCS = pam_unix.c
+CFLAGS += -I${.CURDIR}/../../include
+DPADD = ${LIBCRYPT}
+LDADD = -lcrypt
+
+.include <bsd.lib.mk>
diff --git a/contrib/openpam/modules/pam_unix/pam_unix.c b/contrib/openpam/modules/pam_unix/pam_unix.c
new file mode 100644
index 0000000..7d25d8a
--- /dev/null
+++ b/contrib/openpam/modules/pam_unix/pam_unix.c
@@ -0,0 +1,163 @@
+/*-
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * 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.
+ *
+ * $P4: //depot/projects/openpam/modules/pam_unix/pam_unix.c#2 $
+ */
+
+#include <sys/param.h>
+
+#include <pwd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <security/pam_modules.h>
+
+#ifndef _OPENPAM
+static char password_prompt[] = "Password:";
+#endif
+
+#ifndef PAM_EXTERN
+#define PAM_EXTERN
+#endif
+
+PAM_EXTERN int
+pam_sm_authenticate(pam_handle_t *pamh, int flags,
+ int argc, const char *argv[])
+{
+#ifndef _OPENPAM
+ struct pam_conv *conv;
+ struct pam_message msg;
+ const struct pam_message *msgp;
+ struct pam_response *resp;
+#endif
+ struct passwd *pwd;
+ const char *user;
+ char *crypt_password, *password;
+ int pam_err, retry;
+
+ /* identify user */
+ if ((pam_err = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS)
+ return (pam_err);
+ if ((pwd = getpwnam(user)) == NULL)
+ return (PAM_USER_UNKNOWN);
+
+ /* get password */
+#ifndef _OPENPAM
+ pam_err = pam_get_item(pamh, PAM_CONV, (const void **)&conv);
+ if (pam_err != PAM_SUCCESS)
+ return (PAM_SYSTEM_ERR);
+ msg.msg_style = PAM_PROMPT_ECHO_OFF;
+ msg.msg = password_prompt;
+ msgp = &msg;
+#endif
+ for (retry = 0; retry < 3; ++retry) {
+#ifdef _OPENPAM
+ pam_err = pam_get_authtok(pamh, PAM_AUTHTOK,
+ (const char **)&password, NULL);
+#else
+ resp = NULL;
+ pam_err = (*conv->conv)(1, &msgp, &resp, conv->appdata_ptr);
+ if (resp != NULL) {
+ if (pam_err == PAM_SUCCESS)
+ password = resp->resp;
+ else
+ free(resp->resp);
+ free(resp);
+ }
+#endif
+ if (pam_err == PAM_SUCCESS)
+ break;
+ }
+ if (pam_err == PAM_CONV_ERR)
+ return (pam_err);
+ if (pam_err != PAM_SUCCESS)
+ return (PAM_AUTH_ERR);
+
+ /* compare passwords */
+ if ((!pwd->pw_passwd[0] && (flags & PAM_DISALLOW_NULL_AUTHTOK)) ||
+ (crypt_password = crypt(password, pwd->pw_passwd)) == NULL ||
+ strcmp(crypt_password, pwd->pw_passwd) != 0)
+ pam_err = PAM_AUTH_ERR;
+ else
+ pam_err = PAM_SUCCESS;
+#ifndef _OPENPAM
+ free(password);
+#endif
+ return (pam_err);
+}
+
+PAM_EXTERN int
+pam_sm_setcred(pam_handle_t *pamh, int flags,
+ int argc, const char *argv[])
+{
+
+ return (PAM_SUCCESS);
+}
+
+PAM_EXTERN int
+pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
+ int argc, const char *argv[])
+{
+
+ return (PAM_SUCCESS);
+}
+
+PAM_EXTERN int
+pam_sm_open_session(pam_handle_t *pamh, int flags,
+ int argc, const char *argv[])
+{
+
+ return (PAM_SUCCESS);
+}
+
+PAM_EXTERN int
+pam_sm_close_session(pam_handle_t *pamh, int flags,
+ int argc, const char *argv[])
+{
+
+ return (PAM_SUCCESS);
+}
+
+PAM_EXTERN int
+pam_sm_chauthtok(pam_handle_t *pamh, int flags,
+ int argc, const char *argv[])
+{
+
+ return (PAM_SERVICE_ERR);
+}
+
+#ifdef PAM_MODULE_ENTRY
+PAM_MODULE_ENTRY("pam_unix");
+#endif
OpenPOWER on IntegriCloud