summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2001-08-10 19:18:52 +0000
committermarkm <markm@FreeBSD.org>2001-08-10 19:18:52 +0000
commit74d9830e384cd71f7f22672012bbb29cf7a3fdcf (patch)
tree4a3bc179028503f3223f817905453f25bc79eab6
parent746b322ce6ad4dfd3820ac04b03c510ccae63e3c (diff)
downloadFreeBSD-src-74d9830e384cd71f7f22672012bbb29cf7a3fdcf.zip
FreeBSD-src-74d9830e384cd71f7f22672012bbb29cf7a3fdcf.tar.gz
General code clean-up. Sort out warnings, and make the warning and
logging work the same as other modules.
-rw-r--r--lib/libpam/modules/pam_securetty/pam_securetty.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libpam/modules/pam_securetty/pam_securetty.c b/lib/libpam/modules/pam_securetty/pam_securetty.c
index aecabce..8eb358b 100644
--- a/lib/libpam/modules/pam_securetty/pam_securetty.c
+++ b/lib/libpam/modules/pam_securetty/pam_securetty.c
@@ -43,7 +43,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, const char **argv)
{
struct options options;
struct ttyent *ttyfileinfo;
- struct passwd *user_pwd;
+ struct passwd *pwd;
int retval;
const char *user, *ttyname;
@@ -68,10 +68,10 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, const char **argv)
ttyname += sizeof(TTY_PREFIX) - 1;
/* If the user is not root, secure ttys do not apply */
- user_pwd = getpwnam(user);
- if (user_pwd == NULL)
+ pwd = getpwnam(user);
+ if (pwd == NULL)
PAM_RETURN(PAM_IGNORE);
- else if (user_pwd->pw_uid != 0)
+ else if (pwd->pw_uid != 0)
PAM_RETURN(PAM_SUCCESS);
PAM_LOG("User is not root");
@@ -84,15 +84,23 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, const char **argv)
if (ttyfileinfo->ty_status & TTY_SECURE)
PAM_RETURN(PAM_SUCCESS);
- else
+ else {
+ PAM_VERBOSE_ERROR("Not on secure TTY");
PAM_RETURN(PAM_PERM_DENIED);
+ }
}
PAM_EXTERN
int
pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv)
{
- return PAM_SUCCESS;
+ struct options options;
+
+ pam_std_option(&options, NULL, argc, argv);
+
+ PAM_LOG("Options processed");
+
+ PAM_RETURN(PAM_SUCCESS);
}
PAM_MODULE_ENTRY("pam_securetty");
OpenPOWER on IntegriCloud