spin_lock_irqsave(¤t->sighand->siglock, flags);
sig->audit_tty = current->signal->audit_tty;
+ sig->audit_tty_log_passwd = current->signal->audit_tty_log_passwd;
spin_unlock_irqrestore(¤t->sighand->siglock, flags);
}
{
struct tty_audit_buf *buf;
int major, minor;
+ int audit_log_tty_passwd;
+ unsigned long flags;
if (unlikely(size == 0))
return;
+ spin_lock_irqsave(¤t->sighand->siglock, flags);
+ audit_log_tty_passwd = current->signal->audit_tty_log_passwd;
+ spin_unlock_irqrestore(¤t->sighand->siglock, flags);
+ if (!audit_log_tty_passwd && icanon && !L_ECHO(tty))
+ return;
+
if (tty->driver->type == TTY_DRIVER_TYPE_PTY
&& tty->driver->subtype == PTY_TYPE_MASTER)
return;
};
struct audit_tty_status {
- __u32 enabled; /* 1 = enabled, 0 = disabled */
+ __u32 enabled; /* 1 = enabled, 0 = disabled */
+ __u32 log_passwd; /* 1 = enabled, 0 = disabled */
};
/* audit_rule_data supports filter rules with both integer and string
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/kthread.h>
+#include <linux/kernel.h>
#include <linux/audit.h>
spin_lock_irqsave(&tsk->sighand->siglock, flags);
s.enabled = tsk->signal->audit_tty != 0;
+ s.log_passwd = tsk->signal->audit_tty_log_passwd;
spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
audit_send_reply(NETLINK_CB(skb).portid, seq,
break;
}
case AUDIT_TTY_SET: {
- struct audit_tty_status *s;
+ struct audit_tty_status s;
struct task_struct *tsk = current;
unsigned long flags;
- if (nlh->nlmsg_len < sizeof(struct audit_tty_status))
- return -EINVAL;
- s = data;
- if (s->enabled != 0 && s->enabled != 1)
+ memset(&s, 0, sizeof(s));
+ /* guard against past and future API changes */
+ memcpy(&s, data, min(sizeof(s), (size_t)nlh->nlmsg_len));
+ if ((s.enabled != 0 && s.enabled != 1) ||
+ (s.log_passwd != 0 && s.log_passwd != 1))
return -EINVAL;
spin_lock_irqsave(&tsk->sighand->siglock, flags);
- tsk->signal->audit_tty = s->enabled != 0;
+ tsk->signal->audit_tty = s.enabled;
+ tsk->signal->audit_tty_log_passwd = s.log_passwd;
spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
break;
}