aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pam_securetty/pam_securetty.c')
-rw-r--r--modules/pam_securetty/pam_securetty.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/modules/pam_securetty/pam_securetty.c b/modules/pam_securetty/pam_securetty.c
index 78c4bd5..f6d7bc2 100644
--- a/modules/pam_securetty/pam_securetty.c
+++ b/modules/pam_securetty/pam_securetty.c
@@ -1,11 +1,11 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <stdio.h>
#include <string.h>
#include <ttyent.h>
#include <pwd.h>
-
-#define PAM_SM_ACCOUNT
+#define PAM_SM_AUTH
#include <security/pam_appl.h>
#include <security/pam_modules.h>
@@ -14,7 +14,7 @@
#define TTY_PREFIX "/dev/"
PAM_EXTERN int
-pam_sm_acct_mgmt(pam_handle_t * pamh, int flags,
+pam_sm_authenticate(pam_handle_t * pamh, int flags,
int argc, const char * argv[])
{
struct passwd *pwd;
@@ -45,10 +45,9 @@ pam_sm_acct_mgmt(pam_handle_t * pamh, int flags,
if (tty != NULL && strncmp(TTY_PREFIX, tty, sizeof(TTY_PREFIX)) == 0) {
PAM_LOG("tty starts with " TTY_PREFIX);
- /* skip prefix */
+ /* get rid of prefix */
tty = (const char *)tty + sizeof(TTY_PREFIX) - 1;
}
-
/*
* Linux-PAM, before checking the actual tty,
* opens /etc/securettys to check if it's world
@@ -60,9 +59,18 @@ pam_sm_acct_mgmt(pam_handle_t * pamh, int flags,
if ( tty != NULL && (ttyinfo = getttynam(tty)) != NULL &&
(ttyinfo->ty_status & TTY_SECURE) != 0)
return (PAM_SUCCESS);
-
+
PAM_ERROR("Access denied: tty %s is not secure", tty);
return (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_securetty");