From 6a814ac7ee17723308ea5c6297fc634dbb1a3568 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Sun, 22 Oct 2006 18:10:26 +0000 Subject: [PATCH] Reverted to r41 --- pam_usb/src/local.c | 15 ++++----------- pam_usb/src/local.h | 3 +-- pam_usb/src/pam.c | 4 +--- pam_usb/src/pusb_check.c | 2 +- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/pam_usb/src/local.c b/pam_usb/src/local.c index 858204e..0af461b 100644 --- a/pam_usb/src/local.c +++ b/pam_usb/src/local.c @@ -22,24 +22,17 @@ #include "log.h" #include "conf.h" -int pusb_local_login(t_pusb_options *opts, const char *user, - const char *tty) +int pusb_local_login(t_pusb_options *opts, const char *user) { + char *from; struct utmp utsearch; struct utmp *utent; - const char *from; int i; log_debug("Checking whether the caller is local or not...\n"); - if (tty && *tty) - from = tty; - else - from = ttyname(STDIN_FILENO); - if (!from || !(*from)) - { - log_debug("Couldn't retrive the tty name, aborting..."); + from = ttyname(STDIN_FILENO); + if (!from) return (1); - } log_debug("Authentication request from tty %s\n", from); if (!strncmp(from, "/dev/", strlen("/dev/"))) from += strlen("/dev/"); diff --git a/pam_usb/src/local.h b/pam_usb/src/local.h index 87dd32b..ed796ea 100644 --- a/pam_usb/src/local.h +++ b/pam_usb/src/local.h @@ -18,7 +18,6 @@ #ifndef PUSB_LOCAL_H_ # define PUSB_LOCAL_H_ -int pusb_local_login(t_pusb_options *opts, const char *user, - const char *tty); +int pusb_local_login(t_pusb_options *opts, const char *user); #endif /* !PUSB_LOCAL_H_ */ diff --git a/pam_usb/src/pam.c b/pam_usb/src/pam.c index 0b71c00..c0b7e9c 100644 --- a/pam_usb/src/pam.c +++ b/pam_usb/src/pam.c @@ -32,7 +32,6 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, t_pusb_options opts; const char *service; const char *user; - char *tty; char *conf_file = PUSB_CONF_FILE; int retval; @@ -66,8 +65,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, log_info("pam_usb v.%s\n", PUSB_VERSION); log_info("Authentication request for user \"%s\" (%s)\n", user, service); - pam_get_item(pamh, PAM_TTY, (const void**)&tty); - if (!pusb_local_login(&opts, user, tty)) + if (!pusb_local_login(&opts, user)) { log_error("Access denied.\n"); return (PAM_AUTH_ERR); diff --git a/pam_usb/src/pusb_check.c b/pam_usb/src/pusb_check.c index ad0710d..1a3258b 100644 --- a/pam_usb/src/pusb_check.c +++ b/pam_usb/src/pusb_check.c @@ -52,7 +52,7 @@ static int pusb_check_perform_authentication(t_pusb_options *opts, } log_info("Authentication request for user \"%s\" (%s)\n", user, service); - if (!pusb_local_login(opts, user, NULL)) + if (!pusb_local_login(opts, user)) { log_error("Access denied.\n"); return (0);