Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 375326
b: refs/heads/master
c: 46e959e
h: refs/heads/master
v: v3
  • Loading branch information
Richard Guy Briggs authored and Eric Paris committed Apr 30, 2013
1 parent e228524 commit 3fd4311
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bde02ca858448cf54a4226774dd1481f3bcc455e
refs/heads/master: 46e959ea2969cc1668d09b0dc55226946cf781f1
9 changes: 9 additions & 0 deletions trunk/drivers/tty/tty_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void tty_audit_fork(struct signal_struct *sig)

spin_lock_irqsave(&current->sighand->siglock, flags);
sig->audit_tty = current->signal->audit_tty;
sig->audit_tty_log_passwd = current->signal->audit_tty_log_passwd;
spin_unlock_irqrestore(&current->sighand->siglock, flags);
}

Expand Down Expand Up @@ -275,10 +276,18 @@ void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
{
struct tty_audit_buf *buf;
int major, minor;
int audit_log_tty_passwd;
unsigned long flags;

if (unlikely(size == 0))
return;

spin_lock_irqsave(&current->sighand->siglock, flags);
audit_log_tty_passwd = current->signal->audit_tty_log_passwd;
spin_unlock_irqrestore(&current->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;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ struct signal_struct {
#endif
#ifdef CONFIG_AUDIT
unsigned audit_tty;
unsigned audit_tty_log_passwd;
struct tty_audit_buf *tty_audit_buf;
#endif
#ifdef CONFIG_CGROUPS
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/uapi/linux/audit.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ struct audit_status {
};

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
Expand Down
16 changes: 10 additions & 6 deletions trunk/kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/kthread.h>
#include <linux/kernel.h>

#include <linux/audit.h>

Expand Down Expand Up @@ -808,25 +809,28 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)

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,
AUDIT_TTY_GET, 0, 0, &s, sizeof(s));
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;
}
Expand Down

0 comments on commit 3fd4311

Please sign in to comment.