diff options
Diffstat (limited to 'modules/pam_shells')
-rw-r--r-- | modules/pam_shells/.cvsignore | 8 | ||||
-rw-r--r-- | modules/pam_shells/Makefile.am | 31 | ||||
-rw-r--r-- | modules/pam_shells/README.xml | 41 | ||||
-rw-r--r-- | modules/pam_shells/pam_shells.8.xml | 117 | ||||
-rw-r--r-- | modules/pam_shells/pam_shells.c | 146 | ||||
-rwxr-xr-x | modules/pam_shells/tst-pam_shells | 2 |
6 files changed, 0 insertions, 345 deletions
diff --git a/modules/pam_shells/.cvsignore b/modules/pam_shells/.cvsignore deleted file mode 100644 index f86c33b1..00000000 --- a/modules/pam_shells/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.la -*.lo -.deps -.libs -Makefile -Makefile.in -README -pam_shells.8 diff --git a/modules/pam_shells/Makefile.am b/modules/pam_shells/Makefile.am deleted file mode 100644 index 543e01b4..00000000 --- a/modules/pam_shells/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de> -# - -CLEANFILES = *~ - -EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_shells - -man_MANS = pam_shells.8 -XMLS = README.xml pam_shells.8.xml - -TESTS = tst-pam_shells - -securelibdir = $(SECUREDIR) -secureconfdir = $(SCONFIGDIR) - -AM_CFLAGS = -I$(top_srcdir)/libpam/include -I$(top_srcdir)/libpamc/include -AM_LDFLAGS = -no-undefined -avoid-version -module -if HAVE_VERSIONING - AM_LDFLAGS += -Wl,--version-script=$(srcdir)/../modules.map -endif - -securelib_LTLIBRARIES = pam_shells.la -pam_shells_la_LIBADD = -L$(top_builddir)/libpam -lpam - -if ENABLE_REGENERATE_MAN -noinst_DATA = README -README: pam_shells.8.xml --include $(top_srcdir)/Make.xml.rules -endif - diff --git a/modules/pam_shells/README.xml b/modules/pam_shells/README.xml deleted file mode 100644 index 154b97b5..00000000 --- a/modules/pam_shells/README.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding='UTF-8'?> -<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" -"http://www.docbook.org/xml/4.3/docbookx.dtd" -[ -<!-- -<!ENTITY pamaccess SYSTEM "pam_shells.8.xml"> ---> -]> - -<article> - - <articleinfo> - - <title> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="pam_shells.8.xml" xpointer='xpointer(//refnamediv[@id = "pam_shells-name"]/*)'/> - </title> - - </articleinfo> - - <section> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="pam_shells.8.xml" xpointer='xpointer(//refsect1[@id = "pam_shells-description"]/*)'/> - </section> - - <section> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="pam_shells.8.xml" xpointer='xpointer(//refsect1[@id = "pam_shells-options"]/*)'/> - </section> - - <section> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="pam_shells.8.xml" xpointer='xpointer(//refsect1[@id = "pam_shells-examples"]/*)'/> - </section> - - <section> - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="pam_shells.8.xml" xpointer='xpointer(//refsect1[@id = "pam_shells-author"]/*)'/> - </section> - -</article> diff --git a/modules/pam_shells/pam_shells.8.xml b/modules/pam_shells/pam_shells.8.xml deleted file mode 100644 index abbd5cbd..00000000 --- a/modules/pam_shells/pam_shells.8.xml +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding='UTF-8'?> -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" - "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> - -<refentry id="pam_shells"> - - <refmeta> - <refentrytitle>pam_shells</refentrytitle> - <manvolnum>8</manvolnum> - <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo> - </refmeta> - - <refnamediv id="pam_shells-name"> - <refname>pam_shells</refname> - <refpurpose>PAM module to check for valid login shell</refpurpose> - </refnamediv> - - <refsynopsisdiv> - <cmdsynopsis id="pam_shells-cmdsynopsis"> - <command>pam_shells.so</command> - </cmdsynopsis> - </refsynopsisdiv> - - <refsect1 id="pam_shells-description"> - - <title>DESCRIPTION</title> - - <para> - pam_shells is a PAM module that only allows access to the - system if the users shell is listed in <filename>/etc/shells</filename>. - </para> - <para> - It also checks if <filename>/etc/shells</filename> is a plain - file and not world writable. - </para> - </refsect1> - - <refsect1 id="pam_shells-options"> - - <title>OPTIONS</title> - <para> This module does not recognise any options.</para> - </refsect1> - - <refsect1 id="pam_shells-services"> - <title>MODULE SERVICES PROVIDED</title> - <para> - The services <option>auth</option> and <option>account</option> - are supported. - </para> - </refsect1> - - <refsect1 id='pam_shells-return_values'> - <title>RETURN VALUES</title> - <variablelist> - <varlistentry> - <term>PAM_AUTH_ERR</term> - <listitem> - <para> - Access to the system was denied. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term>PAM_SUCCESS</term> - <listitem> - <para> - The users login shell was listed as valid shell in - <filename>/etc/shells</filename>. - </para> - </listitem> - </varlistentry> - <varlistentry> - <term>PAM_SERVICE_ERR</term> - <listitem> - <para> - The module was not able to get the name of the user. - </para> - </listitem> - </varlistentry> - </variablelist> - </refsect1> - - <refsect1 id='pam_shells-examples'> - <title>EXAMPLES</title> - <para> - <programlisting> -auth required pam_shells.so - </programlisting> - </para> - </refsect1> - - <refsect1 id='pam_shells-see_also'> - <title>SEE ALSO</title> - <para> - <citerefentry> - <refentrytitle>shells</refentrytitle><manvolnum>5</manvolnum> - </citerefentry>, - <citerefentry> - <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum> - </citerefentry>, - <citerefentry> - <refentrytitle>pam.d</refentrytitle><manvolnum>8</manvolnum> - </citerefentry>, - <citerefentry> - <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum> - </citerefentry> - </para> - </refsect1> - - <refsect1 id='pam_shells-author'> - <title>AUTHOR</title> - <para> - pam_shells was written by Erik Troan <ewt@redhat.com>. - </para> - </refsect1> - -</refentry> diff --git a/modules/pam_shells/pam_shells.c b/modules/pam_shells/pam_shells.c deleted file mode 100644 index 89fc297e..00000000 --- a/modules/pam_shells/pam_shells.c +++ /dev/null @@ -1,146 +0,0 @@ -/* pam_shells module */ - -#define SHELL_FILE "/etc/shells" - -/* - * by Erik Troan <ewt@redhat.com>, Red Hat Software. - * August 5, 1996. - * This code shamelessly ripped from the pam_securetty module. - */ - -#include "config.h" - -#include <pwd.h> -#include <stdarg.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <syslog.h> -#include <unistd.h> - -/* - * here, we make a definition for the externally accessible function - * in this file (this definition is required for static a module - * but strongly encouraged generally) it is used to instruct the - * modules include file to define the function prototypes. - */ - -#define PAM_SM_AUTH -#define PAM_SM_ACCOUNT - -#include <security/pam_modules.h> -#include <security/pam_modutil.h> -#include <security/pam_ext.h> - -static int perform_check(pam_handle_t *pamh) -{ - int retval = PAM_AUTH_ERR; - const char *userName; - char *userShell; - char shellFileLine[256]; - struct stat sb; - struct passwd * pw; - FILE * shellFile; - - retval = pam_get_user(pamh, &userName, NULL); - if (retval != PAM_SUCCESS) { - return PAM_SERVICE_ERR; - } - - if (!userName || (userName[0] == '\0')) { - - /* Don't let them use a NULL username... */ - retval = pam_get_user(pamh,&userName,NULL); - if (retval != PAM_SUCCESS) - return PAM_SERVICE_ERR; - - /* It could still be NULL the second time. */ - if (!userName || (userName[0] == '\0')) - return PAM_SERVICE_ERR; - } - - pw = pam_modutil_getpwnam(pamh, userName); - if (!pw) { - return PAM_AUTH_ERR; /* user doesn't exist */ - } - userShell = pw->pw_shell; - - if (stat(SHELL_FILE,&sb)) { - pam_syslog(pamh, LOG_ERR, "Cannot stat %s: %m", SHELL_FILE); - return PAM_AUTH_ERR; /* must have /etc/shells */ - } - - if ((sb.st_mode & S_IWOTH) || !S_ISREG(sb.st_mode)) { - pam_syslog(pamh, LOG_ERR, - "%s is either world writable or not a normal file", - SHELL_FILE); - return PAM_AUTH_ERR; - } - - shellFile = fopen(SHELL_FILE,"r"); - if (shellFile == NULL) { /* Check that we opened it successfully */ - pam_syslog(pamh, LOG_ERR, "Error opening %s: %m", SHELL_FILE); - return PAM_SERVICE_ERR; - } - - retval = 1; - - while(retval && (fgets(shellFileLine, 255, shellFile) != NULL)) { - if (shellFileLine[strlen(shellFileLine) - 1] == '\n') - shellFileLine[strlen(shellFileLine) - 1] = '\0'; - retval = strcmp(shellFileLine, userShell); - } - - fclose(shellFile); - - if (retval) { - return PAM_AUTH_ERR; - } else { - return PAM_SUCCESS; - } -} - -/* --- authentication management functions (only) --- */ - -PAM_EXTERN -int pam_sm_authenticate(pam_handle_t *pamh, int flags UNUSED, - int argc UNUSED, const char **argv UNUSED) -{ - return perform_check(pamh); -} - -PAM_EXTERN -int pam_sm_setcred(pam_handle_t *pamh UNUSED, int flags UNUSED, - int argc UNUSED, const char **argv UNUSED) -{ - return PAM_SUCCESS; -} - -/* --- account management functions (only) --- */ - -PAM_EXTERN -int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags UNUSED, - int argc UNUSED, const char **argv UNUSED) -{ - return perform_check(pamh); -} - -#ifdef PAM_STATIC - -/* static module data */ - -struct pam_module _pam_shells_modstruct = { - "pam_shells", - pam_sm_authenticate, - pam_sm_setcred, - pam_sm_acct_mgmt, - NULL, - NULL, - NULL, -}; - -#endif /* PAM_STATIC */ - -/* end of module definition */ diff --git a/modules/pam_shells/tst-pam_shells b/modules/pam_shells/tst-pam_shells deleted file mode 100755 index dccc33d0..00000000 --- a/modules/pam_shells/tst-pam_shells +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -../../tests/tst-dlopen .libs/pam_shells.so |