Commit 197c69c6 authored by Chris Wright's avatar Chris Wright Committed by David Woodhouse

Move ifdef CONFIG_AUDITSYSCALL to header

Remove code conditionally dependent on CONFIG_AUDITSYSCALL from audit.c.
Move these dependencies to audit.h with the rest.
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 804a6a49
...@@ -192,7 +192,7 @@ extern void audit_inode(const char *name, const struct inode *inode); ...@@ -192,7 +192,7 @@ extern void audit_inode(const char *name, const struct inode *inode);
/* Private API (for audit.c only) */ /* Private API (for audit.c only) */
extern int audit_receive_filter(int type, int pid, int uid, int seq, extern int audit_receive_filter(int type, int pid, int uid, int seq,
void *data, uid_t loginuid); void *data, uid_t loginuid);
extern void audit_get_stamp(struct audit_context *ctx, extern int audit_get_stamp(struct audit_context *ctx,
struct timespec *t, unsigned int *serial); struct timespec *t, unsigned int *serial);
extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
extern uid_t audit_get_loginuid(struct audit_context *ctx); extern uid_t audit_get_loginuid(struct audit_context *ctx);
...@@ -206,6 +206,8 @@ extern void audit_signal_info(int sig, struct task_struct *t); ...@@ -206,6 +206,8 @@ extern void audit_signal_info(int sig, struct task_struct *t);
#define audit_getname(n) do { ; } while (0) #define audit_getname(n) do { ; } while (0)
#define audit_putname(n) do { ; } while (0) #define audit_putname(n) do { ; } while (0)
#define audit_inode(n,i) do { ; } while (0) #define audit_inode(n,i) do { ; } while (0)
#define audit_receive_filter(t,p,u,s,d,l) ({ -EOPNOTSUPP; })
#define audit_get_stamp(c,t,s) ({ 0; })
#define audit_get_loginuid(c) ({ -1; }) #define audit_get_loginuid(c) ({ -1; })
#define audit_ipc_perms(q,u,g,m) ({ 0; }) #define audit_ipc_perms(q,u,g,m) ({ 0; })
#define audit_signal_info(s,t) do { ; } while (0) #define audit_signal_info(s,t) do { ; } while (0)
......
...@@ -416,12 +416,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -416,12 +416,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
return -EINVAL; return -EINVAL;
/* fallthrough */ /* fallthrough */
case AUDIT_LIST: case AUDIT_LIST:
#ifdef CONFIG_AUDITSYSCALL
err = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid, err = audit_receive_filter(nlh->nlmsg_type, NETLINK_CB(skb).pid,
uid, seq, data, loginuid); uid, seq, data, loginuid);
#else
err = -EOPNOTSUPP;
#endif
break; break;
case AUDIT_SIGNAL_INFO: case AUDIT_SIGNAL_INFO:
sig_data.uid = audit_sig_uid; sig_data.uid = audit_sig_uid;
...@@ -636,15 +632,11 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx) ...@@ -636,15 +632,11 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx)
return NULL; return NULL;
} }
#ifdef CONFIG_AUDITSYSCALL if (!audit_get_stamp(ab->ctx, &t, &serial)) {
if (ab->ctx)
audit_get_stamp(ab->ctx, &t, &serial);
else
#endif
{
t = CURRENT_TIME; t = CURRENT_TIME;
serial = 0; serial = 0;
} }
audit_log_format(ab, "audit(%lu.%03lu:%u): ", audit_log_format(ab, "audit(%lu.%03lu:%u): ",
t.tv_sec, t.tv_nsec/1000000, serial); t.tv_sec, t.tv_nsec/1000000, serial);
return ab; return ab;
......
...@@ -992,7 +992,7 @@ void audit_inode(const char *name, const struct inode *inode) ...@@ -992,7 +992,7 @@ void audit_inode(const char *name, const struct inode *inode)
context->names[idx].rdev = inode->i_rdev; context->names[idx].rdev = inode->i_rdev;
} }
void audit_get_stamp(struct audit_context *ctx, int audit_get_stamp(struct audit_context *ctx,
struct timespec *t, unsigned int *serial) struct timespec *t, unsigned int *serial)
{ {
if (ctx) { if (ctx) {
...@@ -1000,10 +1000,9 @@ void audit_get_stamp(struct audit_context *ctx, ...@@ -1000,10 +1000,9 @@ void audit_get_stamp(struct audit_context *ctx,
t->tv_nsec = ctx->ctime.tv_nsec; t->tv_nsec = ctx->ctime.tv_nsec;
*serial = ctx->serial; *serial = ctx->serial;
ctx->auditable = 1; ctx->auditable = 1;
} else { return 1;
*t = CURRENT_TIME;
*serial = 0;
} }
return 0;
} }
extern int audit_set_type(struct audit_buffer *ab, int type); extern int audit_set_type(struct audit_buffer *ab, int type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment