summaryrefslogtreecommitdiffstats
path: root/lib/libpam/modules/pam_securetty/pam_securetty.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-12-11 13:55:16 +0000
committerdes <des@FreeBSD.org>2003-12-11 13:55:16 +0000
commit9c38a557979e384e5fc0e3b85507242bee98321f (patch)
tree79f074d7b6c050b037a9004caf920936f5c2abf9 /lib/libpam/modules/pam_securetty/pam_securetty.c
parent0b146f01b2bf8034a394e4136235609dddda45bf (diff)
downloadFreeBSD-src-9c38a557979e384e5fc0e3b85507242bee98321f.zip
FreeBSD-src-9c38a557979e384e5fc0e3b85507242bee98321f.tar.gz
Fix strict aliasing breakage in PAM modules (except pam_krb5, which needs
more work than the others). This should make most modules build with -O2.
Diffstat (limited to 'lib/libpam/modules/pam_securetty/pam_securetty.c')
-rw-r--r--lib/libpam/modules/pam_securetty/pam_securetty.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libpam/modules/pam_securetty/pam_securetty.c b/lib/libpam/modules/pam_securetty/pam_securetty.c
index 5dd7c90..edb6f3b 100644
--- a/lib/libpam/modules/pam_securetty/pam_securetty.c
+++ b/lib/libpam/modules/pam_securetty/pam_securetty.c
@@ -57,7 +57,8 @@ pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused,
{
struct passwd *pwd;
struct ttyent *ty;
- const char *user, *tty;
+ const char *user;
+ const void *tty;
int pam_err;
pam_err = pam_get_user(pamh, &user, NULL);
@@ -72,7 +73,7 @@ pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused,
if (pwd->pw_uid != 0)
return (PAM_SUCCESS);
- pam_err = pam_get_item(pamh, PAM_TTY, (const void **)&tty);
+ pam_err = pam_get_item(pamh, PAM_TTY, &tty);
if (pam_err != PAM_SUCCESS)
return (pam_err);
@@ -81,7 +82,7 @@ pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused,
/* Ignore any "/dev/" on the PAM_TTY item */
if (tty != NULL && strncmp(TTY_PREFIX, tty, sizeof(TTY_PREFIX)) == 0) {
PAM_LOG("WARNING: PAM_TTY starts with " TTY_PREFIX);
- tty += sizeof(TTY_PREFIX) - 1;
+ tty = (const char *)tty + sizeof(TTY_PREFIX) - 1;
}
if (tty != NULL && (ty = getttynam(tty)) != NULL &&
OpenPOWER on IntegriCloud